[llvm-commits] [llvm] r96436 - in /llvm/trunk/utils/TableGen: DAGISelMatcher.h DAGISelMatcherGen.cpp

Chris Lattner sabre at nondot.org
Tue Feb 16 17:27:29 PST 2010


Author: lattner
Date: Tue Feb 16 19:27:29 2010
New Revision: 96436

URL: http://llvm.org/viewvc/llvm-project?rev=96436&view=rev
Log:
prefix captured value names with $ so they look like
variables.  Use the fancy OpNo variable instead of i,
which has the right index including chains.

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

Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=96436&r1=96435&r2=96436&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Tue Feb 16 19:27:29 2010
@@ -131,10 +131,10 @@
   /// 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;

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp?rev=96436&r1=96435&r2=96436&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherGen.cpp Tue Feb 16 19:27:29 2010
@@ -249,7 +249,7 @@
   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 @@
     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 @@
           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;





More information about the llvm-commits mailing list