[llvm-commits] [llvm] r96411 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

Chris Lattner sabre at nondot.org
Tue Feb 16 15:14:12 PST 2010


Author: lattner
Date: Tue Feb 16 17:13:59 2010
New Revision: 96411

URL: http://llvm.org/viewvc/llvm-project?rev=96411&view=rev
Log:
clean up some code, eliminate NodeIsComplexPattern, which
does the same thing as getComplexPatternInfo.

Modified:
    llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=96411&r1=96410&r2=96411&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Tue Feb 16 17:13:59 2010
@@ -47,16 +47,6 @@
   return S;
 }
 
-/// NodeIsComplexPattern - return true if N is a leaf node and a subclass of
-/// ComplexPattern.
-static bool NodeIsComplexPattern(TreePatternNode *N) {
-  return (N->isLeaf() &&
-          dynamic_cast<DefInit*>(N->getLeafValue()) &&
-          static_cast<DefInit*>(N->getLeafValue())->getDef()->
-          isSubClassOf("ComplexPattern"));
-}
-
-
 /// getPatternSize - Return the 'size' of this pattern.  We want to match large
 /// patterns before small ones.  This is used to determine the size of a
 /// pattern.
@@ -96,7 +86,7 @@
     else if (Child->isLeaf()) {
       if (dynamic_cast<IntInit*>(Child->getLeafValue())) 
         Size += 5;  // Matches a ConstantSDNode (+3) and a specific value (+2).
-      else if (NodeIsComplexPattern(Child))
+      else if (Child->getComplexPatternInfo(CGP))
         Size += getPatternSize(Child, CGP);
       else if (!Child->getPredicateFns().empty())
         ++Size;
@@ -530,10 +520,9 @@
                 ")->getSExtValue() == INT64_C(" +
                 itostr(II->getValue()) + ")");
       return;
-    } else if (!NodeIsComplexPattern(N)) {
-      assert(0 && "Cannot match this as a leaf value!");
-      abort();
     }
+    assert(N->getComplexPatternInfo(CGP) != 0 &&
+           "Cannot match this as a leaf value!");
   }
   
   // If this node has a name associated with it, capture it in VariableMap. If
@@ -2014,11 +2003,9 @@
     else
       Matcher = new PushMatcherNode(N, Matcher);
   }
-  
-  
+
+  // OptimizeMatcher(Matcher);
   EmitMatcherTable(Matcher, OS);
-  
-  
   //Matcher->dump();
   delete Matcher;
 #endif





More information about the llvm-commits mailing list