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

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 3 10:06:15 PST 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.160 -> 1.161
---
Log message:

node predicates add to the complexity of a pattern.  This ensures that the
X86 backend attempts to match small-immediate versions of instructions before
the full size immediate versions.


---
Diffs of the changes:  (+9 -2)

 DAGISelEmitter.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.160 llvm/utils/TableGen/DAGISelEmitter.cpp:1.161
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.160	Fri Feb  3 00:22:41 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Fri Feb  3 12:06:02 2006
@@ -1722,7 +1722,12 @@
   const ComplexPattern *AM = NodeGetComplexPattern(P, ISE);
   if (AM)
     Size += AM->getNumOperands() * 2;
-    
+
+  // If this node has some predicate function that must match, it adds to the
+  // complexity of this node.
+  if (!P->getPredicateFn().empty())
+    ++Size;
+  
   // Count children in the count if they are also nodes.
   for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) {
     TreePatternNode *Child = P->getChild(i);
@@ -1730,9 +1735,11 @@
       Size += getPatternSize(Child, ISE);
     else if (Child->isLeaf()) {
       if (dynamic_cast<IntInit*>(Child->getLeafValue())) 
-        Size += 3;  // Matches a ConstantSDNode.
+        Size += 3;  // Matches a ConstantSDNode (+2) and a specific value (+1).
       else if (NodeIsComplexPattern(Child))
         Size += getPatternSize(Child, ISE);
+      else if (!Child->getPredicateFn().empty())
+        ++Size;
     }
   }
   






More information about the llvm-commits mailing list