Properly implement a fix for PR475
authorChris Lattner <sabre@nondot.org>
Sun, 5 Dec 2004 07:19:16 +0000 (07:19 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 5 Dec 2004 07:19:16 +0000 (07:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18537 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/JIT/JIT.cpp
lib/ExecutionEngine/JIT/JITEmitter.cpp

index 537ca56e024839b4e3930fb344ad5eff6cd262a8..2bab9e735b5d31360248c48aa4f3da2a9dae56ae 100644 (file)
@@ -265,19 +265,6 @@ void *JIT::getPointerToFunction(Function *F) {
   return Addr;
 }
 
-// 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;
-
-  // Otherwise, if the target doesn't support it, just codegen the function.
-  return getPointerToFunction(F);
-}
-
 /// getOrEmitGlobalVariable - Return the address of the specified global
 /// variable, possibly emitting it to memory if needed.  This is used by the
 /// Emitter.
index e5cdc92b7542e2d54e6289141472c19cbbe71535..eff24de89e39e8014c1b2e1227706629f20dcc58 100644 (file)
@@ -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.
 //