[llvm-commits] [llvm] r97212 - /llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h

Chris Lattner sabre at nondot.org
Thu Feb 25 23:28:20 PST 2010


Author: lattner
Date: Fri Feb 26 01:28:20 2010
New Revision: 97212

URL: http://llvm.org/viewvc/llvm-project?rev=97212&view=rev
Log:
fix the matcher in the presence of multiple scopes: we need to save
and restore the entire matcher stack by value.  This is because children
we're testing could do moveparent or other things besides just 
scribbling on additions to the stack.

Modified:
    llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h

Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=97212&r1=97211&r2=97212&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Fri Feb 26 01:28:20 2010
@@ -283,8 +283,8 @@
   /// FailIndex - If this match fails, this is the index to continue with.
   unsigned FailIndex;
   
-  /// NodeStackSize - The size of the node stack when the scope was formed.
-  unsigned NodeStackSize;
+  /// NodeStack - The node stack when the scope was formed.
+  SmallVector<SDValue, 4> NodeStack;
   
   /// NumRecordedNodes - The number of recorded nodes when the scope was formed.
   unsigned NumRecordedNodes;
@@ -383,7 +383,7 @@
       // to match.
       MatchScope NewEntry;
       NewEntry.FailIndex = MatcherIndex+NumToSkip;
-      NewEntry.NodeStackSize = NodeStack.size();
+      NewEntry.NodeStack.append(NodeStack.begin(), NodeStack.end());
       NewEntry.NumRecordedNodes = RecordedNodes.size();
       NewEntry.NumMatchedMemRefs = MatchedMemRefs.size();
       NewEntry.InputChain = InputChain;
@@ -935,7 +935,8 @@
       // formed.
       MatchScope &LastScope = MatchScopes.back();
       RecordedNodes.resize(LastScope.NumRecordedNodes);
-      NodeStack.resize(LastScope.NodeStackSize);
+      NodeStack.clear();
+      NodeStack.append(LastScope.NodeStack.begin(), LastScope.NodeStack.end());
       N = NodeStack.back();
 
       DEBUG(errs() << "  Match failed at index " << MatcherIndex





More information about the llvm-commits mailing list