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/ADT/DenseMap.h"
19 #include "llvm/CodeGen/MachineModuleInfo.h"
26 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
27 /// for MachO targets.
28 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
29 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
30 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
31 /// is true if this GV is external.
32 DenseMap<MCSymbol *, StubValueTy> GVStubs;
34 /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
35 /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
36 /// bit is true if this GV is external.
37 DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
39 virtual void anchor(); // Out of line virtual method.
42 MachineModuleInfoMachO(const MachineModuleInfo &) {}
44 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
45 assert(Sym && "Key cannot be null");
49 StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
50 assert(Sym && "Key cannot be null");
51 return ThreadLocalGVStubs[Sym];
54 /// Accessor methods to return the set of stubs in sorted order.
55 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
56 SymbolListTy GetThreadLocalGVStubList() {
57 return getSortedStubs(ThreadLocalGVStubs);
61 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
63 class MachineModuleInfoELF : public MachineModuleInfoImpl {
64 /// GVStubs - These stubs are used to materialize global addresses in PIC
66 DenseMap<MCSymbol *, StubValueTy> GVStubs;
68 virtual void anchor(); // Out of line virtual method.
71 MachineModuleInfoELF(const MachineModuleInfo &) {}
73 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
74 assert(Sym && "Key cannot be null");
78 /// Accessor methods to return the set of stubs in sorted order.
80 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
83 /// MachineModuleInfoCOFF - This is a MachineModuleInfoImpl implementation
85 class MachineModuleInfoCOFF : public MachineModuleInfoImpl {
86 /// GVStubs - These stubs are used to materialize global addresses in PIC
88 DenseMap<MCSymbol *, StubValueTy> GVStubs;
90 virtual void anchor(); // Out of line virtual method.
93 MachineModuleInfoCOFF(const MachineModuleInfo &) {}
95 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
96 assert(Sym && "Key cannot be null");
100 /// Accessor methods to return the set of stubs in sorted order.
102 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
105 } // end namespace llvm
107 #endif // LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H