Don't assume constant operand can only be in position 1!
authorVikram S. Adve <vadve@cs.uiuc.edu>
Wed, 14 Nov 2001 18:49:45 +0000 (18:49 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Wed, 14 Nov 2001 18:49:45 +0000 (18:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1308 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c7d4260087b250ab89b19fe52e8bc16af1176e92..853fe0f31081a8f0cffb7a1e28fdd60613934c31 100644 (file)
@@ -333,9 +333,9 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
           int64_t immedValue;
           MachineOperand::MachineOperandType opType =
             ChooseRegOrImmed(opValue, minstr->getOpCode(), target,
-                             /*canUseImmed*/ (op == 1),
+                             (target.getInstrInfo().getImmmedConstantPos(minstr->getOpCode()) == (int) op),
                              machineRegNum, immedValue);
-              
+          
           if (opType == MachineOperand::MO_MachineRegister)
             minstr->SetMachineOperand(op, machineRegNum);
           else if (opType == MachineOperand::MO_VirtualRegister)
index c7d4260087b250ab89b19fe52e8bc16af1176e92..853fe0f31081a8f0cffb7a1e28fdd60613934c31 100644 (file)
@@ -333,9 +333,9 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
           int64_t immedValue;
           MachineOperand::MachineOperandType opType =
             ChooseRegOrImmed(opValue, minstr->getOpCode(), target,
-                             /*canUseImmed*/ (op == 1),
+                             (target.getInstrInfo().getImmmedConstantPos(minstr->getOpCode()) == (int) op),
                              machineRegNum, immedValue);
-              
+          
           if (opType == MachineOperand::MO_MachineRegister)
             minstr->SetMachineOperand(op, machineRegNum);
           else if (opType == MachineOperand::MO_VirtualRegister)