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

Evan Cheng evan.cheng at apple.com
Mon Aug 28 23:42:24 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

SelectionDAG.h updated: 1.127 -> 1.128
---
Log message:

Move isCommutativeBinOp from SelectionDAG.cpp and DAGCombiner.cpp out. Make it a static method of SelectionDAG.

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

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


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.127 llvm/include/llvm/CodeGen/SelectionDAG.h:1.128
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.127	Sun Aug 27 03:07:55 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Tue Aug 29 01:42:10 2006
@@ -388,6 +388,25 @@
   /// of the SDNodes* in assigned order by reference.
   unsigned AssignTopologicalOrder(std::vector<SDNode*> &TopOrder);
 
+  /// isCommutativeBinOp - Returns true if the opcode is a commutative binary
+  /// operation.
+  static bool isCommutativeBinOp(unsigned Opcode) {
+    switch (Opcode) {
+    case ISD::ADD:
+    case ISD::MUL:
+    case ISD::MULHU:
+    case ISD::MULHS:
+    case ISD::FADD:
+    case ISD::FMUL:
+    case ISD::AND:
+    case ISD::OR:
+    case ISD::XOR:
+    case ISD::ADDC: 
+    case ISD::ADDE: return true;
+    default: return false;
+    }
+  }
+
   void dump() const;
 
 private:






More information about the llvm-commits mailing list