14 #ifndef LLVM_CODEGEN_MACHINERELOCATION_H
15 #define LLVM_CODEGEN_MACHINERELOCATION_H
17 #include "llvm/Support/DataTypes.h"
22 class MachineBasicBlock;
66 unsigned TargetReloType : 6;
67 AddressType AddrType : 4;
68 bool MayNeedFarStub : 1;
70 bool TargetResolve : 1;
84 bool MayNeedFarStub = 0,
85 bool GOTrelative = 0) {
86 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
88 Result.Offset = offset;
89 Result.ConstantVal = cst;
91 Result.AddrType = isGV;
92 Result.MayNeedFarStub = MayNeedFarStub;
93 Result.GOTRelative = GOTrelative;
94 Result.TargetResolve =
false;
95 Result.Target.
GV =
GV;
104 bool MayNeedFarStub = 0,
105 bool GOTrelative = 0) {
106 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
108 Result.Offset = offset;
109 Result.ConstantVal = cst;
111 Result.AddrType = isIndirectSym;
112 Result.MayNeedFarStub = MayNeedFarStub;
113 Result.GOTRelative = GOTrelative;
114 Result.TargetResolve =
false;
115 Result.Target.
GV =
GV;
123 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
125 Result.Offset = offset;
126 Result.ConstantVal = cst;
128 Result.AddrType = isBB;
129 Result.MayNeedFarStub =
false;
130 Result.GOTRelative =
false;
131 Result.TargetResolve =
false;
141 bool GOTrelative = 0,
142 bool NeedStub =
true) {
143 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
145 Result.Offset = offset;
146 Result.ConstantVal = cst;
148 Result.AddrType = isExtSym;
149 Result.MayNeedFarStub = NeedStub;
150 Result.GOTRelative = GOTrelative;
151 Result.TargetResolve =
false;
152 Result.Target.
ExtSym = ES;
162 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
164 Result.Offset = offset;
165 Result.ConstantVal = cst;
167 Result.AddrType = isConstPool;
168 Result.MayNeedFarStub =
false;
169 Result.GOTRelative =
false;
171 Result.Target.
Index = CPI;
181 assert((RelocationType & ~63) == 0 &&
"Relocation type too large!");
183 Result.Offset = offset;
184 Result.ConstantVal = cst;
186 Result.AddrType = isJumpTable;
187 Result.MayNeedFarStub =
false;
188 Result.GOTRelative =
false;
190 Result.Target.
Index = JTI;
203 return TargetReloType;
223 return AddrType == isGV;
229 return AddrType == isIndirectSym;
235 return AddrType == isBB;
241 return AddrType == isExtSym;
247 return AddrType == isConstPool;
253 return AddrType == isJumpTable;
269 return MayNeedFarStub;
275 return TargetResolve;
282 "This is not a global value reference!");
287 assert(
isBasicBlock() &&
"This is not a basic block reference!");
315 assert(AddrType == isResult &&
"Result pointer isn't set yet!");
328 AddrType = isGOTIndex;
336 assert(AddrType == isGOTIndex);
bool isJumpTableIndex() const
unsigned getRelocationType() const
void setResultPointer(void *Ptr)
unsigned getJumpTableIndex() const
void setGOTIndex(unsigned idx)
setGOTIndex - Set the GOT index to a specific value.
unsigned getConstantPoolIndex() const
bool letTargetResolve() const
intptr_t getConstantVal() const
static MachineRelocation getIndirectSymbol(uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool MayNeedFarStub=0, bool GOTrelative=0)
bool isIndirectSymbol() const
void setConstantVal(intptr_t val)
MachineBasicBlock * getBasicBlock() const
static MachineRelocation getBB(uintptr_t offset, unsigned RelocationType, MachineBasicBlock *MBB, intptr_t cst=0)
bool mayNeedFarStub() const
intptr_t getMachineCodeOffset() const
bool isGOTRelative() const
void * getResultPointer() const
bool isExternalSymbol() const
bool isConstantPoolIndex() const
const char * getExternalSymbol() const
GlobalValue * getGlobalValue() const
static MachineRelocation getGV(uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool MayNeedFarStub=0, bool GOTrelative=0)
unsigned getGOTIndex() const
static MachineRelocation getJumpTable(uintptr_t offset, unsigned RelocationType, unsigned JTI, intptr_t cst=0, bool letTargetResolve=false)
bool isGlobalValue() const
static MachineRelocation getConstPool(uintptr_t offset, unsigned RelocationType, unsigned CPI, intptr_t cst=0, bool letTargetResolve=false)
static MachineRelocation getExtSym(uintptr_t offset, unsigned RelocationType, const char *ES, intptr_t cst=0, bool GOTrelative=0, bool NeedStub=true)
bool isBasicBlock() const