MLIR
20.0.0git
|
This class provides utilities for constructing predicates. More...
#include "Conversion/PDLToPDLInterp/Predicate.h"
Public Types | |
using | Predicate = std::pair< Qualifier *, Qualifier * > |
An ordinal predicate consists of a "Question" and a set of acceptable "Answers" (later converted to ordinal values). More... | |
Public Member Functions | |
PredicateBuilder (PredicateUniquer &uniquer, MLIRContext *ctx) | |
Position * | getRoot () |
Returns the root operation position. More... | |
OperationPosition * | getOperandDefiningOp (Position *p) |
Returns the parent position defining the value held by the given operand. More... | |
OperationPosition * | getPassthroughOp (Position *p) |
Returns the operation position equivalent to the given position. More... | |
ConstraintPosition * | getConstraintPosition (ConstraintQuestion *q, unsigned index) |
Position * | getAttribute (OperationPosition *p, StringRef name) |
Returns an attribute position for an attribute of the given operation. More... | |
Position * | getAttributeLiteral (Attribute attr) |
Returns an attribute position for the given attribute. More... | |
Position * | getForEach (Position *p, unsigned id) |
Position * | getOperand (OperationPosition *p, unsigned operand) |
Returns an operand position for an operand of the given operation. More... | |
Position * | getOperandGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic) |
Returns a position for a group of operands of the given operation. More... | |
Position * | getAllOperands (OperationPosition *p) |
Position * | getResult (OperationPosition *p, unsigned result) |
Returns a result position for a result of the given operation. More... | |
Position * | getResultGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic) |
Returns a position for a group of results of the given operation. More... | |
Position * | getAllResults (OperationPosition *p) |
Position * | getType (Position *p) |
Returns a type position for the given entity. More... | |
Position * | getTypeLiteral (Attribute attr) |
Returns a type position for the given type value. More... | |
UsersPosition * | getUsers (Position *p, bool useRepresentative) |
Returns the users of a position using the value at the given operand. More... | |
Predicate | getAttributeConstraint (Attribute attr) |
Create a predicate comparing an attribute to a known value. More... | |
Predicate | getEqualTo (Position *pos) |
Create a predicate checking if two values are equal. More... | |
Predicate | getNotEqualTo (Position *pos) |
Create a predicate checking if two values are not equal. More... | |
Predicate | getConstraint (StringRef name, ArrayRef< Position * > args, ArrayRef< Type > resultTypes, bool isNegated) |
Create a predicate that applies a generic constraint. More... | |
Predicate | getIsNotNull () |
Create a predicate comparing a value with null. More... | |
Predicate | getOperandCount (unsigned count) |
Create a predicate comparing the number of operands of an operation to a known value. More... | |
Predicate | getOperandCountAtLeast (unsigned count) |
Predicate | getOperationName (StringRef name) |
Create a predicate comparing the name of an operation to a known value. More... | |
Predicate | getResultCount (unsigned count) |
Create a predicate comparing the number of results of an operation to a known value. More... | |
Predicate | getResultCountAtLeast (unsigned count) |
Predicate | getTypeConstraint (Attribute type) |
Create a predicate comparing the type of an attribute or value to a known type. More... | |
This class provides utilities for constructing predicates.
Definition at line 596 of file Predicate.h.
using mlir::pdl_to_pdl_interp::PredicateBuilder::Predicate = std::pair<Qualifier *, Qualifier *> |
An ordinal predicate consists of a "Question" and a set of acceptable "Answers" (later converted to ordinal values).
A predicate will query some property of a positional value and decide what to do based on the result.
Definition at line 693 of file Predicate.h.
|
inline |
Definition at line 598 of file Predicate.h.
|
inline |
Definition at line 651 of file Predicate.h.
References getOperandGroup().
Referenced by getTreePredicates(), and visitUpward().
|
inline |
Definition at line 665 of file Predicate.h.
References getResultGroup().
Referenced by getTreePredicates(), and visitUpward().
|
inline |
Returns an attribute position for an attribute of the given operation.
Definition at line 628 of file Predicate.h.
References mlir::get(), and mlir::pdl_to_pdl_interp::PredicateBase< AttributePosition, Position, std::pair< OperationPosition *, StringAttr >, Predicates::AttributePos >::get().
Referenced by getTreePredicates().
|
inline |
Create a predicate comparing an attribute to a known value.
Definition at line 696 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< AttributeAnswer, Qualifier, Attribute, Predicates::AttributeAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< AttributeQuestion, Qualifier, void, Predicates::AttributeQuestion >::get().
Referenced by getTreePredicates().
Returns an attribute position for the given attribute.
Definition at line 633 of file Predicate.h.
Referenced by getAttributePredicates().
|
inline |
Create a predicate that applies a generic constraint.
Definition at line 712 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< TrueAnswer, Qualifier, void, Predicates::TrueAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< ConstraintQuestion, Qualifier, std::tuple< StringRef, ArrayRef< Position * >, ArrayRef< Type >, bool >, Predicates::ConstraintQuestion >::get().
Referenced by getConstraintPredicates().
|
inline |
Definition at line 622 of file Predicate.h.
Referenced by getConstraintPredicates().
Create a predicate checking if two values are equal.
Definition at line 702 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< TrueAnswer, Qualifier, void, Predicates::TrueAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< EqualToQuestion, Qualifier, Position *, Predicates::EqualToQuestion >::get().
Referenced by getConstraintPredicates(), getOperandTreePredicates(), getTreePredicates(), and visitUpward().
|
inline |
Definition at line 637 of file Predicate.h.
Referenced by visitUpward().
|
inline |
Create a predicate comparing a value with null.
Definition at line 720 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< TrueAnswer, Qualifier, void, Predicates::TrueAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< IsNotNullQuestion, Qualifier, void, Predicates::IsNotNullQuestion >::get().
Referenced by getOperandTreePredicates(), getResultPredicates(), and getTreePredicates().
Create a predicate checking if two values are not equal.
Definition at line 707 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< FalseAnswer, Qualifier, void, Predicates::FalseAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< EqualToQuestion, Qualifier, Position *, Predicates::EqualToQuestion >::get().
|
inline |
Returns an operand position for an operand of the given operation.
Definition at line 642 of file Predicate.h.
Referenced by getTreePredicates(), and visitUpward().
|
inline |
Create a predicate comparing the number of operands of an operation to a known value.
Definition at line 726 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< UnsignedAnswer, Qualifier, unsigned, Predicates::UnsignedAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< OperandCountQuestion, Qualifier, void, Predicates::OperandCountQuestion >::get().
Referenced by getTreePredicates().
|
inline |
Definition at line 730 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< UnsignedAnswer, Qualifier, unsigned, Predicates::UnsignedAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< OperandCountAtLeastQuestion, Qualifier, void, Predicates::OperandCountAtLeastQuestion >::get().
Referenced by getTreePredicates().
|
inline |
Returns the parent position defining the value held by the given operand.
Definition at line 609 of file Predicate.h.
References mlir::pdl_to_pdl_interp::OperationPosition::get().
Referenced by getOperandTreePredicates().
|
inline |
Returns a position for a group of operands of the given operation.
Definition at line 647 of file Predicate.h.
Referenced by getAllOperands(), getTreePredicates(), and visitUpward().
|
inline |
Create a predicate comparing the name of an operation to a known value.
Definition at line 736 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< OperationNameAnswer, Qualifier, OperationName, Predicates::OperationNameAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< OperationNameQuestion, Qualifier, void, Predicates::OperationNameQuestion >::get().
Referenced by getTreePredicates().
|
inline |
Returns the operation position equivalent to the given position.
Definition at line 616 of file Predicate.h.
References mlir::pdl_to_pdl_interp::OperationPosition::get().
Referenced by visitUpward().
|
inline |
Returns a result position for a result of the given operation.
Definition at line 656 of file Predicate.h.
Referenced by getOperandTreePredicates(), getResultPredicates(), getTreePredicates(), and visitUpward().
|
inline |
Create a predicate comparing the number of results of an operation to a known value.
Definition at line 743 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< UnsignedAnswer, Qualifier, unsigned, Predicates::UnsignedAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< ResultCountQuestion, Qualifier, void, Predicates::ResultCountQuestion >::get().
Referenced by getTreePredicates().
|
inline |
Definition at line 747 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< UnsignedAnswer, Qualifier, unsigned, Predicates::UnsignedAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< ResultCountAtLeastQuestion, Qualifier, void, Predicates::ResultCountAtLeastQuestion >::get().
Referenced by getTreePredicates().
|
inline |
Returns a position for a group of results of the given operation.
Definition at line 661 of file Predicate.h.
Referenced by getAllResults(), getOperandTreePredicates(), getResultPredicates(), getTreePredicates(), and visitUpward().
|
inline |
Returns the root operation position.
Definition at line 606 of file Predicate.h.
References mlir::pdl_to_pdl_interp::OperationPosition::getRoot().
Referenced by buildPredicateList().
Returns a type position for the given entity.
Definition at line 670 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< TypePosition, Position, Position *, Predicates::TypePos >::get().
Referenced by getOperandTreePredicates(), and getTreePredicates().
Create a predicate comparing the type of an attribute or value to a known type.
The value is stored as either a TypeAttr, or an ArrayAttr of TypeAttr.
Definition at line 755 of file Predicate.h.
References mlir::pdl_to_pdl_interp::PredicateBase< TypeAnswer, Qualifier, Attribute, Predicates::TypeAnswer >::get(), and mlir::pdl_to_pdl_interp::PredicateBase< TypeQuestion, Qualifier, void, Predicates::TypeQuestion >::get().
Referenced by getTreePredicates().
Returns a type position for the given type value.
The value is stored as either a TypeAttr, or an ArrayAttr of TypeAttr.
Definition at line 674 of file Predicate.h.
Referenced by getTypePredicates().
|
inline |
Returns the users of a position using the value at the given operand.
Definition at line 679 of file Predicate.h.
Referenced by visitUpward().