File: | build/source/build-llvm/tools/clang/stage2-bins/tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc |
Warning: | line 1297, column 5 Value stored to '_firstPrinted' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* AttrDef Definitions *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | #ifdef GET_ATTRDEF_LIST |
10 | #undef GET_ATTRDEF_LIST |
11 | |
12 | ::test::AttrWithSelfTypeParamAttr, |
13 | ::test::AttrWithTraitAttr, |
14 | ::test::AttrWithTypeBuilderAttr, |
15 | ::test::CompoundAAttr, |
16 | ::test::CompoundAttrNestedAttr, |
17 | ::test::CompoundNestedInnerAttr, |
18 | ::test::CompoundNestedOuterAttr, |
19 | ::test::CompoundNestedOuterQualAttr, |
20 | ::test::SimpleAAttr, |
21 | ::test::ArrayOfEnumsAttr, |
22 | ::test::ArrayOfIntsAttr, |
23 | ::test::ArrayOfUglyAttrsAttr, |
24 | ::test::TestAttrParamsAttr, |
25 | ::test::TestAttrSelfTypeParameterFormatAttr, |
26 | ::test::TestAttrSelfTypeParameterStructFormatAttr, |
27 | ::test::TestAttrUglyAttr, |
28 | ::test::TestAttrWithFormatAttr, |
29 | ::test::TestAttrWithOptionalSignedAttr, |
30 | ::test::TestAttrWithOptionalUnsignedAttr, |
31 | ::test::TestAttrWithTypeParamAttr, |
32 | ::test::TestBitEnumAttr, |
33 | ::test::TestBitEnumVerticalBarAttr, |
34 | ::test::TestCustomAnchorAttr, |
35 | ::test::TestEnumAttr, |
36 | ::test::TestExtern1DI64ElementsAttr, |
37 | ::test::TestI64ElementsAttr, |
38 | ::test::TestOverrideBuilderAttr, |
39 | ::test::SimpleEnumAttr, |
40 | ::test::TestSubElementsAccessAttr, |
41 | ::test::IteratorTypeAttr |
42 | |
43 | #endif // GET_ATTRDEF_LIST |
44 | |
45 | #ifdef GET_ATTRDEF_CLASSES |
46 | #undef GET_ATTRDEF_CLASSES |
47 | |
48 | static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { |
49 | return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) |
50 | .Case(::test::AttrWithSelfTypeParamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
51 | value = ::test::AttrWithSelfTypeParamAttr::parse(parser, type); |
52 | return ::mlir::success(!!value); |
53 | }) |
54 | .Case(::test::AttrWithTraitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
55 | value = ::test::AttrWithTraitAttr::get(parser.getContext()); |
56 | return ::mlir::success(!!value); |
57 | }) |
58 | .Case(::test::AttrWithTypeBuilderAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
59 | value = ::test::AttrWithTypeBuilderAttr::parse(parser, type); |
60 | return ::mlir::success(!!value); |
61 | }) |
62 | .Case(::test::CompoundAAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
63 | value = ::test::CompoundAAttr::parse(parser, type); |
64 | return ::mlir::success(!!value); |
65 | }) |
66 | .Case(::test::CompoundAttrNestedAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
67 | value = ::test::CompoundAttrNestedAttr::parse(parser, type); |
68 | return ::mlir::success(!!value); |
69 | }) |
70 | .Case(::test::CompoundNestedInnerAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
71 | value = ::test::CompoundNestedInnerAttr::parse(parser, type); |
72 | return ::mlir::success(!!value); |
73 | }) |
74 | .Case(::test::CompoundNestedOuterAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
75 | value = ::test::CompoundNestedOuterAttr::parse(parser, type); |
76 | return ::mlir::success(!!value); |
77 | }) |
78 | .Case(::test::CompoundNestedOuterQualAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
79 | value = ::test::CompoundNestedOuterQualAttr::parse(parser, type); |
80 | return ::mlir::success(!!value); |
81 | }) |
82 | .Case(::test::SimpleAAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
83 | value = ::test::SimpleAAttr::get(parser.getContext()); |
84 | return ::mlir::success(!!value); |
85 | }) |
86 | .Case(::test::ArrayOfEnumsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
87 | value = ::test::ArrayOfEnumsAttr::parse(parser, type); |
88 | return ::mlir::success(!!value); |
89 | }) |
90 | .Case(::test::ArrayOfIntsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
91 | value = ::test::ArrayOfIntsAttr::parse(parser, type); |
92 | return ::mlir::success(!!value); |
93 | }) |
94 | .Case(::test::ArrayOfUglyAttrsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
95 | value = ::test::ArrayOfUglyAttrsAttr::parse(parser, type); |
96 | return ::mlir::success(!!value); |
97 | }) |
98 | .Case(::test::TestAttrParamsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
99 | value = ::test::TestAttrParamsAttr::parse(parser, type); |
100 | return ::mlir::success(!!value); |
101 | }) |
102 | .Case(::test::TestAttrSelfTypeParameterFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
103 | value = ::test::TestAttrSelfTypeParameterFormatAttr::parse(parser, type); |
104 | return ::mlir::success(!!value); |
105 | }) |
106 | .Case(::test::TestAttrSelfTypeParameterStructFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
107 | value = ::test::TestAttrSelfTypeParameterStructFormatAttr::parse(parser, type); |
108 | return ::mlir::success(!!value); |
109 | }) |
110 | .Case(::test::TestAttrUglyAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
111 | value = ::test::TestAttrUglyAttr::parse(parser, type); |
112 | return ::mlir::success(!!value); |
113 | }) |
114 | .Case(::test::TestAttrWithFormatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
115 | value = ::test::TestAttrWithFormatAttr::parse(parser, type); |
116 | return ::mlir::success(!!value); |
117 | }) |
118 | .Case(::test::TestAttrWithOptionalSignedAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
119 | value = ::test::TestAttrWithOptionalSignedAttr::parse(parser, type); |
120 | return ::mlir::success(!!value); |
121 | }) |
122 | .Case(::test::TestAttrWithOptionalUnsignedAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
123 | value = ::test::TestAttrWithOptionalUnsignedAttr::parse(parser, type); |
124 | return ::mlir::success(!!value); |
125 | }) |
126 | .Case(::test::TestAttrWithTypeParamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
127 | value = ::test::TestAttrWithTypeParamAttr::parse(parser, type); |
128 | return ::mlir::success(!!value); |
129 | }) |
130 | .Case(::test::TestBitEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
131 | value = ::test::TestBitEnumAttr::parse(parser, type); |
132 | return ::mlir::success(!!value); |
133 | }) |
134 | .Case(::test::TestBitEnumVerticalBarAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
135 | value = ::test::TestBitEnumVerticalBarAttr::parse(parser, type); |
136 | return ::mlir::success(!!value); |
137 | }) |
138 | .Case(::test::TestCustomAnchorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
139 | value = ::test::TestCustomAnchorAttr::parse(parser, type); |
140 | return ::mlir::success(!!value); |
141 | }) |
142 | .Case(::test::TestEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
143 | value = ::test::TestEnumAttr::parse(parser, type); |
144 | return ::mlir::success(!!value); |
145 | }) |
146 | .Case(::test::TestExtern1DI64ElementsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
147 | value = ::test::TestExtern1DI64ElementsAttr::parse(parser, type); |
148 | return ::mlir::success(!!value); |
149 | }) |
150 | .Case(::test::TestI64ElementsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
151 | value = ::test::TestI64ElementsAttr::parse(parser, type); |
152 | return ::mlir::success(!!value); |
153 | }) |
154 | .Case(::test::TestOverrideBuilderAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
155 | value = ::test::TestOverrideBuilderAttr::parse(parser, type); |
156 | return ::mlir::success(!!value); |
157 | }) |
158 | .Case(::test::SimpleEnumAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
159 | value = ::test::SimpleEnumAttr::parse(parser, type); |
160 | return ::mlir::success(!!value); |
161 | }) |
162 | .Case(::test::TestSubElementsAccessAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
163 | value = ::test::TestSubElementsAccessAttr::parse(parser, type); |
164 | return ::mlir::success(!!value); |
165 | }) |
166 | .Case(::test::IteratorTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
167 | value = ::test::IteratorTypeAttr::parse(parser, type); |
168 | return ::mlir::success(!!value); |
169 | }) |
170 | .Default([&](llvm::StringRef keyword, llvm::SMLoc) { |
171 | *mnemonic = keyword; |
172 | return std::nullopt; |
173 | }); |
174 | } |
175 | |
176 | static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { |
177 | return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::test::AttrWithSelfTypeParamAttr>([&](auto t) { |
178 | printer << ::test::AttrWithSelfTypeParamAttr::getMnemonic(); |
179 | t.print(printer); |
180 | return ::mlir::success(); |
181 | }) |
182 | .Case<::test::AttrWithTraitAttr>([&](auto t) { |
183 | printer << ::test::AttrWithTraitAttr::getMnemonic(); |
184 | return ::mlir::success(); |
185 | }) |
186 | .Case<::test::AttrWithTypeBuilderAttr>([&](auto t) { |
187 | printer << ::test::AttrWithTypeBuilderAttr::getMnemonic(); |
188 | t.print(printer); |
189 | return ::mlir::success(); |
190 | }) |
191 | .Case<::test::CompoundAAttr>([&](auto t) { |
192 | printer << ::test::CompoundAAttr::getMnemonic(); |
193 | t.print(printer); |
194 | return ::mlir::success(); |
195 | }) |
196 | .Case<::test::CompoundAttrNestedAttr>([&](auto t) { |
197 | printer << ::test::CompoundAttrNestedAttr::getMnemonic(); |
198 | t.print(printer); |
199 | return ::mlir::success(); |
200 | }) |
201 | .Case<::test::CompoundNestedInnerAttr>([&](auto t) { |
202 | printer << ::test::CompoundNestedInnerAttr::getMnemonic(); |
203 | t.print(printer); |
204 | return ::mlir::success(); |
205 | }) |
206 | .Case<::test::CompoundNestedOuterAttr>([&](auto t) { |
207 | printer << ::test::CompoundNestedOuterAttr::getMnemonic(); |
208 | t.print(printer); |
209 | return ::mlir::success(); |
210 | }) |
211 | .Case<::test::CompoundNestedOuterQualAttr>([&](auto t) { |
212 | printer << ::test::CompoundNestedOuterQualAttr::getMnemonic(); |
213 | t.print(printer); |
214 | return ::mlir::success(); |
215 | }) |
216 | .Case<::test::SimpleAAttr>([&](auto t) { |
217 | printer << ::test::SimpleAAttr::getMnemonic(); |
218 | return ::mlir::success(); |
219 | }) |
220 | .Case<::test::ArrayOfEnumsAttr>([&](auto t) { |
221 | printer << ::test::ArrayOfEnumsAttr::getMnemonic(); |
222 | t.print(printer); |
223 | return ::mlir::success(); |
224 | }) |
225 | .Case<::test::ArrayOfIntsAttr>([&](auto t) { |
226 | printer << ::test::ArrayOfIntsAttr::getMnemonic(); |
227 | t.print(printer); |
228 | return ::mlir::success(); |
229 | }) |
230 | .Case<::test::ArrayOfUglyAttrsAttr>([&](auto t) { |
231 | printer << ::test::ArrayOfUglyAttrsAttr::getMnemonic(); |
232 | t.print(printer); |
233 | return ::mlir::success(); |
234 | }) |
235 | .Case<::test::TestAttrParamsAttr>([&](auto t) { |
236 | printer << ::test::TestAttrParamsAttr::getMnemonic(); |
237 | t.print(printer); |
238 | return ::mlir::success(); |
239 | }) |
240 | .Case<::test::TestAttrSelfTypeParameterFormatAttr>([&](auto t) { |
241 | printer << ::test::TestAttrSelfTypeParameterFormatAttr::getMnemonic(); |
242 | t.print(printer); |
243 | return ::mlir::success(); |
244 | }) |
245 | .Case<::test::TestAttrSelfTypeParameterStructFormatAttr>([&](auto t) { |
246 | printer << ::test::TestAttrSelfTypeParameterStructFormatAttr::getMnemonic(); |
247 | t.print(printer); |
248 | return ::mlir::success(); |
249 | }) |
250 | .Case<::test::TestAttrUglyAttr>([&](auto t) { |
251 | printer << ::test::TestAttrUglyAttr::getMnemonic(); |
252 | t.print(printer); |
253 | return ::mlir::success(); |
254 | }) |
255 | .Case<::test::TestAttrWithFormatAttr>([&](auto t) { |
256 | printer << ::test::TestAttrWithFormatAttr::getMnemonic(); |
257 | t.print(printer); |
258 | return ::mlir::success(); |
259 | }) |
260 | .Case<::test::TestAttrWithOptionalSignedAttr>([&](auto t) { |
261 | printer << ::test::TestAttrWithOptionalSignedAttr::getMnemonic(); |
262 | t.print(printer); |
263 | return ::mlir::success(); |
264 | }) |
265 | .Case<::test::TestAttrWithOptionalUnsignedAttr>([&](auto t) { |
266 | printer << ::test::TestAttrWithOptionalUnsignedAttr::getMnemonic(); |
267 | t.print(printer); |
268 | return ::mlir::success(); |
269 | }) |
270 | .Case<::test::TestAttrWithTypeParamAttr>([&](auto t) { |
271 | printer << ::test::TestAttrWithTypeParamAttr::getMnemonic(); |
272 | t.print(printer); |
273 | return ::mlir::success(); |
274 | }) |
275 | .Case<::test::TestBitEnumAttr>([&](auto t) { |
276 | printer << ::test::TestBitEnumAttr::getMnemonic(); |
277 | t.print(printer); |
278 | return ::mlir::success(); |
279 | }) |
280 | .Case<::test::TestBitEnumVerticalBarAttr>([&](auto t) { |
281 | printer << ::test::TestBitEnumVerticalBarAttr::getMnemonic(); |
282 | t.print(printer); |
283 | return ::mlir::success(); |
284 | }) |
285 | .Case<::test::TestCustomAnchorAttr>([&](auto t) { |
286 | printer << ::test::TestCustomAnchorAttr::getMnemonic(); |
287 | t.print(printer); |
288 | return ::mlir::success(); |
289 | }) |
290 | .Case<::test::TestEnumAttr>([&](auto t) { |
291 | printer << ::test::TestEnumAttr::getMnemonic(); |
292 | t.print(printer); |
293 | return ::mlir::success(); |
294 | }) |
295 | .Case<::test::TestExtern1DI64ElementsAttr>([&](auto t) { |
296 | printer << ::test::TestExtern1DI64ElementsAttr::getMnemonic(); |
297 | t.print(printer); |
298 | return ::mlir::success(); |
299 | }) |
300 | .Case<::test::TestI64ElementsAttr>([&](auto t) { |
301 | printer << ::test::TestI64ElementsAttr::getMnemonic(); |
302 | t.print(printer); |
303 | return ::mlir::success(); |
304 | }) |
305 | .Case<::test::TestOverrideBuilderAttr>([&](auto t) { |
306 | printer << ::test::TestOverrideBuilderAttr::getMnemonic(); |
307 | t.print(printer); |
308 | return ::mlir::success(); |
309 | }) |
310 | .Case<::test::SimpleEnumAttr>([&](auto t) { |
311 | printer << ::test::SimpleEnumAttr::getMnemonic(); |
312 | t.print(printer); |
313 | return ::mlir::success(); |
314 | }) |
315 | .Case<::test::TestSubElementsAccessAttr>([&](auto t) { |
316 | printer << ::test::TestSubElementsAccessAttr::getMnemonic(); |
317 | t.print(printer); |
318 | return ::mlir::success(); |
319 | }) |
320 | .Case<::test::IteratorTypeAttr>([&](auto t) { |
321 | printer << ::test::IteratorTypeAttr::getMnemonic(); |
322 | t.print(printer); |
323 | return ::mlir::success(); |
324 | }) |
325 | .Default([](auto) { return ::mlir::failure(); }); |
326 | } |
327 | |
328 | namespace test { |
329 | namespace detail { |
330 | struct AttrWithSelfTypeParamAttrStorage : public ::mlir::AttributeStorage { |
331 | using KeyTy = std::tuple<::mlir::Type>; |
332 | AttrWithSelfTypeParamAttrStorage(::mlir::Type type) : type(type) {} |
333 | |
334 | KeyTy getAsKey() const { |
335 | return KeyTy(type); |
336 | } |
337 | |
338 | bool operator==(const KeyTy &tblgenKey) const { |
339 | return (type == std::get<0>(tblgenKey)); |
340 | } |
341 | |
342 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
343 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
344 | } |
345 | |
346 | static AttrWithSelfTypeParamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
347 | auto type = std::get<0>(tblgenKey); |
348 | return new (allocator.allocate<AttrWithSelfTypeParamAttrStorage>()) AttrWithSelfTypeParamAttrStorage(type); |
349 | } |
350 | |
351 | ::mlir::Type type; |
352 | }; |
353 | } // namespace detail |
354 | AttrWithSelfTypeParamAttr AttrWithSelfTypeParamAttr::get(::mlir::MLIRContext *context, ::mlir::Type type) { |
355 | return Base::get(context, type); |
356 | } |
357 | |
358 | ::mlir::Attribute AttrWithSelfTypeParamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
359 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
360 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
361 | (void) odsLoc; |
362 | ::mlir::FailureOr<::mlir::Type> _result_type; |
363 | |
364 | if (odsType) { |
365 | if (auto reqType = odsType.dyn_cast<::mlir::Type>()) { |
366 | _result_type = reqType; |
367 | } else { |
368 | odsParser.emitError(odsLoc, "invalid kind of type specified"); |
369 | return {}; |
370 | } |
371 | } |
372 | return AttrWithSelfTypeParamAttr::get(odsParser.getContext(), |
373 | ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext()))))); |
374 | } |
375 | |
376 | void AttrWithSelfTypeParamAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
377 | ::mlir::Builder odsBuilder(getContext()); |
378 | } |
379 | |
380 | ::mlir::Type AttrWithSelfTypeParamAttr::getType() const { |
381 | return getImpl()->type; |
382 | } |
383 | |
384 | } // namespace test |
385 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithSelfTypeParamAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::AttrWithSelfTypeParamAttr>::id = {}; } } |
386 | namespace test { |
387 | } // namespace test |
388 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithTraitAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::AttrWithTraitAttr>::id = {}; } } |
389 | namespace test { |
390 | namespace detail { |
391 | struct AttrWithTypeBuilderAttrStorage : public ::mlir::AttributeStorage { |
392 | using KeyTy = std::tuple<::mlir::IntegerAttr, mlir::Type>; |
393 | AttrWithTypeBuilderAttrStorage(::mlir::IntegerAttr attr, mlir::Type type) : attr(attr), type(type) {} |
394 | |
395 | KeyTy getAsKey() const { |
396 | return KeyTy(attr, type); |
397 | } |
398 | |
399 | bool operator==(const KeyTy &tblgenKey) const { |
400 | return (attr == std::get<0>(tblgenKey)) && (type == std::get<1>(tblgenKey)); |
401 | } |
402 | |
403 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
404 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
405 | } |
406 | |
407 | static AttrWithTypeBuilderAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
408 | auto attr = std::get<0>(tblgenKey); |
409 | auto type = std::get<1>(tblgenKey); |
410 | return new (allocator.allocate<AttrWithTypeBuilderAttrStorage>()) AttrWithTypeBuilderAttrStorage(attr, type); |
411 | } |
412 | |
413 | ::mlir::IntegerAttr attr; |
414 | mlir::Type type; |
415 | }; |
416 | } // namespace detail |
417 | AttrWithTypeBuilderAttr AttrWithTypeBuilderAttr::get(::mlir::MLIRContext *context, ::mlir::IntegerAttr attr, mlir::Type type) { |
418 | return Base::get(context, attr, type); |
419 | } |
420 | |
421 | ::mlir::Attribute AttrWithTypeBuilderAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
422 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
423 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
424 | (void) odsLoc; |
425 | ::mlir::FailureOr<::mlir::IntegerAttr> _result_attr; |
426 | ::mlir::FailureOr<mlir::Type> _result_type; |
427 | |
428 | if (odsType) { |
429 | if (auto reqType = odsType.dyn_cast<mlir::Type>()) { |
430 | _result_type = reqType; |
431 | } else { |
432 | odsParser.emitError(odsLoc, "invalid kind of type specified"); |
433 | return {}; |
434 | } |
435 | } |
436 | |
437 | // Parse variable 'attr' |
438 | _result_attr = ::mlir::FieldParser<::mlir::IntegerAttr>::parse(odsParser); |
439 | if (::mlir::failed(_result_attr)) { |
440 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse AttrWithTypeBuilder parameter 'attr' which is to be a `::mlir::IntegerAttr`"); |
441 | return {}; |
442 | } |
443 | assert(::mlir::succeeded(_result_attr))(static_cast <bool> (::mlir::succeeded(_result_attr)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_attr)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 443 , __extension__ __PRETTY_FUNCTION__)); |
444 | return AttrWithTypeBuilderAttr::get(odsParser.getContext(), |
445 | ::mlir::IntegerAttr((*_result_attr)), |
446 | mlir::Type((_result_type.value_or((*_result_attr).getType())))); |
447 | } |
448 | |
449 | void AttrWithTypeBuilderAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
450 | ::mlir::Builder odsBuilder(getContext()); |
451 | odsPrinter << ' '; |
452 | odsPrinter.printStrippedAttrOrType(getAttr()); |
453 | } |
454 | |
455 | ::mlir::IntegerAttr AttrWithTypeBuilderAttr::getAttr() const { |
456 | return getImpl()->attr; |
457 | } |
458 | |
459 | mlir::Type AttrWithTypeBuilderAttr::getType() const { |
460 | return getImpl()->type; |
461 | } |
462 | |
463 | } // namespace test |
464 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithTypeBuilderAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::AttrWithTypeBuilderAttr>::id = {}; } } |
465 | namespace test { |
466 | namespace detail { |
467 | struct CompoundAAttrStorage : public ::mlir::AttributeStorage { |
468 | using KeyTy = std::tuple<int, ::mlir::Type, ::llvm::ArrayRef<int>>; |
469 | CompoundAAttrStorage(int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) : widthOfSomething(widthOfSomething), oneType(oneType), arrayOfInts(arrayOfInts) {} |
470 | |
471 | KeyTy getAsKey() const { |
472 | return KeyTy(widthOfSomething, oneType, arrayOfInts); |
473 | } |
474 | |
475 | bool operator==(const KeyTy &tblgenKey) const { |
476 | return (widthOfSomething == std::get<0>(tblgenKey)) && (oneType == std::get<1>(tblgenKey)) && (arrayOfInts == std::get<2>(tblgenKey)); |
477 | } |
478 | |
479 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
480 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); |
481 | } |
482 | |
483 | static CompoundAAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
484 | auto widthOfSomething = std::get<0>(tblgenKey); |
485 | auto oneType = std::get<1>(tblgenKey); |
486 | auto arrayOfInts = std::get<2>(tblgenKey); |
487 | arrayOfInts = allocator.copyInto(arrayOfInts); |
488 | return new (allocator.allocate<CompoundAAttrStorage>()) CompoundAAttrStorage(widthOfSomething, oneType, arrayOfInts); |
489 | } |
490 | |
491 | int widthOfSomething; |
492 | ::mlir::Type oneType; |
493 | ::llvm::ArrayRef<int> arrayOfInts; |
494 | }; |
495 | } // namespace detail |
496 | CompoundAAttr CompoundAAttr::get(::mlir::MLIRContext *context, int widthOfSomething, ::mlir::Type oneType, ::llvm::ArrayRef<int> arrayOfInts) { |
497 | return Base::get(context, widthOfSomething, oneType, arrayOfInts); |
498 | } |
499 | |
500 | int CompoundAAttr::getWidthOfSomething() const { |
501 | return getImpl()->widthOfSomething; |
502 | } |
503 | |
504 | ::mlir::Type CompoundAAttr::getOneType() const { |
505 | return getImpl()->oneType; |
506 | } |
507 | |
508 | ::llvm::ArrayRef<int> CompoundAAttr::getArrayOfInts() const { |
509 | return getImpl()->arrayOfInts; |
510 | } |
511 | |
512 | } // namespace test |
513 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundAAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::CompoundAAttr>::id = {}; } } |
514 | namespace test { |
515 | namespace detail { |
516 | struct CompoundAttrNestedAttrStorage : public ::mlir::AttributeStorage { |
517 | using KeyTy = std::tuple<::test::CompoundAAttr>; |
518 | CompoundAttrNestedAttrStorage(::test::CompoundAAttr nested) : nested(nested) {} |
519 | |
520 | KeyTy getAsKey() const { |
521 | return KeyTy(nested); |
522 | } |
523 | |
524 | bool operator==(const KeyTy &tblgenKey) const { |
525 | return (nested == std::get<0>(tblgenKey)); |
526 | } |
527 | |
528 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
529 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
530 | } |
531 | |
532 | static CompoundAttrNestedAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
533 | auto nested = std::get<0>(tblgenKey); |
534 | return new (allocator.allocate<CompoundAttrNestedAttrStorage>()) CompoundAttrNestedAttrStorage(nested); |
535 | } |
536 | |
537 | ::test::CompoundAAttr nested; |
538 | }; |
539 | } // namespace detail |
540 | CompoundAttrNestedAttr CompoundAttrNestedAttr::get(::mlir::MLIRContext *context, ::test::CompoundAAttr nested) { |
541 | return Base::get(context, nested); |
542 | } |
543 | |
544 | ::mlir::Attribute CompoundAttrNestedAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
545 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
546 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
547 | (void) odsLoc; |
548 | ::mlir::FailureOr<::test::CompoundAAttr> _result_nested; |
549 | // Parse literal '<' |
550 | if (odsParser.parseLess()) return {}; |
551 | // Parse literal 'nested' |
552 | if (odsParser.parseKeyword("nested")) return {}; |
553 | // Parse literal '=' |
554 | if (odsParser.parseEqual()) return {}; |
555 | |
556 | // Parse variable 'nested' |
557 | _result_nested = ::mlir::FieldParser<::test::CompoundAAttr>::parse(odsParser); |
558 | if (::mlir::failed(_result_nested)) { |
559 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundAttrNested parameter 'nested' which is to be a `::test::CompoundAAttr`"); |
560 | return {}; |
561 | } |
562 | // Parse literal '>' |
563 | if (odsParser.parseGreater()) return {}; |
564 | assert(::mlir::succeeded(_result_nested))(static_cast <bool> (::mlir::succeeded(_result_nested)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_nested)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 564 , __extension__ __PRETTY_FUNCTION__)); |
565 | return CompoundAttrNestedAttr::get(odsParser.getContext(), |
566 | ::test::CompoundAAttr((*_result_nested).cast<::test::CompoundAAttr>())); |
567 | } |
568 | |
569 | void CompoundAttrNestedAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
570 | ::mlir::Builder odsBuilder(getContext()); |
571 | odsPrinter << "<"; |
572 | odsPrinter << "nested"; |
573 | odsPrinter << ' ' << "="; |
574 | odsPrinter << ' '; |
575 | odsPrinter.printStrippedAttrOrType(getNested()); |
576 | odsPrinter << ">"; |
577 | } |
578 | |
579 | ::test::CompoundAAttr CompoundAttrNestedAttr::getNested() const { |
580 | return getImpl()->nested; |
581 | } |
582 | |
583 | } // namespace test |
584 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundAttrNestedAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::CompoundAttrNestedAttr>::id = {}; } } |
585 | namespace test { |
586 | namespace detail { |
587 | struct CompoundNestedInnerAttrStorage : public ::mlir::AttributeStorage { |
588 | using KeyTy = std::tuple<int, ::test::CompoundAAttr>; |
589 | CompoundNestedInnerAttrStorage(int some_int, ::test::CompoundAAttr cmpdA) : some_int(some_int), cmpdA(cmpdA) {} |
590 | |
591 | KeyTy getAsKey() const { |
592 | return KeyTy(some_int, cmpdA); |
593 | } |
594 | |
595 | bool operator==(const KeyTy &tblgenKey) const { |
596 | return (some_int == std::get<0>(tblgenKey)) && (cmpdA == std::get<1>(tblgenKey)); |
597 | } |
598 | |
599 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
600 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
601 | } |
602 | |
603 | static CompoundNestedInnerAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
604 | auto some_int = std::get<0>(tblgenKey); |
605 | auto cmpdA = std::get<1>(tblgenKey); |
606 | return new (allocator.allocate<CompoundNestedInnerAttrStorage>()) CompoundNestedInnerAttrStorage(some_int, cmpdA); |
607 | } |
608 | |
609 | int some_int; |
610 | ::test::CompoundAAttr cmpdA; |
611 | }; |
612 | } // namespace detail |
613 | CompoundNestedInnerAttr CompoundNestedInnerAttr::get(::mlir::MLIRContext *context, int some_int, ::test::CompoundAAttr cmpdA) { |
614 | return Base::get(context, some_int, cmpdA); |
615 | } |
616 | |
617 | ::mlir::Attribute CompoundNestedInnerAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
618 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
619 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
620 | (void) odsLoc; |
621 | ::mlir::FailureOr<int> _result_some_int; |
622 | ::mlir::FailureOr<::test::CompoundAAttr> _result_cmpdA; |
623 | // Parse literal '<' |
624 | if (odsParser.parseLess()) return {}; |
625 | |
626 | // Parse variable 'some_int' |
627 | _result_some_int = ::mlir::FieldParser<int>::parse(odsParser); |
628 | if (::mlir::failed(_result_some_int)) { |
629 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInner parameter 'some_int' which is to be a `int`"); |
630 | return {}; |
631 | } |
632 | |
633 | // Parse variable 'cmpdA' |
634 | _result_cmpdA = ::mlir::FieldParser<::test::CompoundAAttr>::parse(odsParser); |
635 | if (::mlir::failed(_result_cmpdA)) { |
636 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedInner parameter 'cmpdA' which is to be a `::test::CompoundAAttr`"); |
637 | return {}; |
638 | } |
639 | // Parse literal '>' |
640 | if (odsParser.parseGreater()) return {}; |
641 | assert(::mlir::succeeded(_result_some_int))(static_cast <bool> (::mlir::succeeded(_result_some_int )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_some_int)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 641 , __extension__ __PRETTY_FUNCTION__)); |
642 | assert(::mlir::succeeded(_result_cmpdA))(static_cast <bool> (::mlir::succeeded(_result_cmpdA)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_cmpdA)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 642 , __extension__ __PRETTY_FUNCTION__)); |
643 | return CompoundNestedInnerAttr::get(odsParser.getContext(), |
644 | int((*_result_some_int)), |
645 | ::test::CompoundAAttr((*_result_cmpdA).cast<::test::CompoundAAttr>())); |
646 | } |
647 | |
648 | void CompoundNestedInnerAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
649 | ::mlir::Builder odsBuilder(getContext()); |
650 | odsPrinter << "<"; |
651 | odsPrinter.printStrippedAttrOrType(getSomeInt()); |
652 | odsPrinter << ' '; |
653 | odsPrinter.printStrippedAttrOrType(getCmpdA()); |
654 | odsPrinter << ">"; |
655 | } |
656 | |
657 | int CompoundNestedInnerAttr::getSomeInt() const { |
658 | return getImpl()->some_int; |
659 | } |
660 | |
661 | ::test::CompoundAAttr CompoundNestedInnerAttr::getCmpdA() const { |
662 | return getImpl()->cmpdA; |
663 | } |
664 | |
665 | } // namespace test |
666 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedInnerAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::CompoundNestedInnerAttr>::id = {}; } } |
667 | namespace test { |
668 | namespace detail { |
669 | struct CompoundNestedOuterAttrStorage : public ::mlir::AttributeStorage { |
670 | using KeyTy = std::tuple<::test::CompoundNestedInnerAttr>; |
671 | CompoundNestedOuterAttrStorage(::test::CompoundNestedInnerAttr inner) : inner(inner) {} |
672 | |
673 | KeyTy getAsKey() const { |
674 | return KeyTy(inner); |
675 | } |
676 | |
677 | bool operator==(const KeyTy &tblgenKey) const { |
678 | return (inner == std::get<0>(tblgenKey)); |
679 | } |
680 | |
681 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
682 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
683 | } |
684 | |
685 | static CompoundNestedOuterAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
686 | auto inner = std::get<0>(tblgenKey); |
687 | return new (allocator.allocate<CompoundNestedOuterAttrStorage>()) CompoundNestedOuterAttrStorage(inner); |
688 | } |
689 | |
690 | ::test::CompoundNestedInnerAttr inner; |
691 | }; |
692 | } // namespace detail |
693 | CompoundNestedOuterAttr CompoundNestedOuterAttr::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerAttr inner) { |
694 | return Base::get(context, inner); |
695 | } |
696 | |
697 | ::mlir::Attribute CompoundNestedOuterAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
698 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
699 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
700 | (void) odsLoc; |
701 | ::mlir::FailureOr<::test::CompoundNestedInnerAttr> _result_inner; |
702 | // Parse literal '<' |
703 | if (odsParser.parseLess()) return {}; |
704 | // Parse literal 'i' |
705 | if (odsParser.parseKeyword("i")) return {}; |
706 | |
707 | // Parse variable 'inner' |
708 | _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerAttr>::parse(odsParser); |
709 | if (::mlir::failed(_result_inner)) { |
710 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuter parameter 'inner' which is to be a `::test::CompoundNestedInnerAttr`"); |
711 | return {}; |
712 | } |
713 | // Parse literal '>' |
714 | if (odsParser.parseGreater()) return {}; |
715 | assert(::mlir::succeeded(_result_inner))(static_cast <bool> (::mlir::succeeded(_result_inner)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_inner)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 715 , __extension__ __PRETTY_FUNCTION__)); |
716 | return CompoundNestedOuterAttr::get(odsParser.getContext(), |
717 | ::test::CompoundNestedInnerAttr((*_result_inner).cast<::test::CompoundNestedInnerAttr>())); |
718 | } |
719 | |
720 | void CompoundNestedOuterAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
721 | ::mlir::Builder odsBuilder(getContext()); |
722 | odsPrinter << "<"; |
723 | odsPrinter << "i"; |
724 | odsPrinter << ' '; |
725 | odsPrinter.printStrippedAttrOrType(getInner()); |
726 | odsPrinter << ">"; |
727 | } |
728 | |
729 | ::test::CompoundNestedInnerAttr CompoundNestedOuterAttr::getInner() const { |
730 | return getImpl()->inner; |
731 | } |
732 | |
733 | } // namespace test |
734 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::CompoundNestedOuterAttr>::id = {}; } } |
735 | namespace test { |
736 | namespace detail { |
737 | struct CompoundNestedOuterQualAttrStorage : public ::mlir::AttributeStorage { |
738 | using KeyTy = std::tuple<::test::CompoundNestedInnerAttr>; |
739 | CompoundNestedOuterQualAttrStorage(::test::CompoundNestedInnerAttr inner) : inner(inner) {} |
740 | |
741 | KeyTy getAsKey() const { |
742 | return KeyTy(inner); |
743 | } |
744 | |
745 | bool operator==(const KeyTy &tblgenKey) const { |
746 | return (inner == std::get<0>(tblgenKey)); |
747 | } |
748 | |
749 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
750 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
751 | } |
752 | |
753 | static CompoundNestedOuterQualAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
754 | auto inner = std::get<0>(tblgenKey); |
755 | return new (allocator.allocate<CompoundNestedOuterQualAttrStorage>()) CompoundNestedOuterQualAttrStorage(inner); |
756 | } |
757 | |
758 | ::test::CompoundNestedInnerAttr inner; |
759 | }; |
760 | } // namespace detail |
761 | CompoundNestedOuterQualAttr CompoundNestedOuterQualAttr::get(::mlir::MLIRContext *context, ::test::CompoundNestedInnerAttr inner) { |
762 | return Base::get(context, inner); |
763 | } |
764 | |
765 | ::mlir::Attribute CompoundNestedOuterQualAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
766 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
767 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
768 | (void) odsLoc; |
769 | ::mlir::FailureOr<::test::CompoundNestedInnerAttr> _result_inner; |
770 | // Parse literal '<' |
771 | if (odsParser.parseLess()) return {}; |
772 | // Parse literal 'i' |
773 | if (odsParser.parseKeyword("i")) return {}; |
774 | |
775 | // Parse variable 'inner' |
776 | _result_inner = ::mlir::FieldParser<::test::CompoundNestedInnerAttr>::parse(odsParser); |
777 | if (::mlir::failed(_result_inner)) { |
778 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CompoundNestedOuterQual parameter 'inner' which is to be a `::test::CompoundNestedInnerAttr`"); |
779 | return {}; |
780 | } |
781 | // Parse literal '>' |
782 | if (odsParser.parseGreater()) return {}; |
783 | assert(::mlir::succeeded(_result_inner))(static_cast <bool> (::mlir::succeeded(_result_inner)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_inner)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 783 , __extension__ __PRETTY_FUNCTION__)); |
784 | return CompoundNestedOuterQualAttr::get(odsParser.getContext(), |
785 | ::test::CompoundNestedInnerAttr((*_result_inner).cast<::test::CompoundNestedInnerAttr>())); |
786 | } |
787 | |
788 | void CompoundNestedOuterQualAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
789 | ::mlir::Builder odsBuilder(getContext()); |
790 | odsPrinter << "<"; |
791 | odsPrinter << "i"; |
792 | odsPrinter << ' '; |
793 | odsPrinter << getInner(); |
794 | odsPrinter << ">"; |
795 | } |
796 | |
797 | ::test::CompoundNestedInnerAttr CompoundNestedOuterQualAttr::getInner() const { |
798 | return getImpl()->inner; |
799 | } |
800 | |
801 | } // namespace test |
802 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompoundNestedOuterQualAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::CompoundNestedOuterQualAttr>::id = {}; } } |
803 | namespace test { |
804 | } // namespace test |
805 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::SimpleAAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::SimpleAAttr>::id = {}; } } |
806 | namespace test { |
807 | namespace detail { |
808 | struct ArrayOfEnumsAttrStorage : public ::mlir::AttributeStorage { |
809 | using KeyTy = std::tuple<::llvm::ArrayRef<SimpleEnumAttr>>; |
810 | ArrayOfEnumsAttrStorage(::llvm::ArrayRef<SimpleEnumAttr> value) : value(value) {} |
811 | |
812 | KeyTy getAsKey() const { |
813 | return KeyTy(value); |
814 | } |
815 | |
816 | bool operator==(const KeyTy &tblgenKey) const { |
817 | return (::llvm::ArrayRef<SimpleEnumAttr>(value) == ::llvm::ArrayRef<SimpleEnumAttr>(std::get<0>(tblgenKey))); |
818 | } |
819 | |
820 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
821 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
822 | } |
823 | |
824 | static ArrayOfEnumsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
825 | auto value = std::get<0>(tblgenKey); |
826 | value = allocator.copyInto(value); |
827 | return new (allocator.allocate<ArrayOfEnumsAttrStorage>()) ArrayOfEnumsAttrStorage(value); |
828 | } |
829 | |
830 | ::llvm::ArrayRef<SimpleEnumAttr> value; |
831 | }; |
832 | } // namespace detail |
833 | ArrayOfEnumsAttr ArrayOfEnumsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<SimpleEnumAttr> value) { |
834 | return Base::get(context, value); |
835 | } |
836 | |
837 | ::mlir::Attribute ArrayOfEnumsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
838 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
839 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
840 | (void) odsLoc; |
841 | ::mlir::FailureOr<::llvm::SmallVector<SimpleEnumAttr>> _result_value; |
842 | // Parse literal '[' |
843 | if (odsParser.parseLSquare()) return {}; |
844 | // Parse literal ']' |
845 | if (odsParser.parseOptionalRSquare()) { |
846 | |
847 | // Parse variable 'value' |
848 | _result_value = ::mlir::FieldParser<::llvm::SmallVector<SimpleEnumAttr>>::parse(odsParser); |
849 | if (::mlir::failed(_result_value)) { |
850 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfEnums parameter 'value' which is to be a `::llvm::ArrayRef<SimpleEnumAttr>`"); |
851 | return {}; |
852 | } |
853 | // Parse literal ']' |
854 | if (odsParser.parseRSquare()) return {}; |
855 | } else { |
856 | } |
857 | return ArrayOfEnumsAttr::get(odsParser.getContext(), |
858 | ::llvm::ArrayRef<SimpleEnumAttr>((_result_value.value_or(::llvm::SmallVector<SimpleEnumAttr>())))); |
859 | } |
860 | |
861 | void ArrayOfEnumsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
862 | ::mlir::Builder odsBuilder(getContext()); |
863 | odsPrinter << "["; |
864 | if (!(!(::llvm::ArrayRef<SimpleEnumAttr>(getValue()) == ::llvm::ArrayRef<SimpleEnumAttr>(::llvm::SmallVector<SimpleEnumAttr>())))) { |
865 | odsPrinter << "]"; |
866 | } else { |
867 | if (!(::llvm::ArrayRef<SimpleEnumAttr>(getValue()) == ::llvm::ArrayRef<SimpleEnumAttr>(::llvm::SmallVector<SimpleEnumAttr>()))) { |
868 | odsPrinter.printStrippedAttrOrType(getValue()); |
869 | } |
870 | odsPrinter << "]"; |
871 | } |
872 | } |
873 | |
874 | ::llvm::ArrayRef<SimpleEnumAttr> ArrayOfEnumsAttr::getValue() const { |
875 | return getImpl()->value; |
876 | } |
877 | |
878 | } // namespace test |
879 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfEnumsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::ArrayOfEnumsAttr>::id = {}; } } |
880 | namespace test { |
881 | namespace detail { |
882 | struct ArrayOfIntsAttrStorage : public ::mlir::AttributeStorage { |
883 | using KeyTy = std::tuple<::llvm::ArrayRef<int32_t>>; |
884 | ArrayOfIntsAttrStorage(::llvm::ArrayRef<int32_t> value) : value(value) {} |
885 | |
886 | KeyTy getAsKey() const { |
887 | return KeyTy(value); |
888 | } |
889 | |
890 | bool operator==(const KeyTy &tblgenKey) const { |
891 | return (::llvm::ArrayRef<int32_t>(value) == ::llvm::ArrayRef<int32_t>(std::get<0>(tblgenKey))); |
892 | } |
893 | |
894 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
895 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
896 | } |
897 | |
898 | static ArrayOfIntsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
899 | auto value = std::get<0>(tblgenKey); |
900 | value = allocator.copyInto(value); |
901 | return new (allocator.allocate<ArrayOfIntsAttrStorage>()) ArrayOfIntsAttrStorage(value); |
902 | } |
903 | |
904 | ::llvm::ArrayRef<int32_t> value; |
905 | }; |
906 | } // namespace detail |
907 | ArrayOfIntsAttr ArrayOfIntsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<int32_t> value) { |
908 | return Base::get(context, value); |
909 | } |
910 | |
911 | ::mlir::Attribute ArrayOfIntsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
912 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
913 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
914 | (void) odsLoc; |
915 | ::mlir::FailureOr<::llvm::SmallVector<int32_t>> _result_value; |
916 | // Parse literal '[' |
917 | if (odsParser.parseLSquare()) return {}; |
918 | // Parse literal ']' |
919 | if (odsParser.parseOptionalRSquare()) { |
920 | |
921 | // Parse variable 'value' |
922 | _result_value = ::mlir::FieldParser<::llvm::SmallVector<int32_t>>::parse(odsParser); |
923 | if (::mlir::failed(_result_value)) { |
924 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfInts parameter 'value' which is to be a `::llvm::ArrayRef<int32_t>`"); |
925 | return {}; |
926 | } |
927 | // Parse literal ']' |
928 | if (odsParser.parseRSquare()) return {}; |
929 | } else { |
930 | } |
931 | return ArrayOfIntsAttr::get(odsParser.getContext(), |
932 | ::llvm::ArrayRef<int32_t>((_result_value.value_or(::llvm::SmallVector<int32_t>())))); |
933 | } |
934 | |
935 | void ArrayOfIntsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
936 | ::mlir::Builder odsBuilder(getContext()); |
937 | odsPrinter << "["; |
938 | if (!(!(::llvm::ArrayRef<int32_t>(getValue()) == ::llvm::ArrayRef<int32_t>(::llvm::SmallVector<int32_t>())))) { |
939 | odsPrinter << "]"; |
940 | } else { |
941 | if (!(::llvm::ArrayRef<int32_t>(getValue()) == ::llvm::ArrayRef<int32_t>(::llvm::SmallVector<int32_t>()))) { |
942 | odsPrinter.printStrippedAttrOrType(getValue()); |
943 | } |
944 | odsPrinter << "]"; |
945 | } |
946 | } |
947 | |
948 | ::llvm::ArrayRef<int32_t> ArrayOfIntsAttr::getValue() const { |
949 | return getImpl()->value; |
950 | } |
951 | |
952 | } // namespace test |
953 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfIntsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::ArrayOfIntsAttr>::id = {}; } } |
954 | namespace test { |
955 | namespace detail { |
956 | struct ArrayOfUglyAttrsAttrStorage : public ::mlir::AttributeStorage { |
957 | using KeyTy = std::tuple<::llvm::ArrayRef<TestAttrUglyAttr>>; |
958 | ArrayOfUglyAttrsAttrStorage(::llvm::ArrayRef<TestAttrUglyAttr> value) : value(value) {} |
959 | |
960 | KeyTy getAsKey() const { |
961 | return KeyTy(value); |
962 | } |
963 | |
964 | bool operator==(const KeyTy &tblgenKey) const { |
965 | return (::llvm::ArrayRef<TestAttrUglyAttr>(value) == ::llvm::ArrayRef<TestAttrUglyAttr>(std::get<0>(tblgenKey))); |
966 | } |
967 | |
968 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
969 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
970 | } |
971 | |
972 | static ArrayOfUglyAttrsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
973 | auto value = std::get<0>(tblgenKey); |
974 | value = allocator.copyInto(value); |
975 | return new (allocator.allocate<ArrayOfUglyAttrsAttrStorage>()) ArrayOfUglyAttrsAttrStorage(value); |
976 | } |
977 | |
978 | ::llvm::ArrayRef<TestAttrUglyAttr> value; |
979 | }; |
980 | } // namespace detail |
981 | ArrayOfUglyAttrsAttr ArrayOfUglyAttrsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<TestAttrUglyAttr> value) { |
982 | return Base::get(context, value); |
983 | } |
984 | |
985 | ::mlir::Attribute ArrayOfUglyAttrsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
986 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
987 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
988 | (void) odsLoc; |
989 | ::mlir::FailureOr<::llvm::SmallVector<TestAttrUglyAttr>> _result_value; |
990 | // Parse literal '[' |
991 | if (odsParser.parseLSquare()) return {}; |
992 | // Parse literal ']' |
993 | if (odsParser.parseOptionalRSquare()) { |
994 | |
995 | // Parse variable 'value' |
996 | _result_value = ::mlir::FieldParser<::llvm::SmallVector<TestAttrUglyAttr>>::parse(odsParser); |
997 | if (::mlir::failed(_result_value)) { |
998 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestArrayOfUglyAttrs parameter 'value' which is to be a `::llvm::ArrayRef<TestAttrUglyAttr>`"); |
999 | return {}; |
1000 | } |
1001 | // Parse literal ']' |
1002 | if (odsParser.parseRSquare()) return {}; |
1003 | } else { |
1004 | } |
1005 | return ArrayOfUglyAttrsAttr::get(odsParser.getContext(), |
1006 | ::llvm::ArrayRef<TestAttrUglyAttr>((_result_value.value_or(::llvm::SmallVector<TestAttrUglyAttr>())))); |
1007 | } |
1008 | |
1009 | void ArrayOfUglyAttrsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1010 | ::mlir::Builder odsBuilder(getContext()); |
1011 | odsPrinter << "["; |
1012 | if (!(!(::llvm::ArrayRef<TestAttrUglyAttr>(getValue()) == ::llvm::ArrayRef<TestAttrUglyAttr>(::llvm::SmallVector<TestAttrUglyAttr>())))) { |
1013 | odsPrinter << "]"; |
1014 | } else { |
1015 | if (!(::llvm::ArrayRef<TestAttrUglyAttr>(getValue()) == ::llvm::ArrayRef<TestAttrUglyAttr>(::llvm::SmallVector<TestAttrUglyAttr>()))) { |
1016 | odsPrinter.printStrippedAttrOrType(getValue()); |
1017 | } |
1018 | odsPrinter << " "; |
1019 | odsPrinter << "]"; |
1020 | } |
1021 | } |
1022 | |
1023 | ::llvm::ArrayRef<TestAttrUglyAttr> ArrayOfUglyAttrsAttr::getValue() const { |
1024 | return getImpl()->value; |
1025 | } |
1026 | |
1027 | } // namespace test |
1028 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfUglyAttrsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::ArrayOfUglyAttrsAttr>::id = {}; } } |
1029 | namespace test { |
1030 | namespace detail { |
1031 | struct TestAttrParamsAttrStorage : public ::mlir::AttributeStorage { |
1032 | using KeyTy = std::tuple<int, int>; |
1033 | TestAttrParamsAttrStorage(int v0, int v1) : v0(v0), v1(v1) {} |
1034 | |
1035 | KeyTy getAsKey() const { |
1036 | return KeyTy(v0, v1); |
1037 | } |
1038 | |
1039 | bool operator==(const KeyTy &tblgenKey) const { |
1040 | return (v0 == std::get<0>(tblgenKey)) && (v1 == std::get<1>(tblgenKey)); |
1041 | } |
1042 | |
1043 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1044 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
1045 | } |
1046 | |
1047 | static TestAttrParamsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1048 | auto v0 = std::get<0>(tblgenKey); |
1049 | auto v1 = std::get<1>(tblgenKey); |
1050 | return new (allocator.allocate<TestAttrParamsAttrStorage>()) TestAttrParamsAttrStorage(v0, v1); |
1051 | } |
1052 | |
1053 | int v0; |
1054 | int v1; |
1055 | }; |
1056 | } // namespace detail |
1057 | TestAttrParamsAttr TestAttrParamsAttr::get(::mlir::MLIRContext *context, int v0, int v1) { |
1058 | return Base::get(context, v0, v1); |
1059 | } |
1060 | |
1061 | ::mlir::Attribute TestAttrParamsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1062 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1063 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1064 | (void) odsLoc; |
1065 | ::mlir::FailureOr<int> _result_v0; |
1066 | ::mlir::FailureOr<int> _result_v1; |
1067 | // Parse literal '<' |
1068 | if (odsParser.parseLess()) return {}; |
1069 | // Parse parameter list |
1070 | |
1071 | // Parse variable 'v0' |
1072 | _result_v0 = ::mlir::FieldParser<int>::parse(odsParser); |
1073 | if (::mlir::failed(_result_v0)) { |
1074 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrParams parameter 'v0' which is to be a `int`"); |
1075 | return {}; |
1076 | } |
1077 | // Parse literal ',' |
1078 | if (odsParser.parseComma()) return {}; |
1079 | |
1080 | // Parse variable 'v1' |
1081 | _result_v1 = ::mlir::FieldParser<int>::parse(odsParser); |
1082 | if (::mlir::failed(_result_v1)) { |
1083 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrParams parameter 'v1' which is to be a `int`"); |
1084 | return {}; |
1085 | } |
1086 | // Parse literal '>' |
1087 | if (odsParser.parseGreater()) return {}; |
1088 | assert(::mlir::succeeded(_result_v0))(static_cast <bool> (::mlir::succeeded(_result_v0)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_v0)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1088, __extension__ __PRETTY_FUNCTION__)); |
1089 | assert(::mlir::succeeded(_result_v1))(static_cast <bool> (::mlir::succeeded(_result_v1)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_v1)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1089, __extension__ __PRETTY_FUNCTION__)); |
1090 | return TestAttrParamsAttr::get(odsParser.getContext(), |
1091 | int((*_result_v0)), |
1092 | int((*_result_v1))); |
1093 | } |
1094 | |
1095 | void TestAttrParamsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1096 | ::mlir::Builder odsBuilder(getContext()); |
1097 | odsPrinter << "<"; |
1098 | { |
1099 | bool _firstPrinted = true; |
1100 | if (!_firstPrinted) odsPrinter << ", "; |
1101 | _firstPrinted = false; |
1102 | odsPrinter.printStrippedAttrOrType(getV0()); |
1103 | if (!_firstPrinted) odsPrinter << ", "; |
1104 | _firstPrinted = false; |
1105 | odsPrinter.printStrippedAttrOrType(getV1()); |
1106 | } |
1107 | odsPrinter << ">"; |
1108 | } |
1109 | |
1110 | int TestAttrParamsAttr::getV0() const { |
1111 | return getImpl()->v0; |
1112 | } |
1113 | |
1114 | int TestAttrParamsAttr::getV1() const { |
1115 | return getImpl()->v1; |
1116 | } |
1117 | |
1118 | } // namespace test |
1119 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrParamsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrParamsAttr>::id = {}; } } |
1120 | namespace test { |
1121 | namespace detail { |
1122 | struct TestAttrSelfTypeParameterFormatAttrStorage : public ::mlir::AttributeStorage { |
1123 | using KeyTy = std::tuple<int, ::mlir::Type>; |
1124 | TestAttrSelfTypeParameterFormatAttrStorage(int a, ::mlir::Type type) : a(a), type(type) {} |
1125 | |
1126 | KeyTy getAsKey() const { |
1127 | return KeyTy(a, type); |
1128 | } |
1129 | |
1130 | bool operator==(const KeyTy &tblgenKey) const { |
1131 | return (a == std::get<0>(tblgenKey)) && (type == std::get<1>(tblgenKey)); |
1132 | } |
1133 | |
1134 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1135 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
1136 | } |
1137 | |
1138 | static TestAttrSelfTypeParameterFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1139 | auto a = std::get<0>(tblgenKey); |
1140 | auto type = std::get<1>(tblgenKey); |
1141 | return new (allocator.allocate<TestAttrSelfTypeParameterFormatAttrStorage>()) TestAttrSelfTypeParameterFormatAttrStorage(a, type); |
1142 | } |
1143 | |
1144 | int a; |
1145 | ::mlir::Type type; |
1146 | }; |
1147 | } // namespace detail |
1148 | TestAttrSelfTypeParameterFormatAttr TestAttrSelfTypeParameterFormatAttr::get(::mlir::MLIRContext *context, int a, ::mlir::Type type) { |
1149 | return Base::get(context, a, type); |
1150 | } |
1151 | |
1152 | ::mlir::Attribute TestAttrSelfTypeParameterFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1153 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1154 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1155 | (void) odsLoc; |
1156 | ::mlir::FailureOr<int> _result_a; |
1157 | ::mlir::FailureOr<::mlir::Type> _result_type; |
1158 | |
1159 | if (odsType) { |
1160 | if (auto reqType = odsType.dyn_cast<::mlir::Type>()) { |
1161 | _result_type = reqType; |
1162 | } else { |
1163 | odsParser.emitError(odsLoc, "invalid kind of type specified"); |
1164 | return {}; |
1165 | } |
1166 | } |
1167 | // Parse literal '<' |
1168 | if (odsParser.parseLess()) return {}; |
1169 | |
1170 | // Parse variable 'a' |
1171 | _result_a = ::mlir::FieldParser<int>::parse(odsParser); |
1172 | if (::mlir::failed(_result_a)) { |
1173 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrSelfTypeParameterFormat parameter 'a' which is to be a `int`"); |
1174 | return {}; |
1175 | } |
1176 | // Parse literal '>' |
1177 | if (odsParser.parseGreater()) return {}; |
1178 | assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1178, __extension__ __PRETTY_FUNCTION__)); |
1179 | return TestAttrSelfTypeParameterFormatAttr::get(odsParser.getContext(), |
1180 | int((*_result_a)), |
1181 | ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext()))))); |
1182 | } |
1183 | |
1184 | void TestAttrSelfTypeParameterFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1185 | ::mlir::Builder odsBuilder(getContext()); |
1186 | odsPrinter << "<"; |
1187 | odsPrinter.printStrippedAttrOrType(getA()); |
1188 | odsPrinter << ">"; |
1189 | } |
1190 | |
1191 | int TestAttrSelfTypeParameterFormatAttr::getA() const { |
1192 | return getImpl()->a; |
1193 | } |
1194 | |
1195 | ::mlir::Type TestAttrSelfTypeParameterFormatAttr::getType() const { |
1196 | return getImpl()->type; |
1197 | } |
1198 | |
1199 | } // namespace test |
1200 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrSelfTypeParameterFormatAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrSelfTypeParameterFormatAttr>::id = {} ; } } |
1201 | namespace test { |
1202 | namespace detail { |
1203 | struct TestAttrSelfTypeParameterStructFormatAttrStorage : public ::mlir::AttributeStorage { |
1204 | using KeyTy = std::tuple<int, ::mlir::Type>; |
1205 | TestAttrSelfTypeParameterStructFormatAttrStorage(int a, ::mlir::Type type) : a(a), type(type) {} |
1206 | |
1207 | KeyTy getAsKey() const { |
1208 | return KeyTy(a, type); |
1209 | } |
1210 | |
1211 | bool operator==(const KeyTy &tblgenKey) const { |
1212 | return (a == std::get<0>(tblgenKey)) && (type == std::get<1>(tblgenKey)); |
1213 | } |
1214 | |
1215 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1216 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
1217 | } |
1218 | |
1219 | static TestAttrSelfTypeParameterStructFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1220 | auto a = std::get<0>(tblgenKey); |
1221 | auto type = std::get<1>(tblgenKey); |
1222 | return new (allocator.allocate<TestAttrSelfTypeParameterStructFormatAttrStorage>()) TestAttrSelfTypeParameterStructFormatAttrStorage(a, type); |
1223 | } |
1224 | |
1225 | int a; |
1226 | ::mlir::Type type; |
1227 | }; |
1228 | } // namespace detail |
1229 | TestAttrSelfTypeParameterStructFormatAttr TestAttrSelfTypeParameterStructFormatAttr::get(::mlir::MLIRContext *context, int a, ::mlir::Type type) { |
1230 | return Base::get(context, a, type); |
1231 | } |
1232 | |
1233 | ::mlir::Attribute TestAttrSelfTypeParameterStructFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1234 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1235 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1236 | (void) odsLoc; |
1237 | ::mlir::FailureOr<int> _result_a; |
1238 | ::mlir::FailureOr<::mlir::Type> _result_type; |
1239 | |
1240 | if (odsType) { |
1241 | if (auto reqType = odsType.dyn_cast<::mlir::Type>()) { |
1242 | _result_type = reqType; |
1243 | } else { |
1244 | odsParser.emitError(odsLoc, "invalid kind of type specified"); |
1245 | return {}; |
1246 | } |
1247 | } |
1248 | // Parse literal '<' |
1249 | if (odsParser.parseLess()) return {}; |
1250 | // Parse parameter struct |
1251 | bool _seen_a = false; |
1252 | { |
1253 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1254 | // Parse literal '=' |
1255 | if (odsParser.parseEqual()) return {}; |
1256 | if (!_seen_a && _paramKey == "a") { |
1257 | _seen_a = true; |
1258 | |
1259 | // Parse variable 'a' |
1260 | _result_a = ::mlir::FieldParser<int>::parse(odsParser); |
1261 | if (::mlir::failed(_result_a)) { |
1262 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrSelfTypeParameterStructFormat parameter 'a' which is to be a `int`"); |
1263 | return {}; |
1264 | } |
1265 | } else { |
1266 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1267 | return {}; |
1268 | } |
1269 | return true; |
1270 | }; |
1271 | for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { |
1272 | ::llvm::StringRef _paramKey; |
1273 | if (odsParser.parseKeyword(&_paramKey)) { |
1274 | odsParser.emitError(odsParser.getCurrentLocation(), |
1275 | "expected a parameter name in struct"); |
1276 | return {}; |
1277 | } |
1278 | if (!_loop_body(_paramKey)) return {}; |
1279 | if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) |
1280 | return {}; |
1281 | } |
1282 | } |
1283 | // Parse literal '>' |
1284 | if (odsParser.parseGreater()) return {}; |
1285 | assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1285, __extension__ __PRETTY_FUNCTION__)); |
1286 | return TestAttrSelfTypeParameterStructFormatAttr::get(odsParser.getContext(), |
1287 | int((*_result_a)), |
1288 | ::mlir::Type((_result_type.value_or(::mlir::NoneType::get(odsParser.getContext()))))); |
1289 | } |
1290 | |
1291 | void TestAttrSelfTypeParameterStructFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1292 | ::mlir::Builder odsBuilder(getContext()); |
1293 | odsPrinter << "<"; |
1294 | { |
1295 | bool _firstPrinted = true; |
1296 | if (!_firstPrinted) odsPrinter << ", "; |
1297 | _firstPrinted = false; |
Value stored to '_firstPrinted' is never read | |
1298 | odsPrinter << "a = "; |
1299 | odsPrinter.printStrippedAttrOrType(getA()); |
1300 | } |
1301 | odsPrinter << ">"; |
1302 | } |
1303 | |
1304 | int TestAttrSelfTypeParameterStructFormatAttr::getA() const { |
1305 | return getImpl()->a; |
1306 | } |
1307 | |
1308 | ::mlir::Type TestAttrSelfTypeParameterStructFormatAttr::getType() const { |
1309 | return getImpl()->type; |
1310 | } |
1311 | |
1312 | } // namespace test |
1313 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrSelfTypeParameterStructFormatAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrSelfTypeParameterStructFormatAttr>::id = {}; } } |
1314 | namespace test { |
1315 | namespace detail { |
1316 | struct TestAttrUglyAttrStorage : public ::mlir::AttributeStorage { |
1317 | using KeyTy = std::tuple<::mlir::Attribute>; |
1318 | TestAttrUglyAttrStorage(::mlir::Attribute attr) : attr(attr) {} |
1319 | |
1320 | KeyTy getAsKey() const { |
1321 | return KeyTy(attr); |
1322 | } |
1323 | |
1324 | bool operator==(const KeyTy &tblgenKey) const { |
1325 | return (attr == std::get<0>(tblgenKey)); |
1326 | } |
1327 | |
1328 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1329 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
1330 | } |
1331 | |
1332 | static TestAttrUglyAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1333 | auto attr = std::get<0>(tblgenKey); |
1334 | return new (allocator.allocate<TestAttrUglyAttrStorage>()) TestAttrUglyAttrStorage(attr); |
1335 | } |
1336 | |
1337 | ::mlir::Attribute attr; |
1338 | }; |
1339 | } // namespace detail |
1340 | TestAttrUglyAttr TestAttrUglyAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute attr) { |
1341 | return Base::get(context, attr); |
1342 | } |
1343 | |
1344 | ::mlir::Attribute TestAttrUglyAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1345 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1346 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1347 | (void) odsLoc; |
1348 | ::mlir::FailureOr<::mlir::Attribute> _result_attr; |
1349 | // Parse literal 'begin' |
1350 | if (odsParser.parseKeyword("begin")) return {}; |
1351 | |
1352 | // Parse variable 'attr' |
1353 | _result_attr = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); |
1354 | if (::mlir::failed(_result_attr)) { |
1355 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrUgly parameter 'attr' which is to be a `::mlir::Attribute`"); |
1356 | return {}; |
1357 | } |
1358 | // Parse literal 'end' |
1359 | if (odsParser.parseKeyword("end")) return {}; |
1360 | assert(::mlir::succeeded(_result_attr))(static_cast <bool> (::mlir::succeeded(_result_attr)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_attr)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1360 , __extension__ __PRETTY_FUNCTION__)); |
1361 | return TestAttrUglyAttr::get(odsParser.getContext(), |
1362 | ::mlir::Attribute((*_result_attr))); |
1363 | } |
1364 | |
1365 | void TestAttrUglyAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1366 | ::mlir::Builder odsBuilder(getContext()); |
1367 | odsPrinter << ' ' << "begin"; |
1368 | odsPrinter << ' '; |
1369 | odsPrinter.printStrippedAttrOrType(getAttr()); |
1370 | odsPrinter << ' ' << "end"; |
1371 | } |
1372 | |
1373 | ::mlir::Attribute TestAttrUglyAttr::getAttr() const { |
1374 | return getImpl()->attr; |
1375 | } |
1376 | |
1377 | } // namespace test |
1378 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrUglyAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrUglyAttr>::id = {}; } } |
1379 | namespace test { |
1380 | namespace detail { |
1381 | struct TestAttrWithFormatAttrStorage : public ::mlir::AttributeStorage { |
1382 | using KeyTy = std::tuple<int64_t, std::string, ::mlir::IntegerAttr, ::llvm::ArrayRef<int>, uint64_t, ::llvm::ArrayRef<int>, ::llvm::ArrayRef<AttrWithTypeBuilderAttr>>; |
1383 | TestAttrWithFormatAttrStorage(int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, uint64_t five, ::llvm::ArrayRef<int> six, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) : one(one), two(two), three(three), four(four), five(five), six(six), arrayOfAttrWithTypeBuilderAttr(arrayOfAttrWithTypeBuilderAttr) {} |
1384 | |
1385 | KeyTy getAsKey() const { |
1386 | return KeyTy(one, two, three, four, five, six, arrayOfAttrWithTypeBuilderAttr); |
1387 | } |
1388 | |
1389 | bool operator==(const KeyTy &tblgenKey) const { |
1390 | return (one == std::get<0>(tblgenKey)) && (two == std::get<1>(tblgenKey)) && (three == std::get<2>(tblgenKey)) && (four == std::get<3>(tblgenKey)) && (five == std::get<4>(tblgenKey)) && (six == std::get<5>(tblgenKey)) && (arrayOfAttrWithTypeBuilderAttr == std::get<6>(tblgenKey)); |
1391 | } |
1392 | |
1393 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1394 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); |
1395 | } |
1396 | |
1397 | static TestAttrWithFormatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1398 | auto one = std::get<0>(tblgenKey); |
1399 | auto two = std::get<1>(tblgenKey); |
1400 | auto three = std::get<2>(tblgenKey); |
1401 | auto four = std::get<3>(tblgenKey); |
1402 | auto five = std::get<4>(tblgenKey); |
1403 | auto six = std::get<5>(tblgenKey); |
1404 | auto arrayOfAttrWithTypeBuilderAttr = std::get<6>(tblgenKey); |
1405 | four = allocator.copyInto(four); |
1406 | six = allocator.copyInto(six); |
1407 | arrayOfAttrWithTypeBuilderAttr = allocator.copyInto(arrayOfAttrWithTypeBuilderAttr); |
1408 | return new (allocator.allocate<TestAttrWithFormatAttrStorage>()) TestAttrWithFormatAttrStorage(one, two, three, four, five, six, arrayOfAttrWithTypeBuilderAttr); |
1409 | } |
1410 | |
1411 | int64_t one; |
1412 | std::string two; |
1413 | ::mlir::IntegerAttr three; |
1414 | ::llvm::ArrayRef<int> four; |
1415 | uint64_t five; |
1416 | ::llvm::ArrayRef<int> six; |
1417 | ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr; |
1418 | }; |
1419 | } // namespace detail |
1420 | TestAttrWithFormatAttr TestAttrWithFormatAttr::get(::mlir::MLIRContext *context, int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, uint64_t five, ::llvm::ArrayRef<int> six, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) { |
1421 | return Base::get(context, one, two, three, four, five, six, arrayOfAttrWithTypeBuilderAttr); |
1422 | } |
1423 | |
1424 | TestAttrWithFormatAttr TestAttrWithFormatAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int64_t one, std::string two, ::mlir::IntegerAttr three, ::llvm::ArrayRef<int> four, uint64_t five, ::llvm::ArrayRef<int> six, ::llvm::ArrayRef<AttrWithTypeBuilderAttr> arrayOfAttrWithTypeBuilderAttr) { |
1425 | return Base::getChecked(emitError, context, one, two, three, four, five, six, arrayOfAttrWithTypeBuilderAttr); |
1426 | } |
1427 | |
1428 | ::mlir::Attribute TestAttrWithFormatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1429 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1430 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1431 | (void) odsLoc; |
1432 | ::mlir::FailureOr<int64_t> _result_one; |
1433 | ::mlir::FailureOr<std::string> _result_two; |
1434 | ::mlir::FailureOr<::mlir::IntegerAttr> _result_three; |
1435 | ::mlir::FailureOr<llvm::SmallVector<int>> _result_four; |
1436 | ::mlir::FailureOr<uint64_t> _result_five; |
1437 | ::mlir::FailureOr<std::vector<int>> _result_six; |
1438 | ::mlir::FailureOr<::llvm::SmallVector<AttrWithTypeBuilderAttr>> _result_arrayOfAttrWithTypeBuilderAttr; |
1439 | // Parse literal '<' |
1440 | if (odsParser.parseLess()) return {}; |
1441 | |
1442 | // Parse variable 'one' |
1443 | _result_one = ::mlir::FieldParser<int64_t>::parse(odsParser); |
1444 | if (::mlir::failed(_result_one)) { |
1445 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'one' which is to be a `int64_t`"); |
1446 | return {}; |
1447 | } |
1448 | // Parse literal ':' |
1449 | if (odsParser.parseColon()) return {}; |
1450 | // Parse parameter struct |
1451 | bool _seen_two = false; |
1452 | bool _seen_four = false; |
1453 | { |
1454 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1455 | // Parse literal '=' |
1456 | if (odsParser.parseEqual()) return {}; |
1457 | if (!_seen_two && _paramKey == "two") { |
1458 | _seen_two = true; |
1459 | |
1460 | // Parse variable 'two' |
1461 | _result_two = ::mlir::FieldParser<std::string>::parse(odsParser); |
1462 | if (::mlir::failed(_result_two)) { |
1463 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'two' which is to be a `std::string`"); |
1464 | return {}; |
1465 | } |
1466 | } else if (!_seen_four && _paramKey == "four") { |
1467 | _seen_four = true; |
1468 | |
1469 | // Parse variable 'four' |
1470 | _result_four = ::parseIntArray(odsParser); |
1471 | if (::mlir::failed(_result_four)) { |
1472 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'four' which is to be a `::llvm::ArrayRef<int>`"); |
1473 | return {}; |
1474 | } |
1475 | } else { |
1476 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1477 | return {}; |
1478 | } |
1479 | return true; |
1480 | }; |
1481 | for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { |
1482 | ::llvm::StringRef _paramKey; |
1483 | if (odsParser.parseKeyword(&_paramKey)) { |
1484 | odsParser.emitError(odsParser.getCurrentLocation(), |
1485 | "expected a parameter name in struct"); |
1486 | return {}; |
1487 | } |
1488 | if (!_loop_body(_paramKey)) return {}; |
1489 | if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) |
1490 | return {}; |
1491 | } |
1492 | } |
1493 | // Parse literal ':' |
1494 | if (odsParser.parseColon()) return {}; |
1495 | |
1496 | // Parse variable 'three' |
1497 | _result_three = ::mlir::FieldParser<::mlir::IntegerAttr>::parse(odsParser); |
1498 | if (::mlir::failed(_result_three)) { |
1499 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'three' which is to be a `::mlir::IntegerAttr`"); |
1500 | return {}; |
1501 | } |
1502 | // Parse literal ':' |
1503 | if (odsParser.parseColon()) return {}; |
1504 | |
1505 | // Parse variable 'five' |
1506 | _result_five = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
1507 | if (::mlir::failed(_result_five)) { |
1508 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'five' which is to be a `uint64_t`"); |
1509 | return {}; |
1510 | } |
1511 | // Parse literal ':' |
1512 | if (odsParser.parseColon()) return {}; |
1513 | // Parse literal '[' |
1514 | if (odsParser.parseLSquare()) return {}; |
1515 | |
1516 | // Parse variable 'six' |
1517 | _result_six = ::mlir::FieldParser<std::vector<int>>::parse(odsParser); |
1518 | if (::mlir::failed(_result_six)) { |
1519 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'six' which is to be a `::llvm::ArrayRef<int>`"); |
1520 | return {}; |
1521 | } |
1522 | // Parse literal ']' |
1523 | if (odsParser.parseRSquare()) return {}; |
1524 | // Parse literal ',' |
1525 | if (odsParser.parseComma()) return {}; |
1526 | // Parse literal '[' |
1527 | if (odsParser.parseLSquare()) return {}; |
1528 | |
1529 | // Parse variable 'arrayOfAttrWithTypeBuilderAttr' |
1530 | _result_arrayOfAttrWithTypeBuilderAttr = ::mlir::FieldParser<::llvm::SmallVector<AttrWithTypeBuilderAttr>>::parse(odsParser); |
1531 | if (::mlir::failed(_result_arrayOfAttrWithTypeBuilderAttr)) { |
1532 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithFormat parameter 'arrayOfAttrWithTypeBuilderAttr' which is to be a `::llvm::ArrayRef<AttrWithTypeBuilderAttr>`"); |
1533 | return {}; |
1534 | } |
1535 | // Parse literal ']' |
1536 | if (odsParser.parseRSquare()) return {}; |
1537 | // Parse literal '>' |
1538 | if (odsParser.parseGreater()) return {}; |
1539 | assert(::mlir::succeeded(_result_one))(static_cast <bool> (::mlir::succeeded(_result_one)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_one)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1539, __extension__ __PRETTY_FUNCTION__)); |
1540 | assert(::mlir::succeeded(_result_two))(static_cast <bool> (::mlir::succeeded(_result_two)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_two)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1540, __extension__ __PRETTY_FUNCTION__)); |
1541 | assert(::mlir::succeeded(_result_three))(static_cast <bool> (::mlir::succeeded(_result_three)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_three)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1541 , __extension__ __PRETTY_FUNCTION__)); |
1542 | assert(::mlir::succeeded(_result_four))(static_cast <bool> (::mlir::succeeded(_result_four)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_four)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1542 , __extension__ __PRETTY_FUNCTION__)); |
1543 | assert(::mlir::succeeded(_result_five))(static_cast <bool> (::mlir::succeeded(_result_five)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_five)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1543 , __extension__ __PRETTY_FUNCTION__)); |
1544 | assert(::mlir::succeeded(_result_six))(static_cast <bool> (::mlir::succeeded(_result_six)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_six)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 1544, __extension__ __PRETTY_FUNCTION__)); |
1545 | assert(::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr))(static_cast <bool> (::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_arrayOfAttrWithTypeBuilderAttr)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1545 , __extension__ __PRETTY_FUNCTION__)); |
1546 | return odsParser.getChecked<TestAttrWithFormatAttr>(odsLoc, odsParser.getContext(), |
1547 | int64_t((*_result_one)), |
1548 | std::string((*_result_two)), |
1549 | ::mlir::IntegerAttr((*_result_three)), |
1550 | ::llvm::ArrayRef<int>((*_result_four)), |
1551 | uint64_t((*_result_five)), |
1552 | ::llvm::ArrayRef<int>((*_result_six)), |
1553 | ::llvm::ArrayRef<AttrWithTypeBuilderAttr>((*_result_arrayOfAttrWithTypeBuilderAttr))); |
1554 | } |
1555 | |
1556 | void TestAttrWithFormatAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1557 | ::mlir::Builder odsBuilder(getContext()); |
1558 | odsPrinter << "<"; |
1559 | odsPrinter.printStrippedAttrOrType(getOne()); |
1560 | odsPrinter << ' ' << ":"; |
1561 | odsPrinter << ' '; |
1562 | { |
1563 | bool _firstPrinted = true; |
1564 | if (!_firstPrinted) odsPrinter << ", "; |
1565 | _firstPrinted = false; |
1566 | odsPrinter << "two = "; |
1567 | odsPrinter << '"' << getTwo() << '"'; |
1568 | if (!_firstPrinted) odsPrinter << ", "; |
1569 | _firstPrinted = false; |
1570 | odsPrinter << "four = "; |
1571 | ::printIntArray(odsPrinter, getFour()); |
1572 | } |
1573 | odsPrinter << ' ' << ":"; |
1574 | odsPrinter << ' '; |
1575 | odsPrinter.printStrippedAttrOrType(getThree()); |
1576 | odsPrinter << ' ' << ":"; |
1577 | odsPrinter << ' '; |
1578 | odsPrinter.printStrippedAttrOrType(getFive()); |
1579 | odsPrinter << ' ' << ":"; |
1580 | odsPrinter << ' ' << "["; |
1581 | odsPrinter.printStrippedAttrOrType(getSix()); |
1582 | odsPrinter << "]"; |
1583 | odsPrinter << ","; |
1584 | odsPrinter << ' ' << "["; |
1585 | odsPrinter.printStrippedAttrOrType(getArrayOfAttrWithTypeBuilderAttr()); |
1586 | odsPrinter << "]"; |
1587 | odsPrinter << ">"; |
1588 | } |
1589 | |
1590 | int64_t TestAttrWithFormatAttr::getOne() const { |
1591 | return getImpl()->one; |
1592 | } |
1593 | |
1594 | llvm::StringRef TestAttrWithFormatAttr::getTwo() const { |
1595 | return getImpl()->two; |
1596 | } |
1597 | |
1598 | ::mlir::IntegerAttr TestAttrWithFormatAttr::getThree() const { |
1599 | return getImpl()->three; |
1600 | } |
1601 | |
1602 | ::llvm::ArrayRef<int> TestAttrWithFormatAttr::getFour() const { |
1603 | return getImpl()->four; |
1604 | } |
1605 | |
1606 | uint64_t TestAttrWithFormatAttr::getFive() const { |
1607 | return getImpl()->five; |
1608 | } |
1609 | |
1610 | ::llvm::ArrayRef<int> TestAttrWithFormatAttr::getSix() const { |
1611 | return getImpl()->six; |
1612 | } |
1613 | |
1614 | ::llvm::ArrayRef<AttrWithTypeBuilderAttr> TestAttrWithFormatAttr::getArrayOfAttrWithTypeBuilderAttr() const { |
1615 | return getImpl()->arrayOfAttrWithTypeBuilderAttr; |
1616 | } |
1617 | |
1618 | } // namespace test |
1619 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithFormatAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrWithFormatAttr>::id = {}; } } |
1620 | namespace test { |
1621 | namespace detail { |
1622 | struct TestAttrWithOptionalSignedAttrStorage : public ::mlir::AttributeStorage { |
1623 | using KeyTy = std::tuple<std::optional<int64_t>>; |
1624 | TestAttrWithOptionalSignedAttrStorage(std::optional<int64_t> value) : value(value) {} |
1625 | |
1626 | KeyTy getAsKey() const { |
1627 | return KeyTy(value); |
1628 | } |
1629 | |
1630 | bool operator==(const KeyTy &tblgenKey) const { |
1631 | return (value == std::get<0>(tblgenKey)); |
1632 | } |
1633 | |
1634 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1635 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
1636 | } |
1637 | |
1638 | static TestAttrWithOptionalSignedAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1639 | auto value = std::get<0>(tblgenKey); |
1640 | return new (allocator.allocate<TestAttrWithOptionalSignedAttrStorage>()) TestAttrWithOptionalSignedAttrStorage(value); |
1641 | } |
1642 | |
1643 | std::optional<int64_t> value; |
1644 | }; |
1645 | } // namespace detail |
1646 | TestAttrWithOptionalSignedAttr TestAttrWithOptionalSignedAttr::get(::mlir::MLIRContext *context, std::optional<int64_t> value) { |
1647 | return Base::get(context, value); |
1648 | } |
1649 | |
1650 | ::mlir::Attribute TestAttrWithOptionalSignedAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1651 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1652 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1653 | (void) odsLoc; |
1654 | ::mlir::FailureOr<std::optional<int64_t>> _result_value; |
1655 | // Parse literal '<' |
1656 | if (odsParser.parseLess()) return {}; |
1657 | |
1658 | // Parse variable 'value' |
1659 | _result_value = ::mlir::FieldParser<std::optional<int64_t>>::parse(odsParser); |
1660 | if (::mlir::failed(_result_value)) { |
1661 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithOptionalSigned parameter 'value' which is to be a `std::optional<int64_t>`"); |
1662 | return {}; |
1663 | } |
1664 | // Parse literal '>' |
1665 | if (odsParser.parseGreater()) return {}; |
1666 | return TestAttrWithOptionalSignedAttr::get(odsParser.getContext(), |
1667 | std::optional<int64_t>((_result_value.value_or(std::optional<int64_t>())))); |
1668 | } |
1669 | |
1670 | void TestAttrWithOptionalSignedAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1671 | ::mlir::Builder odsBuilder(getContext()); |
1672 | odsPrinter << "<"; |
1673 | if (!(getValue() == std::optional<int64_t>())) { |
1674 | odsPrinter.printStrippedAttrOrType(getValue()); |
1675 | } |
1676 | odsPrinter << ">"; |
1677 | } |
1678 | |
1679 | std::optional<int64_t> TestAttrWithOptionalSignedAttr::getValue() const { |
1680 | return getImpl()->value; |
1681 | } |
1682 | |
1683 | } // namespace test |
1684 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithOptionalSignedAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrWithOptionalSignedAttr>::id = {}; } } |
1685 | namespace test { |
1686 | namespace detail { |
1687 | struct TestAttrWithOptionalUnsignedAttrStorage : public ::mlir::AttributeStorage { |
1688 | using KeyTy = std::tuple<std::optional<uint64_t>>; |
1689 | TestAttrWithOptionalUnsignedAttrStorage(std::optional<uint64_t> value) : value(value) {} |
1690 | |
1691 | KeyTy getAsKey() const { |
1692 | return KeyTy(value); |
1693 | } |
1694 | |
1695 | bool operator==(const KeyTy &tblgenKey) const { |
1696 | return (value == std::get<0>(tblgenKey)); |
1697 | } |
1698 | |
1699 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1700 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
1701 | } |
1702 | |
1703 | static TestAttrWithOptionalUnsignedAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1704 | auto value = std::get<0>(tblgenKey); |
1705 | return new (allocator.allocate<TestAttrWithOptionalUnsignedAttrStorage>()) TestAttrWithOptionalUnsignedAttrStorage(value); |
1706 | } |
1707 | |
1708 | std::optional<uint64_t> value; |
1709 | }; |
1710 | } // namespace detail |
1711 | TestAttrWithOptionalUnsignedAttr TestAttrWithOptionalUnsignedAttr::get(::mlir::MLIRContext *context, std::optional<uint64_t> value) { |
1712 | return Base::get(context, value); |
1713 | } |
1714 | |
1715 | ::mlir::Attribute TestAttrWithOptionalUnsignedAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1716 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1717 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1718 | (void) odsLoc; |
1719 | ::mlir::FailureOr<std::optional<uint64_t>> _result_value; |
1720 | // Parse literal '<' |
1721 | if (odsParser.parseLess()) return {}; |
1722 | |
1723 | // Parse variable 'value' |
1724 | _result_value = ::mlir::FieldParser<std::optional<uint64_t>>::parse(odsParser); |
1725 | if (::mlir::failed(_result_value)) { |
1726 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithOptionalUnsigned parameter 'value' which is to be a `std::optional<uint64_t>`"); |
1727 | return {}; |
1728 | } |
1729 | // Parse literal '>' |
1730 | if (odsParser.parseGreater()) return {}; |
1731 | return TestAttrWithOptionalUnsignedAttr::get(odsParser.getContext(), |
1732 | std::optional<uint64_t>((_result_value.value_or(std::optional<uint64_t>())))); |
1733 | } |
1734 | |
1735 | void TestAttrWithOptionalUnsignedAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1736 | ::mlir::Builder odsBuilder(getContext()); |
1737 | odsPrinter << "<"; |
1738 | if (!(getValue() == std::optional<uint64_t>())) { |
1739 | odsPrinter.printStrippedAttrOrType(getValue()); |
1740 | } |
1741 | odsPrinter << ">"; |
1742 | } |
1743 | |
1744 | std::optional<uint64_t> TestAttrWithOptionalUnsignedAttr::getValue() const { |
1745 | return getImpl()->value; |
1746 | } |
1747 | |
1748 | } // namespace test |
1749 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithOptionalUnsignedAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrWithOptionalUnsignedAttr>::id = {}; } } |
1750 | namespace test { |
1751 | namespace detail { |
1752 | struct TestAttrWithTypeParamAttrStorage : public ::mlir::AttributeStorage { |
1753 | using KeyTy = std::tuple<::mlir::IntegerType, ::mlir::Type>; |
1754 | TestAttrWithTypeParamAttrStorage(::mlir::IntegerType int_type, ::mlir::Type any_type) : int_type(int_type), any_type(any_type) {} |
1755 | |
1756 | KeyTy getAsKey() const { |
1757 | return KeyTy(int_type, any_type); |
1758 | } |
1759 | |
1760 | bool operator==(const KeyTy &tblgenKey) const { |
1761 | return (int_type == std::get<0>(tblgenKey)) && (any_type == std::get<1>(tblgenKey)); |
1762 | } |
1763 | |
1764 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1765 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
1766 | } |
1767 | |
1768 | static TestAttrWithTypeParamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1769 | auto int_type = std::get<0>(tblgenKey); |
1770 | auto any_type = std::get<1>(tblgenKey); |
1771 | return new (allocator.allocate<TestAttrWithTypeParamAttrStorage>()) TestAttrWithTypeParamAttrStorage(int_type, any_type); |
1772 | } |
1773 | |
1774 | ::mlir::IntegerType int_type; |
1775 | ::mlir::Type any_type; |
1776 | }; |
1777 | } // namespace detail |
1778 | TestAttrWithTypeParamAttr TestAttrWithTypeParamAttr::get(::mlir::MLIRContext *context, ::mlir::IntegerType int_type, ::mlir::Type any_type) { |
1779 | return Base::get(context, int_type, any_type); |
1780 | } |
1781 | |
1782 | ::mlir::Attribute TestAttrWithTypeParamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1783 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1784 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1785 | (void) odsLoc; |
1786 | ::mlir::FailureOr<::mlir::IntegerType> _result_int_type; |
1787 | ::mlir::FailureOr<::mlir::Type> _result_any_type; |
1788 | // Parse literal '<' |
1789 | if (odsParser.parseLess()) return {}; |
1790 | |
1791 | // Parse variable 'int_type' |
1792 | _result_int_type = ::mlir::FieldParser<::mlir::IntegerType>::parse(odsParser); |
1793 | if (::mlir::failed(_result_int_type)) { |
1794 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithTypeParam parameter 'int_type' which is to be a `::mlir::IntegerType`"); |
1795 | return {}; |
1796 | } |
1797 | // Parse literal ',' |
1798 | if (odsParser.parseComma()) return {}; |
1799 | |
1800 | // Parse variable 'any_type' |
1801 | _result_any_type = ::mlir::FieldParser<::mlir::Type>::parse(odsParser); |
1802 | if (::mlir::failed(_result_any_type)) { |
1803 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestAttrWithTypeParam parameter 'any_type' which is to be a `::mlir::Type`"); |
1804 | return {}; |
1805 | } |
1806 | // Parse literal '>' |
1807 | if (odsParser.parseGreater()) return {}; |
1808 | assert(::mlir::succeeded(_result_int_type))(static_cast <bool> (::mlir::succeeded(_result_int_type )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_int_type)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1808 , __extension__ __PRETTY_FUNCTION__)); |
1809 | assert(::mlir::succeeded(_result_any_type))(static_cast <bool> (::mlir::succeeded(_result_any_type )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_any_type)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1809 , __extension__ __PRETTY_FUNCTION__)); |
1810 | return TestAttrWithTypeParamAttr::get(odsParser.getContext(), |
1811 | ::mlir::IntegerType((*_result_int_type)), |
1812 | ::mlir::Type((*_result_any_type))); |
1813 | } |
1814 | |
1815 | void TestAttrWithTypeParamAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1816 | ::mlir::Builder odsBuilder(getContext()); |
1817 | odsPrinter << "<"; |
1818 | odsPrinter.printStrippedAttrOrType(getIntType()); |
1819 | odsPrinter << ","; |
1820 | odsPrinter << ' '; |
1821 | odsPrinter.printStrippedAttrOrType(getAnyType()); |
1822 | odsPrinter << ">"; |
1823 | } |
1824 | |
1825 | ::mlir::IntegerType TestAttrWithTypeParamAttr::getIntType() const { |
1826 | return getImpl()->int_type; |
1827 | } |
1828 | |
1829 | ::mlir::Type TestAttrWithTypeParamAttr::getAnyType() const { |
1830 | return getImpl()->any_type; |
1831 | } |
1832 | |
1833 | } // namespace test |
1834 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestAttrWithTypeParamAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestAttrWithTypeParamAttr>::id = {}; } } |
1835 | namespace test { |
1836 | namespace detail { |
1837 | struct TestBitEnumAttrStorage : public ::mlir::AttributeStorage { |
1838 | using KeyTy = std::tuple<test::TestBitEnum>; |
1839 | TestBitEnumAttrStorage(test::TestBitEnum value) : value(value) {} |
1840 | |
1841 | KeyTy getAsKey() const { |
1842 | return KeyTy(value); |
1843 | } |
1844 | |
1845 | bool operator==(const KeyTy &tblgenKey) const { |
1846 | return (value == std::get<0>(tblgenKey)); |
1847 | } |
1848 | |
1849 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1850 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
1851 | } |
1852 | |
1853 | static TestBitEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1854 | auto value = std::get<0>(tblgenKey); |
1855 | return new (allocator.allocate<TestBitEnumAttrStorage>()) TestBitEnumAttrStorage(value); |
1856 | } |
1857 | |
1858 | test::TestBitEnum value; |
1859 | }; |
1860 | } // namespace detail |
1861 | TestBitEnumAttr TestBitEnumAttr::get(::mlir::MLIRContext *context, test::TestBitEnum value) { |
1862 | return Base::get(context, value); |
1863 | } |
1864 | |
1865 | ::mlir::Attribute TestBitEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1866 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1867 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1868 | (void) odsLoc; |
1869 | ::mlir::FailureOr<test::TestBitEnum> _result_value; |
1870 | // Parse literal '<' |
1871 | if (odsParser.parseLess()) return {}; |
1872 | |
1873 | // Parse variable 'value' |
1874 | _result_value = [&]() -> ::mlir::FailureOr<test::TestBitEnum> { |
1875 | test::TestBitEnum flags = {}; |
1876 | auto loc = odsParser.getCurrentLocation(); |
1877 | ::llvm::StringRef enumKeyword; |
1878 | do { |
1879 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
1880 | return ::mlir::failure(); |
1881 | auto maybeEnum = test::symbolizeTestBitEnum(enumKeyword); |
1882 | if (!maybeEnum) { |
1883 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestBitEnum" << " to be one of: " << "read" << ", " << "write" << ", " << "execute")}; |
1884 | } |
1885 | flags = flags | *maybeEnum; |
1886 | } while(::mlir::succeeded(odsParser.parseOptionalComma())); |
1887 | return flags; |
1888 | }(); |
1889 | if (::mlir::failed(_result_value)) { |
1890 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestBitEnumAttr parameter 'value' which is to be a `test::TestBitEnum`"); |
1891 | return {}; |
1892 | } |
1893 | // Parse literal '>' |
1894 | if (odsParser.parseGreater()) return {}; |
1895 | assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_value)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1895 , __extension__ __PRETTY_FUNCTION__)); |
1896 | return TestBitEnumAttr::get(odsParser.getContext(), |
1897 | test::TestBitEnum((*_result_value))); |
1898 | } |
1899 | |
1900 | void TestBitEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1901 | ::mlir::Builder odsBuilder(getContext()); |
1902 | odsPrinter << "<"; |
1903 | odsPrinter << stringifyTestBitEnum(getValue()); |
1904 | odsPrinter << ">"; |
1905 | } |
1906 | |
1907 | test::TestBitEnum TestBitEnumAttr::getValue() const { |
1908 | return getImpl()->value; |
1909 | } |
1910 | |
1911 | } // namespace test |
1912 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestBitEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestBitEnumAttr>::id = {}; } } |
1913 | namespace test { |
1914 | namespace detail { |
1915 | struct TestBitEnumVerticalBarAttrStorage : public ::mlir::AttributeStorage { |
1916 | using KeyTy = std::tuple<test::TestBitEnumVerticalBar>; |
1917 | TestBitEnumVerticalBarAttrStorage(test::TestBitEnumVerticalBar value) : value(value) {} |
1918 | |
1919 | KeyTy getAsKey() const { |
1920 | return KeyTy(value); |
1921 | } |
1922 | |
1923 | bool operator==(const KeyTy &tblgenKey) const { |
1924 | return (value == std::get<0>(tblgenKey)); |
1925 | } |
1926 | |
1927 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1928 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
1929 | } |
1930 | |
1931 | static TestBitEnumVerticalBarAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1932 | auto value = std::get<0>(tblgenKey); |
1933 | return new (allocator.allocate<TestBitEnumVerticalBarAttrStorage>()) TestBitEnumVerticalBarAttrStorage(value); |
1934 | } |
1935 | |
1936 | test::TestBitEnumVerticalBar value; |
1937 | }; |
1938 | } // namespace detail |
1939 | TestBitEnumVerticalBarAttr TestBitEnumVerticalBarAttr::get(::mlir::MLIRContext *context, test::TestBitEnumVerticalBar value) { |
1940 | return Base::get(context, value); |
1941 | } |
1942 | |
1943 | ::mlir::Attribute TestBitEnumVerticalBarAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1944 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1945 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1946 | (void) odsLoc; |
1947 | ::mlir::FailureOr<test::TestBitEnumVerticalBar> _result_value; |
1948 | // Parse literal '<' |
1949 | if (odsParser.parseLess()) return {}; |
1950 | |
1951 | // Parse variable 'value' |
1952 | _result_value = [&]() -> ::mlir::FailureOr<test::TestBitEnumVerticalBar> { |
1953 | test::TestBitEnumVerticalBar flags = {}; |
1954 | auto loc = odsParser.getCurrentLocation(); |
1955 | ::llvm::StringRef enumKeyword; |
1956 | do { |
1957 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
1958 | return ::mlir::failure(); |
1959 | auto maybeEnum = test::symbolizeTestBitEnumVerticalBar(enumKeyword); |
1960 | if (!maybeEnum) { |
1961 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestBitEnumVerticalBar" << " to be one of: " << "user" << ", " << "group" << ", " << "other")}; |
1962 | } |
1963 | flags = flags | *maybeEnum; |
1964 | } while(::mlir::succeeded(odsParser.parseOptionalVerticalBar())); |
1965 | return flags; |
1966 | }(); |
1967 | if (::mlir::failed(_result_value)) { |
1968 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestBitEnumVerticalBarAttr parameter 'value' which is to be a `test::TestBitEnumVerticalBar`"); |
1969 | return {}; |
1970 | } |
1971 | // Parse literal '>' |
1972 | if (odsParser.parseGreater()) return {}; |
1973 | assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_value)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 1973 , __extension__ __PRETTY_FUNCTION__)); |
1974 | return TestBitEnumVerticalBarAttr::get(odsParser.getContext(), |
1975 | test::TestBitEnumVerticalBar((*_result_value))); |
1976 | } |
1977 | |
1978 | void TestBitEnumVerticalBarAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1979 | ::mlir::Builder odsBuilder(getContext()); |
1980 | odsPrinter << "<"; |
1981 | odsPrinter << stringifyTestBitEnumVerticalBar(getValue()); |
1982 | odsPrinter << ">"; |
1983 | } |
1984 | |
1985 | test::TestBitEnumVerticalBar TestBitEnumVerticalBarAttr::getValue() const { |
1986 | return getImpl()->value; |
1987 | } |
1988 | |
1989 | } // namespace test |
1990 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestBitEnumVerticalBarAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestBitEnumVerticalBarAttr>::id = {}; } } |
1991 | namespace test { |
1992 | namespace detail { |
1993 | struct TestCustomAnchorAttrStorage : public ::mlir::AttributeStorage { |
1994 | using KeyTy = std::tuple<int, std::optional<int>>; |
1995 | TestCustomAnchorAttrStorage(int a, std::optional<int> b) : a(a), b(b) {} |
1996 | |
1997 | KeyTy getAsKey() const { |
1998 | return KeyTy(a, b); |
1999 | } |
2000 | |
2001 | bool operator==(const KeyTy &tblgenKey) const { |
2002 | return (a == std::get<0>(tblgenKey)) && (b == std::get<1>(tblgenKey)); |
2003 | } |
2004 | |
2005 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2006 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
2007 | } |
2008 | |
2009 | static TestCustomAnchorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2010 | auto a = std::get<0>(tblgenKey); |
2011 | auto b = std::get<1>(tblgenKey); |
2012 | return new (allocator.allocate<TestCustomAnchorAttrStorage>()) TestCustomAnchorAttrStorage(a, b); |
2013 | } |
2014 | |
2015 | int a; |
2016 | std::optional<int> b; |
2017 | }; |
2018 | } // namespace detail |
2019 | TestCustomAnchorAttr TestCustomAnchorAttr::get(::mlir::MLIRContext *context, int a, std::optional<int> b) { |
2020 | return Base::get(context, a, b); |
2021 | } |
2022 | |
2023 | ::mlir::Attribute TestCustomAnchorAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2024 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2025 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2026 | (void) odsLoc; |
2027 | ::mlir::FailureOr<int> _result_a; |
2028 | ::mlir::FailureOr<std::optional<int>> _result_b; |
2029 | // Parse literal '<' |
2030 | if (odsParser.parseLess()) return {}; |
2031 | |
2032 | // Parse variable 'a' |
2033 | _result_a = ::mlir::FieldParser<int>::parse(odsParser); |
2034 | if (::mlir::failed(_result_a)) { |
2035 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestCustomAnchor parameter 'a' which is to be a `int`"); |
2036 | return {}; |
2037 | } |
2038 | // Parse literal '>' |
2039 | if (odsParser.parseOptionalGreater()) { |
2040 | // Parse literal ',' |
2041 | if (odsParser.parseComma()) return {}; |
2042 | { |
2043 | auto odsCustomLoc = odsParser.getCurrentLocation(); |
2044 | (void)odsCustomLoc; |
2045 | auto odsCustomResult = parseTrueFalse(odsParser, |
2046 | ::mlir::detail::unwrapForCustomParse(_result_b)); |
2047 | if (::mlir::failed(odsCustomResult)) return {}; |
2048 | } |
2049 | // Parse literal '>' |
2050 | if (odsParser.parseGreater()) return {}; |
2051 | } else { |
2052 | } |
2053 | assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 2053, __extension__ __PRETTY_FUNCTION__)); |
2054 | return TestCustomAnchorAttr::get(odsParser.getContext(), |
2055 | int((*_result_a)), |
2056 | std::optional<int>((_result_b.value_or(std::optional<int>())))); |
2057 | } |
2058 | |
2059 | void TestCustomAnchorAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2060 | ::mlir::Builder odsBuilder(getContext()); |
2061 | odsPrinter << "<"; |
2062 | odsPrinter.printStrippedAttrOrType(getA()); |
2063 | if (!(!(getB() == std::optional<int>()))) { |
2064 | odsPrinter << ">"; |
2065 | } else { |
2066 | odsPrinter << ","; |
2067 | odsPrinter << ' '; |
2068 | printTrueFalse(odsPrinter, |
2069 | getB()); |
2070 | odsPrinter << ">"; |
2071 | } |
2072 | } |
2073 | |
2074 | int TestCustomAnchorAttr::getA() const { |
2075 | return getImpl()->a; |
2076 | } |
2077 | |
2078 | std::optional<int> TestCustomAnchorAttr::getB() const { |
2079 | return getImpl()->b; |
2080 | } |
2081 | |
2082 | } // namespace test |
2083 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestCustomAnchorAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestCustomAnchorAttr>::id = {}; } } |
2084 | namespace test { |
2085 | namespace detail { |
2086 | struct TestEnumAttrStorage : public ::mlir::AttributeStorage { |
2087 | using KeyTy = std::tuple<test::TestEnum>; |
2088 | TestEnumAttrStorage(test::TestEnum value) : value(value) {} |
2089 | |
2090 | KeyTy getAsKey() const { |
2091 | return KeyTy(value); |
2092 | } |
2093 | |
2094 | bool operator==(const KeyTy &tblgenKey) const { |
2095 | return (value == std::get<0>(tblgenKey)); |
2096 | } |
2097 | |
2098 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2099 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
2100 | } |
2101 | |
2102 | static TestEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2103 | auto value = std::get<0>(tblgenKey); |
2104 | return new (allocator.allocate<TestEnumAttrStorage>()) TestEnumAttrStorage(value); |
2105 | } |
2106 | |
2107 | test::TestEnum value; |
2108 | }; |
2109 | } // namespace detail |
2110 | TestEnumAttr TestEnumAttr::get(::mlir::MLIRContext *context, test::TestEnum value) { |
2111 | return Base::get(context, value); |
2112 | } |
2113 | |
2114 | ::mlir::Attribute TestEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2115 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2116 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2117 | (void) odsLoc; |
2118 | ::mlir::FailureOr<test::TestEnum> _result_value; |
2119 | |
2120 | // Parse variable 'value' |
2121 | _result_value = [&]() -> ::mlir::FailureOr<test::TestEnum> { |
2122 | auto loc = odsParser.getCurrentLocation(); |
2123 | ::llvm::StringRef enumKeyword; |
2124 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
2125 | return ::mlir::failure(); |
2126 | auto maybeEnum = test::symbolizeTestEnum(enumKeyword); |
2127 | if (maybeEnum) |
2128 | return *maybeEnum; |
2129 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "test::TestEnum" << " to be one of: " << "first" << ", " << "second" << ", " << "third")}; |
2130 | }(); |
2131 | if (::mlir::failed(_result_value)) { |
2132 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestEnumAttr parameter 'value' which is to be a `test::TestEnum`"); |
2133 | return {}; |
2134 | } |
2135 | assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_value)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 2135 , __extension__ __PRETTY_FUNCTION__)); |
2136 | return TestEnumAttr::get(odsParser.getContext(), |
2137 | test::TestEnum((*_result_value))); |
2138 | } |
2139 | |
2140 | void TestEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2141 | ::mlir::Builder odsBuilder(getContext()); |
2142 | odsPrinter << ' '; |
2143 | odsPrinter << stringifyTestEnum(getValue()); |
2144 | } |
2145 | |
2146 | test::TestEnum TestEnumAttr::getValue() const { |
2147 | return getImpl()->value; |
2148 | } |
2149 | |
2150 | } // namespace test |
2151 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestEnumAttr>::id = {}; } } |
2152 | namespace test { |
2153 | namespace detail { |
2154 | struct TestExtern1DI64ElementsAttrStorage : public ::mlir::AttributeStorage { |
2155 | using KeyTy = std::tuple<::mlir::ShapedType, TestDialectResourceBlobHandle>; |
2156 | TestExtern1DI64ElementsAttrStorage(::mlir::ShapedType type, TestDialectResourceBlobHandle handle) : type(type), handle(handle) {} |
2157 | |
2158 | KeyTy getAsKey() const { |
2159 | return KeyTy(type, handle); |
2160 | } |
2161 | |
2162 | bool operator==(const KeyTy &tblgenKey) const { |
2163 | return (type == std::get<0>(tblgenKey)) && (handle == std::get<1>(tblgenKey)); |
2164 | } |
2165 | |
2166 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2167 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
2168 | } |
2169 | |
2170 | static TestExtern1DI64ElementsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2171 | auto type = std::get<0>(tblgenKey); |
2172 | auto handle = std::get<1>(tblgenKey); |
2173 | return new (allocator.allocate<TestExtern1DI64ElementsAttrStorage>()) TestExtern1DI64ElementsAttrStorage(type, handle); |
2174 | } |
2175 | |
2176 | ::mlir::ShapedType type; |
2177 | TestDialectResourceBlobHandle handle; |
2178 | }; |
2179 | } // namespace detail |
2180 | TestExtern1DI64ElementsAttr TestExtern1DI64ElementsAttr::get(::mlir::MLIRContext *context, ::mlir::ShapedType type, TestDialectResourceBlobHandle handle) { |
2181 | return Base::get(context, type, handle); |
2182 | } |
2183 | |
2184 | ::mlir::Attribute TestExtern1DI64ElementsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2185 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2186 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2187 | (void) odsLoc; |
2188 | ::mlir::FailureOr<::mlir::ShapedType> _result_type; |
2189 | |
2190 | if (odsType) { |
2191 | if (auto reqType = odsType.dyn_cast<::mlir::ShapedType>()) { |
2192 | _result_type = reqType; |
2193 | } else { |
2194 | odsParser.emitError(odsLoc, "invalid kind of type specified"); |
2195 | return {}; |
2196 | } |
2197 | } else { |
2198 | odsParser.emitError(odsLoc, "expected a trailing type"); |
2199 | return {}; |
2200 | } |
2201 | ::mlir::FailureOr<TestDialectResourceBlobHandle> _result_handle; |
2202 | // Parse literal '<' |
2203 | if (odsParser.parseLess()) return {}; |
2204 | |
2205 | // Parse variable 'handle' |
2206 | _result_handle = odsParser.parseResourceHandle<TestDialectResourceBlobHandle>(); |
2207 | if (::mlir::failed(_result_handle)) { |
2208 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestExtern1DI64ElementsAttr parameter 'handle' which is to be a `TestDialectResourceBlobHandle`"); |
2209 | return {}; |
2210 | } |
2211 | // Parse literal '>' |
2212 | if (odsParser.parseGreater()) return {}; |
2213 | assert(::mlir::succeeded(_result_type))(static_cast <bool> (::mlir::succeeded(_result_type)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_type)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 2213 , __extension__ __PRETTY_FUNCTION__)); |
2214 | assert(::mlir::succeeded(_result_handle))(static_cast <bool> (::mlir::succeeded(_result_handle)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_handle)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 2214 , __extension__ __PRETTY_FUNCTION__)); |
2215 | return TestExtern1DI64ElementsAttr::get(odsParser.getContext(), |
2216 | ::mlir::ShapedType((*_result_type)), |
2217 | TestDialectResourceBlobHandle((*_result_handle))); |
2218 | } |
2219 | |
2220 | void TestExtern1DI64ElementsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2221 | ::mlir::Builder odsBuilder(getContext()); |
2222 | odsPrinter << "<"; |
2223 | odsPrinter.printResourceHandle(getHandle()); |
2224 | odsPrinter << ">"; |
2225 | } |
2226 | |
2227 | ::mlir::ShapedType TestExtern1DI64ElementsAttr::getType() const { |
2228 | return getImpl()->type; |
2229 | } |
2230 | |
2231 | TestDialectResourceBlobHandle TestExtern1DI64ElementsAttr::getHandle() const { |
2232 | return getImpl()->handle; |
2233 | } |
2234 | |
2235 | } // namespace test |
2236 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestExtern1DI64ElementsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestExtern1DI64ElementsAttr>::id = {}; } } |
2237 | namespace test { |
2238 | namespace detail { |
2239 | struct TestI64ElementsAttrStorage : public ::mlir::AttributeStorage { |
2240 | using KeyTy = std::tuple<::mlir::ShapedType, ::llvm::ArrayRef<uint64_t>>; |
2241 | TestI64ElementsAttrStorage(::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) : type(type), elements(elements) {} |
2242 | |
2243 | KeyTy getAsKey() const { |
2244 | return KeyTy(type, elements); |
2245 | } |
2246 | |
2247 | bool operator==(const KeyTy &tblgenKey) const { |
2248 | return (type == std::get<0>(tblgenKey)) && (elements == std::get<1>(tblgenKey)); |
2249 | } |
2250 | |
2251 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2252 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
2253 | } |
2254 | |
2255 | static TestI64ElementsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2256 | auto type = std::get<0>(tblgenKey); |
2257 | auto elements = std::get<1>(tblgenKey); |
2258 | elements = allocator.copyInto(elements); |
2259 | return new (allocator.allocate<TestI64ElementsAttrStorage>()) TestI64ElementsAttrStorage(type, elements); |
2260 | } |
2261 | |
2262 | ::mlir::ShapedType type; |
2263 | ::llvm::ArrayRef<uint64_t> elements; |
2264 | }; |
2265 | } // namespace detail |
2266 | TestI64ElementsAttr TestI64ElementsAttr::get(::mlir::MLIRContext *context, ::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) { |
2267 | return Base::get(context, type, elements); |
2268 | } |
2269 | |
2270 | TestI64ElementsAttr TestI64ElementsAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::mlir::ShapedType type, ::llvm::ArrayRef<uint64_t> elements) { |
2271 | return Base::getChecked(emitError, context, type, elements); |
2272 | } |
2273 | |
2274 | ::mlir::ShapedType TestI64ElementsAttr::getType() const { |
2275 | return getImpl()->type; |
2276 | } |
2277 | |
2278 | ::llvm::ArrayRef<uint64_t> TestI64ElementsAttr::getElements() const { |
2279 | return getImpl()->elements; |
2280 | } |
2281 | |
2282 | } // namespace test |
2283 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestI64ElementsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestI64ElementsAttr>::id = {}; } } |
2284 | namespace test { |
2285 | namespace detail { |
2286 | struct TestOverrideBuilderAttrStorage : public ::mlir::AttributeStorage { |
2287 | using KeyTy = std::tuple<int>; |
2288 | TestOverrideBuilderAttrStorage(int a) : a(a) {} |
2289 | |
2290 | KeyTy getAsKey() const { |
2291 | return KeyTy(a); |
2292 | } |
2293 | |
2294 | bool operator==(const KeyTy &tblgenKey) const { |
2295 | return (a == std::get<0>(tblgenKey)); |
2296 | } |
2297 | |
2298 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2299 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
2300 | } |
2301 | |
2302 | static TestOverrideBuilderAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2303 | auto a = std::get<0>(tblgenKey); |
2304 | return new (allocator.allocate<TestOverrideBuilderAttrStorage>()) TestOverrideBuilderAttrStorage(a); |
2305 | } |
2306 | |
2307 | int a; |
2308 | }; |
2309 | } // namespace detail |
2310 | ::mlir::Attribute TestOverrideBuilderAttr::get(::mlir::MLIRContext *context, int a) { |
2311 | return ::mlir::IntegerAttr::get(::mlir::IndexType::get(context), a); |
2312 | } |
2313 | |
2314 | ::mlir::Attribute TestOverrideBuilderAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int a) { |
2315 | return ::mlir::IntegerAttr::get(::mlir::IndexType::get(context), a); |
2316 | } |
2317 | |
2318 | ::mlir::Attribute TestOverrideBuilderAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2319 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2320 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2321 | (void) odsLoc; |
2322 | ::mlir::FailureOr<int> _result_a; |
2323 | // Parse literal '<' |
2324 | if (odsParser.parseLess()) return {}; |
2325 | |
2326 | // Parse variable 'a' |
2327 | _result_a = ::mlir::FieldParser<int>::parse(odsParser); |
2328 | if (::mlir::failed(_result_a)) { |
2329 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestOverrideBuilderAttr parameter 'a' which is to be a `int`"); |
2330 | return {}; |
2331 | } |
2332 | // Parse literal '>' |
2333 | if (odsParser.parseGreater()) return {}; |
2334 | assert(::mlir::succeeded(_result_a))(static_cast <bool> (::mlir::succeeded(_result_a)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_a)", "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc" , 2334, __extension__ __PRETTY_FUNCTION__)); |
2335 | return odsParser.getChecked<TestOverrideBuilderAttr>(odsLoc, odsParser.getContext(), |
2336 | int((*_result_a))); |
2337 | } |
2338 | |
2339 | void TestOverrideBuilderAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2340 | ::mlir::Builder odsBuilder(getContext()); |
2341 | odsPrinter << "<"; |
2342 | odsPrinter.printStrippedAttrOrType(getA()); |
2343 | odsPrinter << ">"; |
2344 | } |
2345 | |
2346 | int TestOverrideBuilderAttr::getA() const { |
2347 | return getImpl()->a; |
2348 | } |
2349 | |
2350 | } // namespace test |
2351 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestOverrideBuilderAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestOverrideBuilderAttr>::id = {}; } } |
2352 | namespace test { |
2353 | namespace detail { |
2354 | struct SimpleEnumAttrStorage : public ::mlir::AttributeStorage { |
2355 | using KeyTy = std::tuple<::test::SimpleEnum>; |
2356 | SimpleEnumAttrStorage(::test::SimpleEnum value) : value(value) {} |
2357 | |
2358 | KeyTy getAsKey() const { |
2359 | return KeyTy(value); |
2360 | } |
2361 | |
2362 | bool operator==(const KeyTy &tblgenKey) const { |
2363 | return (value == std::get<0>(tblgenKey)); |
2364 | } |
2365 | |
2366 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2367 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
2368 | } |
2369 | |
2370 | static SimpleEnumAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2371 | auto value = std::get<0>(tblgenKey); |
2372 | return new (allocator.allocate<SimpleEnumAttrStorage>()) SimpleEnumAttrStorage(value); |
2373 | } |
2374 | |
2375 | ::test::SimpleEnum value; |
2376 | }; |
2377 | } // namespace detail |
2378 | SimpleEnumAttr SimpleEnumAttr::get(::mlir::MLIRContext *context, ::test::SimpleEnum value) { |
2379 | return Base::get(context, value); |
2380 | } |
2381 | |
2382 | ::mlir::Attribute SimpleEnumAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2383 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2384 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2385 | (void) odsLoc; |
2386 | ::mlir::FailureOr<::test::SimpleEnum> _result_value; |
2387 | |
2388 | // Parse variable 'value' |
2389 | _result_value = [&]() -> ::mlir::FailureOr<::test::SimpleEnum> { |
2390 | auto loc = odsParser.getCurrentLocation(); |
2391 | ::llvm::StringRef enumKeyword; |
2392 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
2393 | return ::mlir::failure(); |
2394 | auto maybeEnum = ::test::symbolizeSimpleEnum(enumKeyword); |
2395 | if (maybeEnum) |
2396 | return *maybeEnum; |
2397 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::test::SimpleEnum" << " to be one of: " << "a" << ", " << "b")}; |
2398 | }(); |
2399 | if (::mlir::failed(_result_value)) { |
2400 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TestSimpleEnumAttr parameter 'value' which is to be a `::test::SimpleEnum`"); |
2401 | return {}; |
2402 | } |
2403 | assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_value)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 2403 , __extension__ __PRETTY_FUNCTION__)); |
2404 | return SimpleEnumAttr::get(odsParser.getContext(), |
2405 | ::test::SimpleEnum((*_result_value))); |
2406 | } |
2407 | |
2408 | void SimpleEnumAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2409 | ::mlir::Builder odsBuilder(getContext()); |
2410 | odsPrinter << stringifySimpleEnum(getValue()); |
2411 | } |
2412 | |
2413 | ::test::SimpleEnum SimpleEnumAttr::getValue() const { |
2414 | return getImpl()->value; |
2415 | } |
2416 | |
2417 | } // namespace test |
2418 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::SimpleEnumAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::SimpleEnumAttr>::id = {}; } } |
2419 | namespace test { |
2420 | namespace detail { |
2421 | struct TestSubElementsAccessAttrStorage : public ::mlir::AttributeStorage { |
2422 | using KeyTy = std::tuple<::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute>; |
2423 | TestSubElementsAccessAttrStorage(::mlir::Attribute first, ::mlir::Attribute second, ::mlir::Attribute third) : first(first), second(second), third(third) {} |
2424 | |
2425 | KeyTy getAsKey() const { |
2426 | return KeyTy(first, second, third); |
2427 | } |
2428 | |
2429 | bool operator==(const KeyTy &tblgenKey) const { |
2430 | return (first == std::get<0>(tblgenKey)) && (second == std::get<1>(tblgenKey)) && (third == std::get<2>(tblgenKey)); |
2431 | } |
2432 | |
2433 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2434 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); |
2435 | } |
2436 | |
2437 | static TestSubElementsAccessAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2438 | auto first = std::get<0>(tblgenKey); |
2439 | auto second = std::get<1>(tblgenKey); |
2440 | auto third = std::get<2>(tblgenKey); |
2441 | return new (allocator.allocate<TestSubElementsAccessAttrStorage>()) TestSubElementsAccessAttrStorage(first, second, third); |
2442 | } |
2443 | |
2444 | ::mlir::Attribute first; |
2445 | ::mlir::Attribute second; |
2446 | ::mlir::Attribute third; |
2447 | }; |
2448 | } // namespace detail |
2449 | TestSubElementsAccessAttr TestSubElementsAccessAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute first, ::mlir::Attribute second, ::mlir::Attribute third) { |
2450 | return Base::get(context, first, second, third); |
2451 | } |
2452 | |
2453 | ::mlir::Attribute TestSubElementsAccessAttr::getFirst() const { |
2454 | return getImpl()->first; |
2455 | } |
2456 | |
2457 | ::mlir::Attribute TestSubElementsAccessAttr::getSecond() const { |
2458 | return getImpl()->second; |
2459 | } |
2460 | |
2461 | ::mlir::Attribute TestSubElementsAccessAttr::getThird() const { |
2462 | return getImpl()->third; |
2463 | } |
2464 | |
2465 | } // namespace test |
2466 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::TestSubElementsAccessAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::TestSubElementsAccessAttr>::id = {}; } } |
2467 | namespace test { |
2468 | namespace detail { |
2469 | struct IteratorTypeAttrStorage : public ::mlir::AttributeStorage { |
2470 | using KeyTy = std::tuple<::mlir::utils::IteratorType>; |
2471 | IteratorTypeAttrStorage(::mlir::utils::IteratorType value) : value(value) {} |
2472 | |
2473 | KeyTy getAsKey() const { |
2474 | return KeyTy(value); |
2475 | } |
2476 | |
2477 | bool operator==(const KeyTy &tblgenKey) const { |
2478 | return (value == std::get<0>(tblgenKey)); |
2479 | } |
2480 | |
2481 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2482 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
2483 | } |
2484 | |
2485 | static IteratorTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2486 | auto value = std::get<0>(tblgenKey); |
2487 | return new (allocator.allocate<IteratorTypeAttrStorage>()) IteratorTypeAttrStorage(value); |
2488 | } |
2489 | |
2490 | ::mlir::utils::IteratorType value; |
2491 | }; |
2492 | } // namespace detail |
2493 | IteratorTypeAttr IteratorTypeAttr::get(::mlir::MLIRContext *context, ::mlir::utils::IteratorType value) { |
2494 | return Base::get(context, value); |
2495 | } |
2496 | |
2497 | ::mlir::Attribute IteratorTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2498 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2499 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2500 | (void) odsLoc; |
2501 | ::mlir::FailureOr<::mlir::utils::IteratorType> _result_value; |
2502 | // Parse literal '<' |
2503 | if (odsParser.parseLess()) return {}; |
2504 | |
2505 | // Parse variable 'value' |
2506 | _result_value = [&]() -> ::mlir::FailureOr<::mlir::utils::IteratorType> { |
2507 | auto loc = odsParser.getCurrentLocation(); |
2508 | ::llvm::StringRef enumKeyword; |
2509 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
2510 | return ::mlir::failure(); |
2511 | auto maybeEnum = ::mlir::utils::symbolizeIteratorType(enumKeyword); |
2512 | if (maybeEnum) |
2513 | return *maybeEnum; |
2514 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::utils::IteratorType" << " to be one of: " << "parallel" << ", " << "reduction")}; |
2515 | }(); |
2516 | if (::mlir::failed(_result_value)) { |
2517 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Test_IteratorTypeEnum parameter 'value' which is to be a `::mlir::utils::IteratorType`"); |
2518 | return {}; |
2519 | } |
2520 | // Parse literal '>' |
2521 | if (odsParser.parseGreater()) return {}; |
2522 | assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_value)" , "tools/mlir/test/lib/Dialect/Test/TestAttrDefs.cpp.inc", 2522 , __extension__ __PRETTY_FUNCTION__)); |
2523 | return IteratorTypeAttr::get(odsParser.getContext(), |
2524 | ::mlir::utils::IteratorType((*_result_value))); |
2525 | } |
2526 | |
2527 | void IteratorTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2528 | ::mlir::Builder odsBuilder(getContext()); |
2529 | odsPrinter << "<"; |
2530 | odsPrinter << stringifyIteratorType(getValue()); |
2531 | odsPrinter << ">"; |
2532 | } |
2533 | |
2534 | ::mlir::utils::IteratorType IteratorTypeAttr::getValue() const { |
2535 | return getImpl()->value; |
2536 | } |
2537 | |
2538 | } // namespace test |
2539 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IteratorTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::test::IteratorTypeAttr>::id = {}; } } |
2540 | namespace test { |
2541 | |
2542 | /// Parse an attribute registered to this dialect. |
2543 | ::mlir::Attribute TestDialect::parseAttribute(::mlir::DialectAsmParser &parser, |
2544 | ::mlir::Type type) const { |
2545 | ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); |
2546 | ::llvm::StringRef attrTag; |
2547 | { |
2548 | ::mlir::Attribute attr; |
2549 | auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); |
2550 | if (parseResult.has_value()) |
2551 | return attr; |
2552 | } |
2553 | |
2554 | { |
2555 | ::mlir::Attribute genAttr; |
2556 | auto parseResult = parseOptionalDynamicAttr(attrTag, parser, genAttr); |
2557 | if (parseResult.has_value()) { |
2558 | if (::mlir::succeeded(parseResult.value())) |
2559 | return genAttr; |
2560 | return Attribute(); |
2561 | } |
2562 | } |
2563 | |
2564 | parser.emitError(typeLoc) << "unknown attribute `" |
2565 | << attrTag << "` in dialect `" << getNamespace() << "`"; |
2566 | return {}; |
2567 | } |
2568 | /// Print an attribute registered to this dialect. |
2569 | void TestDialect::printAttribute(::mlir::Attribute attr, |
2570 | ::mlir::DialectAsmPrinter &printer) const { |
2571 | if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) |
2572 | return; |
2573 | |
2574 | if (::mlir::succeeded(printIfDynamicAttr(attr, printer))) |
2575 | return; |
2576 | |
2577 | } |
2578 | } // namespace test |
2579 | |
2580 | #endif // GET_ATTRDEF_CLASSES |
2581 |