aboutsummaryrefslogtreecommitdiff
path: root/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
commite518b7170b09b20abf2806b2762019db082471d8 (patch)
treec4727ea57dbb993e44e513fa67a04787d3ef19a8 /lib/ExecutionEngine/JIT/JITEmitter.cpp
parent2969ba4ab3c633fb0dcd9f1b82da841e14340fec (diff)
Properly implement a fix for PR475
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index e5cdc92b75..eff24de89e 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/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.
//