add plumbing for handling multiple result nodes

in some more places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99366 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-03-24 00:41:19 +00:00
parent 92d7b35bd0
commit 084df627c8
8 changed files with 36 additions and 27 deletions
+9 -10
View File
@@ -408,13 +408,13 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
// If N and NodeNoTypes don't agree on a type, then this is a case where we
// need to do a type check. Emit the check, apply the tyep to NodeNoTypes and
// reinfer any correlated types.
bool DoTypeCheck = false;
if (NodeNoTypes->getNumTypes() != 0 &&
NodeNoTypes->getExtType(0) != N->getExtType(0)) {
assert(NodeNoTypes->getNumTypes() == 1 && "FIXME: Handle multiple results");
NodeNoTypes->setType(0, N->getExtType(0));
SmallVector<unsigned, 2> ResultsToTypeCheck;
for (unsigned i = 0, e = NodeNoTypes->getNumTypes(); i != e; ++i) {
if (NodeNoTypes->getExtType(i) == N->getExtType(i)) continue;
NodeNoTypes->setType(i, N->getExtType(i));
InferPossibleTypes();
DoTypeCheck = true;
ResultsToTypeCheck.push_back(i);
}
// If this node has a name associated with it, capture it in VariableMap. If
@@ -444,10 +444,9 @@ void MatcherGen::EmitMatchCode(const TreePatternNode *N,
for (unsigned i = 0, e = N->getPredicateFns().size(); i != e; ++i)
AddMatcher(new CheckPredicateMatcher(N->getPredicateFns()[i]));
if (DoTypeCheck) {
assert(N->getNumTypes() == 1);
AddMatcher(new CheckTypeMatcher(N->getType(0)));
}
for (unsigned i = 0, e = ResultsToTypeCheck.size(); i != e; ++i)
AddMatcher(new CheckTypeMatcher(N->getType(ResultsToTypeCheck[i]),
ResultsToTypeCheck[i]));
}
/// EmitMatcherCode - Generate the code that matches the predicate of this