[llvm-commits] [llvm] r97442 - /llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp

Chris Lattner sabre at nondot.org
Sun Feb 28 23:54:59 PST 2010


Author: lattner
Date: Mon Mar  1 01:54:59 2010
New Revision: 97442

URL: http://llvm.org/viewvc/llvm-project?rev=97442&view=rev
Log:
Emit type checks late instead of early, this encourages
structural matching code to be factored and shared this
shrinks the X86 isel table from 86537 to 83890 bytes.

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

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=97442&r1=97441&r2=97442&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Mon Mar  1 01:54:59 2010
@@ -460,8 +460,9 @@
   // If N and NodeNoTypes don't agree on a type, then this is a case where we
   // need to do a type check.  Emit the check, apply the tyep to NodeNoTypes and
   // reinfer any correlated types.
+  unsigned NodeType = EEVT::isUnknown;
   if (NodeNoTypes->getExtTypes() != N->getExtTypes()) {
-    AddMatcher(new CheckTypeMatcher(N->getTypeNum(0)));
+    NodeType = N->getTypeNum(0);
     NodeNoTypes->setTypes(N->getExtTypes());
     InferPossibleTypes();
   }
@@ -488,6 +489,10 @@
     EmitLeafMatchCode(N);
   else
     EmitOperatorMatchCode(N, NodeNoTypes);
+  
+  if (NodeType != EEVT::isUnknown)
+    AddMatcher(new CheckTypeMatcher((MVT::SimpleValueType)NodeType));
+
 }
 
 /// EmitMatcherCode - Generate the code that matches the predicate of this





More information about the llvm-commits mailing list