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
Return op name pdl_interp.apply_constraint as a bitstring.
pdl_interp.apply_constraint - Apply a constraint to a set of positional values
Attributes
name- Single,StrAttr, string attributeisNegated- 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
Return op name pdl_interp.apply_rewrite as a bitstring.
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)
Return op name pdl_interp.are_equal as a bitstring.
pdl_interp.are_equal - Check if two positional values or ranges are equivalent
Operands
lhs- Single,PDL_AnyType, pdl typerhs- 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
Return op name pdl_interp.branch as a bitstring.
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
Return op name pdl_interp.check_attribute as a bitstring.
pdl_interp.check_attribute - Check the value of an Attribute
Attributes
constantValue- Single,AnyAttr, any attribute
Operands
attribute- Single,PDL_Attribute, PDL handle to anmlir::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
Return op name pdl_interp.check_operand_count as a bitstring.
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-negativecompareAtLeast- Optional,UnitAttr, unit attribute
Operands
inputOp- Single,PDL_Operation, PDL handle to anmlir::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
Return op name pdl_interp.check_operation_name as a bitstring.
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 anmlir::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
Return op name pdl_interp.check_result_count as a bitstring.
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-negativecompareAtLeast- Optional,UnitAttr, unit attribute
Operands
inputOp- Single,PDL_Operation, PDL handle to anmlir::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
Return op name pdl_interp.check_type as a bitstring.
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 anmlir::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
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
Attributes
types- Single,TypeArrayAttr, type array attribute
Operands
value- Single, anonymous/composite constraint, range of PDL handle to anmlir::Typevalues
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
Return op name pdl_interp.continue as a bitstring.
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
Return op name pdl_interp.create_attribute as a bitstring.
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 anmlir::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
Return op name pdl_interp.create_operation as a bitstring.
pdl_interp.create_operation - Create an instance of a specific Operation
Attributes
name- Single,StrAttr, string attributeinputAttributeNames- Single,StrArrayAttr, string array attributeinferredResultTypes- Optional,UnitAttr, unit attribute
Operands
inputOperands- Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle for anmlir::ValueinputAttributes- Variadic,PDL_Attribute, variadic of PDL handle to anmlir::AttributeinputResultTypes- Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle to anmlir::Type
Results
resultOp- Single,PDL_Operation, PDL handle to anmlir::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>
Return op name pdl_interp.create_range as a bitstring.
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 anmlir::Typeor PDL handle for anmlir::Valuevalues
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>
Return op name pdl_interp.create_type as a bitstring.
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 anmlir::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
Return op name pdl_interp.create_types as a bitstring.
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 anmlir::Typevalues
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]
Return op name pdl_interp.erase as a bitstring.
pdl_interp.erase - Mark an operation as erased
Operands
inputOp- Single,PDL_Operation, PDL handle to anmlir::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
Return op name pdl_interp.extract as a bitstring.
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
Return op name pdl_interp.finalize as a bitstring.
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
Return op name pdl_interp.foreach as a bitstring.
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
Return op name pdl_interp.func as a bitstring.
pdl_interp.func - PDL Interpreter Function Operation
Attributes
sym_name- Single,SymbolNameAttr, string attributefunction_type- Single, anonymous/composite constraint, type attribute of function typearg_attrs- Optional,DictArrayAttr, Array of dictionary attributesres_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
}
Return op name pdl_interp.get_attribute as a bitstring.
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 anmlir::Operation *
Results
attribute- Single,PDL_Attribute, PDL handle to anmlir::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
Return op name pdl_interp.get_attribute_type as a bitstring.
pdl_interp.get_attribute_type - Get the result type of a specified Attribute
Operands
value- Single,PDL_Attribute, PDL handle to anmlir::Attribute
Results
result- Single,PDL_Type, PDL handle to anmlir::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
Return op name pdl_interp.get_defining_op as a bitstring.
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 anmlir::Value
Results
inputOp- Single,PDL_Operation, PDL handle to anmlir::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
Return op name pdl_interp.get_operand as a bitstring.
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 anmlir::Operation *
Results
value- Single,PDL_Value, PDL handle for anmlir::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
Return op name pdl_interp.get_operands as a bitstring.
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 anmlir::Operation *
Results
value- Single, anonymous/composite constraint, single element or range of PDL handle for anmlir::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>
Return op name pdl_interp.get_result as a bitstring.
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 anmlir::Operation *
Results
value- Single,PDL_Value, PDL handle for anmlir::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
Return op name pdl_interp.get_results as a bitstring.
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 anmlir::Operation *
Results
value- Single, anonymous/composite constraint, single element or range of PDL handle for anmlir::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>
Return op name pdl_interp.get_users as a bitstring.
pdl_interp.get_users - Get the users of a Value
Operands
value- Single, anonymous/composite constraint, single element or range of PDL handle for anmlir::Value
Results
operations- Single, anonymous/composite constraint, range of PDL handle to anmlir::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>
Return op name pdl_interp.get_value_type as a bitstring.
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 anmlir::Value
Results
result- Single, anonymous/composite constraint, single element or range of PDL handle to anmlir::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>
Return op name pdl_interp.is_not_null as a bitstring.
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
Return op name pdl_interp.record_match as a bitstring.
pdl_interp.record_match - Record the metadata for a successful pattern match
Attributes
rewriter- Single,SymbolRefAttr, symbol reference attributerootKind- Optional,StrAttr, string attributegeneratedOps- Optional,StrArrayAttr, string array attributebenefit- Single,I16Attr, 16-bit signless integer attribute whose value is non-negative
Operands
inputs- Variadic,PDL_AnyType, variadic of pdl typematchedOps- Variadic,PDL_Operation, variadic of PDL handle to anmlir::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
Return op name pdl_interp.replace as a bitstring.
pdl_interp.replace - Mark an operation as replaced
Operands
inputOp- Single,PDL_Operation, PDL handle to anmlir::Operation *replValues- Variadic, anonymous/composite constraint, variadic of single element or range of PDL handle for anmlir::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)
Return op name pdl_interp.switch_attribute as a bitstring.
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 anmlir::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
Return op name pdl_interp.switch_operand_count as a bitstring.
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 anmlir::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
Return op name pdl_interp.switch_operation_name as a bitstring.
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 anmlir::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
Return op name pdl_interp.switch_result_count as a bitstring.
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 anmlir::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
Return op name pdl_interp.switch_type as a bitstring.
pdl_interp.switch_type - Switch on a Type value
Attributes
caseValues- Single,TypeArrayAttr, type array attribute
Operands
value- Single,PDL_Type, PDL handle to anmlir::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
Return op name pdl_interp.switch_types as a bitstring.
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 anmlir::Typevalues
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