summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2003-06-07 02:34:43 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2003-06-07 02:34:43 +0000
commit366494ab0d1d0822e3f8d4d6cbd5f0a22d058a2d (patch)
tree16869f8576ddaf5244e06534e2a166d0780b8a5b /llvm/lib/CodeGen
parent91ca134e26293b96094df2e2e015175ee8a0e8b3 (diff)
downloadbcm5719-llvm-366494ab0d1d0822e3f8d4d6cbd5f0a22d058a2d.tar.gz
bcm5719-llvm-366494ab0d1d0822e3f8d4d6cbd5f0a22d058a2d.zip
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. llvm-svn: 6662
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 86a7e7042cd..8f35be8a07d 100644
--- a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -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
OpenPOWER on IntegriCloud