diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-01-05 02:26:58 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-01-05 02:26:58 +0000 |
commit | 880b080887e59879a45bf24f852f44b2976d8e52 (patch) | |
tree | 8795e98ea89598ef3bc716d0027d2708c665f52c /llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | |
parent | 7b1b947ca10a613d583ffa7c399575cd70946b81 (diff) | |
download | bcm5719-llvm-880b080887e59879a45bf24f852f44b2976d8e52.tar.gz bcm5719-llvm-880b080887e59879a45bf24f852f44b2976d8e52.zip |
X86 JIT PIC jumptable support.
llvm-svn: 45616
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index aa572a408f8..049b3bc4a36 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/llvm/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?"); |