[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h

Chris Lattner sabre at nondot.org
Fri Oct 20 15:39:51 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.189 -> 1.190
---
Log message:

add isIdenticalTo method to machineinstr/operand.


---
Diffs of the changes:  (+19 -0)

 MachineInstr.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.189 llvm/include/llvm/CodeGen/MachineInstr.h:1.190
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.189	Fri Oct 20 13:00:03 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Fri Oct 20 17:39:36 2006
@@ -118,6 +118,10 @@
     assert(isImm() && "Wrong MachineOperand accessor");
     return contents.immedVal;
   }
+  MachineBasicBlock *getMBB() const {
+    assert(isMachineBasicBlock() && "Wrong MachineOperand accessor");
+    return contents.MBB;
+  }
   MachineBasicBlock *getMachineBasicBlock() const {
     assert(isMachineBasicBlock() && "Wrong MachineOperand accessor");
     return contents.MBB;
@@ -203,6 +207,9 @@
     contents.immedVal = Idx;
   }
   
+  /// isIdenticalTo - Return true if this operand is identical to the specified
+  /// operand.
+  bool isIdenticalTo(const MachineOperand &Other) const;
   
   /// ChangeToImmediate - Replace this operand with a new immediate operand of
   /// the specified value.  If an operand is known to be an immediate already,
@@ -279,6 +286,18 @@
     return Operands[i];
   }
 
+  
+  /// isIdenticalTo - Return true if this instruction is identical to (same
+  /// opcode and same operands as) the specified instruction.
+  bool isIdenticalTo(const MachineInstr *Other) const {
+    if (Other->getOpcode() != getOpcode() ||
+        getNumOperands() != getNumOperands())
+      return false;
+    for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+      if (!getOperand(i).isIdenticalTo(Other->getOperand(i)))
+        return false;
+    return true;
+  }
 
   /// clone - Create a copy of 'this' instruction that is identical in
   /// all ways except the the instruction has no parent, prev, or next.






More information about the llvm-commits mailing list