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

Brian Gaeke gaeke at cs.uiuc.edu
Wed May 19 16:31:01 PDT 2004


Changes in directory llvm/lib/Target/SparcV9:

SparcV9CodeEmitter.cpp updated: 1.60 -> 1.61

---
Log message:

Minor simplification: eliminate a dyn_cast.
Fix a typo in a debug message. 


---
Diffs of the changes:  (+4 -9)

Index: llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.60 llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.61
--- llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp:1.60	Fri Apr 23 13:10:38 2004
+++ llvm/lib/Target/SparcV9/SparcV9CodeEmitter.cpp	Wed May 19 16:30:01 2004
@@ -596,14 +596,9 @@
       DEBUG(std::cerr << "Saving reference to BB (VReg)\n");
       unsigned* CurrPC = (unsigned*)(intptr_t)MCE.getCurrentPCValue();
       BBRefs.push_back(std::make_pair(BB, std::make_pair(CurrPC, &MI)));
-    } else if (const Constant *C = dyn_cast<Constant>(V)) {
-      if (const ConstantInt *CI = dyn_cast<ConstantInt>(C)) {
-        rv = CI->getRawValue() - MCE.getCurrentPCValue();
-      } else {
-        std::cerr << "Cannot have non-integral const in instruction: "
-                  << *C;
-        abort();
-      }
+    } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
+      // Make constant PC-relative by subtracting the PC from it.
+      rv = CI->getRawValue() - MCE.getCurrentPCValue();
     } else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
       // same as MO.isGlobalAddress()
       DEBUG(std::cerr << "GlobalValue: ");
@@ -777,7 +772,7 @@
     if (binCode == (1 << 30)) {
       // this is an invalid call: the addr is out of bounds. that means a code
       // sequence has already been emitted, and this is a no-op
-      DEBUG(std::cerr << "Call supressed: already emitted far call.\n");
+      DEBUG(std::cerr << "Call suppressed: already emitted far call.\n");
     } else {
       emitWord(binCode);
     }





More information about the llvm-commits mailing list