mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
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
This commit is contained in:
parent
60df53e30a
commit
06158406c5
@ -53,8 +53,31 @@ static void ContractNodes(OwningPtr<MatcherNode> &MatcherPtr) {
|
|||||||
ContractNodes(N->getNextPtr());
|
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) {
|
MatcherNode *llvm::OptimizeMatcher(MatcherNode *Matcher) {
|
||||||
OwningPtr<MatcherNode> MatcherPtr(Matcher);
|
OwningPtr<MatcherNode> MatcherPtr(Matcher);
|
||||||
ContractNodes(MatcherPtr);
|
ContractNodes(MatcherPtr);
|
||||||
|
FactorNodes(MatcherPtr);
|
||||||
return MatcherPtr.take();
|
return MatcherPtr.take();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user