Module irdl

Module irdl 

Source
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§

AllOfOperation
An all_of operation. Constraints to the intersection of the provided constraints.
AllOfOperationBuilder
A builder for an all_of operation.
AnyOfOperation
An any_of operation. Constraints to the union of the provided constraints.
AnyOfOperationBuilder
A builder for an any_of operation.
AnyOperation
An any operation. Accept any type or attribute.
AnyOperationBuilder
A builder for an any operation.
AttributeOperation
An attribute operation. Define a new attribute.
AttributeOperationBuilder
A builder for an attribute operation.
AttributesOperation
An attributes operation. Define the attributes of an operation.
AttributesOperationBuilder
A builder for an attributes operation.
BaseOperation
A base operation. Constraints an attribute/type base.
BaseOperationBuilder
A builder for a base operation.
CPredOperation
A c_pred operation. Constraints an attribute using a C++ predicate.
CPredOperationBuilder
A builder for a c_pred operation.
DialectOperation
A dialect operation. Define a new dialect.
DialectOperationBuilder
A builder for a dialect operation.
IsOperation
An is operation. Constraints an attribute/type to be a specific attribute instance.
IsOperationBuilder
A builder for an is operation.
OperandsOperation
An operands operation. Define the operands of an operation.
OperandsOperationBuilder
A builder for an operands operation.
OperationOperation
An operation operation. Define a new operation.
OperationOperationBuilder
A builder for an operation operation.
ParametersOperation
A parameters operation. Define the constraints on parameters of a type/attribute definition.
ParametersOperationBuilder
A builder for a parameters operation.
ParametricOperation
A parametric operation. Constraints an attribute/type base and its parameters.
ParametricOperationBuilder
A builder for a parametric operation.
RegionOperation
A region operation. Define a region of an operation.
RegionOperationBuilder
A builder for a region operation.
RegionsOperation
A regions operation. Define the regions of an operation.
RegionsOperationBuilder
A builder for a regions operation.
ResultsOperation
A results operation. Define the results of an operation.
ResultsOperationBuilder
A builder for a results operation.
TypeOperation
A type operation. Define a new type.
TypeOperationBuilder
A builder for a type operation.

Enums§

IrdlDialectOperation

Functions§

_operation
Creates an operation operation.
all_of
Creates an all_of operation.
any
Creates an any operation.
any_of
Creates an any_of operation.
attribute
Creates an attribute operation.
attributes
Creates an attributes operation.
base
Creates a base operation.
c_pred
Creates a c_pred operation.
dialect
Creates a dialect operation.
is
Creates an is operation.
operands
Creates an operands operation.
parameters
Creates a parameters operation.
parametric
Creates a parametric operation.
region
Creates a region operation.
regions
Creates a regions operation.
results
Creates a results operation.
type
Creates a type operation.