| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H |
| 15 |
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H |
| 16 |
|
| 17 |
#include "llvm/ADT/DenseMap.h" |
| 18 |
#include "llvm/ADT/StringSet.h" |
| 19 |
#include "llvm/CodeGen/MachineModuleInfo.h" |
| 20 |
#include <cassert> |
| 21 |
|
| 22 |
namespace llvm { |
| 23 |
|
| 24 |
class MCSymbol; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
class MachineModuleInfoMachO : public MachineModuleInfoImpl { |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
DenseMap<MCSymbol *, StubValueTy> GVStubs; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
DenseMap<MCSymbol *, StubValueTy> ThreadLocalGVStubs; |
| 38 |
|
| 39 |
virtual void anchor(); |
| 40 |
|
| 41 |
public: |
| 42 |
MachineModuleInfoMachO(const MachineModuleInfo &) {} |
| 43 |
|
| 44 |
StubValueTy &getGVStubEntry(MCSymbol *Sym) { |
| 45 |
assert(Sym && "Key cannot be null"); |
| 46 |
return GVStubs[Sym]; |
| 47 |
} |
| 48 |
|
| 49 |
StubValueTy &getThreadLocalGVStubEntry(MCSymbol *Sym) { |
| 50 |
assert(Sym && "Key cannot be null"); |
| 51 |
return ThreadLocalGVStubs[Sym]; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); } |
| 56 |
SymbolListTy GetThreadLocalGVStubList() { |
| 57 |
return getSortedStubs(ThreadLocalGVStubs); |
| 58 |
} |
| 59 |
}; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
class MachineModuleInfoELF : public MachineModuleInfoImpl { |
| 64 |
|
| 65 |
|
| 66 |
DenseMap<MCSymbol *, StubValueTy> GVStubs; |
| 67 |
|
| 68 |
virtual void anchor(); |
| 69 |
|
| 70 |
public: |
| 71 |
MachineModuleInfoELF(const MachineModuleInfo &) {} |
| 72 |
|
| 73 |
StubValueTy &getGVStubEntry(MCSymbol *Sym) { |
| 74 |
assert(Sym && "Key cannot be null"); |
| 75 |
return GVStubs[Sym]; |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); } |
| 81 |
}; |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
class MachineModuleInfoCOFF : public MachineModuleInfoImpl { |
| 86 |
|
| 87 |
|
| 88 |
DenseMap<MCSymbol *, StubValueTy> GVStubs; |
| 89 |
|
| 90 |
virtual void anchor(); |
| 91 |
|
| 92 |
public: |
| 93 |
MachineModuleInfoCOFF(const MachineModuleInfo &) {} |
| 94 |
|
| 95 |
StubValueTy &getGVStubEntry(MCSymbol *Sym) { |
| 96 |
assert(Sym && "Key cannot be null"); |
| 97 |
return GVStubs[Sym]; |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); } |
| 103 |
}; |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
class MachineModuleInfoWasm : public MachineModuleInfoImpl { |
| 108 |
virtual void anchor(); |
| 109 |
|
| 110 |
public: |
| 111 |
MachineModuleInfoWasm(const MachineModuleInfo &) {} |
| 112 |
|
| 113 |
StringSet<> MachineSymbolsUsed; |
| 114 |
}; |
| 115 |
|
| 116 |
} |
| 117 |
|
| 118 |
#endif |