]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/CodeGen/MachineModuleInfoImpls.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / CodeGen / MachineModuleInfoImpls.h
1 //===-- llvm/CodeGen/MachineModuleInfoImpls.h -------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines object-file format specific implementations of
11 // MachineModuleInfoImpl.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
16 #define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
17
18 #include "llvm/BinaryFormat/Wasm.h"
19 #include "llvm/CodeGen/MachineModuleInfo.h"
20 #include "llvm/CodeGen/ValueTypes.h"
21
22 namespace llvm {
23 class MCSymbol;
24
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;
32
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;
37
38   virtual void anchor(); // Out of line virtual method.
39 public:
40   MachineModuleInfoMachO(const MachineModuleInfo &) {}
41
42   StubValueTy &getGVStubEntry(MCSymbol *Sym) {
43     assert(Sym && "Key cannot be null");
44     return GVStubs[Sym];
45   }
46
47   StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) {
48     assert(Sym && "Key cannot be null");
49     return ThreadLocalGVStubs[Sym];
50   }
51
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);
56   }
57 };
58
59 /// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
60 /// for ELF targets.
61 class MachineModuleInfoELF : public MachineModuleInfoImpl {
62   /// GVStubs - These stubs are used to materialize global addresses in PIC
63   /// mode.
64   DenseMap<MCSymbol *, StubValueTy> GVStubs;
65
66   virtual void anchor(); // Out of line virtual method.
67 public:
68   MachineModuleInfoELF(const MachineModuleInfo &) {}
69
70   StubValueTy &getGVStubEntry(MCSymbol *Sym) {
71     assert(Sym && "Key cannot be null");
72     return GVStubs[Sym];
73   }
74
75   /// Accessor methods to return the set of stubs in sorted order.
76
77   SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
78 };
79
80 } // end namespace llvm
81
82 #endif