enhance comment output to specify what recorded slot
authorChris Lattner <sabre@nondot.org>
Thu, 4 Mar 2010 00:28:05 +0000 (00:28 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 4 Mar 2010 00:28:05 +0000 (00:28 +0000)
numbers a ComplexPat will match into.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97696 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/DAGISelMatcher.h
utils/TableGen/DAGISelMatcherEmitter.cpp
utils/TableGen/DAGISelMatcherGen.cpp

index c2e81711e085d45601a10ea53411c1bbb714e5a4..8498d60b5d1a7a419f6fbe458bdd8752fe3dec16 100644 (file)
@@ -609,11 +609,15 @@ private:
 /// the current node.
 class CheckComplexPatMatcher : public Matcher {
   const ComplexPattern &Pattern;
+  /// FirstResult - This is the first slot in the RecordedNodes list that the
+  /// result of the match populates.
+  unsigned FirstResult;
 public:
-  CheckComplexPatMatcher(const ComplexPattern &pattern)
-    : Matcher(CheckComplexPat), Pattern(pattern) {}
+  CheckComplexPatMatcher(const ComplexPattern &pattern, unsigned firstresult)
+    : Matcher(CheckComplexPat), Pattern(pattern), FirstResult(firstresult) {}
   
   const ComplexPattern &getPattern() const { return Pattern; }
+  unsigned getFirstResult() const { return FirstResult; }
   
   static inline bool classof(const Matcher *N) {
     return N->getKind() == CheckComplexPat;
index 1f0405038c6bd54d1e834e197d8bb42b474fa3f3..1f9e09383f2165f02c27cfbda9a7e6b6aa9ab9b2 100644 (file)
@@ -375,9 +375,12 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
     OS << "OPC_CheckComplexPat, " << getComplexPat(Pattern) << ',';
     if (!OmitComments) {
       OS.PadToColumn(CommentIndent) << "// " << Pattern.getSelectFunc();
-      OS << ": " << Pattern.getNumOperands() << " operands";
+      OS << ':';
+      for (unsigned i = 0, e = Pattern.getNumOperands(); i != e; ++i)
+        OS << " #" << cast<CheckComplexPatMatcher>(N)->getFirstResult()+i;
+           
       if (Pattern.hasProperty(SDNPHasChain))
-        OS << " + chain result and input";
+        OS << " + chain result";
     }
     OS << '\n';
     return 2;
index 448280345bc6982dc2a5be85cf73184389cb2484..f4e2b8d884e43b5e198197939da77365622c15ea 100644 (file)
@@ -252,7 +252,7 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
     
     // Emit a CheckComplexPat operation, which does the match (aborting if it
     // fails) and pushes the matched operands onto the recorded nodes list.
-    AddMatcher(new CheckComplexPatMatcher(CP));
+    AddMatcher(new CheckComplexPatMatcher(CP, NextRecordedOperandNo));
     
     // Record the right number of operands.
     NextRecordedOperandNo += CP.getNumOperands();