[llvm-commits] CVS: llvm/tools/lli/JIT/SparcEmitter.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Sun Jun 1 21:11:01 PDT 2003


Changes in directory llvm/tools/lli/JIT:

SparcEmitter.cpp updated: 1.6 -> 1.7

---
Log message:

The flag modifications weren't picking up the old values of the
flags before. Save them in a temporary variable, then restore them from the
temporary after creating the new constant.


---
Diffs of the changes:

Index: llvm/tools/lli/JIT/SparcEmitter.cpp
diff -u llvm/tools/lli/JIT/SparcEmitter.cpp:1.6 llvm/tools/lli/JIT/SparcEmitter.cpp:1.7
--- llvm/tools/lli/JIT/SparcEmitter.cpp:1.6	Sun Jun  1 17:08:29 2003
+++ llvm/tools/lli/JIT/SparcEmitter.cpp	Sun Jun  1 21:10:31 2003
@@ -106,13 +106,18 @@
         // Location is the target of the branch
         // Ref is the location of the instruction, and hence the PC
         unsigned branchTarget = (Location - (long)Ref) >> 2;
+        // Save the flags.
+        bool loBits32=false, hiBits32=false, loBits64=false, hiBits64=false;
+        if (op.opLoBits32()) { loBits32=true; }
+        if (op.opHiBits32()) { hiBits32=true; }
+        if (op.opLoBits64()) { loBits64=true; }
+        if (op.opHiBits64()) { hiBits64=true; }
         MI->SetMachineOperandConst(ii, MachineOperand::MO_SignExtendedImmed,
                                    branchTarget);
-        // Copy the flags.
-        if (op.opLoBits32()) { MI->setOperandLo32(ii); }
-        else if (op.opHiBits32()) { MI->setOperandHi32(ii); }
-        else if (op.opLoBits64()) { MI->setOperandLo64(ii); }
-        else if (op.opHiBits64()) { MI->setOperandHi64(ii); }
+        if (loBits32) { MI->setOperandLo32(ii); }
+        else if (hiBits32) { MI->setOperandHi32(ii); }
+        else if (loBits64) { MI->setOperandLo64(ii); }
+        else if (hiBits64) { MI->setOperandHi64(ii); }
         std::cerr << "Rewrote BB ref: ";
         unsigned fixedInstr = SparcV9CodeEmitter::getBinaryCodeForInstr(*MI);
         *Ref = fixedInstr;





More information about the llvm-commits mailing list