aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-08 21:44:21 +0000
committerChris Lattner <sabre@nondot.org>2003-05-08 21:44:21 +0000
commiteb5a93b86baaeb867942decb3c2902a9ae779e83 (patch)
tree54c62156c36bf16a99dbdbe429560870641f2517 /lib
parentc309a7627ce8849b63f6f297ca319d582f4ae066 (diff)
downloadexternal_llvm-eb5a93b86baaeb867942decb3c2902a9ae779e83.zip
external_llvm-eb5a93b86baaeb867942decb3c2902a9ae779e83.tar.gz
external_llvm-eb5a93b86baaeb867942decb3c2902a9ae779e83.tar.bz2
Minor speedup by avoiding callbacks to functions already generated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ExecutionEngine/JIT/Callback.cpp1
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp14
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/ExecutionEngine/JIT/Callback.cpp b/lib/ExecutionEngine/JIT/Callback.cpp
index 75abf43..fc13a10 100644
--- a/lib/ExecutionEngine/JIT/Callback.cpp
+++ b/lib/ExecutionEngine/JIT/Callback.cpp
@@ -46,7 +46,6 @@ void VM::CompilationCallback() {
#endif
}
-
void VM::registerCallback() {
TheVM = this;
}
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index d6f75c0..69e2453 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -131,11 +131,15 @@ void Emitter::emitAddress(void *Addr, bool isPCRelative) {
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));
-
- // Delayed resolution...
- emitAddress((void*)VM::CompilationCallback, isPCRelative);
+ // 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);
+ }
} else {
emitAddress(TheVM.getPointerToGlobal(V), isPCRelative);
}