[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue May 2 17:13:18 PDT 2006
Changes in directory llvm/lib/ExecutionEngine/JIT:
JITEmitter.cpp updated: 1.89 -> 1.90
---
Log message:
Simplify some code
---
Diffs of the changes: (+7 -21)
JITEmitter.cpp | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.89 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.90
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.89 Tue May 2 18:22:24 2006
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue May 2 19:13:06 2006
@@ -565,32 +565,18 @@
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]];
}
}
More information about the llvm-commits
mailing list