[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Sep 14 16:54:38 PDT 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.255 -> 1.256
---
Log message:

Relax this check.


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

 DAGISelEmitter.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.255 llvm/utils/TableGen/DAGISelEmitter.cpp:1.256
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.255	Sun Sep 10 21:24:43 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Thu Sep 14 18:54:24 2006
@@ -824,13 +824,16 @@
   const SDNodeInfo &NodeInfo = ISE.getSDNodeInfo(getOperator());
   if (NodeInfo.hasProperty(SDNodeInfo::SDNPCommutative)) {
     // Scan all of the operands of the node and make sure that only the last one
-    // is a constant node.
-    for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i)
-      if (!getChild(i)->isLeaf() && 
-          getChild(i)->getOperator()->getName() == "imm") {
-        Reason = "Immediate value must be on the RHS of commutative operators!";
-        return false;
-      }
+    // is a constant node, unless the RHS also is.
+    if (getChild(getNumChildren()-1)->isLeaf() ||
+        getChild(getNumChildren()-1)->getOperator()->getName() != "imm") {
+      for (unsigned i = 0, e = getNumChildren()-1; i != e; ++i)
+        if (!getChild(i)->isLeaf() && 
+            getChild(i)->getOperator()->getName() == "imm") {
+          Reason = "Immediate value must be on the RHS of commutative operators!";
+          return false;
+        }
+    }
   }
   
   return true;






More information about the llvm-commits mailing list