[all-commits] [llvm/llvm-project] d4bde6: [mlir][irdl] Introduce a way to define regions
Daniil Dudkin via All-commits
all-commits at lists.llvm.org
Wed Aug 23 07:55:49 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d4bde6968e11a6b8ff9ecd5fbca1d98d8f6feeca
https://github.com/llvm/llvm-project/commit/d4bde6968e11a6b8ff9ecd5fbca1d98d8f6feeca
Author: Daniil Dudkin <unterumarmung at yandex.ru>
Date: 2023-08-23 (Wed, 23 Aug 2023)
Changed paths:
M mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.td
M mlir/include/mlir/Dialect/IRDL/IR/IRDLOps.td
M mlir/include/mlir/Dialect/IRDL/IR/IRDLTypes.td
M mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h
M mlir/lib/Dialect/IRDL/IR/IRDL.cpp
M mlir/lib/Dialect/IRDL/IR/IRDLOps.cpp
M mlir/lib/Dialect/IRDL/IRDLLoading.cpp
M mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp
A mlir/test/Dialect/IRDL/regions-ops.irdl.mlir
M mlir/test/Dialect/IRDL/testd.irdl.mlir
M mlir/test/Dialect/IRDL/testd.mlir
Log Message:
-----------
[mlir][irdl] Introduce a way to define regions
This patch introduces new operations:
`irdl.region` and `irdl.regions`.
The former lets us to specify characteristics of a region,
such as the arguments for the entry block and the number of blocks.
The latter accepts all results of the former operations
to define the set of the regions for the operation.
Example:
```
irdl.dialect @example {
irdl.operation @op_with_regions {
%r0 = irdl.region
%r1 = irdl.region()
%v0 = irdl.is i32
%v1 = irdl.is i64
%r2 = irdl.region(%v0, %v1)
%r3 = irdl.region with size 3
irdl.regions(%r0, %r1, %r2, %r3)
}
}
```
The above snippet demonstrates an operation named `@op_with_regions`,
which is constrained to have four regions.
* Region `%r0` doesn't have any constraints on the arguments or the number of blocks.
* Region `%r1` should have an empty set of arguments.
* Region `%r2` should have two arguments of types `i32` and `i64`.
* Region `%r3` should contain exactly three blocks.
In the future the block count constraint may be expanded to support range of possible number of blocks.
Reviewed By: math-fehr, Mogball
Differential Revision: https://reviews.llvm.org/D155112
More information about the All-commits
mailing list