xref: /llvm-project/mlir/include/mlir/Dialect/Transform/IR/TransformTypes.td (revision 5a9bdd85ee4d8527e2cedf44f3ce26ff414f9b6a)
1//===- TransformTypes.td - Transform dialect types ---------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_DIALECT_TRANSFORM_IR_TRANSFORMTYPES
10#define MLIR_DIALECT_TRANSFORM_IR_TRANSFORMTYPES
11
12include "mlir/IR/AttrTypeBase.td"
13include "mlir/Dialect/Transform/Interfaces/TransformInterfaces.td"
14include "mlir/Dialect/Transform/IR/TransformDialect.td"
15
16def Transform_AffineMapParamType : TypeDef<Transform_Dialect, "AffineMapParam",
17    [DeclareTypeInterfaceMethods<TransformParamTypeInterface>]> {
18  let description = [{
19    Transform IR parameter value that can be associated with a list of affine
20    map attributes.
21  }];
22  let mnemonic = "affine_map";
23  let assemblyFormat = "";
24}
25
26def Transform_AnyOpType : TypeDef<Transform_Dialect, "AnyOp",
27    [DeclareTypeInterfaceMethods<TransformHandleTypeInterface>]> {
28  let description = [{
29    Transform IR handle that can be associated with a list of arbitrary
30    Payload IR operations.
31  }];
32  let mnemonic = "any_op";
33  let assemblyFormat = "";
34}
35
36def Transform_AnyValue : TypeDef<Transform_Dialect, "AnyValue",
37    [DeclareTypeInterfaceMethods<TransformValueHandleTypeInterface>]> {
38  let description = [{
39    Transform IR value that can be associated with a list of Payload IR values.
40  }];
41  let mnemonic = "any_value";
42  let assemblyFormat = "";
43}
44
45def Transform_OperationType : TypeDef<Transform_Dialect, "Operation",
46    [DeclareTypeInterfaceMethods<TransformHandleTypeInterface>]> {
47  let description = [{
48    Transform IR handle that can be associated with a list of Payload IR
49    operations with the specified operation name.
50  }];
51  let mnemonic = "op";
52  let parameters = (ins
53    StringRefParameter<"Name of the allowed payload operation">:$operation_name
54  );
55  let assemblyFormat = "`<` $operation_name `>`";
56}
57
58def Transform_AnyParamType : TypeDef<Transform_Dialect, "AnyParam",
59    [DeclareTypeInterfaceMethods<TransformParamTypeInterface>]> {
60  let description = [{
61    Transform IR value that can be associated with a list of parameters
62    of any type.
63  }];
64  let mnemonic = "any_param";
65  let assemblyFormat = "";
66}
67
68def Transform_ParamType : TypeDef<Transform_Dialect, "Param",
69    [DeclareTypeInterfaceMethods<TransformParamTypeInterface>]> {
70  let description = [{
71    Transform IR value that can be associated with the list of parameters
72    of the given type. Types are currently limited to integers, but may be
73    extended in the future to other types values of which can be contained
74    in attributes.
75  }];
76  let mnemonic = "param";
77  let parameters = (ins
78    TypeParameter<"::mlir::Type", "Underlying type of the parameter">:$type
79  );
80  let assemblyFormat = "`<` $type `>`";
81  let genVerifyDecl = 1;
82}
83
84def Transform_TypeParamType : TypeDef<Transform_Dialect, "TypeParam",
85    [DeclareTypeInterfaceMethods<TransformParamTypeInterface>]> {
86  let description = [{
87    Transform IR parameter value that can be associated with a list of type
88    attributes.
89  }];
90  let mnemonic = "type";
91  let assemblyFormat = "";
92}
93
94class Transform_ConcreteOpType<string opname>
95  : Type<And<[Transform_OperationType.predicate,
96              CPred<"::llvm::cast<::mlir::transform::OperationType>($_self)"
97                    ".getOperationName() == \"" # opname # "\"">]>,
98         "Transform IR handle to " # opname # " operations",
99         "::mlir::transform::OperationType">;
100
101def TransformAnyHandle : Type<
102    Or<[TransformHandleTypeInterface.predicate,
103        TransformValueHandleTypeInterface.predicate]>,
104    "transform operation or value handle">;
105
106#endif  // MLIR_DIALECT_TRANSFORM_IR_TRANSFORMTYPES
107