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

Misha Brukman brukman at cs.uiuc.edu
Fri May 30 15:37:01 PDT 2003


Changes in directory llvm/lib/CodeGen/InstrSelection:

InstrSelectionSupport.cpp updated: 1.46 -> 1.47

---
Log message:

When converting virtual registers to immediate constants, change the opcode.


---
Diffs of the changes:

Index: llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
diff -u llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.46 llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.47
--- llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp:1.46	Wed Jan 15 15:36:49 2003
+++ llvm/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp	Fri May 30 15:36:27 2003
@@ -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 @@
                                       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
@@ -212,6 +219,13 @@
               opValue = isSigned
                 ? (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);
             }
         }
 





More information about the llvm-commits mailing list