Expand description
irdl dialect.
IRDL is an SSA-based declarative representation of dynamic dialects. It allows the definition of dialects, operations, attributes, and types, with a declarative description of their verifiers. IRDL code is meant to be generated and not written by hand. As such, the design focuses on ease of generation/analysis instead of ease of writing/reading.
Users can define a new dialect with irdl.dialect, operations with
irdl.operation, types with irdl.type, and attributes with
irdl.attribute.
An example dialect is shown below:
irdl.dialect @cmath {
irdl.type @complex {
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(%0, %1)
irdl.parameters(%2)
}
irdl.operation @mul {
%0 = irdl.is f32
%1 = irdl.is f64
%2 = irdl.any_of(%0, %1)
%3 = irdl.parametric @cmath::@complex<%2>
irdl.operands(%3, %3)
irdl.results(%3)
}
}This program defines a cmath dialect that defines a complex type, and
a mul operation. Both express constraints over their parameters using
SSA constraint operations. Informally, one can see those SSA values as
constraint variables that evaluate to a single type at constraint
evaluation. For example, the result of the irdl.any_of stored in %2
in the mul operation will collapse into either f32 or f64 for the
entirety of this instance of mul constraint evaluation. As such,
both operands and the result of mul must be of equal type (and not just
satisfy the same constraint).
IRDL variables are handle over mlir::Attribute. In order to support
manipulating mlir::Type, IRDL wraps all types in an mlir::TypeAttr
attribute. The rationale of this is to simplify the dialect.
Structs§
- AllOf
Operation - An
all_ofoperation. Constraints to the intersection of the provided constraints. - AllOf
Operation Builder - A builder for an
all_ofoperation. - AnyOf
Operation - An
any_ofoperation. Constraints to the union of the provided constraints. - AnyOf
Operation Builder - A builder for an
any_ofoperation. - AnyOperation
- An
anyoperation. Accept any type or attribute. - AnyOperation
Builder - A builder for an
anyoperation. - Attribute
Operation - An
attributeoperation. Define a new attribute. - Attribute
Operation Builder - A builder for an
attributeoperation. - Attributes
Operation - An
attributesoperation. Define the attributes of an operation. - Attributes
Operation Builder - A builder for an
attributesoperation. - Base
Operation - A
baseoperation. Constraints an attribute/type base. - Base
Operation Builder - A builder for a
baseoperation. - CPred
Operation - A
c_predoperation. Constraints an attribute using a C++ predicate. - CPred
Operation Builder - A builder for a
c_predoperation. - Dialect
Operation - A
dialectoperation. Define a new dialect. - Dialect
Operation Builder - A builder for a
dialectoperation. - IsOperation
- An
isoperation. Constraints an attribute/type to be a specific attribute instance. - IsOperation
Builder - A builder for an
isoperation. - Operands
Operation - An
operandsoperation. Define the operands of an operation. - Operands
Operation Builder - A builder for an
operandsoperation. - Operation
Operation - An
operationoperation. Define a new operation. - Operation
Operation Builder - A builder for an
operationoperation. - Parameters
Operation - A
parametersoperation. Define the constraints on parameters of a type/attribute definition. - Parameters
Operation Builder - A builder for a
parametersoperation. - Parametric
Operation - A
parametricoperation. Constraints an attribute/type base and its parameters. - Parametric
Operation Builder - A builder for a
parametricoperation. - Region
Operation - A
regionoperation. Define a region of an operation. - Region
Operation Builder - A builder for a
regionoperation. - Regions
Operation - A
regionsoperation. Define the regions of an operation. - Regions
Operation Builder - A builder for a
regionsoperation. - Results
Operation - A
resultsoperation. Define the results of an operation. - Results
Operation Builder - A builder for a
resultsoperation. - Type
Operation - A
typeoperation. Define a new type. - Type
Operation Builder - A builder for a
typeoperation.
Enums§
Functions§
- _operation
- Creates an
operationoperation. - all_of
- Creates an
all_ofoperation. - any
- Creates an
anyoperation. - any_of
- Creates an
any_ofoperation. - attribute
- Creates an
attributeoperation. - attributes
- Creates an
attributesoperation. - base
- Creates a
baseoperation. - c_pred
- Creates a
c_predoperation. - dialect
- Creates a
dialectoperation. - is
- Creates an
isoperation. - operands
- Creates an
operandsoperation. - parameters
- Creates a
parametersoperation. - parametric
- Creates a
parametricoperation. - region
- Creates a
regionoperation. - regions
- Creates a
regionsoperation. - results
- Creates a
resultsoperation. - type
- Creates a
typeoperation.