[llvm-commits] CVS: llvm/lib/Target/TargetInstrInfo.cpp

Evan Cheng evan.cheng at apple.com
Wed Nov 1 15:00:46 PST 2006



Changes in directory llvm/lib/Target:

TargetInstrInfo.cpp updated: 1.19 -> 1.20
---
Log message:

Added getTiedToSrcOperand() to check for two-address'ness.

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

 TargetInstrInfo.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/lib/Target/TargetInstrInfo.cpp
diff -u llvm/lib/Target/TargetInstrInfo.cpp:1.19 llvm/lib/Target/TargetInstrInfo.cpp:1.20
--- llvm/lib/Target/TargetInstrInfo.cpp:1.19	Thu May 11 20:46:26 2006
+++ llvm/lib/Target/TargetInstrInfo.cpp	Wed Nov  1 17:00:31 2006
@@ -38,6 +38,18 @@
   TargetInstrDescriptors = NULL; // reset global variable
 }
 
+int
+TargetInstrInfo::getTiedToSrcOperand(MachineOpCode Opc, unsigned OpNum) const {
+  for (unsigned i = 0, e = getNumOperands(Opc); i != e; ++i) {
+    if (i == OpNum)
+      continue;
+    int ti = getOperandConstraint(Opc, i, TIED_TO);
+    if (ti == (int)OpNum)
+      return i;
+  }
+  return -1;
+}
+
 
 // commuteInstruction - The default implementation of this method just exchanges
 // operand 1 and 2.






More information about the llvm-commits mailing list