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/CodeGen/MachineModuleInfo.h"
23 /// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
24 /// for MachO targets.
25 class MachineModuleInfoMachO : public MachineModuleInfoImpl {
26 /// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
27 /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
28 /// is true if this GV is external.
29 DenseMap<MCSymbol *, StubValueTy> GVStubs;
31 /// ThreadLocalGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something
32 /// like "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra
33 /// bit is true if this GV is external.
34 DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs;
36 virtual void anchor(); // Out of line virtual method.
38 MachineModuleInfoMachO(const MachineModuleInfo &) {}
40 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
41 assert(Sym && "Key cannot be null");
45 StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
46 assert(Sym && "Key cannot be null");
47 return ThreadLocalGVStubs[Sym];
50 /// Accessor methods to return the set of stubs in sorted order.
51 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
52 SymbolListTy GetThreadLocalGVStubList() {
53 return getSortedStubs(ThreadLocalGVStubs);
57 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
59 class MachineModuleInfoELF : public MachineModuleInfoImpl {
60 /// GVStubs - These stubs are used to materialize global addresses in PIC
62 DenseMap<MCSymbol *, StubValueTy> GVStubs;
64 virtual void anchor(); // Out of line virtual method.
66 MachineModuleInfoELF(const MachineModuleInfo &) {}
68 StubValueTy &getGVStubEntry(MCSymbol *Sym) {
69 assert(Sym && "Key cannot be null");
73 /// Accessor methods to return the set of stubs in sorted order.
75 SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
78 } // end namespace llvm