14 #ifndef MLIR_LIB_CONVERSION_PDLTOPDLINTERP_PREDICATETREE_H_ 15 #define MLIR_LIB_CONVERSION_PDLTOPDLINTERP_PREDICATETREE_H_ 19 #include "llvm/ADT/MapVector.h" 24 namespace pdl_to_pdl_interp {
58 static std::unique_ptr<MatcherNode>
74 failureNode = std::move(node);
84 std::unique_ptr<MatcherNode> failureNode =
nullptr);
94 std::unique_ptr<MatcherNode> failureNode;
97 std::unique_ptr<MatcherNode> failureNodeStorage;
111 std::unique_ptr<MatcherNode> successNode,
112 std::unique_ptr<MatcherNode> failureNode =
nullptr);
131 std::unique_ptr<MatcherNode> successNode;
156 std::unique_ptr<MatcherNode> failureNode);
173 pdl::PatternOp pattern;
196 using ChildMapT = llvm::MapVector<Qualifier *, std::unique_ptr<MatcherNode>>;
200 std::pair<Qualifier *, std::unique_ptr<MatcherNode>> &
getChild(
unsigned i) {
201 assert(i < children.size() &&
"invalid child index");
202 return *std::next(children.begin(), i);
214 #endif // MLIR_CONVERSION_PDLTOPDLINTERP_PREDICATETREE_H_ static bool classof(const MatcherNode *node)
Returns if the given matcher node is an instance of this class, used to support type casting...
Include the generated interface declarations.
static bool classof(const MatcherNode *node)
Returns if the given matcher node is an instance of this class, used to support type casting...
Qualifier * getQuestion() const
Returns the predicate checked on this node.
A SwitchNode denotes a question with multiple potential results.
An ordinal predicate consists of a "Question" and a set of acceptable "Answers" (later converted to o...
Position * position
The position the predicate is applied to.
This class represents the base of a predicate matcher node.
llvm::MapVector< Qualifier *, std::unique_ptr< MatcherNode > > ChildMapT
Returns the children of this switch node.
std::pair< Qualifier *, std::unique_ptr< MatcherNode > > & getChild(unsigned i)
Returns the child at the given index.
PositionalPredicate(Position *pos, const PredicateBuilder::Predicate &predicate)
ChildMapT & getChildren()
TypeID getMatcherTypeID() const
Returns the unique type ID of this matcher instance.
This class provides an efficient unique identifier for a specific C++ type.
std::unique_ptr< MatcherNode > & getFailureNode()
Returns the node that should be visited if this, or a subsequent node fails.
A position describes a value on the input IR on which a predicate may be applied, such as an operatio...
A PositionalPredicate is a predicate that is associated with a specific positional value...
pdl::PatternOp getPattern() const
Return the high level pattern operation that is matched with this node.
static bool classof(const MatcherNode *node)
Returns if the given matcher node is an instance of this class, used to support type casting...
Qualifier * getAnswer() const
Returns the expected answer of this boolean node.
Qualifier * answer
The expected answer of the predicate.
An ExitNode is a special sentinel node that denotes the end of matcher.
void setFailureNode(std::unique_ptr< MatcherNode > node)
Sets the node that should be visited if this, or a subsequent node fails.
A BoolNode denotes a question with a boolean-like result.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Position * getPosition() const
Returns the position on which the question predicate should be checked.
std::unique_ptr< MatcherNode > & getSuccessNode()
Returns the node that should be visited on success.
Qualifier * question
The question that the predicate applies.
Value getRoot() const
Return the chosen root of the pattern.
std::pair< Qualifier *, Qualifier * > Predicate
An ordinal predicate consists of a "Question" and a set of acceptable "Answers" (later converted to o...
static bool classof(const MatcherNode *node)
Returns if the given matcher node is an instance of this class, used to support type casting...
A SuccessNode denotes that a given high level pattern has successfully been matched.
This class provides utilities for constructing predicates.