From 736e6172dc65540907261c5412c91465e8646f2f Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Fri, 30 May 2003 20:36:27 +0000 Subject: When converting virtual registers to immediate constants, change the opcode. llvm-svn: 6452 --- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp') diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp index 187da269c9c..a5a3662e937 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp @@ -16,6 +16,7 @@ #include "llvm/Constants.h" #include "llvm/BasicBlock.h" #include "llvm/DerivedTypes.h" +#include "../../Target/Sparc/SparcInstrSelectionSupport.h" using std::vector; //*************************** Local Functions ******************************/ @@ -186,6 +187,12 @@ 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 @@ -213,6 +220,13 @@ FixConstantOperandsForInstr(Instruction* vmInstr, ? (Value*)ConstantSInt::get(Type::LongTy, immedValue) : (Value*)ConstantUInt::get(Type::ULongTy,(uint64_t)immedValue); } + 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); + } } if (opType == MachineOperand::MO_MachineRegister) -- cgit v1.2.3