[llvm-commits] CVS: llvm/lib/VMCore/Instruction.cpp iOperators.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Jun 27 13:40:01 PDT 2004


Changes in directory llvm/lib/VMCore:

Instruction.cpp updated: 1.36 -> 1.37
iOperators.cpp updated: 1.28 -> 1.29

---
Log message:

Fold iType into Value::VTy


---
Diffs of the changes:  (+8 -7)

Index: llvm/lib/VMCore/Instruction.cpp
diff -u llvm/lib/VMCore/Instruction.cpp:1.36 llvm/lib/VMCore/Instruction.cpp:1.37
--- llvm/lib/VMCore/Instruction.cpp:1.36	Wed May 26 16:41:09 2004
+++ llvm/lib/VMCore/Instruction.cpp	Sun Jun 27 13:38:48 2004
@@ -25,9 +25,7 @@
 
 Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
                          Instruction *InsertBefore)
-  : User(ty, Value::InstructionVal, Name),
-    Parent(0),
-    iType(it) {
+  : User(ty, Value::InstructionVal + it, Name), Parent(0) {
   init();
 
   // If requested, insert this instruction into a basic block...
@@ -40,9 +38,7 @@
 
 Instruction::Instruction(const Type *ty, unsigned it, const std::string &Name,
                          BasicBlock *InsertAtEnd)
-  : User(ty, Value::InstructionVal, Name),
-    Parent(0),
-    iType(it) {
+  : User(ty, Value::InstructionVal + it, Name), Parent(0) {
   init();
 
   // append this instruction into the basic block
@@ -50,6 +46,10 @@
   InsertAtEnd->getInstList().push_back(this);
 }
 
+void Instruction::setOpcode(unsigned opc) {
+  setValueType(Value::InstructionVal + opc);
+}
+
 void Instruction::setParent(BasicBlock *P) {
   if (getParent()) {
     if (!P) LeakDetector::addGarbageObject(this);


Index: llvm/lib/VMCore/iOperators.cpp
diff -u llvm/lib/VMCore/iOperators.cpp:1.28 llvm/lib/VMCore/iOperators.cpp:1.29
--- llvm/lib/VMCore/iOperators.cpp:1.28	Wed Jun  9 20:57:38 2004
+++ llvm/lib/VMCore/iOperators.cpp	Sun Jun 27 13:38:48 2004
@@ -173,7 +173,8 @@
   if (isCommutative())
     ;  // If the instruction is commutative, it is safe to swap the operands
   else if (SetCondInst *SCI = dyn_cast<SetCondInst>(this))
-    iType = SCI->getSwappedCondition();
+    /// FIXME: SetCC instructions shouldn't all have different opcodes.
+    setOpcode(SCI->getSwappedCondition());
   else
     return true;   // Can't commute operands
 





More information about the llvm-commits mailing list