[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Jun 5 23:42:00 PDT 2003


Changes in directory llvm/lib/Target/Sparc:

SparcV9CodeEmitter.cpp updated: 1.15 -> 1.16

---
Log message:

Fixed a bunch of test cases in test/Regression/Jello which could not get the
address of a floating-point (allocated via ConstantPool) correctly.


---
Diffs of the changes:

Index: llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp
diff -u llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.15 llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.16
--- llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp:1.15	Thu Jun  5 22:35:37 2003
+++ llvm/lib/Target/Sparc/SparcV9CodeEmitter.cpp	Thu Jun  5 23:41:22 2003
@@ -22,7 +22,7 @@
 bool UltraSparc::addPassesToEmitMachineCode(PassManager &PM,
                                             MachineCodeEmitter &MCE) {
   MachineCodeEmitter *M = &MCE;
-  DEBUG(MachineCodeEmitter::createFilePrinterEmitter(MCE));
+  DEBUG(M = MachineCodeEmitter::createFilePrinterEmitter(MCE));
   PM.add(new SparcV9CodeEmitter(*this, *M));
   PM.add(createMachineCodeDestructionPass()); // Free stuff no longer needed
   return false;
@@ -443,8 +443,19 @@
           DEBUG(std::cerr << "already generated: 0x" << std::hex << rv << "\n");
         }
       } else {
-        DEBUG(std::cerr << "not a function: " << *GV << "\n");
         rv = (int64_t)MCE.getGlobalValueAddress(GV);
+        if (rv == 0) {
+          if (Constant *C = ConstantPointerRef::get(GV)) {
+            if (ConstantMap.find(C) != ConstantMap.end()) {
+              rv = MCE.getConstantPoolEntryAddress(ConstantMap[C]);
+            } else {
+              std::cerr << "Constant: 0x" << std::hex << &*C << std::dec
+                        << ", " << *V << " not found in ConstantMap!\n";
+              abort();
+            }
+          }
+        }
+        DEBUG(std::cerr << "Global addr: " << rv << "\n");
       }
       // The real target of the call is Addr = PC + (rv * 4)
       // So undo that: give the instruction (Addr - PC) / 4





More information about the llvm-commits mailing list