diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-11-19 23:42:58 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-11-19 23:42:58 +0000 |
commit | 34fb6838bcbe3115596cd26d2c2a888ab323fdc5 (patch) | |
tree | 70e4bfd7fac4bdae02acb58f2194f67fd6ad8a8b | |
parent | deebf6efabfedb7dbe62b15feccfd94b1282105d (diff) | |
download | bcm5719-llvm-34fb6838bcbe3115596cd26d2c2a888ab323fdc5.tar.gz bcm5719-llvm-34fb6838bcbe3115596cd26d2c2a888ab323fdc5.zip |
Try to fix JITTest.FarCallToKnownFunction on ARM and PPC.
llvm-svn: 89410
-rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp index 5f195ee8b10..aabab98dcca 100644 --- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/llvm/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 |