aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-10-29 23:54:46 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-10-29 23:54:46 +0000
commitef5784ef9b9cdfbc9819a96440c6873196eade76 (patch)
tree8db0635f394271a762bdad673bc4f6378c69480e /lib/ExecutionEngine
parent46281865724c8836de538995e97168db3b06edfc (diff)
downloadexternal_llvm-ef5784ef9b9cdfbc9819a96440c6873196eade76.zip
external_llvm-ef5784ef9b9cdfbc9819a96440c6873196eade76.tar.gz
external_llvm-ef5784ef9b9cdfbc9819a96440c6873196eade76.tar.bz2
Let target resolve some relocation results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp53
1 files changed, 23 insertions, 30 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 44e6638..73346fe 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -876,30 +876,32 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
for (unsigned i = 0, e = Relocations.size(); i != e; ++i) {
MachineRelocation &MR = Relocations[i];
void *ResultPtr;
- if (MR.isString()) {
- ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString());
-
- // If the target REALLY wants a stub for this function, emit it now.
- if (!MR.doesntNeedStub())
- ResultPtr = Resolver.getExternalFunctionStub(ResultPtr);
- } else if (MR.isGlobalValue()) {
- ResultPtr = getPointerToGlobal(MR.getGlobalValue(),
- BufferBegin+MR.getMachineCodeOffset(),
- MR.doesntNeedStub());
- } else if (MR.isGlobalValueLazyPtr()) {
- ResultPtr = getPointerToGVLazyPtr(MR.getGlobalValue(),
+ if (!MR.letTargetResolve()) {
+ if (MR.isString()) {
+ ResultPtr = TheJIT->getPointerToNamedFunction(MR.getString());
+
+ // If the target REALLY wants a stub for this function, emit it now.
+ if (!MR.doesntNeedStub())
+ ResultPtr = Resolver.getExternalFunctionStub(ResultPtr);
+ } else if (MR.isGlobalValue()) {
+ ResultPtr = getPointerToGlobal(MR.getGlobalValue(),
+ BufferBegin+MR.getMachineCodeOffset(),
+ MR.doesntNeedStub());
+ } else if (MR.isGlobalValueLazyPtr()) {
+ ResultPtr = getPointerToGVLazyPtr(MR.getGlobalValue(),
BufferBegin+MR.getMachineCodeOffset(),
MR.doesntNeedStub());
- } else if (MR.isBasicBlock()) {
- ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock());
- } else if (MR.isConstantPoolIndex()) {
- ResultPtr=(void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex());
- } else {
- assert(MR.isJumpTableIndex());
- ResultPtr=(void*)getJumpTableEntryAddress(MR.getJumpTableIndex());
- }
+ } else if (MR.isBasicBlock()) {
+ ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock());
+ } else if (MR.isConstantPoolIndex()) {
+ ResultPtr = (void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex());
+ } else {
+ assert(MR.isJumpTableIndex());
+ ResultPtr=(void*)getJumpTableEntryAddress(MR.getJumpTableIndex());
+ }
- MR.setResultPointer(ResultPtr);
+ MR.setResultPointer(ResultPtr);
+ }
// if we are managing the GOT and the relocation wants an index,
// give it one
@@ -1011,11 +1013,6 @@ void* JITEmitter::allocateSpace(intptr_t Size, unsigned Alignment) {
}
void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
- if (TheJIT->getJITInfo().hasCustomConstantPool()) {
- DOUT << "JIT: Target has custom constant pool handling. Omitting standard "
- "constant pool\n";
- return;
- }
const std::vector<MachineConstantPoolEntry> &Constants = MCP->getConstants();
if (Constants.empty()) return;
@@ -1129,10 +1126,6 @@ void *JITEmitter::finishFunctionStub(const GlobalValue* F) {
// method.
//
intptr_t JITEmitter::getConstantPoolEntryAddress(unsigned ConstantNum) const {
- if (TheJIT->getJITInfo().hasCustomConstantPool()) {
- return TheJIT->getJITInfo().getCustomConstantPoolEntryAddress(ConstantNum);
- }
-
assert(ConstantNum < ConstantPool->getConstants().size() &&
"Invalid ConstantPoolIndex!");
return (intptr_t)ConstantPoolBase +