prefix captured value names with $ so they look like
authorChris Lattner <sabre@nondot.org>
Wed, 17 Feb 2010 01:27:29 +0000 (01:27 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 17 Feb 2010 01:27:29 +0000 (01:27 +0000)
variables.  Use the fancy OpNo variable instead of i,
which has the right index including chains.

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

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

index e20a00ee313e258d9f166b0ae50ac194fe45453d..53cf923e7035be1b676f753744dab715e1ea1262 100644 (file)
@@ -131,10 +131,10 @@ class RecordMatcherNode : public MatcherNodeWithChild {
   /// should only be used for comment generation not anything semantic.
   std::string WhatFor;
 public:
-  RecordMatcherNode(StringRef whatfor)
+  RecordMatcherNode(const std::string &whatfor)
     : MatcherNodeWithChild(Record), WhatFor(whatfor) {}
   
-  StringRef getWhatFor() const { return WhatFor; }
+  const std::string &getWhatFor() const { return WhatFor; }
   
   static inline bool classof(const MatcherNode *N) {
     return N->getKind() == Record;
index 5591cfb2a8823100d9f57aac81b3f20d1114c4ed..345b964c2d17fee3909613f6c0290807562b9327 100644 (file)
@@ -249,7 +249,7 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N,
   for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i, ++OpNo) {
     // Get the code suitable for matching this child.  Move to the child, check
     // it then move back to the parent.
-    AddMatcherNode(new MoveChildMatcherNode(i));
+    AddMatcherNode(new MoveChildMatcherNode(OpNo));
     EmitMatchCode(N->getChild(i), NodeNoTypes->getChild(i));
     AddMatcherNode(new MoveParentMatcherNode());
   }
@@ -267,7 +267,6 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
     InferPossibleTypes();
   }
   
-  
   // If this node has a name associated with it, capture it in VariableMap. If
   // we already saw this in the pattern, emit code to verify dagness.
   if (!N->getName().empty()) {
@@ -288,7 +287,7 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
           NumRecorded += 2; // Input and output chains.
       } else {
         // If it is a normal named node, we must emit a 'Record' opcode.
-        AddMatcherNode(new RecordMatcherNode(N->getName()));
+        AddMatcherNode(new RecordMatcherNode("$" + N->getName()));
         NumRecorded = 1;
       }
       NextRecordedOperandNo += NumRecorded;