Rewrite chain handling validation and input TokenFactor handling

stuff now that we don't care about emulating the old broken 
behavior of the old isel.  This eliminates the 
'CheckChainCompatible' check (along with IsChainCompatible) which
did an incorrect and inefficient scan *up* the chain nodes which
happened as the pattern was being formed and does the validation
at the end in HandleMergeInputChains when it forms a structural 
pattern.  This scans "down" the graph, which means that it is
quickly bounded by nodes already selected.  This also handles
token factors that get "trapped" in the dag.

Removing the CheckChainCompatible nodes also shrinks the 
generated tables by about 6K for X86 (down to 83K).

There are two pieces remaining before I can nuke PreprocessRMW:
1. I xfailed a test because we're now producing worse code in a 
   case that has nothing to do with the change: it turns out that
   our use of MorphNodeTo will leave dead nodes in the graph
   which (depending on how the graph is walked) end up causing
   bogus uses of chains and blocking matches.  This is really 
   bad for other reasons, so I'll fix this in a follow-up patch.

2. CheckFoldableChainNode needs to be improved to handle the TF.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-03-02 02:22:10 +00:00
parent 5b870aff81
commit c6d7ad3c7d
8 changed files with 160 additions and 114 deletions
-23
View File
@@ -267,16 +267,6 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
assert(NextRecordedOperandNo > 1 &&
"Should have recorded input/result chains at least!");
MatchedChainNodes.push_back(NextRecordedOperandNo-1);
// If we need to check chains, do so, see comment for
// "NodeHasProperty(SDNPHasChain" below.
if (MatchedChainNodes.size() > 1) {
// FIXME2: This is broken, we should eliminate this nonsense completely,
// but we want to produce the same selections that the old matcher does
// for now.
unsigned PrevOp = MatchedChainNodes[MatchedChainNodes.size()-2];
AddMatcher(new CheckChainCompatibleMatcher(PrevOp));
}
}
// TODO: Complex patterns can't have output flags, if they did, we'd want
@@ -354,19 +344,6 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N,
// Remember all of the input chains our pattern will match.
MatchedChainNodes.push_back(NextRecordedOperandNo++);
// If this is the second (e.g. indbr(load) or store(add(load))) or third
// input chain (e.g. (store (add (load, load))) from msp430) we need to make
// sure that folding the chain won't induce cycles in the DAG. This could
// happen if there were an intermediate node between the indbr and load, for
// example.
if (MatchedChainNodes.size() > 1) {
// FIXME2: This is broken, we should eliminate this nonsense completely,
// but we want to produce the same selections that the old matcher does
// for now.
unsigned PrevOp = MatchedChainNodes[MatchedChainNodes.size()-2];
AddMatcher(new CheckChainCompatibleMatcher(PrevOp));
}
// Don't look at the input chain when matching the tree pattern to the
// SDNode.
OpNo = 1;