From 084df627c82fdf4e1829723edf0a833b5bc31f89 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 24 Mar 2010 00:41:19 +0000 Subject: 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 --- utils/TableGen/DAGISelMatcherOpt.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'utils/TableGen/DAGISelMatcherOpt.cpp') diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index 820ab63..c73bdb9 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -48,8 +48,9 @@ static void ContractNodes(OwningPtr &MatcherPtr, New = new RecordChildMatcher(MC->getChildNo(), RM->getWhatFor(), RM->getResultNo()); - if (CheckTypeMatcher *CT= dyn_cast(MC->getNext())) - if (MC->getChildNo() < 8) // Only have CheckChildType0...7 + if (CheckTypeMatcher *CT = dyn_cast(MC->getNext())) + if (MC->getChildNo() < 8 && // Only have CheckChildType0...7 + CT->getResNo() == 0) // CheckChildType checks res #0 New = new CheckChildTypeMatcher(MC->getChildNo(), CT->getType()); if (New) { @@ -420,10 +421,12 @@ static void FactorNodes(OwningPtr &MatcherPtr) { CheckTypeMatcher *CTM = cast_or_null(FindNodeWithKind(NewOptionsToMatch[i], Matcher::CheckType)); - if (CTM == 0 || + if (CTM == 0 || // iPTR checks could alias any other case without us knowing, don't // bother with them. CTM->getType() == MVT::iPTR || + // SwitchType only works for result #0. + CTM->getResNo() != 0 || // If the CheckType isn't at the start of the list, see if we can move // it there. !CTM->canMoveBefore(NewOptionsToMatch[i])) { @@ -488,7 +491,7 @@ static void FactorNodes(OwningPtr &MatcherPtr) { MatcherPtr.reset(new SwitchTypeMatcher(&Cases[0], Cases.size())); } else { // If we factored and ended up with one case, create it now. - MatcherPtr.reset(new CheckTypeMatcher(Cases[0].first)); + MatcherPtr.reset(new CheckTypeMatcher(Cases[0].first, 0)); MatcherPtr->setNext(Cases[0].second); } return; -- cgit v1.1