MLIR 22.0.0git
mlir::pdl_to_pdl_interp::PredicateBuilder Class Reference

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).

Public Member Functions

 PredicateBuilder (PredicateUniquer &uniquer, MLIRContext *ctx)
PositiongetRoot ()
 Returns the root operation position.
OperationPositiongetOperandDefiningOp (Position *p)
 Returns the parent position defining the value held by the given operand.
OperationPositiongetPassthroughOp (Position *p)
 Returns the operation position equivalent to the given position.
ConstraintPositiongetConstraintPosition (ConstraintQuestion *q, unsigned index)
PositiongetAttribute (OperationPosition *p, StringRef name)
 Returns an attribute position for an attribute of the given operation.
PositiongetAttributeLiteral (Attribute attr)
 Returns an attribute position for the given attribute.
PositiongetForEach (Position *p, unsigned id)
PositiongetOperand (OperationPosition *p, unsigned operand)
 Returns an operand position for an operand of the given operation.
PositiongetOperandGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic)
 Returns a position for a group of operands of the given operation.
PositiongetAllOperands (OperationPosition *p)
PositiongetResult (OperationPosition *p, unsigned result)
 Returns a result position for a result of the given operation.
PositiongetResultGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic)
 Returns a position for a group of results of the given operation.
PositiongetAllResults (OperationPosition *p)
PositiongetType (Position *p)
 Returns a type position for the given entity.
PositiongetTypeLiteral (Attribute attr)
 Returns a type position for the given type value.
UsersPositiongetUsers (Position *p, bool useRepresentative)
 Returns the users of a position using the value at the given operand.
Predicate getAttributeConstraint (Attribute attr)
 Create a predicate comparing an attribute to a known value.
Predicate getEqualTo (Position *pos)
 Create a predicate checking if two values are equal.
Predicate getNotEqualTo (Position *pos)
 Create a predicate checking if two values are not equal.
Predicate getConstraint (StringRef name, ArrayRef< Position * > args, ArrayRef< Type > resultTypes, bool isNegated)
 Create a predicate that applies a generic constraint.
Predicate getIsNotNull ()
 Create a predicate comparing a value with null.
Predicate getOperandCount (unsigned count)
 Create a predicate comparing the number of operands of an operation to a known value.
Predicate getOperandCountAtLeast (unsigned count)
Predicate getOperationName (StringRef name)
 Create a predicate comparing the name of an operation to a known value.
Predicate getResultCount (unsigned count)
 Create a predicate comparing the number of results of an operation to a known value.
Predicate getResultCountAtLeast (unsigned count)
Predicate getTypeConstraint (Attribute type)
 Create a predicate comparing the type of an attribute or value to a known type.

Detailed Description

This class provides utilities for constructing predicates.

Definition at line 610 of file Predicate.h.

Member Typedef Documentation

◆ Predicate

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 707 of file Predicate.h.

Constructor & Destructor Documentation

◆ PredicateBuilder()

mlir::pdl_to_pdl_interp::PredicateBuilder::PredicateBuilder ( PredicateUniquer & uniquer,
MLIRContext * ctx )
inline

Definition at line 612 of file Predicate.h.

Member Function Documentation

◆ getAllOperands()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getAllOperands ( OperationPosition * p)
inline

Definition at line 665 of file Predicate.h.

References getOperandGroup().

Referenced by getTreePredicates(), and visitUpward().

◆ getAllResults()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getAllResults ( OperationPosition * p)
inline

Definition at line 679 of file Predicate.h.

References getResultGroup().

Referenced by getTreePredicates(), and visitUpward().

◆ getAttribute()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getAttribute ( OperationPosition * p,
StringRef name )
inline

Returns an attribute position for an attribute of the given operation.

Definition at line 642 of file Predicate.h.

References mlir::pdl_to_pdl_interp::PredicateBase< AttributePosition, Position, std::pair< OperationPosition *, StringAttr >, Predicates::AttributePos >::get().

Referenced by getTreePredicates().

◆ getAttributeConstraint()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getAttributeConstraint ( Attribute attr)
inline

◆ getAttributeLiteral()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getAttributeLiteral ( Attribute attr)
inline

Returns an attribute position for the given attribute.

Definition at line 647 of file Predicate.h.

References mlir::pdl_to_pdl_interp::PredicateBase< AttributeLiteralPosition, Position, Attribute, Predicates::AttributeLiteralPos >::get().

Referenced by getAttributePredicates().

◆ getConstraint()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getConstraint ( StringRef name,
ArrayRef< Position * > args,
ArrayRef< Type > resultTypes,
bool isNegated )
inline

◆ getConstraintPosition()

◆ getEqualTo()

◆ getForEach()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getForEach ( Position * p,
unsigned id )
inline

◆ getIsNotNull()

◆ getNotEqualTo()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getNotEqualTo ( Position * pos)
inline

◆ getOperand()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getOperand ( OperationPosition * p,
unsigned operand )
inline

Returns an operand position for an operand of the given operation.

Definition at line 656 of file Predicate.h.

References mlir::pdl_to_pdl_interp::PredicateBase< OperandPosition, Position, std::pair< OperationPosition *, unsigned >, Predicates::OperandPos >::get().

Referenced by getTreePredicates(), and visitUpward().

◆ getOperandCount()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getOperandCount ( unsigned count)
inline

◆ getOperandCountAtLeast()

◆ getOperandDefiningOp()

OperationPosition * mlir::pdl_to_pdl_interp::PredicateBuilder::getOperandDefiningOp ( Position * p)
inline

Returns the parent position defining the value held by the given operand.

Definition at line 623 of file Predicate.h.

References mlir::pdl_to_pdl_interp::OperationPosition::get().

Referenced by getOperandTreePredicates().

◆ getOperandGroup()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getOperandGroup ( OperationPosition * p,
std::optional< unsigned > group,
bool isVariadic )
inline

◆ getOperationName()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getOperationName ( StringRef name)
inline

◆ getPassthroughOp()

OperationPosition * mlir::pdl_to_pdl_interp::PredicateBuilder::getPassthroughOp ( Position * p)
inline

Returns the operation position equivalent to the given position.

Definition at line 630 of file Predicate.h.

References mlir::pdl_to_pdl_interp::OperationPosition::get().

Referenced by visitUpward().

◆ getResult()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getResult ( OperationPosition * p,
unsigned result )
inline

◆ getResultCount()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getResultCount ( unsigned count)
inline

◆ getResultCountAtLeast()

◆ getResultGroup()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getResultGroup ( OperationPosition * p,
std::optional< unsigned > group,
bool isVariadic )
inline

◆ getRoot()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getRoot ( )
inline

Returns the root operation position.

Definition at line 620 of file Predicate.h.

References mlir::pdl_to_pdl_interp::OperationPosition::getRoot().

Referenced by buildPredicateList().

◆ getType()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getType ( Position * p)
inline

◆ getTypeConstraint()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getTypeConstraint ( Attribute type)
inline

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 769 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().

◆ getTypeLiteral()

Position * mlir::pdl_to_pdl_interp::PredicateBuilder::getTypeLiteral ( Attribute attr)
inline

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 688 of file Predicate.h.

References mlir::pdl_to_pdl_interp::PredicateBase< TypeLiteralPosition, Position, Attribute, Predicates::TypeLiteralPos >::get().

Referenced by getTypePredicates().

◆ getUsers()

UsersPosition * mlir::pdl_to_pdl_interp::PredicateBuilder::getUsers ( Position * p,
bool useRepresentative )
inline

Returns the users of a position using the value at the given operand.

Definition at line 693 of file Predicate.h.

References mlir::pdl_to_pdl_interp::PredicateBase< UsersPosition, Position, std::pair< Position *, bool >, Predicates::UsersPos >::get().

Referenced by visitUpward().


The documentation for this class was generated from the following file: