summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-11-19 23:42:58 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-11-19 23:42:58 +0000
commite03a39b09620d4efc5ee4a76859a99ff0e095ae0 (patch)
tree3a1f7e88cbe05df616f24bb4cdb02a0d62c9107b /lib/ExecutionEngine/JIT/JITEmitter.cpp
parent470fb519615d6c2bf31e9b3c0dd068bb0af39af2 (diff)
downloadllvm-e03a39b09620d4efc5ee4a76859a99ff0e095ae0.tar.gz
llvm-e03a39b09620d4efc5ee4a76859a99ff0e095ae0.tar.bz2
llvm-e03a39b09620d4efc5ee4a76859a99ff0e095ae0.tar.xz
Try to fix JITTest.FarCallToKnownFunction on ARM and PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 5f195ee8b1..aabab98dcc 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -736,17 +736,21 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference,
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