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

Chris Lattner sabre at nondot.org
Tue Feb 16 22:08:25 PST 2010


Author: lattner
Date: Wed Feb 17 00:08:25 2010
New Revision: 96457

URL: http://llvm.org/viewvc/llvm-project?rev=96457&view=rev
Log:
properly record chain inputs to complex patterns,
resolving a fixme.

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=96457&r1=96456&r2=96457&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Wed Feb 17 00:08:25 2010
@@ -155,7 +155,18 @@
     
     // Handle complex pattern.
     const ComplexPattern &CP = CGP.getComplexPattern(LeafRec);
-    return AddMatcherNode(new CheckComplexPatMatcherNode(CP));
+    AddMatcherNode(new CheckComplexPatMatcherNode(CP));
+    
+    // If the complex pattern has a chain, then we need to keep track of the
+    // fact that we just recorded a chain input.  The chain input will be
+    // matched as the last operand of the predicate if it was successful.
+    if (CP.hasProperty(SDNPHasChain)) {
+      // It is the last operand recorded.
+      assert(NextRecordedOperandNo > 1 &&
+             "Should have recorded input/result chains at least!");
+      InputChains.push_back(NextRecordedOperandNo-1);
+    }
+    return;
   }
   
   errs() << "Unknown leaf kind: " << *N << "\n";
@@ -203,9 +214,6 @@
   // the child numbers of the node are all offset by one.
   unsigned OpNo = 0;
   if (N->NodeHasProperty(SDNPHasChain, CGP)) {
-    // FIXME: Not correct for complex patterns, they need to push their own
-    // *matched* input chain.
-    
     // Record the input chain, which is always input #0 of the SDNode.
     AddMatcherNode(new MoveChildMatcherNode(0));
     AddMatcherNode(new RecordMatcherNode("'" + N->getOperator()->getName() +
@@ -222,8 +230,7 @@
     // happen if there were an intermediate node between the indbr and load, for
     // example.
     
-    // FIXME: Emit "lastchain.getNode() == CurrentNode ||
-    //               IsChainCompatible(lastchain.getNode(), CurrentNode)".
+    // FIXME: Emit "IsChainCompatible(lastchain.getNode(), CurrentNode)".
     // Rename IsChainCompatible -> IsChainUnreachable, add comment about
     // complexity.
     





More information about the llvm-commits mailing list