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

Evan Cheng evan.cheng at apple.com
Wed Oct 29 16:54:46 PDT 2008


Author: evancheng
Date: Wed Oct 29 18:54:46 2008
New Revision: 58407

URL: http://llvm.org/viewvc/llvm-project?rev=58407&view=rev
Log:
Let target resolve some relocation results.

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=58407&r1=58406&r2=58407&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Wed Oct 29 18:54:46 2008
@@ -876,30 +876,32 @@
     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::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 @@
 // 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 +





More information about the llvm-commits mailing list