@@ -20,107 +20,109 @@ def Transform_Dialect : Dialect {
20
20
21
21
let hasOperationAttrVerify = 1;
22
22
let extraClassDeclaration = [{
23
- /// Name of the attribute attachable to the symbol table operation
24
- /// containing named sequences. This is used to trigger verification.
25
- constexpr const static ::llvm::StringLiteral
26
- kWithNamedSequenceAttrName = "transform.with_named_sequence";
27
-
28
- /// Name of the attribute attachable to an operation so it can be
29
- /// identified as root by the default interpreter pass.
30
- constexpr const static ::llvm::StringLiteral
31
- kTargetTagAttrName = "transform.target_tag";
32
-
33
- /// Name of the attribute attachable to an operation, indicating that
34
- /// TrackingListener failures should be silenced.
35
- constexpr const static ::llvm::StringLiteral
36
- kSilenceTrackingFailuresAttrName = "transform.silence_tracking_failures";
37
-
38
- /// Names of the attributes indicating whether an argument of an external
39
- /// transform dialect symbol is consumed or only read.
40
- constexpr const static ::llvm::StringLiteral
41
- kArgConsumedAttrName = "transform.consumed";
42
- constexpr const static ::llvm::StringLiteral
43
- kArgReadOnlyAttrName = "transform.readonly";
44
-
45
- template <typename DataTy>
46
- const DataTy &getExtraData() const {
47
- return *static_cast<const DataTy *>(extraData.at(::mlir::TypeID::get<DataTy>()).get());
48
- }
49
-
50
- /// Parses a type registered by this dialect or one of its extensions.
51
- ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override;
52
-
53
- /// Prints a type registered by this dialect or one of its extensions.
54
- void printType(::mlir::Type type,
55
- ::mlir::DialectAsmPrinter &printer) const override;
56
-
57
- /// Parser callback for an individual type registered by this dialect or
58
- /// its extensions.
59
- using ExtensionTypeParsingHook = ::mlir::Type (*)(::mlir::AsmParser &);
60
-
61
- /// Printer callback for an individual type registered by this dialect or
62
- /// its extensions.
63
- using ExtensionTypePrintingHook =
64
- std::function<void (::mlir::Type, ::mlir::AsmPrinter &)>;
65
-
66
- private:
67
- /// Registers operations specified as template parameters with this
68
- /// dialect. Checks that they implement the required interfaces.
69
- template <typename... OpTys>
70
- void addOperationsChecked() {
71
- (addOperationIfNotRegistered<OpTys>(), ...);
72
- }
73
- template <typename OpTy>
74
- void addOperationIfNotRegistered();
75
-
76
- /// Reports a repeated registration error of an op with the given name.
77
- [[noreturn]] void reportDuplicateOpRegistration(StringRef opName);
78
-
79
- /// Registers the types specified as template parameters with the
80
- /// Transform dialect. Checks that they meet the requirements for
81
- /// Transform IR types.
82
- template <typename... TypeTys>
83
- void addTypesChecked() {
84
- (addTypeIfNotRegistered<TypeTys>(), ...);
85
- }
86
- template <typename Type>
87
- void addTypeIfNotRegistered();
88
-
89
- /// Reports a repeated registration error of a type with the given
90
- /// mnemonic.
91
- [[noreturn]] void reportDuplicateTypeRegistration(StringRef mnemonic);
92
-
93
- /// Registers dialect types with the context.
94
- void initializeTypes();
95
-
96
- // Give extensions access to injection functions.
97
- template <typename, typename...>
98
- friend class TransformDialectExtension;
99
-
100
- /// Gets a mutable reference to extra data of the kind specified as
101
- /// template argument. Allocates the data on the first call.
102
- template <typename DataTy>
103
- DataTy &getOrCreateExtraData();
104
-
105
- //===----------------------------------------------------------------===//
106
- // Data fields
107
- //===----------------------------------------------------------------===//
108
-
109
- /// Additional data associated with and owned by the dialect. Accessible
110
- /// to extensions.
111
- ::llvm::DenseMap<::mlir::TypeID, std::unique_ptr<
112
- ::mlir::transform::detail::TransformDialectDataBase>>
113
- extraData;
114
-
115
- /// A map from type mnemonic to its parsing function for the remainder of
116
- /// the syntax. The parser has access to the mnemonic, so it is used for
117
- /// further dispatch.
118
- ::llvm::StringMap<ExtensionTypeParsingHook> typeParsingHooks;
119
-
120
- /// A map from type TypeID to its printing function. No need to do string
121
- /// lookups when the type is fully constructed.
122
- ::llvm::DenseMap<::mlir::TypeID, ExtensionTypePrintingHook>
123
- typePrintingHooks;
23
+ /// Name of the attribute attachable to the symbol table operation
24
+ /// containing named sequences. This is used to trigger verification.
25
+ constexpr const static ::llvm::StringLiteral kWithNamedSequenceAttrName =
26
+ "transform.with_named_sequence";
27
+
28
+ /// Name of the attribute attachable to an operation so it can be
29
+ /// identified as root by the default interpreter pass.
30
+ constexpr const static ::llvm::StringLiteral kTargetTagAttrName =
31
+ "transform.target_tag";
32
+
33
+ /// Name of the attribute attachable to an operation, indicating that
34
+ /// TrackingListener failures should be silenced.
35
+ constexpr const static ::llvm::StringLiteral
36
+ kSilenceTrackingFailuresAttrName =
37
+ "transform.silence_tracking_failures";
38
+
39
+ /// Names of the attributes indicating whether an argument of an external
40
+ /// transform dialect symbol is consumed or only read.
41
+ constexpr const static ::llvm::StringLiteral kArgConsumedAttrName =
42
+ "transform.consumed";
43
+ constexpr const static ::llvm::StringLiteral kArgReadOnlyAttrName =
44
+ "transform.readonly";
45
+
46
+ template <typename DataTy>
47
+ const DataTy &getExtraData() const {
48
+ return *static_cast<const DataTy *>(
49
+ extraData.at(::mlir::TypeID::get<DataTy>()).get());
50
+ }
51
+
52
+ /// Parses a type registered by this dialect or one of its extensions.
53
+ ::mlir::Type parseType(::mlir::DialectAsmParser & parser) const override;
54
+
55
+ /// Prints a type registered by this dialect or one of its extensions.
56
+ void printType(::mlir::Type type, ::mlir::DialectAsmPrinter & printer)
57
+ const override;
58
+
59
+ /// Parser callback for an individual type registered by this dialect or
60
+ /// its extensions.
61
+ using ExtensionTypeParsingHook = ::mlir::Type (*)(::mlir::AsmParser &);
62
+
63
+ /// Printer callback for an individual type registered by this dialect or
64
+ /// its extensions.
65
+ using ExtensionTypePrintingHook =
66
+ std::function<void(::mlir::Type, ::mlir::AsmPrinter &)>;
67
+
68
+ private:
69
+ /// Registers operations specified as template parameters with this
70
+ /// dialect. Checks that they implement the required interfaces.
71
+ template <typename... OpTys>
72
+ void addOperationsChecked() {
73
+ (addOperationIfNotRegistered<OpTys>(), ...);
74
+ }
75
+ template <typename OpTy>
76
+ void addOperationIfNotRegistered();
77
+
78
+ /// Reports a repeated registration error of an op with the given name.
79
+ [[noreturn]] void reportDuplicateOpRegistration(StringRef opName);
80
+
81
+ /// Registers types specified as template parameters with the Transform
82
+ /// dialect. Checks that they meet the requirements for Transform IR types.
83
+ template <typename... TypeTys>
84
+ void addTypesChecked() {
85
+ (addTypeIfNotRegistered<TypeTys>(), ...);
86
+ }
87
+ template <typename Type>
88
+ void addTypeIfNotRegistered();
89
+
90
+ /// Reports a repeated registration error of a type with the given
91
+ /// mnemonic.
92
+ [[noreturn]] void reportDuplicateTypeRegistration(StringRef mnemonic);
93
+
94
+ /// Registers dialect types with the context.
95
+ void initializeTypes();
96
+
97
+ // Give extensions access to injection functions.
98
+ template <typename, typename...>
99
+ friend class TransformDialectExtension;
100
+
101
+ /// Gets a mutable reference to extra data of the kind specified as
102
+ /// template argument. Allocates the data on the first call.
103
+ template <typename DataTy>
104
+ DataTy &getOrCreateExtraData();
105
+
106
+ //===----------------------------------------------------------------===//
107
+ // Data fields
108
+ //===----------------------------------------------------------------===//
109
+
110
+ /// Additional data associated with and owned by the dialect. Accessible
111
+ /// to extensions.
112
+ ::llvm::DenseMap<
113
+ ::mlir::TypeID,
114
+ std::unique_ptr<::mlir::transform::detail::TransformDialectDataBase>>
115
+ extraData;
116
+
117
+ /// A map from type mnemonic to its parsing function for the remainder of
118
+ /// the syntax. The parser has access to the mnemonic, so it is used for
119
+ /// further dispatch.
120
+ ::llvm::StringMap<ExtensionTypeParsingHook> typeParsingHooks;
121
+
122
+ /// A map from type TypeID to its printing function. No need to do string
123
+ /// lookups when the type is fully constructed.
124
+ ::llvm::DenseMap<::mlir::TypeID, ExtensionTypePrintingHook>
125
+ typePrintingHooks;
124
126
}];
125
127
}
126
128
0 commit comments