Lines Matching defs:predicate
23 #define DEBUG_TYPE "pdl-predicate-tree"
722 /// This class represents a specific predicate applied to a position, and
731 /// The position this predicate is applied to.
734 /// The question that is applied by this predicate onto the position.
738 /// The primary sum is the number of occurrences of this predicate among all
742 /// predicates within each pattern that contains this predicate. This allows
749 /// predicate dependency.
752 /// A map between a pattern operation and the answer to the predicate question
756 /// Returns true if this predicate is ordered before `rhs`, based on the cost
763 // * lower predicate dependency
802 /// Returns true if the given matcher refers to the same predicate as the given
803 /// ordered predicate. This means that the position and questions of the two
805 static bool isSamePredicate(MatcherNode *node, OrderedPredicate *predicate) {
806 return node->getPosition() == predicate->position &&
807 node->getQuestion() == predicate->question;
811 /// predicate and parent pattern.
813 OrderedPredicate *predicate,
815 assert(isSamePredicate(node, predicate) &&
816 "expected matcher to equal the given predicate");
818 auto it = predicate->patternToAnswer.find(pattern);
819 assert(it != predicate->patternToAnswer.end() &&
820 "expected pattern to exist in predicate");
824 /// Build the matcher CFG by "pushing" patterns through by sorted predicate
837 // If the pattern doesn't contain this predicate, ignore it.
851 // If the matcher has already been created, and it is for this predicate we
858 // If the matcher doesn't match the current predicate, insert a branch as
876 // If the node only contains one child, collapse it into a boolean predicate
902 // Cannot compute sortBeforeOthers in the predicate of stable_partition
971 // Associate a pattern result with each unique predicate.
974 for (auto &predicate : patternAndPredList.predicates) {
975 auto it = uniqued.insert(predicate);
977 predicate.answer);
990 for (auto &predicate : patternAndPredList.predicates) {
991 OrderedPredicate *orderedPredicate = &*uniqued.find(predicate);
994 // Increment the primary sum for each reference to a particular predicate.
1001 // secondary sum of each predicate. Square the primary sums to emphasize
1005 for (auto *predicate : list.predicates)
1006 total += predicate->primary * predicate->primary;
1007 for (auto *predicate : list.predicates)
1008 predicate->secondary += total;
1025 // Build the matchers for each of the pattern predicate lists.