[llvm-commits] CVS: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp

Misha Brukman brukman at cs.uiuc.edu
Fri Jun 6 21:35:01 PDT 2003


Changes in directory llvm/lib/CodeGen/InstrSelection:

InstrSelectionSupport.cpp updated: 1.50 -> 1.51

---
Log message:

Do not hastily change the Opcode from 'r' to 'i' type if we're not actually
SETTING the operand to be an immediate or have verified that one of the operands
is really a SignExtended or Unextended immediate value already, which warrants
an 'i' opcode.


---
Diffs of the changes:

Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.50 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.51
--- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.50	Tue Jun  3 23:54:06 2003
+++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp	Fri Jun  6 21:34:43 2003
@@ -186,12 +186,6 @@
                                       immedValue);
             if (opType == MachineOperand::MO_VirtualRegister)
               constantThatMustBeLoaded = true;
-            else {
-              // The optype has changed from being a register to an immediate
-              // This means we need to change the opcode, e.g. ADDr -> ADDi
-              unsigned newOpcode = convertOpcodeFromRegToImm(opCode);
-              minstr->setOpcode(newOpcode);
-            }
           }
         }
       else
@@ -209,7 +203,8 @@
                                     opCode, target, (immedPos == (int)op), 
                                     machineRegNum, immedValue);
 
-          if (opType == MachineOperand::MO_SignExtendedImmed) {
+          if (opType == MachineOperand::MO_SignExtendedImmed ||
+              opType == MachineOperand::MO_UnextendedImmed) {
             // The optype is an immediate value
             // This means we need to change the opcode, e.g. ADDr -> ADDi
             unsigned newOpcode = convertOpcodeFromRegToImm(opCode);
@@ -233,6 +228,10 @@
       else if (opType == MachineOperand::MO_SignExtendedImmed ||
                opType == MachineOperand::MO_UnextendedImmed) {
         minstr->SetMachineOperandConst(op, opType, immedValue);
+        // The optype is or has become an immediate
+        // This means we need to change the opcode, e.g. ADDr -> ADDi
+        unsigned newOpcode = convertOpcodeFromRegToImm(opCode);
+        minstr->setOpcode(newOpcode);
       } else if (constantThatMustBeLoaded ||
                (opValue && isa<GlobalValue>(opValue)))
         { // opValue is a constant that must be explicitly loaded into a reg





More information about the llvm-commits mailing list