[llvm-commits] [llvm] r89410 - /llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp

Jeffrey Yasskin jyasskin at google.com
Thu Nov 19 15:42:58 PST 2009


Author: jyasskin
Date: Thu Nov 19 17:42:58 2009
New Revision: 89410

URL: http://llvm.org/viewvc/llvm-project?rev=89410&view=rev
Log:
Try to fix JITTest.FarCallToKnownFunction on ARM and PPC.

Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=89410&r1=89409&r2=89410&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Nov 19 17:42:58 2009
@@ -736,17 +736,21 @@
     return FnStub;
   }
 
-  // Otherwise if we have code, go ahead and return that.
-  void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F);
-  if (ResultPtr) return ResultPtr;
-
-  // If this is an external function pointer, we can force the JIT to
-  // 'compile' it, which really just adds it to the map.
-  if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode() &&
-      !MayNeedFarStub)
-    return TheJIT->getPointerToFunction(F);
+  // If we know the target can handle arbitrary-distance calls, try to
+  // return a direct pointer.
+  if (!MayNeedFarStub) {
+    // If we have code, go ahead and return that.
+    void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F);
+    if (ResultPtr) return ResultPtr;
+
+    // If this is an external function pointer, we can force the JIT to
+    // 'compile' it, which really just adds it to the map.
+    if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode())
+      return TheJIT->getPointerToFunction(F);
+  }
 
-  // Otherwise, we have to emit a stub.
+  // Otherwise, we may need a to emit a stub, and, conservatively, we
+  // always do so.
   void *StubAddr = Resolver.getFunctionStub(F);
 
   // Add the stub to the current function's list of referenced stubs, so we can





More information about the llvm-commits mailing list