Lines Matching refs:Pattern
49 const PatternToMatch &Pattern;
52 /// PatWithNoTypes - This is a clone of Pattern.getSrcPattern() that starts
85 /// physreg input to the pattern. The first elt is the Register node, the
86 /// second is the recorded slot number the input pattern match saved it in.
96 MatcherGen(const PatternToMatch &pattern, const CodeGenDAGPatterns &cgp);
129 /// GetInstPatternNode - Get the pattern for an instruction.
147 MatcherGen::MatcherGen(const PatternToMatch &pattern,
149 : Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0),
151 // We need to produce the matcher tree for the patterns source pattern. To do
157 // To figure out the fewest number of type checks needed, clone the pattern,
158 // remove the types, then perform type inference on the pattern as a whole.
163 PatWithNoTypes = Pattern.getSrcPattern()->clone();
170 /// InferPossibleTypes - As we emit the pattern, we end up generating type
175 // TP - Get *SOME* tree pattern, we don't care which. It is only used for
197 // Pattern Match Generation
209 if (N == Pattern.getSrcPattern()) {
268 OS << "We expect complex pattern uses to have names: " << *N;
288 // The "name" of a non-leaf complex pattern (MY_PAT $op1, $op2) is
323 // If this is at the root of the pattern, we emit a redundant
326 if (N == Pattern.getSrcPattern())
360 // Remember all of the input chains our pattern will match.
363 // Don't look at the input chain when matching the tree pattern to the
388 const TreePatternNode *Root = Pattern.getSrcPattern();
389 if (N != Root) { // Not the root of the pattern.
417 N != Pattern.getSrcPattern()) {
427 // glue, capture it as the glue input of the pattern.
473 // we already saw this in the pattern, emit code to verify dagness.
493 /// pattern for the specified Variant. If the variant is invalid this returns
496 // If the root of the pattern is a ComplexPattern and if it is specified to
501 Pattern.getSrcPattern()->getComplexPatternInfo(CGP)) {
503 assert(!OpNodes.empty() &&"Complex Pattern must specify what it can match");
511 // Emit the matcher for the pattern structure and types.
512 EmitMatchCode(Pattern.getSrcPattern(), PatWithNoTypes);
514 // If the pattern has a predicate on it (e.g. only enabled when a subtarget
516 if (!Pattern.getPredicateCheck().empty())
517 AddMatcher(new CheckPatternPredicateMatcher(Pattern.getPredicateCheck()));
550 // If the complex pattern has a chain, then we need to keep track of the
655 /// GetInstPatternNode - Get the pattern for an instruction.
661 // FIXME2?: Assume actual pattern comes before "implicit".
665 else if (/*isRoot*/ N == Pattern.getDstPattern())
666 InstPatNode = Pattern.getSrcPattern();
714 // If we can, get the pattern for the instruction we're generating. We derive
715 // a variety of information from this pattern, such as whether it has a chain.
727 // regardless of whether they happen to have an internal pattern saying so.
728 if (Pattern.getSrcPattern()->TreeHasProperty(SDNPHasChain, CGP)
733 bool isRoot = N == Pattern.getDstPattern();
738 const TreePatternNode *SrcPat = Pattern.getSrcPattern();
742 // FIXME2: this is checking the entire pattern, not just the node in
757 // Loop over all of the fixed operands of the instruction pattern, emitting
839 // If this is the root instruction of a pattern that has physical registers in
840 // its result pattern, add output VTs for them. For example, X86 has:
844 if (isRoot && !Pattern.getDstRegs().empty()) {
851 for (unsigned i = 0; i != Pattern.getDstRegs().size(); ++i) {
852 Record *Reg = Pattern.getDstRegs()[i];
858 // If this is the root of the pattern and the pattern we're matching includes
863 Pattern.getSrcPattern()->NodeHasProperty(SDNPVariadic, CGP))
864 NumFixedArityOperands = Pattern.getSrcPattern()->getNumChildren();
866 // If this is the root node and multiple matched nodes in the input pattern
874 Pattern.getSrcPattern()->TreeHasProperty(SDNPMemOperand, CGP);
879 numNodesThatMayLoadOrStore(Pattern.getDstPattern(), CGP);
926 // This is something selected from the pattern we matched.
939 PrintFatalError("Unknown node in result pattern!");
949 // Codegen the root of the result pattern, capturing the resulting values.
951 EmitResultOperand(Pattern.getDstPattern(), Ops);
953 // At this point, we have however many values the result pattern produces.
954 // However, the input pattern might not need all of these. If there are
959 unsigned NumSrcResults = Pattern.getSrcPattern()->getNumTypes();
961 // If the pattern also has (implicit) results, count them as well.
962 if (!Pattern.getDstRegs().empty()) {
966 const TreePatternNode *DstPat = Pattern.getDstPattern();
975 for (unsigned i = 0; i != Pattern.getDstRegs().size(); ++i) {
976 Record *Reg = Pattern.getDstRegs()[i];
985 AddMatcher(new CompleteMatchMatcher(Ops, Pattern));
989 /// ConvertPatternToMatcher - Create the matcher for the specified pattern with
991 Matcher *llvm::ConvertPatternToMatcher(const PatternToMatch &Pattern,
994 MatcherGen Gen(Pattern, CGP);
1005 // If the match succeeds, then we generate Pattern.