make the new isel generator plop out a CheckComplexPattern function
for evaluating complex patterns.  Some cleanup has to happen before
this can be used though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96419 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index 532d3c1..c44be1c 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -273,19 +273,25 @@
   if (!N->getName().empty()) {
     unsigned &VarMapEntry = VariableMap[N->getName()];
     if (VarMapEntry == 0) {
-      VarMapEntry = ++NextRecordedOperandNo;
+      VarMapEntry = NextRecordedOperandNo+1;
+      
+      unsigned NumRecorded;
       
       // If this is a complex pattern, the match operation for it will
       // implicitly record all of the outputs of it (which may be more than
       // one).
       if (const ComplexPattern *AM = N->getComplexPatternInfo(CGP)) {
         // Record the right number of operands.
-        // FIXME: Does this include chain?
-        VarMapEntry += AM->getNumOperands()-1;
+        NumRecorded = AM->getNumOperands()-1;
+        
+        if (AM->hasProperty(SDNPHasChain))
+          NumRecorded += 2; // Input and output chains.
       } else {
         // If it is a normal named node, we must emit a 'Record' opcode.
         AddMatcherNode(new RecordMatcherNode());
+        NumRecorded = 1;
       }
+      NextRecordedOperandNo += NumRecorded;
       
     } else {
       // If we get here, this is a second reference to a specific name.  Since