Lines Matching refs:Pattern
50 const PatternToMatch &Pattern;
53 /// PatWithNoTypes - This is a clone of Pattern.getSrcPattern() that starts
90 /// physreg input to the pattern. The first elt is the Register node, the
91 /// second is the recorded slot number the input pattern match saved it in.
101 MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp);
134 /// GetInstPatternNode - Get the pattern for an instruction.
152 MatcherGen::MatcherGen(const PatternToMatch &pattern,
154 : Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0),
156 // We need to produce the matcher tree for the patterns source pattern. To do
162 // To figure out the fewest number of type checks needed, clone the pattern,
163 // remove the types, then perform type inference on the pattern as a whole.
168 PatWithNoTypes = Pattern.getSrcPattern()->clone();
175 /// InferPossibleTypes - As we emit the pattern, we end up generating type
180 // TP - Get *SOME* tree pattern, we don't care which. It is only used for
202 // Pattern Match Generation
214 if (N == Pattern.getSrcPattern()) {
273 OS << "We expect complex pattern uses to have names: " << *N;
293 // The "name" of a non-leaf complex pattern (MY_PAT $op1, $op2) is
328 // If this is at the root of the pattern, we emit a redundant
331 if (N == Pattern.getSrcPattern())
365 // Remember all of the input chains our pattern will match.
368 // Don't look at the input chain when matching the tree pattern to the
393 const TreePatternNode *Root = Pattern.getSrcPattern();
394 if (N != Root) { // Not the root of the pattern.
422 N != Pattern.getSrcPattern()) {
429 // Remember all of the nodes with output glue our pattern will match.
434 // glue, capture it as the glue input of the pattern.
480 // we already saw this in the pattern, emit code to verify dagness.
500 /// pattern for the specified Variant. If the variant is invalid this returns
503 // If the root of the pattern is a ComplexPattern and if it is specified to
508 Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) {
510 assert(!OpNodes.empty() &&"Complex Pattern must specify what it can match");
518 // Emit the matcher for the pattern structure and types.
519 EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes);
521 // If the pattern has a predicate on it (e.g. only enabled when a subtarget
523 if (!Pattern.getPredicateCheck().empty())
524 AddMatcher(new CheckPatternPredicateMatcher(Pattern.getPredicateCheck()));
557 // If the complex pattern has a chain, then we need to keep track of the
662 /// GetInstPatternNode - Get the pattern for an instruction.
668 // FIXME2?: Assume actual pattern comes before "implicit".
672 else if (/*isRoot*/ N == Pattern.getDstPattern())
673 InstPatNode = Pattern.getSrcPattern();
721 // If we can, get the pattern for the instruction we're generating. We derive
722 // a variety of information from this pattern, such as whether it has a chain.
734 // regardless of whether they happen to have an internal pattern saying so.
735 if (Pattern.getSrcPattern()->TreeHasProperty(SDNPHasChain, CGP)
740 bool isRoot = N == Pattern.getDstPattern();
745 const TreePatternNode *SrcPat = Pattern.getSrcPattern();
749 // FIXME2: this is checking the entire pattern, not just the node in
764 // Loop over all of the fixed operands of the instruction pattern, emitting
846 // If this is the root instruction of a pattern that has physical registers in
847 // its result pattern, add output VTs for them. For example, X86 has:
851 if (isRoot && !Pattern.getDstRegs().empty()) {
858 for (unsigned i = 0; i != Pattern.getDstRegs().size(); ++i) {
859 Record *Reg = Pattern.getDstRegs()[i];
865 // If this is the root of the pattern and the pattern we're matching includes
870 Pattern.getSrcPattern()->NodeHasProperty(SDNPVariadic, CGP))
871 NumFixedArityOperands = Pattern.getSrcPattern()->getNumChildren();
873 // If this is the root node and multiple matched nodes in the input pattern
881 Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP);
886 numNodesThatMayLoadOrStore(Pattern.getDstPattern(), CGP);
933 // This is something selected from the pattern we matched.
946 PrintFatalError("Unknown node in result pattern!");
956 // Codegen the root of the result pattern, capturing the resulting values.
958 EmitResultOperand(Pattern.getDstPattern(), Ops);
960 // At this point, we have however many values the result pattern produces.
961 // However, the input pattern might not need all of these. If there are
966 unsigned NumSrcResults = Pattern.getSrcPattern()->getNumTypes();
968 // If the pattern also has (implicit) results, count them as well.
969 if (!Pattern.getDstRegs().empty()) {
973 const TreePatternNode *DstPat = Pattern.getDstPattern();
982 for (unsigned i = 0; i != Pattern.getDstRegs().size(); ++i) {
983 Record *Reg = Pattern.getDstRegs()[i];
992 // If the matched pattern covers nodes which define a glue result, emit a node
997 AddMatcher(new CompleteMatchMatcher(Ops, Pattern));
1001 /// ConvertPatternToMatcher - Create the matcher for the specified pattern with
1003 Matcher *llvm::ConvertPatternToMatcher(const PatternToMatch &Pattern,
1006 MatcherGen Gen(Pattern, CGP);
1017 // If the match succeeds, then we generate Pattern.