diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-05-08 21:44:21 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-05-08 21:44:21 +0000 |
| commit | 037f1e58bdf437282d12daf188c4c72ecc0bde3b (patch) | |
| tree | 94366289d438f7037c8262d5e1c710c1e91ffd4a /llvm/lib/ExecutionEngine/JIT/Emitter.cpp | |
| parent | d340dbdb5d430a2f33630720e67fe97903b60001 (diff) | |
| download | bcm5719-llvm-037f1e58bdf437282d12daf188c4c72ecc0bde3b.tar.gz bcm5719-llvm-037f1e58bdf437282d12daf188c4c72ecc0bde3b.zip | |
Minor speedup by avoiding callbacks to functions already generated
llvm-svn: 6052
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/Emitter.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/Emitter.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp b/llvm/lib/ExecutionEngine/JIT/Emitter.cpp index d6f75c08f76..69e2453090d 100644 --- a/llvm/lib/ExecutionEngine/JIT/Emitter.cpp +++ b/llvm/lib/ExecutionEngine/JIT/Emitter.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); } |

