From 06158406c5d0ba49ed3840bce382a3b502a3fdea Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 25 Feb 2010 01:57:41 +0000 Subject: [PATCH] add some noop code to push it out of my tree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97094 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/DAGISelMatcherOpt.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index 623d8703e44..48396cd0fc6 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -53,8 +53,31 @@ static void ContractNodes(OwningPtr &MatcherPtr) { ContractNodes(N->getNextPtr()); } +static void FactorNodes(OwningPtr &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(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 OptionsToMatch; + + MatcherNode *CurNode = N; + for (; ScopeMatcherNode *PMN = dyn_cast(CurNode); + CurNode = PMN->getNext()) + OptionsToMatch.push_back(PMN->getCheck()); + OptionsToMatch.push_back(CurNode); + + +} + MatcherNode *llvm::OptimizeMatcher(MatcherNode *Matcher) { OwningPtr MatcherPtr(Matcher); ContractNodes(MatcherPtr); + FactorNodes(MatcherPtr); return MatcherPtr.take(); }