MLIR  19.0.0git
Public Types | Public Member Functions | List of all members
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). More...
 

Public Member Functions

 PredicateBuilder (PredicateUniquer &uniquer, MLIRContext *ctx)
 
PositiongetRoot ()
 Returns the root operation position. More...
 
OperationPositiongetOperandDefiningOp (Position *p)
 Returns the parent position defining the value held by the given operand. More...
 
OperationPositiongetPassthroughOp (Position *p)
 Returns the operation position equivalent to the given position. More...
 
ConstraintPositiongetConstraintPosition (ConstraintQuestion *q, unsigned index)
 
PositiongetAttribute (OperationPosition *p, StringRef name)
 Returns an attribute position for an attribute of the given operation. More...
 
PositiongetAttributeLiteral (Attribute attr)
 Returns an attribute position for the given attribute. More...
 
PositiongetForEach (Position *p, unsigned id)
 
PositiongetOperand (OperationPosition *p, unsigned operand)
 Returns an operand position for an operand of the given operation. More...
 
PositiongetOperandGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic)
 Returns a position for a group of operands of the given operation. More...
 
PositiongetAllOperands (OperationPosition *p)
 
PositiongetResult (OperationPosition *p, unsigned result)
 Returns a result position for a result of the given operation. More...
 
PositiongetResultGroup (OperationPosition *p, std::optional< unsigned > group, bool isVariadic)
 Returns a position for a group of results of the given operation. More...
 
PositiongetAllResults (OperationPosition *p)
 
PositiongetType (Position *p)
 Returns a type position for the given entity. More...
 
PositiongetTypeLiteral (Attribute attr)
 Returns a type position for the given type value. More...
 
UsersPositiongetUsers (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...
 

Detailed Description

This class provides utilities for constructing predicates.

Definition at line 596 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 693 of file Predicate.h.

Constructor & Destructor Documentation

◆ PredicateBuilder()

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

Definition at line 598 of file Predicate.h.

Member Function Documentation

◆ getAllOperands()

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

Definition at line 651 of file Predicate.h.

References getOperandGroup().

Referenced by visitUpward().

◆ getAllResults()

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

Definition at line 665 of file Predicate.h.

References getResultGroup().

Referenced by 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 628 of file Predicate.h.

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

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

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

◆ getConstraint()

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

◆ getConstraintPosition()

ConstraintPosition* mlir::pdl_to_pdl_interp::PredicateBuilder::getConstraintPosition ( ConstraintQuestion q,
unsigned  index 
)
inline

◆ getEqualTo()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getEqualTo ( Position pos)
inline

◆ getForEach()

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

◆ getIsNotNull()

Predicate mlir::pdl_to_pdl_interp::PredicateBuilder::getIsNotNull ( )
inline

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

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

Referenced by visitUpward().

◆ getOperandCount()

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

◆ getOperandCountAtLeast()

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

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

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

◆ 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 616 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

Returns a result position for a result of the given operation.

Definition at line 656 of file Predicate.h.

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

Referenced by visitUpward().

◆ getResultCount()

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

◆ getResultCountAtLeast()

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

◆ 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 606 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

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

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

◆ 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 674 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 679 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: