1 //===-- llvm/CodeGen/MachineModuleInfoImpls.h -------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines object-file format specific implementations of
11 // MachineModuleInfoImpl.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16 #define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
18 #include "llvm/BinaryFormat/Wasm.h"
19 #include "llvm/CodeGen/MachineModuleInfo.h"
20 #include "llvm/CodeGen/ValueTypes.h"
25 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
26 /// for MachO targets.
27 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
28 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
29 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
30 /// is true if this GV is external.
31 DenseMap<MCSymbol *, StubValueTy> GVStubs;
33 /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
34 /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
35 /// bit is true if this GV is external.
36 DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
38 virtual void anchor(); // Out of line virtual method.
40 MachineModuleInfoMachO(const MachineModuleInfo &) {}
42 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
43 assert(Sym && "Key cannot be null");
47 StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
48 assert(Sym && "Key cannot be null");
49 return ThreadLocalGVStubs[Sym];
52 /// Accessor methods to return the set of stubs in sorted order.
53 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
54 SymbolListTy GetThreadLocalGVStubList() {
55 return getSortedStubs(ThreadLocalGVStubs);
59 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
61 class MachineModuleInfoELF : public MachineModuleInfoImpl {
62 /// GVStubs - These stubs are used to materialize global addresses in PIC
64 DenseMap<MCSymbol *, StubValueTy> GVStubs;
66 virtual void anchor(); // Out of line virtual method.
68 MachineModuleInfoELF(const MachineModuleInfo &) {}
70 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
71 assert(Sym && "Key cannot be null");
75 /// Accessor methods to return the set of stubs in sorted order.
77 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
80 } // end namespace llvm