[llvm-commits] CVS: llvm/tools/lli/JIT/Callback.cpp Emitter.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu May 8 16:45:02 PDT 2003
Changes in directory llvm/tools/lli/JIT:
Callback.cpp updated: 1.3 -> 1.4
Emitter.cpp updated: 1.4 -> 1.5
---
Log message:
Minor speedup by avoiding callbacks to functions already generated
---
Diffs of the changes:
Index: llvm/tools/lli/JIT/Callback.cpp
diff -u llvm/tools/lli/JIT/Callback.cpp:1.3 llvm/tools/lli/JIT/Callback.cpp:1.4
--- llvm/tools/lli/JIT/Callback.cpp:1.3 Thu May 8 16:34:11 2003
+++ llvm/tools/lli/JIT/Callback.cpp Thu May 8 16:44:21 2003
@@ -46,7 +46,6 @@
#endif
}
-
void VM::registerCallback() {
TheVM = this;
}
Index: llvm/tools/lli/JIT/Emitter.cpp
diff -u llvm/tools/lli/JIT/Emitter.cpp:1.4 llvm/tools/lli/JIT/Emitter.cpp:1.5
--- llvm/tools/lli/JIT/Emitter.cpp:1.4 Thu May 8 16:34:11 2003
+++ llvm/tools/lli/JIT/Emitter.cpp Thu May 8 16:44:21 2003
@@ -131,11 +131,15 @@
void Emitter::emitGlobalAddress(GlobalValue *V, bool isPCRelative) {
if (isPCRelative) { // must be a call, this is a major hack!
- // FIXME: Try looking up the function to see if it is already compiled!
- TheVM.addFunctionRef(CurByte, cast<Function>(V));
+ // Try looking up the function to see if it is already compiled!
+ if (void *Addr = TheVM.getPointerToGlobalIfAvailable(V)) {
+ emitAddress(Addr, isPCRelative);
+ } else { // Function has not yet been code generated!
+ TheVM.addFunctionRef(CurByte, cast<Function>(V));
- // Delayed resolution...
- emitAddress((void*)VM::CompilationCallback, isPCRelative);
+ // Delayed resolution...
+ emitAddress((void*)VM::CompilationCallback, isPCRelative);
+ }
} else {
emitAddress(TheVM.getPointerToGlobal(V), isPCRelative);
}
More information about the llvm-commits
mailing list