summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineRelocation.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-11-21 03:27:13 +0000
committerChris Lattner <sabre@nondot.org>2004-11-21 03:27:13 +0000
commit765da91525b3b606dba71350c797bf123c3dff74 (patch)
tree1d16062cd7e7ff2d595bbcf9234a6bab296a4b2a /include/llvm/CodeGen/MachineRelocation.h
parent39a11a1547df0fbf69870c2ea63dd5c70fad1e82 (diff)
downloadllvm-765da91525b3b606dba71350c797bf123c3dff74.tar.gz
llvm-765da91525b3b606dba71350c797bf123c3dff74.tar.bz2
llvm-765da91525b3b606dba71350c797bf123c3dff74.tar.xz
Add another bit, to make the JIT a bit more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineRelocation.h')
-rw-r--r--include/llvm/CodeGen/MachineRelocation.h33
1 files changed, 23 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/MachineRelocation.h b/include/llvm/CodeGen/MachineRelocation.h
index 8a6ff473d1..a72f29dd0f 100644
--- a/include/llvm/CodeGen/MachineRelocation.h
+++ b/include/llvm/CodeGen/MachineRelocation.h
@@ -27,15 +27,17 @@ class GlobalValue;
///
/// A relocation is made up of the following logical portions:
/// 1. An offset in the machine code buffer, the location to modify.
-/// 2. A target specific relocation type (a number from 0 to 127).
+/// 2. A target specific relocation type (a number from 0 to 63).
/// 3. A symbol being referenced, either as a GlobalValue* or as a string.
/// 4. An optional constant value to be added to the reference.
+/// 5. A bit, CanRewrite, which indicates to the JIT that a function stub is
+/// not needed for the relocation.
///
class MachineRelocation {
/// OffsetTypeExternal - The low 24-bits of this value is the offset from the
/// start of the code buffer of the relocation to perform. Bit 24 of this is
- /// set if Target should use ExtSym instead of GV, and the high 7 bits are to
- /// hold the relocation type.
+ /// set if Target should use ExtSym instead of GV, Bit 25 is the CanRewrite
+ /// bit, and the high 6 bits hold the relocation type.
unsigned OffsetTypeExternal;
union {
GlobalValue *GV; // If this is a pointer to an LLVM global
@@ -45,19 +47,21 @@ class MachineRelocation {
intptr_t ConstantVal;
public:
MachineRelocation(unsigned Offset, unsigned RelocationType, GlobalValue *GV,
- intptr_t cst = 0)
- : OffsetTypeExternal(Offset + (RelocationType << 25)), ConstantVal(cst) {
+ intptr_t cst = 0, bool DoesntNeedFunctionStub = 0)
+ : OffsetTypeExternal(Offset + (RelocationType << 26)), ConstantVal(cst) {
assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!");
- assert((RelocationType & ~127) == 0 && "Relocation type too large!");
+ assert((RelocationType & ~63) == 0 && "Relocation type too large!");
Target.GV = GV;
+ if (DoesntNeedFunctionStub)
+ OffsetTypeExternal |= 1 << 25;
}
MachineRelocation(unsigned Offset, unsigned RelocationType, const char *ES,
- intptr_t cst = 0)
- : OffsetTypeExternal(Offset + (1 << 24) + (RelocationType << 25)),
+ intptr_t cst = 0)
+ : OffsetTypeExternal(Offset + (1 << 24) + (RelocationType << 26)),
ConstantVal(cst) {
assert((Offset & ~((1 << 24)-1)) == 0 && "Code offset too large!");
- assert((RelocationType & ~127) == 0 && "Relocation type too large!");
+ assert((RelocationType & ~63) == 0 && "Relocation type too large!");
Target.ExtSym = ES;
}
@@ -70,7 +74,7 @@ public:
/// getRelocationType - Return the target-specific relocation ID for this
/// relocation.
unsigned getRelocationType() const {
- return OffsetTypeExternal >> 25;
+ return OffsetTypeExternal >> 26;
}
/// getConstantVal - Get the constant value associated with this relocation.
@@ -92,6 +96,15 @@ public:
return !isGlobalValue();
}
+ /// doesntNeedFunctionStub - This function returns true if the JIT for this
+ /// target is capable of directly handling the relocated instruction without
+ /// using a stub function. It is always conservatively correct for this flag
+ /// to be false, but targets can improve their compilation callback functions
+ /// to handle more general cases if they want improved performance.
+ bool doesntNeedFunctionStub() const {
+ return (OffsetTypeExternal & (1 << 25)) != 0;
+ }
+
/// getGlobalValue - If this is a global value reference, return the
/// referenced global.
GlobalValue *getGlobalValue() const {