summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-05 07:19:16 +0000
committerChris Lattner <sabre@nondot.org>2004-12-05 07:19:16 +0000
commita34f9da4b40be2650575c24a9b849515222809bc (patch)
tree2673495180b873ef9f36d0b3e099ab8fad7a6641 /llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
parentcc6d1928d22416e21e2af6738afbc2992ae8c7b1 (diff)
downloadbcm5719-llvm-a34f9da4b40be2650575c24a9b849515222809bc.tar.gz
bcm5719-llvm-a34f9da4b40be2650575c24a9b849515222809bc.zip
Properly implement a fix for PR475
llvm-svn: 18537
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index e5cdc92b754..eff24de89e3 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -208,6 +208,21 @@ void *JITResolver::JITCompilerFn(void *Stub) {
}
+// getPointerToFunctionOrStub - If the specified function has been
+// code-gen'd, return a pointer to the function. If not, compile it, or use
+// a stub to implement lazy compilation if available.
+//
+void *JIT::getPointerToFunctionOrStub(Function *F) {
+ // If we have already code generated the function, just return the address.
+ if (void *Addr = getPointerToGlobalIfAvailable(F))
+ return Addr;
+
+ // Get a stub if the target supports it
+ return getJITResolver(MCE).getFunctionStub(F);
+}
+
+
+
//===----------------------------------------------------------------------===//
// JITEmitter code.
//
OpenPOWER on IntegriCloud