Beaver.MLIR.Dialect.PDLInterp (beaver v0.4.8)

Copy Markdown

Summary

Functions

Return op name pdl_interp.apply_constraint as a bitstring.

pdl_interp.apply_constraint - Apply a constraint to a set of positional values

Return op name pdl_interp.apply_rewrite as a bitstring.

pdl_interp.apply_rewrite - Invoke and apply an externally registered rewrite method

Return op name pdl_interp.are_equal as a bitstring.

pdl_interp.are_equal - Check if two positional values or ranges are equivalent

Return op name pdl_interp.branch as a bitstring.

pdl_interp.branch - General branch operation

Return op name pdl_interp.check_attribute as a bitstring.

pdl_interp.check_attribute - Check the value of an Attribute

Return op name pdl_interp.check_operand_count as a bitstring.

pdl_interp.check_operand_count - Check the number of operands of an Operation

Return op name pdl_interp.check_operation_name as a bitstring.

pdl_interp.check_operation_name - Check the OperationName of an Operation

Return op name pdl_interp.check_result_count as a bitstring.

pdl_interp.check_result_count - Check the number of results of an Operation

Return op name pdl_interp.check_type as a bitstring.

pdl_interp.check_type - Compare a type to a known value

Return op name pdl_interp.check_types as a bitstring.

pdl_interp.check_types - Compare a range of types to a range of known values

Return op name pdl_interp.continue as a bitstring.

pdl_interp.continue - Breaks the current iteration

Return op name pdl_interp.create_attribute as a bitstring.

pdl_interp.create_attribute - Create an interpreter handle to a constant Attribute

Return op name pdl_interp.create_operation as a bitstring.

pdl_interp.create_operation - Create an instance of a specific Operation

Return op name pdl_interp.create_range as a bitstring.

pdl_interp.create_range - Construct a range of PDL entities

Return op name pdl_interp.create_type as a bitstring.

pdl_interp.create_type - Create an interpreter handle to a constant Type

Return op name pdl_interp.create_types as a bitstring.

pdl_interp.create_types - Create an interpreter handle to a range of constant Types

Return op name pdl_interp.erase as a bitstring.

pdl_interp.erase - Mark an operation as erased

Return op name pdl_interp.extract as a bitstring.

pdl_interp.extract - Extract the item at the specified index in a range

Return op name pdl_interp.finalize as a bitstring.

pdl_interp.finalize - Finalize a pattern match or rewrite sequence

Return op name pdl_interp.foreach as a bitstring.

pdl_interp.foreach - Iterates over a range of values or ranges

Return op name pdl_interp.func as a bitstring.

pdl_interp.func - PDL Interpreter Function Operation

Return op name pdl_interp.get_attribute as a bitstring.

pdl_interp.get_attribute - Get a specified attribute value from an Operation

Return op name pdl_interp.get_attribute_type as a bitstring.

pdl_interp.get_attribute_type - Get the result type of a specified Attribute

Return op name pdl_interp.get_defining_op as a bitstring.

pdl_interp.get_defining_op - Get the defining operation of a Value

Return op name pdl_interp.get_operand as a bitstring.

pdl_interp.get_operand - Get a specified operand from an Operation

Return op name pdl_interp.get_operands as a bitstring.

pdl_interp.get_operands - Get a specified operand group from an Operation

Return op name pdl_interp.get_result as a bitstring.

pdl_interp.get_result - Get a specified result from an Operation

Return op name pdl_interp.get_results as a bitstring.

pdl_interp.get_results - Get a specified result group from an Operation

Return op name pdl_interp.get_users as a bitstring.

pdl_interp.get_users - Get the users of a Value

Return op name pdl_interp.get_value_type as a bitstring.

pdl_interp.get_value_type - Get the result type of a specified Value

Return op name pdl_interp.is_not_null as a bitstring.

pdl_interp.is_not_null - Check if a positional value is non-null

Return op name pdl_interp.record_match as a bitstring.

pdl_interp.record_match - Record the metadata for a successful pattern match

Return op name pdl_interp.replace as a bitstring.

pdl_interp.replace - Mark an operation as replaced

Return op name pdl_interp.switch_attribute as a bitstring.

pdl_interp.switch_attribute - Switch on the value of an Attribute

Return op name pdl_interp.switch_operand_count as a bitstring.

pdl_interp.switch_operand_count - Switch on the operand count of an Operation

Return op name pdl_interp.switch_operation_name as a bitstring.

pdl_interp.switch_operation_name - Switch on the OperationName of an Operation

Return op name pdl_interp.switch_result_count as a bitstring.

pdl_interp.switch_result_count - Switch on the result count of an Operation

Return op name pdl_interp.switch_type as a bitstring.

pdl_interp.switch_type - Switch on a Type value

Return op name pdl_interp.switch_types as a bitstring.

pdl_interp.switch_types - Switch on a range of Type values

Functions

apply_constraint()

Return op name pdl_interp.apply_constraint as a bitstring.

apply_constraint(ssa)

pdl_interp.apply_constraint - Apply a constraint to a set of positional values

Attributes

  • name - Single, StrAttr, string attribute
  • isNegated - Single, BoolAttr, bool attribute

Operands

  • args - Variadic, PDL_AnyType, variadic of pdl type

Results

  • results - Variadic, PDL_AnyType, variadic of pdl type

Description

pdl_interp.apply_constraint operations apply a generic constraint, that has been registered with the interpreter, with a given set of positional values. The constraint function may return any number of results. On success, this operation branches to the true destination, otherwise the false destination is taken. This behavior can be reversed by setting the attribute isNegated to true.

Example:

// Apply `myConstraint` to the entities defined by `input`, `attr`, and
// `op`.
pdl_interp.apply_constraint "myConstraint"(%input, %attr, %op : !pdl.value, !pdl.attribute, !pdl.operation) -> ^matchDest, ^failureDest

apply_rewrite()

Return op name pdl_interp.apply_rewrite as a bitstring.

apply_rewrite(ssa)

pdl_interp.apply_rewrite - Invoke and apply an externally registered rewrite method

Attributes

  • name - Single, StrAttr, string attribute

Operands

  • args - Variadic, PDL_AnyType, variadic of pdl type

Results

  • results - Variadic, PDL_AnyType, variadic of pdl type

Description

pdl_interp.apply_rewrite operations invoke an external rewriter that has been registered with the interpreter to perform the rewrite after a successful match. The rewrite is passed a set of positional arguments. The rewrite function may return any number of results.

Example:

// Rewriter operating solely on the root operation.
pdl_interp.apply_rewrite "rewriter"(%root : !pdl.operation)

// Rewriter operating solely on the root operation and return an attribute.
%attr = pdl_interp.apply_rewrite "rewriter"(%root : !pdl.operation) : !pdl.attribute

// Rewriter operating on the root operation along with additional arguments
// from the matcher.
pdl_interp.apply_rewrite "rewriter"(%root : !pdl.operation, %value : !pdl.value)

are_equal()

Return op name pdl_interp.are_equal as a bitstring.

are_equal(ssa)

pdl_interp.are_equal - Check if two positional values or ranges are equivalent

Operands

  • lhs - Single, PDL_AnyType, pdl type
  • rhs - Single, PDL_AnyType, pdl type

Description

pdl_interp.are_equal operations compare two positional values for equality. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

pdl_interp.are_equal %result1, %result2 : !pdl.value -> ^matchDest, ^failureDest

branch()

Return op name pdl_interp.branch as a bitstring.

branch(ssa)

pdl_interp.branch - General branch operation

Description

pdl_interp.branch operations expose general branch functionality to the interpreter, and are generally used to branch from one pattern match sequence to another.

Example:

pdl_interp.branch ^dest

check_attribute()

Return op name pdl_interp.check_attribute as a bitstring.

check_attribute(ssa)

pdl_interp.check_attribute - Check the value of an Attribute

Attributes

  • constantValue - Single, AnyAttr, any attribute

Operands

  • attribute - Single, PDL_Attribute, PDL handle to an mlir::Attribute

Description

pdl_interp.check_attribute operations compare the value of a given attribute with a constant value. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

pdl_interp.check_attribute %attr is 10 -> ^matchDest, ^failureDest

check_operand_count()

Return op name pdl_interp.check_operand_count as a bitstring.

check_operand_count(ssa)

pdl_interp.check_operand_count - Check the number of operands of an Operation

Attributes

  • count - Single, I32Attr, 32-bit signless integer attribute whose value is non-negative
  • compareAtLeast - Optional, UnitAttr, unit attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.check_operand_count operations compare the number of operands of a given operation value with a constant. The comparison is either exact or at_least, with the latter used to compare against a minimum number of expected operands. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

// Check for exact equality.
pdl_interp.check_operand_count of %op is 2 -> ^matchDest, ^failureDest

// Check for at least N operands.
pdl_interp.check_operand_count of %op is at_least 2 -> ^matchDest, ^failureDest

check_operation_name()

Return op name pdl_interp.check_operation_name as a bitstring.

check_operation_name(ssa)

pdl_interp.check_operation_name - Check the OperationName of an Operation

Attributes

  • name - Single, StrAttr, string attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.check_operation_name operations compare the name of a given operation with a known name. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

pdl_interp.check_operation_name of %op is "foo.op" -> ^matchDest, ^failureDest

check_result_count()

Return op name pdl_interp.check_result_count as a bitstring.

check_result_count(ssa)

pdl_interp.check_result_count - Check the number of results of an Operation

Attributes

  • count - Single, I32Attr, 32-bit signless integer attribute whose value is non-negative
  • compareAtLeast - Optional, UnitAttr, unit attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.check_result_count operations compare the number of results of a given operation value with a constant. The comparison is either exact or at_least, with the latter used to compare against a minimum number of expected results. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

// Check for exact equality.
pdl_interp.check_result_count of %op is 2 -> ^matchDest, ^failureDest

// Check for at least N results.
pdl_interp.check_result_count of %op is at_least 2 -> ^matchDest, ^failureDest

check_type()

Return op name pdl_interp.check_type as a bitstring.

check_type(ssa)

pdl_interp.check_type - Compare a type to a known value

Attributes

  • type - Single, TypeAttr, any type attribute

Operands

  • value - Single, PDL_Type, PDL handle to an mlir::Type

Description

pdl_interp.check_type operations compare a type with a statically known type. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

pdl_interp.check_type %type is i32 -> ^matchDest, ^failureDest

check_types()

Return op name pdl_interp.check_types as a bitstring.

check_types(ssa)

pdl_interp.check_types - Compare a range of types to a range of known values

Attributes

  • types - Single, TypeArrayAttr, type array attribute

Operands

  • value - Single, anonymous/composite constraint, range of PDL handle to an mlir::Type values

Description

pdl_interp.check_types operations compare a range of types with a statically known range of types. On success, this operation branches to the true destination, otherwise the false destination is taken.

Example:

pdl_interp.check_types %type are [i32, i64] -> ^matchDest, ^failureDest

continue()

Return op name pdl_interp.continue as a bitstring.

continue(ssa)

pdl_interp.continue - Breaks the current iteration

Description

pdl_interp.continue operation breaks the current iteration within the pdl_interp.foreach region and continues with the next iteration from the beginning of the region.

Example:

pdl_interp.continue

create_attribute()

Return op name pdl_interp.create_attribute as a bitstring.

create_attribute(ssa)

pdl_interp.create_attribute - Create an interpreter handle to a constant Attribute

Attributes

  • value - Single, AnyAttr, any attribute

Results

  • attribute - Single, PDL_Attribute, PDL handle to an mlir::Attribute

Description

pdl_interp.create_attribute operations generate a handle within the interpreter for a specific constant attribute value.

Example:

%attr = pdl_interp.create_attribute 10 : i64

create_operation()

Return op name pdl_interp.create_operation as a bitstring.

create_operation(ssa)

pdl_interp.create_operation - Create an instance of a specific Operation

Attributes

  • name - Single, StrAttr, string attribute
  • inputAttributeNames - Single, StrArrayAttr, string array attribute
  • inferredResultTypes - Optional, UnitAttr, unit attribute

Operands

  • inputOperands - Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle for an mlir::Value
  • inputAttributes - Variadic, PDL_Attribute, variadic of PDL handle to an mlir::Attribute
  • inputResultTypes - Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle to an mlir::Type

Results

  • resultOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.create_operation operations create an Operation instance with the specified attributes, operands, and result types. See pdl.operation for a more detailed description on the general interpretation of the arguments to this operation.

Example:

// Create an instance of a `foo.op` operation.
%op = pdl_interp.create_operation "foo.op"(%arg0 : !pdl.value) {"attrA" = %attr0} -> (%type : !pdl.type)

// Create an instance of a `foo.op` operation that has inferred result types
// (using the InferTypeOpInterface).
%op = pdl_interp.create_operation "foo.op"(%arg0 : !pdl.value) {"attrA" = %attr0} -> <inferred>

create_range()

Return op name pdl_interp.create_range as a bitstring.

create_range(ssa)

pdl_interp.create_range - Construct a range of PDL entities

Operands

  • arguments - Variadic, PDL_AnyType, variadic of pdl type

Results

  • result - Single, anonymous/composite constraint, range of PDL handle to an mlir::Type or PDL handle for an mlir::Value values

Description

pdl_interp.create_range operations construct a range from a given set of PDL entities, which all share the same underlying element type. For example, a !pdl.range<value> may be constructed from a list of !pdl.value or !pdl.range<value> entities.

Example:

// Construct a range of values.
%valueRange = pdl_interp.create_range %inputValue, %inputRange : !pdl.value, !pdl.range<value>

// Construct a range of types.
%typeRange = pdl_interp.create_range %inputType, %inputRange : !pdl.type, !pdl.range<type>

// Construct an empty range of types.
%valueRange = pdl_interp.create_range : !pdl.range<type>

create_type()

Return op name pdl_interp.create_type as a bitstring.

create_type(ssa)

pdl_interp.create_type - Create an interpreter handle to a constant Type

Attributes

  • value - Single, TypeAttr, any type attribute

Results

  • result - Single, PDL_Type, PDL handle to an mlir::Type

Description

pdl_interp.create_type operations generate a handle within the interpreter for a specific constant type value.

Example:

pdl_interp.create_type i64

create_types()

Return op name pdl_interp.create_types as a bitstring.

create_types(ssa)

pdl_interp.create_types - Create an interpreter handle to a range of constant Types

Attributes

  • value - Single, TypeArrayAttr, type array attribute

Results

  • result - Single, anonymous/composite constraint, range of PDL handle to an mlir::Type values

Description

pdl_interp.create_types operations generate a handle within the interpreter for a specific range of constant type values.

Example:

pdl_interp.create_types [i64, i64]

erase()

Return op name pdl_interp.erase as a bitstring.

erase(ssa)

pdl_interp.erase - Mark an operation as erased

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl.erase operations are used to specify that an operation should be marked as erased. The semantics of this operation correspond with the eraseOp method on a PatternRewriter.

Example:

pdl_interp.erase %root

extract()

Return op name pdl_interp.extract as a bitstring.

extract(ssa)

pdl_interp.extract - Extract the item at the specified index in a range

Attributes

  • index - Single, I32Attr, 32-bit signless integer attribute whose value is non-negative

Operands

  • range - Single, anonymous/composite constraint, range of pdl type values

Results

  • result - Single, PDL_AnyType, pdl type

Description

pdl_interp.extract operations are used to extract an item from a range at the specified index. If the index is out of range, returns null.

Example:

// Extract the value at index 1 from a range of values.
%ops = pdl_interp.extract 1 of %values : !pdl.value

finalize()

Return op name pdl_interp.finalize as a bitstring.

finalize(ssa)

pdl_interp.finalize - Finalize a pattern match or rewrite sequence

Description

pdl_interp.finalize is used to denote the termination of a match or rewrite sequence.

Example:

pdl_interp.finalize

foreach()

Return op name pdl_interp.foreach as a bitstring.

foreach(ssa)

pdl_interp.foreach - Iterates over a range of values or ranges

Operands

  • values - Single, anonymous/composite constraint, range of pdl type values

Description

pdl_interp.foreach iteratively selects an element from a range of values and executes the region until pdl.continue is reached.

In the bytecode interpreter, this operation is implemented by looping over the values and, for each selection, running the bytecode until we reach pdl.continue. This may result in multiple matches being reported. Note that the input range is mutated (popped from).

Example:

pdl_interp.foreach %op : !pdl.operation in %ops {
  pdl_interp.continue
} -> ^next

func()

Return op name pdl_interp.func as a bitstring.

func(ssa)

pdl_interp.func - PDL Interpreter Function Operation

Attributes

  • sym_name - Single, SymbolNameAttr, string attribute
  • function_type - Single, anonymous/composite constraint, type attribute of function type
  • arg_attrs - Optional, DictArrayAttr, Array of dictionary attributes
  • res_attrs - Optional, DictArrayAttr, Array of dictionary attributes

Description

pdl_interp.func operations act as interpreter functions. These are callable SSA-region operations that contain other interpreter operations. Interpreter functions are used for both the matching and the rewriting portion of the interpreter.

Example:

pdl_interp.func @rewriter(%root: !pdl.operation) {
  %op = pdl_interp.create_operation "foo.new_operation"
  pdl_interp.erase %root
  pdl_interp.finalize
}

get_attribute()

Return op name pdl_interp.get_attribute as a bitstring.

get_attribute(ssa)

pdl_interp.get_attribute - Get a specified attribute value from an Operation

Attributes

  • name - Single, StrAttr, string attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Results

  • attribute - Single, PDL_Attribute, PDL handle to an mlir::Attribute

Description

pdl_interp.get_attribute operations try to get a specific attribute from an operation. If the operation does not have that attribute, a null value is returned.

Example:

%attr = pdl_interp.get_attribute "attr" of %op

get_attribute_type()

Return op name pdl_interp.get_attribute_type as a bitstring.

get_attribute_type(ssa)

pdl_interp.get_attribute_type - Get the result type of a specified Attribute

Operands

  • value - Single, PDL_Attribute, PDL handle to an mlir::Attribute

Results

  • result - Single, PDL_Type, PDL handle to an mlir::Type

Description

pdl_interp.get_attribute_type operations get the resulting type of a specific attribute.

Example:

%type = pdl_interp.get_attribute_type of %attr

get_defining_op()

Return op name pdl_interp.get_defining_op as a bitstring.

get_defining_op(ssa)

pdl_interp.get_defining_op - Get the defining operation of a Value

Operands

  • value - Single, anonymous/composite constraint, single element or range of PDL handle for an mlir::Value

Results

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.get_defining_op operations try to get the defining operation of a specific value or range of values. In the case of range, the defining op of the first value is returned. If the value is not an operation result or range of operand results, null is returned.

Example:

%op = pdl_interp.get_defining_op of %value : !pdl.value

get_operand()

Return op name pdl_interp.get_operand as a bitstring.

get_operand(ssa)

pdl_interp.get_operand - Get a specified operand from an Operation

Attributes

  • index - Single, I32Attr, 32-bit signless integer attribute whose value is non-negative

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Results

  • value - Single, PDL_Value, PDL handle for an mlir::Value

Description

pdl_interp.get_operand operations try to get a specific operand from an operation If the operation does not have an operand for the given index, a null value is returned.

Example:

%operand = pdl_interp.get_operand 1 of %op

get_operands()

Return op name pdl_interp.get_operands as a bitstring.

get_operands(ssa)

pdl_interp.get_operands - Get a specified operand group from an Operation

Attributes

  • index - Optional, I32Attr, 32-bit signless integer attribute whose value is non-negative

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Results

  • value - Single, anonymous/composite constraint, single element or range of PDL handle for an mlir::Value

Description

pdl_interp.get_operands operations try to get a specific operand group from an operation. If the expected result is a single Value, null is returned if the operand group is not of size 1. If a range is expected, null is returned if the operand group is invalid. If no index is provided, the returned operand group corresponds to all operands of the operation.

Example:

// Get the first group of operands from an operation, and expect a single
// element.
%operand = pdl_interp.get_operands 0 of %op : !pdl.value

// Get the first group of operands from an operation.
%operands = pdl_interp.get_operands 0 of %op : !pdl.range<value>

// Get all of the operands from an operation.
%operands = pdl_interp.get_operands of %op : !pdl.range<value>

get_result()

Return op name pdl_interp.get_result as a bitstring.

get_result(ssa)

pdl_interp.get_result - Get a specified result from an Operation

Attributes

  • index - Single, I32Attr, 32-bit signless integer attribute whose value is non-negative

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Results

  • value - Single, PDL_Value, PDL handle for an mlir::Value

Description

pdl_interp.get_result operations try to get a specific result from an operation. If the operation does not have a result for the given index, a null value is returned.

Example:

%result = pdl_interp.get_result 1 of %op

get_results()

Return op name pdl_interp.get_results as a bitstring.

get_results(ssa)

pdl_interp.get_results - Get a specified result group from an Operation

Attributes

  • index - Optional, I32Attr, 32-bit signless integer attribute whose value is non-negative

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Results

  • value - Single, anonymous/composite constraint, single element or range of PDL handle for an mlir::Value

Description

pdl_interp.get_results operations try to get a specific result group from an operation. If the expected result is a single Value, null is returned if the result group is not of size 1. If a range is expected, null is returned if the result group is invalid. If no index is provided, the returned operand group corresponds to all results of the operation.

Example:

// Get the first group of results from an operation, and expect a single
// element.
%result = pdl_interp.get_results 0 of %op : !pdl.value

// Get the first group of results from an operation.
%results = pdl_interp.get_results 0 of %op : !pdl.range<value>

// Get all of the results from an operation.
%results = pdl_interp.get_results of %op : !pdl.range<value>

get_users()

Return op name pdl_interp.get_users as a bitstring.

get_users(ssa)

pdl_interp.get_users - Get the users of a Value

Operands

  • value - Single, anonymous/composite constraint, single element or range of PDL handle for an mlir::Value

Results

  • operations - Single, anonymous/composite constraint, range of PDL handle to an mlir::Operation * values

Description

pdl_interp.get_users extracts the users that accept this value. In the case of a range, the union of users of the all the values are returned, similarly to ResultRange::getUsers.

Example:

// Get all the users of a single value.
%ops = pdl_interp.get_users of %value : !pdl.value

// Get all the users of the first value in a range.
%ops = pdl_interp.get_users of %values : !pdl.range<value>

get_value_type()

Return op name pdl_interp.get_value_type as a bitstring.

get_value_type(ssa)

pdl_interp.get_value_type - Get the result type of a specified Value

Operands

  • value - Single, anonymous/composite constraint, single element or range of PDL handle for an mlir::Value

Results

  • result - Single, anonymous/composite constraint, single element or range of PDL handle to an mlir::Type

Description

pdl_interp.get_value_type operations get the resulting type of a specific value or range thereof.

Example:

// Get the type of a single value.
%type = pdl_interp.get_value_type of %value : !pdl.type

// Get the types of a value range.
%type = pdl_interp.get_value_type of %values : !pdl.range<type>

is_not_null()

Return op name pdl_interp.is_not_null as a bitstring.

is_not_null(ssa)

pdl_interp.is_not_null - Check if a positional value is non-null

Operands

  • value - Single, PDL_AnyType, pdl type

Description

pdl_interp.is_not_null operations check that a positional value or range exists. For ranges, this does not mean that the range was simply empty. On success, this operation branches to the true destination. Otherwise, the false destination is taken.

Example:

pdl_interp.is_not_null %value : !pdl.value -> ^matchDest, ^failureDest

record_match()

Return op name pdl_interp.record_match as a bitstring.

record_match(ssa)

pdl_interp.record_match - Record the metadata for a successful pattern match

Attributes

  • rewriter - Single, SymbolRefAttr, symbol reference attribute
  • rootKind - Optional, StrAttr, string attribute
  • generatedOps - Optional, StrArrayAttr, string array attribute
  • benefit - Single, I16Attr, 16-bit signless integer attribute whose value is non-negative

Operands

  • inputs - Variadic, PDL_AnyType, variadic of pdl type
  • matchedOps - Variadic, PDL_Operation, variadic of PDL handle to an mlir::Operation *

Description

pdl_interp.record_match operations record a successful pattern match with the interpreter and branch to the next part of the matcher. The metadata recorded by these operations correspond to a specific pdl.pattern, as well as what values were used during that match that should be propagated to the rewriter.

Example:

pdl_interp.record_match @rewriters::myRewriter(%root : !pdl.operation) : benefit(1), loc([%root, %op1]), root("foo.op") -> ^nextDest

replace()

Return op name pdl_interp.replace as a bitstring.

replace(ssa)

pdl_interp.replace - Mark an operation as replaced

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *
  • replValues - Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle for an mlir::Value

Description

pdl_interp.replaced operations are used to specify that an operation should be marked as replaced. The semantics of this operation correspond with the replaceOp method on a PatternRewriter. The set of replacement values must match the number of results specified by the operation.

Example:

// Replace root node with 2 values:
pdl_interp.replace %root with (%val0, %val1 : !pdl.type, !pdl.type)

switch_attribute()

Return op name pdl_interp.switch_attribute as a bitstring.

switch_attribute(ssa)

pdl_interp.switch_attribute - Switch on the value of an Attribute

Attributes

  • caseValues - Single, ArrayAttr, array attribute

Operands

  • attribute - Single, PDL_Attribute, PDL handle to an mlir::Attribute

Description

pdl_interp.switch_attribute operations compare the value of a given attribute with a set of constant attributes. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_attribute %attr to [10, true](^10Dest, ^trueDest) -> ^defaultDest

switch_operand_count()

Return op name pdl_interp.switch_operand_count as a bitstring.

switch_operand_count(ssa)

pdl_interp.switch_operand_count - Switch on the operand count of an Operation

Attributes

  • caseValues - Single, I32ElementsAttr, 32-bit signless integer elements attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.switch_operand_count operations compare the operand count of a given operation with a set of potential counts. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_operand_count of %op to [10, 2] -> ^10Dest, ^2Dest, ^defaultDest

switch_operation_name()

Return op name pdl_interp.switch_operation_name as a bitstring.

switch_operation_name(ssa)

pdl_interp.switch_operation_name - Switch on the OperationName of an Operation

Attributes

  • caseValues - Single, StrArrayAttr, string array attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.switch_operation_name operations compare the name of a given operation with a set of known names. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_operation_name of %op to ["foo.op", "bar.op"](^fooDest, ^barDest) -> ^defaultDest

switch_result_count()

Return op name pdl_interp.switch_result_count as a bitstring.

switch_result_count(ssa)

pdl_interp.switch_result_count - Switch on the result count of an Operation

Attributes

  • caseValues - Single, I32ElementsAttr, 32-bit signless integer elements attribute

Operands

  • inputOp - Single, PDL_Operation, PDL handle to an mlir::Operation *

Description

pdl_interp.switch_result_count operations compare the result count of a given operation with a set of potential counts. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_result_count of %op to [0, 2](^0Dest, ^2Dest) -> ^defaultDest

switch_type()

Return op name pdl_interp.switch_type as a bitstring.

switch_type(ssa)

pdl_interp.switch_type - Switch on a Type value

Attributes

  • caseValues - Single, TypeArrayAttr, type array attribute

Operands

  • value - Single, PDL_Type, PDL handle to an mlir::Type

Description

pdl_interp.switch_type operations compare a type with a set of statically known types. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_type %type to [i32, i64] -> ^i32Dest, ^i64Dest, ^defaultDest

switch_types()

Return op name pdl_interp.switch_types as a bitstring.

switch_types(ssa)

pdl_interp.switch_types - Switch on a range of Type values

Attributes

  • caseValues - Single, anonymous/composite constraint, type-array array attribute

Operands

  • value - Single, anonymous/composite constraint, range of PDL handle to an mlir::Type values

Description

pdl_interp.switch_types operations compare a range of types with a set of statically known ranges. If the value matches one of the provided case values the destination for that case value is taken, otherwise the default destination is taken.

Example:

pdl_interp.switch_types %type is [[i32], [i64, i64]] -> ^i32Dest, ^i64Dest, ^defaultDest