aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-05 02:26:58 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-05 02:26:58 +0000
commit2a3e08b5961353fa3faeadf81f481ae9f5463427 (patch)
tree480ae5513b731edf30a29cf969f552b7053d3bc1 /lib/ExecutionEngine
parent9bb459b55411c45175e599f6f421b7a57060ee57 (diff)
X86 JIT PIC jumptable support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index aa572a408f..049b3bc4a3 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -341,7 +341,7 @@ namespace {
/// JumpTableBase - A pointer to the first entry in the jump table.
///
void *JumpTableBase;
-
+
/// Resolver - This contains info about the currently resolved functions.
JITResolver Resolver;
public:
@@ -380,7 +380,7 @@ namespace {
virtual intptr_t getConstantPoolEntryAddress(unsigned Entry) const;
virtual intptr_t getJumpTableEntryAddress(unsigned Entry) const;
-
+
virtual intptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
MBBLocations[MBB->getNumber()] && "MBB not emitted!");
@@ -616,8 +616,10 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
// Store the offset of the basic block for this jump table slot in the
// memory we allocated for the jump table in 'initJumpTableInfo'
intptr_t Base = (intptr_t)SlotPtr;
- for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi)
- *SlotPtr++ = (intptr_t)getMachineBasicBlockAddress(MBBs[mi]) - Base;
+ for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) {
+ intptr_t MBBAddr = getMachineBasicBlockAddress(MBBs[mi]);
+ *SlotPtr++ = TheJIT->getJITInfo().getPICJumpTableEntry(MBBAddr, Base);
+ }
}
} else {
assert(MJTI->getEntrySize() == sizeof(void*) && "Cross JIT'ing?");