Do not hastily change the Opcode from 'r' to 'i' type if we're not actually
authorMisha Brukman <brukman+llvm@gmail.com>
Sat, 7 Jun 2003 02:34:43 +0000 (02:34 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Sat, 7 Jun 2003 02:34:43 +0000 (02:34 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6662 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp

index 86a7e7042cd77acee8f782232d21473291820b08..8f35be8a07d3ce38802e9baeac385941128896d9 100644 (file)
@@ -186,12 +186,6 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
                                       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 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
                                     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 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
       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
index 86a7e7042cd77acee8f782232d21473291820b08..8f35be8a07d3ce38802e9baeac385941128896d9 100644 (file)
@@ -186,12 +186,6 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
                                       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 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
                                     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 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
       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