diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-03 00:13:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-03 00:13:06 +0000 |
commit | 32ca55f3bc64c1a4424ac2e4710cf4cbcaceea43 (patch) | |
tree | de96e914c91de36dc2b1dc66bc9583531610b13b /lib/ExecutionEngine/JIT | |
parent | f75f9be3fb89eb6661a0ed8bfee8a6328ee5a4d1 (diff) | |
download | external_llvm-32ca55f3bc64c1a4424ac2e4710cf4cbcaceea43.zip external_llvm-32ca55f3bc64c1a4424ac2e4710cf4cbcaceea43.tar.gz external_llvm-32ca55f3bc64c1a4424ac2e4710cf4cbcaceea43.tar.bz2 |
Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT')
-rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 7d8848e..d20c7a2 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -565,32 +565,18 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI, if (JT.empty() || JumpTableBase == 0) return; unsigned Offset = 0; - unsigned EntrySize = MJTI->getEntrySize(); + assert(MJTI->getEntrySize() == sizeof(void*) && "Cross JIT'ing?"); // For each jump table, map each target in the jump table to the address of // an emitted MachineBasicBlock. + intptr_t *SlotPtr = (intptr_t*)JumpTableBase; + for (unsigned i = 0, e = JT.size(); i != e; ++i) { const std::vector<MachineBasicBlock*> &MBBs = JT[i].MBBs; - for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) { - uint64_t addr = MBBM[MBBs[mi]]; - GenericValue addrgv; - const Type *Ty; - if (EntrySize == 4) { - addrgv.UIntVal = addr; - Ty = Type::UIntTy; - } else if (EntrySize == 8) { - addrgv.ULongVal = addr; - Ty = Type::ULongTy; - } else { - assert(0 && "Unhandled jump table entry size!"); - abort(); - } - // Store the address of the basic block for this jump table slot in the - // memory we allocated for the jump table in 'initJumpTableInfo' - void *ptr = (void *)((char *)JumpTableBase + Offset); - TheJIT->StoreValueToMemory(addrgv, (GenericValue *)ptr, Ty); - Offset += EntrySize; - } + // Store the address of the basic block for this jump table slot in the + // memory we allocated for the jump table in 'initJumpTableInfo' + for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) + *SlotPtr++ = (intptr_t)MBBM[MBBs[mi]]; } } |