Home | History | Annotate | Download | only in TableGen

Lines Matching refs:Matcher

1 //===- DAGISelMatcherOpt.cpp - Optimize a DAG Matcher ---------------------===//
10 // This file implements the DAG Matcher optimizer.
23 /// ContractNodes - Turn multiple matcher node patterns like 'MoveChild+Record'
25 static void ContractNodes(OwningPtr<Matcher> &MatcherPtr,
28 Matcher *N = MatcherPtr.get();
34 OwningPtr<Matcher> Child(Scope->takeChild(i));
44 Matcher *New = 0;
80 Matcher *EmitNode = MatcherPtr.take();
81 Matcher *MFR = EmitNode->takeNext();
82 Matcher *Tail = MFR->takeNext();
160 Matcher *CheckType = MatcherPtr.take();
161 Matcher *CheckOpcode = CheckType->takeNext();
162 Matcher *Tail = CheckOpcode->takeNext();
178 /// matcher predicate in the series. However, it turns out that some
183 static void SinkPatternPredicates(OwningPtr<Matcher> &MatcherPtr) {
186 Matcher *N = MatcherPtr.get();
192 OwningPtr<Matcher> Child(Scope->takeChild(i));
225 /// FindNodeWithKind - Scan a series of matchers looking for a matcher with a
227 /// matcher.
228 static Matcher *FindNodeWithKind(Matcher *M, Matcher::KindTy Kind) {
248 static void FactorNodes(OwningPtr<Matcher> &MatcherPtr) {
250 Matcher *N = MatcherPtr.get();
261 SmallVector<Matcher*, 32> OptionsToMatch;
265 OwningPtr<Matcher> Child(Scope->takeChild(i));
268 if (Matcher *N = Child.take())
272 SmallVector<Matcher*, 32> NewOptionsToMatch;
275 // starting nodes into a shared matcher.
278 Matcher *Optn = OptionsToMatch[OptionIdx++];
285 // See if the next option starts with the same matcher. If the two
286 // neighbors *do* start with the same matcher, we can factor the matcher out
289 SmallVector<Matcher*, 8> EqualMatchers;
297 // If we found a non-equal matcher, see if it is contradictory with the
306 Matcher *ScanMatcher = OptionsToMatch[Scan];
308 // If we found an entry that matches out matcher, merge it into the set to
330 Matcher *M2 = FindNodeWithKind(ScanMatcher, Optn->getKind());
334 Matcher *MatcherWithoutM2 = ScanMatcher->unlinkNode(M2);
359 // If we only found one option starting with this matcher, no factoring is
368 Matcher *Shared = Optn;
374 Matcher *Tmp = EqualMatchers[i]->takeNext();
422 Matcher::CheckType));
446 SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
461 SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
465 Matcher::CheckType));
466 Matcher *MatcherWithoutCTM = NewOptionsToMatch[i]->unlinkNode(CTM);
473 Matcher *PrevMatcher = Cases[Entry-1].second;
480 Matcher *Entries[2] = { PrevMatcher, MatcherWithoutCTM };
506 Matcher *llvm::OptimizeMatcher(Matcher *TheMatcher,
508 OwningPtr<Matcher> MatcherPtr(TheMatcher);