/// found, an error is flagged.
bool ApplyTypeConstraints(TreePatternNode *N, TreePattern &TP) const;
};
-
+
/// TreePredicateFn - This is an abstraction that represents the predicates on
/// a PatFrag node. This is a simple one-word wrapper around a pointer to
/// provide nice accessors.
/// TreePredicateFn constructor. Here 'N' is a subclass of PatFrag.
TreePredicateFn(TreePattern *N);
-
+
TreePattern *getOrigPatFragRecord() const { return PatFragRec; }
-
+
/// isAlwaysTrue - Return true if this is a noop predicate.
bool isAlwaysTrue() const;
-
+
bool isImmediatePattern() const { return !getImmCode().empty(); }
-
+
/// getImmediatePredicateCode - Return the code that evaluates this pattern if
/// this is an immediate predicate. It is an error to call this on a
/// non-immediate pattern.
assert(!Result.empty() && "Isn't an immediate pattern!");
return Result;
}
-
-
+
+
bool operator==(const TreePredicateFn &RHS) const {
return PatFragRec == RHS.PatFragRec;
}
/// Return the name to use in the generated code to reference this, this is
/// "Predicate_foo" if from a pattern fragment "foo".
std::string getFnName() const;
-
+
/// getCodeToRunOnSDNode - Return the code for the function body that
/// evaluates this predicate. The argument is expected to be in "Node",
/// not N. This handles casting and conversion to a concrete node type as
/// appropriate.
std::string getCodeToRunOnSDNode() const;
-
+
private:
std::string getPredCode() const;
std::string getImmCode() const;
};
-
+
/// FIXME: TreePatternNode's can be shared in some cases (due to dag-shaped
/// patterns), and as such should be ref counted. We currently just leak all
bool setDefaultMode(unsigned Mode);
bool hasAnyPredicate() const { return !PredicateFns.empty(); }
-
+
const std::vector<TreePredicateFn> &getPredicateFns() const {
return PredicateFns;
}