Home | History | Annotate | Download | only in TableGen

Lines Matching full: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(std::unique_ptr<Matcher> &MatcherPtr,
28 Matcher *N = MatcherPtr.get();
34 std::unique_ptr<Matcher> Child(Scope->takeChild(i));
44 Matcher *New = nullptr;
149 Matcher *CheckType = MatcherPtr.release();
150 Matcher *CheckOpcode = CheckType->takeNext();
151 Matcher *Tail = CheckOpcode->takeNext();
161 /// FindNodeWithKind - Scan a series of matchers looking for a matcher with a
163 /// matcher.
164 static Matcher *FindNodeWithKind(Matcher *M, Matcher::KindTy Kind) {
184 static void FactorNodes(std::unique_ptr<Matcher> &MatcherPtr) {
186 Matcher *N = MatcherPtr.get();
196 SmallVector<Matcher*, 32> OptionsToMatch;
200 std::unique_ptr<Matcher> Child(Scope->takeChild(i));
203 if (Matcher *N = Child.release())
207 SmallVector<Matcher*, 32> NewOptionsToMatch;
210 // starting nodes into a shared matcher.
213 Matcher *Optn = OptionsToMatch[OptionIdx++];
220 // See if the next option starts with the same matcher. If the two
221 // neighbors *do* start with the same matcher, we can factor the matcher out
224 SmallVector<Matcher*, 8> EqualMatchers;
232 // If we found a non-equal matcher, see if it is contradictory with the
241 Matcher *ScanMatcher = OptionsToMatch[Scan];
243 // If we found an entry that matches out matcher, merge it into the set to
265 Matcher *M2 = FindNodeWithKind(ScanMatcher, Optn->getKind());
269 Matcher *MatcherWithoutM2 = ScanMatcher->unlinkNode(M2);
294 // If we only found one option starting with this matcher, no factoring is
303 Matcher *Shared = Optn;
309 Matcher *Tmp = EqualMatchers[i]->takeNext();
357 Matcher::CheckType));
381 SmallVector<std::pair<const SDNodeInfo*, Matcher*>, 8> Cases;
397 SmallVector<std::pair<MVT::SimpleValueType, Matcher*>, 8> Cases;
401 Matcher::CheckType));
402 Matcher *MatcherWithoutCTM = NewOptionsToMatch[i]->unlinkNode(CTM);
409 Matcher *PrevMatcher = Cases[Entry-1].second;
416 Matcher *Entries[2] = { PrevMatcher, MatcherWithoutCTM };
417 std::unique_ptr<Matcher> Case(new ScopeMatcher(Entries));
445 llvm::OptimizeMatcher(std::unique_ptr<Matcher> &MatcherPtr,