mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
rename PushMatcherNode -> ScopeMatcherNode to more accurately
reflect what it does. Switch the sense of the Next and the Check arms to be more logical. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -14,14 +14,14 @@
|
||||
#include "DAGISelMatcher.h"
|
||||
using namespace llvm;
|
||||
|
||||
static void ContractNodes(OwningPtr<MatcherNode> &Matcher) {
|
||||
static void ContractNodes(OwningPtr<MatcherNode> &MatcherPtr) {
|
||||
// If we reached the end of the chain, we're done.
|
||||
MatcherNode *N = Matcher.get();
|
||||
MatcherNode *N = MatcherPtr.get();
|
||||
if (N == 0) return;
|
||||
|
||||
// If we have a push node, walk down both edges.
|
||||
if (PushMatcherNode *Push = dyn_cast<PushMatcherNode>(N))
|
||||
ContractNodes(Push->getFailurePtr());
|
||||
// If we have a scope node, walk down both edges.
|
||||
if (ScopeMatcherNode *Push = dyn_cast<ScopeMatcherNode>(N))
|
||||
ContractNodes(Push->getCheckPtr());
|
||||
|
||||
// If we found a movechild node with a node that comes in a 'foochild' form,
|
||||
// transform it.
|
||||
@@ -35,25 +35,24 @@ static void ContractNodes(OwningPtr<MatcherNode> &Matcher) {
|
||||
|
||||
if (New) {
|
||||
// Insert the new node.
|
||||
New->setNext(Matcher.take());
|
||||
Matcher.reset(New);
|
||||
New->setNext(MatcherPtr.take());
|
||||
MatcherPtr.reset(New);
|
||||
// Remove the old one.
|
||||
MC->setNext(MC->getNext()->takeNext());
|
||||
return ContractNodes(Matcher);
|
||||
return ContractNodes(MatcherPtr);
|
||||
}
|
||||
}
|
||||
|
||||
if (MoveChildMatcherNode *MC = dyn_cast<MoveChildMatcherNode>(N))
|
||||
if (MoveParentMatcherNode *MP =
|
||||
dyn_cast<MoveParentMatcherNode>(MC->getNext())) {
|
||||
Matcher.reset(MP->takeNext());
|
||||
return ContractNodes(Matcher);
|
||||
MatcherPtr.reset(MP->takeNext());
|
||||
return ContractNodes(MatcherPtr);
|
||||
}
|
||||
|
||||
ContractNodes(N->getNextPtr());
|
||||
}
|
||||
|
||||
|
||||
MatcherNode *llvm::OptimizeMatcher(MatcherNode *Matcher) {
|
||||
OwningPtr<MatcherNode> MatcherPtr(Matcher);
|
||||
ContractNodes(MatcherPtr);
|
||||
|
||||
Reference in New Issue
Block a user