[llvm-commits] [llvm] r97094 - /llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp
Chris Lattner
sabre at nondot.org
Wed Feb 24 17:57:41 PST 2010
Author: lattner
Date: Wed Feb 24 19:57:41 2010
New Revision: 97094
URL: http://llvm.org/viewvc/llvm-project?rev=97094&view=rev
Log:
add some noop code to push it out of my tree.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp?rev=97094&r1=97093&r2=97094&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp Wed Feb 24 19:57:41 2010
@@ -53,8 +53,31 @@
ContractNodes(N->getNextPtr());
}
+static void FactorNodes(OwningPtr<MatcherNode> &MatcherPtr) {
+ // If we reached the end of the chain, we're done.
+ MatcherNode *N = MatcherPtr.get();
+ if (N == 0) return;
+
+ // If this is not a push node, just scan for one.
+ if (!isa<ScopeMatcherNode>(N))
+ return FactorNodes(N->getNextPtr());
+
+ // Okay, pull together the series of linear push nodes into a vector so we can
+ // inspect it more easily.
+ SmallVector<MatcherNode*, 32> OptionsToMatch;
+
+ MatcherNode *CurNode = N;
+ for (; ScopeMatcherNode *PMN = dyn_cast<ScopeMatcherNode>(CurNode);
+ CurNode = PMN->getNext())
+ OptionsToMatch.push_back(PMN->getCheck());
+ OptionsToMatch.push_back(CurNode);
+
+
+}
+
MatcherNode *llvm::OptimizeMatcher(MatcherNode *Matcher) {
OwningPtr<MatcherNode> MatcherPtr(Matcher);
ContractNodes(MatcherPtr);
+ FactorNodes(MatcherPtr);
return MatcherPtr.take();
}
More information about the llvm-commits
mailing list