diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-25 01:57:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-25 01:57:41 +0000 |
commit | c36ab923c66887692b347634fcb255692dfa37a6 (patch) | |
tree | 701bec5e84d7f2eb10df27cee0818a954856546e /llvm/utils/TableGen/DAGISelMatcherOpt.cpp | |
parent | ac55f9df88a32b9c9a4706919d352e6e38373b30 (diff) | |
download | bcm5719-llvm-c36ab923c66887692b347634fcb255692dfa37a6.tar.gz bcm5719-llvm-c36ab923c66887692b347634fcb255692dfa37a6.zip |
add some noop code to push it out of my tree.
llvm-svn: 97094
Diffstat (limited to 'llvm/utils/TableGen/DAGISelMatcherOpt.cpp')
-rw-r--r-- | llvm/utils/TableGen/DAGISelMatcherOpt.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp index 623d8703e44..48396cd0fc6 100644 --- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp @@ -53,8 +53,31 @@ static void ContractNodes(OwningPtr<MatcherNode> &MatcherPtr) { 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(); } |