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::mlir::acc::ClauseDefaultValueAttr,
13::mlir::acc::ReductionOperatorAttr,
14::mlir::acc::ParLevelAttr,
15::mlir::acc::RecipeKindAttr,
16::mlir::acc::DataClauseAttr,
17::mlir::acc::DataClauseModifierAttr,
18::mlir::acc::DeclareAttr,
19::mlir::acc::DeclareActionAttr,
20::mlir::acc::LoopLocAttr,
21::mlir::acc::DeviceTypeAttr,
22::mlir::acc::GangArgTypeAttr,
23::mlir::acc::CombinedConstructsTypeAttr,
24::mlir::acc::ConstructAttr,
25::mlir::acc::VarNameAttr,
26::mlir::acc::RoutineInfoAttr,
27::mlir::acc::SpecializedRoutineAttr,
28::mlir::acc::DataDescKindAttr,
29::mlir::acc::MapFlagsAttr,
30::mlir::acc::GPUParallelDimAttr,
31::mlir::acc::GPUParallelDimsAttr,
32::mlir::acc::GPUBlockRedundantAttr,
33::mlir::acc::ChunkSizeAttr,
34::mlir::acc::ActiveParDimsAttr
35
36#endif // GET_ATTRDEF_LIST
37
38#ifdef GET_ATTRDEF_CLASSES
39#undef GET_ATTRDEF_CLASSES
40
41#include "llvm/ADT/TypeSwitch.h"
42#include "mlir/IR/Builders.h"
43#include "mlir/IR/DialectImplementation.h"
44#include "mlir/IR/OpImplementation.h"
45
46static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
47 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser, mnemonic)
48 .Case(::mlir::acc::ClauseDefaultValueAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
49 value = ::mlir::acc::ClauseDefaultValueAttr::parse(parser, type);
50 return ::mlir::success(!!value);
51 })
52 .Case(::mlir::acc::ReductionOperatorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
53 value = ::mlir::acc::ReductionOperatorAttr::parse(parser, type);
54 return ::mlir::success(!!value);
55 })
56 .Case(::mlir::acc::ParLevelAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
57 value = ::mlir::acc::ParLevelAttr::parse(parser, type);
58 return ::mlir::success(!!value);
59 })
60 .Case(::mlir::acc::RecipeKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
61 value = ::mlir::acc::RecipeKindAttr::parse(parser, type);
62 return ::mlir::success(!!value);
63 })
64 .Case(::mlir::acc::DataClauseAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
65 value = ::mlir::acc::DataClauseAttr::parse(parser, type);
66 return ::mlir::success(!!value);
67 })
68 .Case(::mlir::acc::DataClauseModifierAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
69 value = ::mlir::acc::DataClauseModifierAttr::parse(parser, type);
70 return ::mlir::success(!!value);
71 })
72 .Case(::mlir::acc::DeclareAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
73 value = ::mlir::acc::DeclareAttr::parse(parser, type);
74 return ::mlir::success(!!value);
75 })
76 .Case(::mlir::acc::DeclareActionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
77 value = ::mlir::acc::DeclareActionAttr::parse(parser, type);
78 return ::mlir::success(!!value);
79 })
80 .Case(::mlir::acc::LoopLocAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
81 value = ::mlir::acc::LoopLocAttr::parse(parser, type);
82 return ::mlir::success(!!value);
83 })
84 .Case(::mlir::acc::DeviceTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
85 value = ::mlir::acc::DeviceTypeAttr::parse(parser, type);
86 return ::mlir::success(!!value);
87 })
88 .Case(::mlir::acc::GangArgTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
89 value = ::mlir::acc::GangArgTypeAttr::parse(parser, type);
90 return ::mlir::success(!!value);
91 })
92 .Case(::mlir::acc::CombinedConstructsTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
93 value = ::mlir::acc::CombinedConstructsTypeAttr::parse(parser, type);
94 return ::mlir::success(!!value);
95 })
96 .Case(::mlir::acc::ConstructAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
97 value = ::mlir::acc::ConstructAttr::parse(parser, type);
98 return ::mlir::success(!!value);
99 })
100 .Case(::mlir::acc::VarNameAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
101 value = ::mlir::acc::VarNameAttr::parse(parser, type);
102 return ::mlir::success(!!value);
103 })
104 .Case(::mlir::acc::RoutineInfoAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
105 value = ::mlir::acc::RoutineInfoAttr::parse(parser, type);
106 return ::mlir::success(!!value);
107 })
108 .Case(::mlir::acc::SpecializedRoutineAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
109 value = ::mlir::acc::SpecializedRoutineAttr::parse(parser, type);
110 return ::mlir::success(!!value);
111 })
112 .Case(::mlir::acc::DataDescKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
113 value = ::mlir::acc::DataDescKindAttr::parse(parser, type);
114 return ::mlir::success(!!value);
115 })
116 .Case(::mlir::acc::MapFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
117 value = ::mlir::acc::MapFlagsAttr::parse(parser, type);
118 return ::mlir::success(!!value);
119 })
120 .Case(::mlir::acc::GPUParallelDimAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
121 value = ::mlir::acc::GPUParallelDimAttr::parse(parser, type);
122 return ::mlir::success(!!value);
123 })
124 .Case(::mlir::acc::GPUParallelDimsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
125 value = ::mlir::acc::GPUParallelDimsAttr::parse(parser, type);
126 return ::mlir::success(!!value);
127 })
128 .Case(::mlir::acc::GPUBlockRedundantAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
129 value = ::mlir::acc::GPUBlockRedundantAttr::get(parser.getContext());
130 return ::mlir::success(!!value);
131 })
132 .Case(::mlir::acc::ChunkSizeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
133 value = ::mlir::acc::ChunkSizeAttr::parse(parser, type);
134 return ::mlir::success(!!value);
135 })
136 .Case(::mlir::acc::ActiveParDimsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
137 value = ::mlir::acc::ActiveParDimsAttr::parse(parser, type);
138 return ::mlir::success(!!value);
139 })
140 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
141 *mnemonic = keyword;
142 return std::nullopt;
143 });
144}
145
146static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
147 return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::mlir::acc::ClauseDefaultValueAttr>([&](auto t) {
148 printer << ::mlir::acc::ClauseDefaultValueAttr::getMnemonic();
149t.print(printer);
150 return ::mlir::success();
151 })
152 .Case<::mlir::acc::ReductionOperatorAttr>([&](auto t) {
153 printer << ::mlir::acc::ReductionOperatorAttr::getMnemonic();
154t.print(printer);
155 return ::mlir::success();
156 })
157 .Case<::mlir::acc::ParLevelAttr>([&](auto t) {
158 printer << ::mlir::acc::ParLevelAttr::getMnemonic();
159t.print(printer);
160 return ::mlir::success();
161 })
162 .Case<::mlir::acc::RecipeKindAttr>([&](auto t) {
163 printer << ::mlir::acc::RecipeKindAttr::getMnemonic();
164t.print(printer);
165 return ::mlir::success();
166 })
167 .Case<::mlir::acc::DataClauseAttr>([&](auto t) {
168 printer << ::mlir::acc::DataClauseAttr::getMnemonic();
169t.print(printer);
170 return ::mlir::success();
171 })
172 .Case<::mlir::acc::DataClauseModifierAttr>([&](auto t) {
173 printer << ::mlir::acc::DataClauseModifierAttr::getMnemonic();
174t.print(printer);
175 return ::mlir::success();
176 })
177 .Case<::mlir::acc::DeclareAttr>([&](auto t) {
178 printer << ::mlir::acc::DeclareAttr::getMnemonic();
179t.print(printer);
180 return ::mlir::success();
181 })
182 .Case<::mlir::acc::DeclareActionAttr>([&](auto t) {
183 printer << ::mlir::acc::DeclareActionAttr::getMnemonic();
184t.print(printer);
185 return ::mlir::success();
186 })
187 .Case<::mlir::acc::LoopLocAttr>([&](auto t) {
188 printer << ::mlir::acc::LoopLocAttr::getMnemonic();
189t.print(printer);
190 return ::mlir::success();
191 })
192 .Case<::mlir::acc::DeviceTypeAttr>([&](auto t) {
193 printer << ::mlir::acc::DeviceTypeAttr::getMnemonic();
194t.print(printer);
195 return ::mlir::success();
196 })
197 .Case<::mlir::acc::GangArgTypeAttr>([&](auto t) {
198 printer << ::mlir::acc::GangArgTypeAttr::getMnemonic();
199t.print(printer);
200 return ::mlir::success();
201 })
202 .Case<::mlir::acc::CombinedConstructsTypeAttr>([&](auto t) {
203 printer << ::mlir::acc::CombinedConstructsTypeAttr::getMnemonic();
204t.print(printer);
205 return ::mlir::success();
206 })
207 .Case<::mlir::acc::ConstructAttr>([&](auto t) {
208 printer << ::mlir::acc::ConstructAttr::getMnemonic();
209t.print(printer);
210 return ::mlir::success();
211 })
212 .Case<::mlir::acc::VarNameAttr>([&](auto t) {
213 printer << ::mlir::acc::VarNameAttr::getMnemonic();
214t.print(printer);
215 return ::mlir::success();
216 })
217 .Case<::mlir::acc::RoutineInfoAttr>([&](auto t) {
218 printer << ::mlir::acc::RoutineInfoAttr::getMnemonic();
219t.print(printer);
220 return ::mlir::success();
221 })
222 .Case<::mlir::acc::SpecializedRoutineAttr>([&](auto t) {
223 printer << ::mlir::acc::SpecializedRoutineAttr::getMnemonic();
224t.print(printer);
225 return ::mlir::success();
226 })
227 .Case<::mlir::acc::DataDescKindAttr>([&](auto t) {
228 printer << ::mlir::acc::DataDescKindAttr::getMnemonic();
229t.print(printer);
230 return ::mlir::success();
231 })
232 .Case<::mlir::acc::MapFlagsAttr>([&](auto t) {
233 printer << ::mlir::acc::MapFlagsAttr::getMnemonic();
234t.print(printer);
235 return ::mlir::success();
236 })
237 .Case<::mlir::acc::GPUParallelDimAttr>([&](auto t) {
238 printer << ::mlir::acc::GPUParallelDimAttr::getMnemonic();
239t.print(printer);
240 return ::mlir::success();
241 })
242 .Case<::mlir::acc::GPUParallelDimsAttr>([&](auto t) {
243 printer << ::mlir::acc::GPUParallelDimsAttr::getMnemonic();
244t.print(printer);
245 return ::mlir::success();
246 })
247 .Case<::mlir::acc::GPUBlockRedundantAttr>([&](auto t) {
248 printer << ::mlir::acc::GPUBlockRedundantAttr::getMnemonic();
249 return ::mlir::success();
250 })
251 .Case<::mlir::acc::ChunkSizeAttr>([&](auto t) {
252 printer << ::mlir::acc::ChunkSizeAttr::getMnemonic();
253t.print(printer);
254 return ::mlir::success();
255 })
256 .Case<::mlir::acc::ActiveParDimsAttr>([&](auto t) {
257 printer << ::mlir::acc::ActiveParDimsAttr::getMnemonic();
258t.print(printer);
259 return ::mlir::success();
260 })
261 .Default([](auto) { return ::mlir::failure(); });
262}
263
264namespace mlir::acc {
265
266namespace detail {
267
268struct ClauseDefaultValueAttrStorage : public ::mlir::AttributeStorage {
269 using KeyTy = std::tuple<::mlir::acc::ClauseDefaultValue>;
270 ClauseDefaultValueAttrStorage(::mlir::acc::ClauseDefaultValue value) : value(std::move(value)) {}
271
272 KeyTy getAsKey() const {
273 return KeyTy(value);
274 }
275
276 bool operator==(const KeyTy &tblgenKey) const {
277 return (value == std::get<0>(tblgenKey));
278 }
279
280 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
281 return ::llvm::hash_combine(std::get<0>(tblgenKey));
282 }
283
284 static ClauseDefaultValueAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
285 auto value = std::move(std::get<0>(tblgenKey));
286 return new (allocator.allocate<ClauseDefaultValueAttrStorage>()) ClauseDefaultValueAttrStorage(std::move(value));
287 }
288
289 ::mlir::acc::ClauseDefaultValue value;
290};
291
292} // namespace detail
293ClauseDefaultValueAttr ClauseDefaultValueAttr::get(::mlir::MLIRContext *context, ::mlir::acc::ClauseDefaultValue value) {
294 return Base::get(context, std::move(value));
295}
296
297::mlir::Attribute ClauseDefaultValueAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
298 ::mlir::Builder odsBuilder(odsParser.getContext());
299 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
300 (void) odsLoc;
301 ::mlir::FailureOr<::mlir::acc::ClauseDefaultValue> _result_value;
302 // Parse literal '<'
303 if (odsParser.parseLess()) return {};
304
305 // Parse variable 'value'
306 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::ClauseDefaultValue> {
307 auto loc = odsParser.getCurrentLocation();
308 std::string enumKeyword;
309 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
310 return ::mlir::failure();
311 auto maybeEnum = ::mlir::acc::symbolizeClauseDefaultValue(enumKeyword);
312 if (maybeEnum)
313 return *maybeEnum;
314 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::ClauseDefaultValue" << " to be one of: " << "present" << ", " << "none")};
315 }();
316 if (::mlir::failed(_result_value)) {
317 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DefaultValueAttr parameter 'value' which is to be a `::mlir::acc::ClauseDefaultValue`");
318 return {};
319 }
320 // Parse literal '>'
321 if (odsParser.parseGreater()) return {};
322 assert(::mlir::succeeded(_result_value));
323 return ClauseDefaultValueAttr::get(odsParser.getContext(),
324 ::mlir::acc::ClauseDefaultValue((*_result_value)));
325}
326
327void ClauseDefaultValueAttr::print(::mlir::AsmPrinter &odsPrinter) const {
328 ::mlir::Builder odsBuilder(getContext());
329 odsPrinter << "<";
330 odsPrinter << stringifyClauseDefaultValue(getValue());
331 odsPrinter << ">";
332}
333
334::mlir::acc::ClauseDefaultValue ClauseDefaultValueAttr::getValue() const {
335 return getImpl()->value;
336}
337
338
339} // namespace mlir::acc
340MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ClauseDefaultValueAttr)
341namespace mlir::acc {
342
343namespace detail {
344
345struct ReductionOperatorAttrStorage : public ::mlir::AttributeStorage {
346 using KeyTy = std::tuple<::mlir::acc::ReductionOperator>;
347 ReductionOperatorAttrStorage(::mlir::acc::ReductionOperator value) : value(std::move(value)) {}
348
349 KeyTy getAsKey() const {
350 return KeyTy(value);
351 }
352
353 bool operator==(const KeyTy &tblgenKey) const {
354 return (value == std::get<0>(tblgenKey));
355 }
356
357 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
358 return ::llvm::hash_combine(std::get<0>(tblgenKey));
359 }
360
361 static ReductionOperatorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
362 auto value = std::move(std::get<0>(tblgenKey));
363 return new (allocator.allocate<ReductionOperatorAttrStorage>()) ReductionOperatorAttrStorage(std::move(value));
364 }
365
366 ::mlir::acc::ReductionOperator value;
367};
368
369} // namespace detail
370ReductionOperatorAttr ReductionOperatorAttr::get(::mlir::MLIRContext *context, ::mlir::acc::ReductionOperator value) {
371 return Base::get(context, std::move(value));
372}
373
374::mlir::Attribute ReductionOperatorAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
375 ::mlir::Builder odsBuilder(odsParser.getContext());
376 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
377 (void) odsLoc;
378 ::mlir::FailureOr<::mlir::acc::ReductionOperator> _result_value;
379 // Parse literal '<'
380 if (odsParser.parseLess()) return {};
381
382 // Parse variable 'value'
383 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::ReductionOperator> {
384 auto loc = odsParser.getCurrentLocation();
385 std::string enumKeyword;
386 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
387 return ::mlir::failure();
388 auto maybeEnum = ::mlir::acc::symbolizeReductionOperator(enumKeyword);
389 if (maybeEnum)
390 return *maybeEnum;
391 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::ReductionOperator" << " to be one of: " << "none" << ", " << "add" << ", " << "mul" << ", " << "max" << ", " << "min" << ", " << "iand" << ", " << "ior" << ", " << "xor" << ", " << "eqv" << ", " << "neqv" << ", " << "land" << ", " << "lor" << ", " << "maximumf" << ", " << "minimumf" << ", " << "maxnumf" << ", " << "minnumf")};
392 }();
393 if (::mlir::failed(_result_value)) {
394 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_ReductionOperatorAttr parameter 'value' which is to be a `::mlir::acc::ReductionOperator`");
395 return {};
396 }
397 // Parse literal '>'
398 if (odsParser.parseGreater()) return {};
399 assert(::mlir::succeeded(_result_value));
400 return ReductionOperatorAttr::get(odsParser.getContext(),
401 ::mlir::acc::ReductionOperator((*_result_value)));
402}
403
404void ReductionOperatorAttr::print(::mlir::AsmPrinter &odsPrinter) const {
405 ::mlir::Builder odsBuilder(getContext());
406 odsPrinter << "<";
407 odsPrinter << stringifyReductionOperator(getValue());
408 odsPrinter << ">";
409}
410
411::mlir::acc::ReductionOperator ReductionOperatorAttr::getValue() const {
412 return getImpl()->value;
413}
414
415
416} // namespace mlir::acc
417MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ReductionOperatorAttr)
418namespace mlir::acc {
419
420namespace detail {
421
422struct ParLevelAttrStorage : public ::mlir::AttributeStorage {
423 using KeyTy = std::tuple<::mlir::acc::ParLevel>;
424 ParLevelAttrStorage(::mlir::acc::ParLevel value) : value(std::move(value)) {}
425
426 KeyTy getAsKey() const {
427 return KeyTy(value);
428 }
429
430 bool operator==(const KeyTy &tblgenKey) const {
431 return (value == std::get<0>(tblgenKey));
432 }
433
434 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
435 return ::llvm::hash_combine(std::get<0>(tblgenKey));
436 }
437
438 static ParLevelAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
439 auto value = std::move(std::get<0>(tblgenKey));
440 return new (allocator.allocate<ParLevelAttrStorage>()) ParLevelAttrStorage(std::move(value));
441 }
442
443 ::mlir::acc::ParLevel value;
444};
445
446} // namespace detail
447ParLevelAttr ParLevelAttr::get(::mlir::MLIRContext *context, ::mlir::acc::ParLevel value) {
448 return Base::get(context, std::move(value));
449}
450
451::mlir::Attribute ParLevelAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
452 ::mlir::Builder odsBuilder(odsParser.getContext());
453 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
454 (void) odsLoc;
455 ::mlir::FailureOr<::mlir::acc::ParLevel> _result_value;
456 // Parse literal '<'
457 if (odsParser.parseLess()) return {};
458
459 // Parse variable 'value'
460 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::ParLevel> {
461 auto loc = odsParser.getCurrentLocation();
462 std::string enumKeyword;
463 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
464 return ::mlir::failure();
465 auto maybeEnum = ::mlir::acc::symbolizeParLevel(enumKeyword);
466 if (maybeEnum)
467 return *maybeEnum;
468 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::ParLevel" << " to be one of: " << "seq" << ", " << "gang_dim1" << ", " << "gang_dim2" << ", " << "gang_dim3" << ", " << "worker" << ", " << "vector")};
469 }();
470 if (::mlir::failed(_result_value)) {
471 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_ParLevelAttr parameter 'value' which is to be a `::mlir::acc::ParLevel`");
472 return {};
473 }
474 // Parse literal '>'
475 if (odsParser.parseGreater()) return {};
476 assert(::mlir::succeeded(_result_value));
477 return ParLevelAttr::get(odsParser.getContext(),
478 ::mlir::acc::ParLevel((*_result_value)));
479}
480
481void ParLevelAttr::print(::mlir::AsmPrinter &odsPrinter) const {
482 ::mlir::Builder odsBuilder(getContext());
483 odsPrinter << "<";
484 odsPrinter << stringifyParLevel(getValue());
485 odsPrinter << ">";
486}
487
488::mlir::acc::ParLevel ParLevelAttr::getValue() const {
489 return getImpl()->value;
490}
491
492
493} // namespace mlir::acc
494MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ParLevelAttr)
495namespace mlir::acc {
496
497namespace detail {
498
499struct RecipeKindAttrStorage : public ::mlir::AttributeStorage {
500 using KeyTy = std::tuple<::mlir::acc::RecipeKind>;
501 RecipeKindAttrStorage(::mlir::acc::RecipeKind value) : value(std::move(value)) {}
502
503 KeyTy getAsKey() const {
504 return KeyTy(value);
505 }
506
507 bool operator==(const KeyTy &tblgenKey) const {
508 return (value == std::get<0>(tblgenKey));
509 }
510
511 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
512 return ::llvm::hash_combine(std::get<0>(tblgenKey));
513 }
514
515 static RecipeKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
516 auto value = std::move(std::get<0>(tblgenKey));
517 return new (allocator.allocate<RecipeKindAttrStorage>()) RecipeKindAttrStorage(std::move(value));
518 }
519
520 ::mlir::acc::RecipeKind value;
521};
522
523} // namespace detail
524RecipeKindAttr RecipeKindAttr::get(::mlir::MLIRContext *context, ::mlir::acc::RecipeKind value) {
525 return Base::get(context, std::move(value));
526}
527
528::mlir::Attribute RecipeKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
529 ::mlir::Builder odsBuilder(odsParser.getContext());
530 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
531 (void) odsLoc;
532 ::mlir::FailureOr<::mlir::acc::RecipeKind> _result_value;
533 // Parse literal '<'
534 if (odsParser.parseLess()) return {};
535
536 // Parse variable 'value'
537 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::RecipeKind> {
538 auto loc = odsParser.getCurrentLocation();
539 std::string enumKeyword;
540 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
541 return ::mlir::failure();
542 auto maybeEnum = ::mlir::acc::symbolizeRecipeKind(enumKeyword);
543 if (maybeEnum)
544 return *maybeEnum;
545 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::RecipeKind" << " to be one of: " << "private_recipe" << ", " << "firstprivate_recipe" << ", " << "reduction_recipe")};
546 }();
547 if (::mlir::failed(_result_value)) {
548 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_RecipeKindAttr parameter 'value' which is to be a `::mlir::acc::RecipeKind`");
549 return {};
550 }
551 // Parse literal '>'
552 if (odsParser.parseGreater()) return {};
553 assert(::mlir::succeeded(_result_value));
554 return RecipeKindAttr::get(odsParser.getContext(),
555 ::mlir::acc::RecipeKind((*_result_value)));
556}
557
558void RecipeKindAttr::print(::mlir::AsmPrinter &odsPrinter) const {
559 ::mlir::Builder odsBuilder(getContext());
560 odsPrinter << "<";
561 odsPrinter << stringifyRecipeKind(getValue());
562 odsPrinter << ">";
563}
564
565::mlir::acc::RecipeKind RecipeKindAttr::getValue() const {
566 return getImpl()->value;
567}
568
569
570} // namespace mlir::acc
571MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::RecipeKindAttr)
572namespace mlir::acc {
573
574namespace detail {
575
576struct DataClauseAttrStorage : public ::mlir::AttributeStorage {
577 using KeyTy = std::tuple<::mlir::acc::DataClause>;
578 DataClauseAttrStorage(::mlir::acc::DataClause value) : value(std::move(value)) {}
579
580 KeyTy getAsKey() const {
581 return KeyTy(value);
582 }
583
584 bool operator==(const KeyTy &tblgenKey) const {
585 return (value == std::get<0>(tblgenKey));
586 }
587
588 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
589 return ::llvm::hash_combine(std::get<0>(tblgenKey));
590 }
591
592 static DataClauseAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
593 auto value = std::move(std::get<0>(tblgenKey));
594 return new (allocator.allocate<DataClauseAttrStorage>()) DataClauseAttrStorage(std::move(value));
595 }
596
597 ::mlir::acc::DataClause value;
598};
599
600} // namespace detail
601DataClauseAttr DataClauseAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DataClause value) {
602 return Base::get(context, std::move(value));
603}
604
605::mlir::Attribute DataClauseAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
606 ::mlir::Builder odsBuilder(odsParser.getContext());
607 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
608 (void) odsLoc;
609 ::mlir::FailureOr<::mlir::acc::DataClause> _result_value;
610 // Parse literal '<'
611 if (odsParser.parseLess()) return {};
612
613 // Parse variable 'value'
614 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::DataClause> {
615 auto loc = odsParser.getCurrentLocation();
616 std::string enumKeyword;
617 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
618 return ::mlir::failure();
619 auto maybeEnum = ::mlir::acc::symbolizeDataClause(enumKeyword);
620 if (maybeEnum)
621 return *maybeEnum;
622 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::DataClause" << " to be one of: " << "acc_copyin" << ", " << "acc_copyin_readonly" << ", " << "acc_copy" << ", " << "acc_copyout" << ", " << "acc_copyout_zero" << ", " << "acc_present" << ", " << "acc_create" << ", " << "acc_create_zero" << ", " << "acc_delete" << ", " << "acc_attach" << ", " << "acc_detach" << ", " << "acc_no_create" << ", " << "acc_private" << ", " << "acc_firstprivate" << ", " << "acc_deviceptr" << ", " << "acc_getdeviceptr" << ", " << "acc_update_host" << ", " << "acc_update_self" << ", " << "acc_update_device" << ", " << "acc_use_device" << ", " << "acc_reduction" << ", " << "acc_declare_device_resident" << ", " << "acc_declare_link" << ", " << "acc_cache" << ", " << "acc_cache_readonly")};
623 }();
624 if (::mlir::failed(_result_value)) {
625 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_DataClauseAttr parameter 'value' which is to be a `::mlir::acc::DataClause`");
626 return {};
627 }
628 // Parse literal '>'
629 if (odsParser.parseGreater()) return {};
630 assert(::mlir::succeeded(_result_value));
631 return DataClauseAttr::get(odsParser.getContext(),
632 ::mlir::acc::DataClause((*_result_value)));
633}
634
635void DataClauseAttr::print(::mlir::AsmPrinter &odsPrinter) const {
636 ::mlir::Builder odsBuilder(getContext());
637 odsPrinter << "<";
638 odsPrinter << stringifyDataClause(getValue());
639 odsPrinter << ">";
640}
641
642::mlir::acc::DataClause DataClauseAttr::getValue() const {
643 return getImpl()->value;
644}
645
646
647} // namespace mlir::acc
648MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataClauseAttr)
649namespace mlir::acc {
650
651namespace detail {
652
653struct DataClauseModifierAttrStorage : public ::mlir::AttributeStorage {
654 using KeyTy = std::tuple<::mlir::acc::DataClauseModifier>;
655 DataClauseModifierAttrStorage(::mlir::acc::DataClauseModifier value) : value(std::move(value)) {}
656
657 KeyTy getAsKey() const {
658 return KeyTy(value);
659 }
660
661 bool operator==(const KeyTy &tblgenKey) const {
662 return (value == std::get<0>(tblgenKey));
663 }
664
665 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
666 return ::llvm::hash_combine(std::get<0>(tblgenKey));
667 }
668
669 static DataClauseModifierAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
670 auto value = std::move(std::get<0>(tblgenKey));
671 return new (allocator.allocate<DataClauseModifierAttrStorage>()) DataClauseModifierAttrStorage(std::move(value));
672 }
673
674 ::mlir::acc::DataClauseModifier value;
675};
676
677} // namespace detail
678DataClauseModifierAttr DataClauseModifierAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DataClauseModifier value) {
679 return Base::get(context, std::move(value));
680}
681
682::mlir::Attribute DataClauseModifierAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
683 ::mlir::Builder odsBuilder(odsParser.getContext());
684 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
685 (void) odsLoc;
686 ::mlir::FailureOr<::mlir::acc::DataClauseModifier> _result_value;
687 // Parse literal '<'
688 if (odsParser.parseLess()) return {};
689
690 // Parse variable 'value'
691 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::DataClauseModifier> {
692 ::mlir::acc::DataClauseModifier flags = {};
693 auto loc = odsParser.getCurrentLocation();
694 std::string enumKeyword;
695 do {
696 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
697 return ::mlir::failure();
698 auto maybeEnum = ::mlir::acc::symbolizeDataClauseModifier(enumKeyword);
699 if (!maybeEnum) {
700 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::DataClauseModifier" << " to be one of: " << "none" << ", " << "zero" << ", " << "readonly" << ", " << "alwaysin" << ", " << "alwaysout" << ", " << "always" << ", " << "capture")};
701 }
702 flags = flags | *maybeEnum;
703 } while(::mlir::succeeded(odsParser.parseOptionalComma()));
704 return flags;
705 }();
706 if (::mlir::failed(_result_value)) {
707 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_DataClauseModifierAttr parameter 'value' which is to be a `::mlir::acc::DataClauseModifier`");
708 return {};
709 }
710 // Parse literal '>'
711 if (odsParser.parseGreater()) return {};
712 assert(::mlir::succeeded(_result_value));
713 return DataClauseModifierAttr::get(odsParser.getContext(),
714 ::mlir::acc::DataClauseModifier((*_result_value)));
715}
716
717void DataClauseModifierAttr::print(::mlir::AsmPrinter &odsPrinter) const {
718 ::mlir::Builder odsBuilder(getContext());
719 odsPrinter << "<";
720 odsPrinter << stringifyDataClauseModifier(getValue());
721 odsPrinter << ">";
722}
723
724::mlir::acc::DataClauseModifier DataClauseModifierAttr::getValue() const {
725 return getImpl()->value;
726}
727
728
729} // namespace mlir::acc
730MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataClauseModifierAttr)
731namespace mlir::acc {
732
733namespace detail {
734
735struct DeclareAttrStorage : public ::mlir::AttributeStorage {
736 using KeyTy = std::tuple<::mlir::acc::DataClauseAttr, bool>;
737 DeclareAttrStorage(::mlir::acc::DataClauseAttr dataClause, bool implicit) : dataClause(std::move(dataClause)), implicit(std::move(implicit)) {}
738
739 KeyTy getAsKey() const {
740 return KeyTy(dataClause, implicit);
741 }
742
743 bool operator==(const KeyTy &tblgenKey) const {
744 return (dataClause == std::get<0>(tblgenKey)) && (implicit == std::get<1>(tblgenKey));
745 }
746
747 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
748 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
749 }
750
751 static DeclareAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
752 auto dataClause = std::move(std::get<0>(tblgenKey));
753 auto implicit = std::move(std::get<1>(tblgenKey));
754 return new (allocator.allocate<DeclareAttrStorage>()) DeclareAttrStorage(std::move(dataClause), std::move(implicit));
755 }
756
757 ::mlir::acc::DataClauseAttr dataClause;
758 bool implicit;
759};
760
761} // namespace detail
762DeclareAttr DeclareAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DataClauseAttr dataClause, bool implicit) {
763 return Base::get(context, std::move(dataClause), std::move(implicit));
764}
765
766DeclareAttr DeclareAttr::get(::mlir::MLIRContext *context, DataClauseAttr dataClause) {
767 return Base::get(context, dataClause, /*implicit=*/false);
768}
769
770::mlir::Attribute DeclareAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
771 ::mlir::Builder odsBuilder(odsParser.getContext());
772 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
773 (void) odsLoc;
774 ::mlir::FailureOr<::mlir::acc::DataClauseAttr> _result_dataClause;
775 ::mlir::FailureOr<bool> _result_implicit;
776 // Parse literal '<'
777 if (odsParser.parseLess()) return {};
778 // Parse parameter struct
779 bool _seen_dataClause = false;
780 bool _seen_implicit = false;
781 {
782 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
783 // Parse literal '='
784 if (odsParser.parseEqual()) return {};
785 if (!_seen_dataClause && _paramKey == "dataClause") {
786 _seen_dataClause = true;
787
788 // Parse variable 'dataClause'
789 odsParser.getContext()->getOrLoadDialect<::mlir::acc::OpenACCDialect>();
790 _result_dataClause = [&]() -> ::mlir::FailureOr<::mlir::acc::DataClauseAttr> {
791 auto odsEnumValue = ::mlir::FieldParser<::mlir::acc::DataClause>::parse(odsParser);
792 if (::mlir::failed(odsEnumValue))
793 return ::mlir::failure();
794 return ::mlir::acc::DataClauseAttr::get(odsParser.getContext(), *odsEnumValue);
795 }();
796 if (::mlir::failed(_result_dataClause)) {
797 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareAttr parameter 'dataClause' which is to be a `::mlir::acc::DataClauseAttr`");
798 return {};
799 }
800 } else if (!_seen_implicit && _paramKey == "implicit") {
801 _seen_implicit = true;
802
803 // Parse variable 'implicit'
804 _result_implicit = ::mlir::FieldParser<bool>::parse(odsParser);
805 if (::mlir::failed(_result_implicit)) {
806 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareAttr parameter 'implicit' which is to be a `bool`");
807 return {};
808 }
809 } else {
810 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
811 return {};
812 }
813 return true;
814 };
815 do {
816 ::llvm::StringRef _paramKey;
817 if (odsParser.parseKeyword(&_paramKey)) {
818 odsParser.emitError(odsParser.getCurrentLocation(),
819 "expected a parameter name in struct");
820 return {};
821 }
822 if (!_loop_body(_paramKey)) return {};
823 } while(!odsParser.parseOptionalComma());
824 if (!_seen_dataClause) {
825 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "dataClause";
826 return {};
827 }
828 }
829 // Parse literal '>'
830 if (odsParser.parseGreater()) return {};
831 assert(::mlir::succeeded(_result_dataClause));
832 return DeclareAttr::get(odsParser.getContext(),
833 ::mlir::acc::DataClauseAttr((*_result_dataClause)),
834 bool((_result_implicit.value_or(false))));
835}
836
837void DeclareAttr::print(::mlir::AsmPrinter &odsPrinter) const {
838 ::mlir::Builder odsBuilder(getContext());
839 odsPrinter << "<";
840 {
841 bool _firstPrinted = true;
842 if (!_firstPrinted) odsPrinter << ", ";
843 _firstPrinted = false;
844 odsPrinter << "dataClause = ";
845 odsPrinter << getDataClause().getValue();
846 if (!(getImplicit() == false)) {
847 if (!_firstPrinted) odsPrinter << ", ";
848 _firstPrinted = false;
849 odsPrinter << "implicit = ";
850 if (!(getImplicit() == false)) {
851 odsPrinter.printStrippedAttrOrType(getImplicit());
852 }
853 }
854 }
855 odsPrinter << ">";
856}
857
858::mlir::acc::DataClauseAttr DeclareAttr::getDataClause() const {
859 return getImpl()->dataClause;
860}
861
862bool DeclareAttr::getImplicit() const {
863 return getImpl()->implicit;
864}
865
866
867} // namespace mlir::acc
868MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareAttr)
869namespace mlir::acc {
870
871namespace detail {
872
873struct DeclareActionAttrStorage : public ::mlir::AttributeStorage {
874 using KeyTy = std::tuple<SymbolRefAttr, SymbolRefAttr, SymbolRefAttr, SymbolRefAttr>;
875 DeclareActionAttrStorage(SymbolRefAttr preAlloc, SymbolRefAttr postAlloc, SymbolRefAttr preDealloc, SymbolRefAttr postDealloc) : preAlloc(std::move(preAlloc)), postAlloc(std::move(postAlloc)), preDealloc(std::move(preDealloc)), postDealloc(std::move(postDealloc)) {}
876
877 KeyTy getAsKey() const {
878 return KeyTy(preAlloc, postAlloc, preDealloc, postDealloc);
879 }
880
881 bool operator==(const KeyTy &tblgenKey) const {
882 return (preAlloc == std::get<0>(tblgenKey)) && (postAlloc == std::get<1>(tblgenKey)) && (preDealloc == std::get<2>(tblgenKey)) && (postDealloc == std::get<3>(tblgenKey));
883 }
884
885 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
886 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
887 }
888
889 static DeclareActionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
890 auto preAlloc = std::move(std::get<0>(tblgenKey));
891 auto postAlloc = std::move(std::get<1>(tblgenKey));
892 auto preDealloc = std::move(std::get<2>(tblgenKey));
893 auto postDealloc = std::move(std::get<3>(tblgenKey));
894 return new (allocator.allocate<DeclareActionAttrStorage>()) DeclareActionAttrStorage(std::move(preAlloc), std::move(postAlloc), std::move(preDealloc), std::move(postDealloc));
895 }
896
897 SymbolRefAttr preAlloc;
898 SymbolRefAttr postAlloc;
899 SymbolRefAttr preDealloc;
900 SymbolRefAttr postDealloc;
901};
902
903} // namespace detail
904DeclareActionAttr DeclareActionAttr::get(::mlir::MLIRContext *context, SymbolRefAttr preAlloc, SymbolRefAttr postAlloc, SymbolRefAttr preDealloc, SymbolRefAttr postDealloc) {
905 return Base::get(context, std::move(preAlloc), std::move(postAlloc), std::move(preDealloc), std::move(postDealloc));
906}
907
908::mlir::Attribute DeclareActionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
909 ::mlir::Builder odsBuilder(odsParser.getContext());
910 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
911 (void) odsLoc;
912 ::mlir::FailureOr<SymbolRefAttr> _result_preAlloc;
913 ::mlir::FailureOr<SymbolRefAttr> _result_postAlloc;
914 ::mlir::FailureOr<SymbolRefAttr> _result_preDealloc;
915 ::mlir::FailureOr<SymbolRefAttr> _result_postDealloc;
916 // Parse literal '<'
917 if (odsParser.parseLess()) return {};
918 // Parse parameter struct
919 bool _seen_preAlloc = false;
920 bool _seen_postAlloc = false;
921 bool _seen_preDealloc = false;
922 bool _seen_postDealloc = false;
923 {
924 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
925 // Parse literal '='
926 if (odsParser.parseEqual()) return {};
927 if (!_seen_preAlloc && _paramKey == "preAlloc") {
928 _seen_preAlloc = true;
929
930 // Parse variable 'preAlloc'
931 _result_preAlloc = ::mlir::FieldParser<SymbolRefAttr>::parse(odsParser);
932 if (::mlir::failed(_result_preAlloc)) {
933 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'preAlloc' which is to be a `SymbolRefAttr`");
934 return {};
935 }
936 } else if (!_seen_postAlloc && _paramKey == "postAlloc") {
937 _seen_postAlloc = true;
938
939 // Parse variable 'postAlloc'
940 _result_postAlloc = ::mlir::FieldParser<SymbolRefAttr>::parse(odsParser);
941 if (::mlir::failed(_result_postAlloc)) {
942 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'postAlloc' which is to be a `SymbolRefAttr`");
943 return {};
944 }
945 } else if (!_seen_preDealloc && _paramKey == "preDealloc") {
946 _seen_preDealloc = true;
947
948 // Parse variable 'preDealloc'
949 _result_preDealloc = ::mlir::FieldParser<SymbolRefAttr>::parse(odsParser);
950 if (::mlir::failed(_result_preDealloc)) {
951 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'preDealloc' which is to be a `SymbolRefAttr`");
952 return {};
953 }
954 } else if (!_seen_postDealloc && _paramKey == "postDealloc") {
955 _seen_postDealloc = true;
956
957 // Parse variable 'postDealloc'
958 _result_postDealloc = ::mlir::FieldParser<SymbolRefAttr>::parse(odsParser);
959 if (::mlir::failed(_result_postDealloc)) {
960 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse DeclareActionAttr parameter 'postDealloc' which is to be a `SymbolRefAttr`");
961 return {};
962 }
963 } else {
964 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
965 return {};
966 }
967 return true;
968 };
969 ::llvm::StringRef _paramKey;
970 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
971 if (!_loop_body(_paramKey)) return {};
972 while (!odsParser.parseOptionalComma()) {
973 ::llvm::StringRef _paramKey;
974 if (odsParser.parseKeyword(&_paramKey)) {
975 odsParser.emitError(odsParser.getCurrentLocation(),
976 "expected a parameter name in struct");
977 return {};
978 }
979 if (!_loop_body(_paramKey)) return {};
980 }
981 }
982 }
983 // Parse literal '>'
984 if (odsParser.parseGreater()) return {};
985 return DeclareActionAttr::get(odsParser.getContext(),
986 SymbolRefAttr((_result_preAlloc.value_or(SymbolRefAttr()))),
987 SymbolRefAttr((_result_postAlloc.value_or(SymbolRefAttr()))),
988 SymbolRefAttr((_result_preDealloc.value_or(SymbolRefAttr()))),
989 SymbolRefAttr((_result_postDealloc.value_or(SymbolRefAttr()))));
990}
991
992void DeclareActionAttr::print(::mlir::AsmPrinter &odsPrinter) const {
993 ::mlir::Builder odsBuilder(getContext());
994 odsPrinter << "<";
995 {
996 bool _firstPrinted = true;
997 if (!(getPreAlloc() == SymbolRefAttr())) {
998 if (!_firstPrinted) odsPrinter << ", ";
999 _firstPrinted = false;
1000 odsPrinter << "preAlloc = ";
1001 if (!(getPreAlloc() == SymbolRefAttr())) {
1002 odsPrinter.printStrippedAttrOrType(getPreAlloc());
1003 }
1004 }
1005 if (!(getPostAlloc() == SymbolRefAttr())) {
1006 if (!_firstPrinted) odsPrinter << ", ";
1007 _firstPrinted = false;
1008 odsPrinter << "postAlloc = ";
1009 if (!(getPostAlloc() == SymbolRefAttr())) {
1010 odsPrinter.printStrippedAttrOrType(getPostAlloc());
1011 }
1012 }
1013 if (!(getPreDealloc() == SymbolRefAttr())) {
1014 if (!_firstPrinted) odsPrinter << ", ";
1015 _firstPrinted = false;
1016 odsPrinter << "preDealloc = ";
1017 if (!(getPreDealloc() == SymbolRefAttr())) {
1018 odsPrinter.printStrippedAttrOrType(getPreDealloc());
1019 }
1020 }
1021 if (!(getPostDealloc() == SymbolRefAttr())) {
1022 if (!_firstPrinted) odsPrinter << ", ";
1023 _firstPrinted = false;
1024 odsPrinter << "postDealloc = ";
1025 if (!(getPostDealloc() == SymbolRefAttr())) {
1026 odsPrinter.printStrippedAttrOrType(getPostDealloc());
1027 }
1028 }
1029 }
1030 odsPrinter << ">";
1031}
1032
1033SymbolRefAttr DeclareActionAttr::getPreAlloc() const {
1034 return getImpl()->preAlloc;
1035}
1036
1037SymbolRefAttr DeclareActionAttr::getPostAlloc() const {
1038 return getImpl()->postAlloc;
1039}
1040
1041SymbolRefAttr DeclareActionAttr::getPreDealloc() const {
1042 return getImpl()->preDealloc;
1043}
1044
1045SymbolRefAttr DeclareActionAttr::getPostDealloc() const {
1046 return getImpl()->postDealloc;
1047}
1048
1049
1050} // namespace mlir::acc
1051MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeclareActionAttr)
1052namespace mlir::acc {
1053
1054namespace detail {
1055
1056struct LoopLocAttrStorage : public ::mlir::AttributeStorage {
1057 using KeyTy = std::tuple<::mlir::LocationAttr, ::llvm::ArrayRef<::mlir::LocationAttr>>;
1058 LoopLocAttrStorage(::mlir::LocationAttr directive, ::llvm::ArrayRef<::mlir::LocationAttr> loops) : directive(std::move(directive)), loops(std::move(loops)) {}
1059
1060 KeyTy getAsKey() const {
1061 return KeyTy(directive, loops);
1062 }
1063
1064 bool operator==(const KeyTy &tblgenKey) const {
1065 return (directive == std::get<0>(tblgenKey)) && (loops == std::get<1>(tblgenKey));
1066 }
1067
1068 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1069 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1070 }
1071
1072 static LoopLocAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1073 auto directive = std::move(std::get<0>(tblgenKey));
1074 auto loops = std::move(std::get<1>(tblgenKey));
1075 loops = allocator.copyInto(loops);
1076 return new (allocator.allocate<LoopLocAttrStorage>()) LoopLocAttrStorage(std::move(directive), std::move(loops));
1077 }
1078
1079 ::mlir::LocationAttr directive;
1080 ::llvm::ArrayRef<::mlir::LocationAttr> loops;
1081};
1082
1083} // namespace detail
1084LoopLocAttr LoopLocAttr::get(::mlir::MLIRContext *context, ::mlir::LocationAttr directive, ::llvm::ArrayRef<::mlir::LocationAttr> loops) {
1085 return Base::get(context, std::move(directive), std::move(loops));
1086}
1087
1088::mlir::Attribute LoopLocAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1089 ::mlir::Builder odsBuilder(odsParser.getContext());
1090 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1091 (void) odsLoc;
1092 ::mlir::FailureOr<::mlir::LocationAttr> _result_directive;
1093 ::mlir::FailureOr<::llvm::SmallVector<::mlir::LocationAttr>> _result_loops;
1094 // Parse literal '<'
1095 if (odsParser.parseLess()) return {};
1096 // Parse parameter struct
1097 bool _seen_directive = false;
1098 bool _seen_loops = false;
1099 {
1100 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1101 // Parse literal '='
1102 if (odsParser.parseEqual()) return {};
1103 if (!_seen_directive && _paramKey == "directive") {
1104 _seen_directive = true;
1105
1106 // Parse variable 'directive'
1107 _result_directive = ::mlir::FieldParser<::mlir::LocationAttr>::parse(odsParser);
1108 if (::mlir::failed(_result_directive)) {
1109 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_LoopLocAttr parameter 'directive' which is to be a `::mlir::LocationAttr`");
1110 return {};
1111 }
1112 } else if (!_seen_loops && _paramKey == "loops") {
1113 _seen_loops = true;
1114
1115 // Parse variable 'loops'
1116 _result_loops = ::mlir::FieldParser<::llvm::SmallVector<::mlir::LocationAttr>>::parse(odsParser);
1117 if (::mlir::failed(_result_loops)) {
1118 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_LoopLocAttr parameter 'loops' which is to be a `::llvm::ArrayRef<::mlir::LocationAttr>`");
1119 return {};
1120 }
1121 } else {
1122 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1123 return {};
1124 }
1125 return true;
1126 };
1127 do {
1128 ::llvm::StringRef _paramKey;
1129 if (odsParser.parseKeyword(&_paramKey)) {
1130 odsParser.emitError(odsParser.getCurrentLocation(),
1131 "expected a parameter name in struct");
1132 return {};
1133 }
1134 if (!_loop_body(_paramKey)) return {};
1135 } while(!odsParser.parseOptionalComma());
1136 if (!_seen_loops) {
1137 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "loops";
1138 return {};
1139 }
1140 }
1141 // Parse literal '>'
1142 if (odsParser.parseGreater()) return {};
1143 assert(::mlir::succeeded(_result_loops));
1144 return LoopLocAttr::get(odsParser.getContext(),
1145 ::mlir::LocationAttr((_result_directive.value_or(::mlir::LocationAttr()))),
1146 ::llvm::ArrayRef<::mlir::LocationAttr>((*_result_loops)));
1147}
1148
1149void LoopLocAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1150 ::mlir::Builder odsBuilder(getContext());
1151 odsPrinter << "<";
1152 {
1153 bool _firstPrinted = true;
1154 if (!(getDirective() == ::mlir::LocationAttr())) {
1155 if (!_firstPrinted) odsPrinter << ", ";
1156 _firstPrinted = false;
1157 odsPrinter << "directive = ";
1158 if (!(getDirective() == ::mlir::LocationAttr())) {
1159 odsPrinter.printStrippedAttrOrType(getDirective());
1160 }
1161 }
1162 if (!_firstPrinted) odsPrinter << ", ";
1163 _firstPrinted = false;
1164 odsPrinter << "loops = ";
1165 odsPrinter.printStrippedAttrOrType(getLoops());
1166 }
1167 odsPrinter << ">";
1168}
1169
1170::mlir::LocationAttr LoopLocAttr::getDirective() const {
1171 return getImpl()->directive;
1172}
1173
1174::llvm::ArrayRef<::mlir::LocationAttr> LoopLocAttr::getLoops() const {
1175 return getImpl()->loops;
1176}
1177
1178
1179} // namespace mlir::acc
1180MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::LoopLocAttr)
1181namespace mlir::acc {
1182
1183namespace detail {
1184
1185struct DeviceTypeAttrStorage : public ::mlir::AttributeStorage {
1186 using KeyTy = std::tuple<::mlir::acc::DeviceType>;
1187 DeviceTypeAttrStorage(::mlir::acc::DeviceType value) : value(std::move(value)) {}
1188
1189 KeyTy getAsKey() const {
1190 return KeyTy(value);
1191 }
1192
1193 bool operator==(const KeyTy &tblgenKey) const {
1194 return (value == std::get<0>(tblgenKey));
1195 }
1196
1197 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1198 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1199 }
1200
1201 static DeviceTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1202 auto value = std::move(std::get<0>(tblgenKey));
1203 return new (allocator.allocate<DeviceTypeAttrStorage>()) DeviceTypeAttrStorage(std::move(value));
1204 }
1205
1206 ::mlir::acc::DeviceType value;
1207};
1208
1209} // namespace detail
1210DeviceTypeAttr DeviceTypeAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DeviceType value) {
1211 return Base::get(context, std::move(value));
1212}
1213
1214::mlir::Attribute DeviceTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1215 ::mlir::Builder odsBuilder(odsParser.getContext());
1216 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1217 (void) odsLoc;
1218 ::mlir::FailureOr<::mlir::acc::DeviceType> _result_value;
1219 // Parse literal '<'
1220 if (odsParser.parseLess()) return {};
1221
1222 // Parse variable 'value'
1223 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::DeviceType> {
1224 auto loc = odsParser.getCurrentLocation();
1225 std::string enumKeyword;
1226 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1227 return ::mlir::failure();
1228 auto maybeEnum = ::mlir::acc::symbolizeDeviceType(enumKeyword);
1229 if (maybeEnum)
1230 return *maybeEnum;
1231 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::DeviceType" << " to be one of: " << "none" << ", " << "star" << ", " << "default" << ", " << "host" << ", " << "multicore" << ", " << "nvidia" << ", " << "radeon")};
1232 }();
1233 if (::mlir::failed(_result_value)) {
1234 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_DeviceTypeAttr parameter 'value' which is to be a `::mlir::acc::DeviceType`");
1235 return {};
1236 }
1237 // Parse literal '>'
1238 if (odsParser.parseGreater()) return {};
1239 assert(::mlir::succeeded(_result_value));
1240 return DeviceTypeAttr::get(odsParser.getContext(),
1241 ::mlir::acc::DeviceType((*_result_value)));
1242}
1243
1244void DeviceTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1245 ::mlir::Builder odsBuilder(getContext());
1246 odsPrinter << "<";
1247 odsPrinter << stringifyDeviceType(getValue());
1248 odsPrinter << ">";
1249}
1250
1251::mlir::acc::DeviceType DeviceTypeAttr::getValue() const {
1252 return getImpl()->value;
1253}
1254
1255
1256} // namespace mlir::acc
1257MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DeviceTypeAttr)
1258namespace mlir::acc {
1259
1260namespace detail {
1261
1262struct GangArgTypeAttrStorage : public ::mlir::AttributeStorage {
1263 using KeyTy = std::tuple<::mlir::acc::GangArgType>;
1264 GangArgTypeAttrStorage(::mlir::acc::GangArgType value) : value(std::move(value)) {}
1265
1266 KeyTy getAsKey() const {
1267 return KeyTy(value);
1268 }
1269
1270 bool operator==(const KeyTy &tblgenKey) const {
1271 return (value == std::get<0>(tblgenKey));
1272 }
1273
1274 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1275 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1276 }
1277
1278 static GangArgTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1279 auto value = std::move(std::get<0>(tblgenKey));
1280 return new (allocator.allocate<GangArgTypeAttrStorage>()) GangArgTypeAttrStorage(std::move(value));
1281 }
1282
1283 ::mlir::acc::GangArgType value;
1284};
1285
1286} // namespace detail
1287GangArgTypeAttr GangArgTypeAttr::get(::mlir::MLIRContext *context, ::mlir::acc::GangArgType value) {
1288 return Base::get(context, std::move(value));
1289}
1290
1291::mlir::Attribute GangArgTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1292 ::mlir::Builder odsBuilder(odsParser.getContext());
1293 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1294 (void) odsLoc;
1295 ::mlir::FailureOr<::mlir::acc::GangArgType> _result_value;
1296 // Parse literal '<'
1297 if (odsParser.parseLess()) return {};
1298
1299 // Parse variable 'value'
1300 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::GangArgType> {
1301 auto loc = odsParser.getCurrentLocation();
1302 std::string enumKeyword;
1303 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1304 return ::mlir::failure();
1305 auto maybeEnum = ::mlir::acc::symbolizeGangArgType(enumKeyword);
1306 if (maybeEnum)
1307 return *maybeEnum;
1308 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::GangArgType" << " to be one of: " << "Num" << ", " << "Dim" << ", " << "Static")};
1309 }();
1310 if (::mlir::failed(_result_value)) {
1311 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_GangArgTypeAttr parameter 'value' which is to be a `::mlir::acc::GangArgType`");
1312 return {};
1313 }
1314 // Parse literal '>'
1315 if (odsParser.parseGreater()) return {};
1316 assert(::mlir::succeeded(_result_value));
1317 return GangArgTypeAttr::get(odsParser.getContext(),
1318 ::mlir::acc::GangArgType((*_result_value)));
1319}
1320
1321void GangArgTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1322 ::mlir::Builder odsBuilder(getContext());
1323 odsPrinter << "<";
1324 odsPrinter << stringifyGangArgType(getValue());
1325 odsPrinter << ">";
1326}
1327
1328::mlir::acc::GangArgType GangArgTypeAttr::getValue() const {
1329 return getImpl()->value;
1330}
1331
1332
1333} // namespace mlir::acc
1334MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GangArgTypeAttr)
1335namespace mlir::acc {
1336
1337namespace detail {
1338
1339struct CombinedConstructsTypeAttrStorage : public ::mlir::AttributeStorage {
1340 using KeyTy = std::tuple<::mlir::acc::CombinedConstructsType>;
1341 CombinedConstructsTypeAttrStorage(::mlir::acc::CombinedConstructsType value) : value(std::move(value)) {}
1342
1343 KeyTy getAsKey() const {
1344 return KeyTy(value);
1345 }
1346
1347 bool operator==(const KeyTy &tblgenKey) const {
1348 return (value == std::get<0>(tblgenKey));
1349 }
1350
1351 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1352 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1353 }
1354
1355 static CombinedConstructsTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1356 auto value = std::move(std::get<0>(tblgenKey));
1357 return new (allocator.allocate<CombinedConstructsTypeAttrStorage>()) CombinedConstructsTypeAttrStorage(std::move(value));
1358 }
1359
1360 ::mlir::acc::CombinedConstructsType value;
1361};
1362
1363} // namespace detail
1364CombinedConstructsTypeAttr CombinedConstructsTypeAttr::get(::mlir::MLIRContext *context, ::mlir::acc::CombinedConstructsType value) {
1365 return Base::get(context, std::move(value));
1366}
1367
1368::mlir::Attribute CombinedConstructsTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1369 ::mlir::Builder odsBuilder(odsParser.getContext());
1370 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1371 (void) odsLoc;
1372 ::mlir::FailureOr<::mlir::acc::CombinedConstructsType> _result_value;
1373 // Parse literal '<'
1374 if (odsParser.parseLess()) return {};
1375
1376 // Parse variable 'value'
1377 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::CombinedConstructsType> {
1378 auto loc = odsParser.getCurrentLocation();
1379 std::string enumKeyword;
1380 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1381 return ::mlir::failure();
1382 auto maybeEnum = ::mlir::acc::symbolizeCombinedConstructsType(enumKeyword);
1383 if (maybeEnum)
1384 return *maybeEnum;
1385 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::CombinedConstructsType" << " to be one of: " << "kernels_loop" << ", " << "parallel_loop" << ", " << "serial_loop")};
1386 }();
1387 if (::mlir::failed(_result_value)) {
1388 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_CombinedConstructsAttr parameter 'value' which is to be a `::mlir::acc::CombinedConstructsType`");
1389 return {};
1390 }
1391 // Parse literal '>'
1392 if (odsParser.parseGreater()) return {};
1393 assert(::mlir::succeeded(_result_value));
1394 return CombinedConstructsTypeAttr::get(odsParser.getContext(),
1395 ::mlir::acc::CombinedConstructsType((*_result_value)));
1396}
1397
1398void CombinedConstructsTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1399 ::mlir::Builder odsBuilder(getContext());
1400 odsPrinter << "<";
1401 odsPrinter << stringifyCombinedConstructsType(getValue());
1402 odsPrinter << ">";
1403}
1404
1405::mlir::acc::CombinedConstructsType CombinedConstructsTypeAttr::getValue() const {
1406 return getImpl()->value;
1407}
1408
1409
1410} // namespace mlir::acc
1411MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::CombinedConstructsTypeAttr)
1412namespace mlir::acc {
1413
1414namespace detail {
1415
1416struct ConstructAttrStorage : public ::mlir::AttributeStorage {
1417 using KeyTy = std::tuple<::mlir::acc::Construct>;
1418 ConstructAttrStorage(::mlir::acc::Construct value) : value(std::move(value)) {}
1419
1420 KeyTy getAsKey() const {
1421 return KeyTy(value);
1422 }
1423
1424 bool operator==(const KeyTy &tblgenKey) const {
1425 return (value == std::get<0>(tblgenKey));
1426 }
1427
1428 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1429 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1430 }
1431
1432 static ConstructAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1433 auto value = std::move(std::get<0>(tblgenKey));
1434 return new (allocator.allocate<ConstructAttrStorage>()) ConstructAttrStorage(std::move(value));
1435 }
1436
1437 ::mlir::acc::Construct value;
1438};
1439
1440} // namespace detail
1441ConstructAttr ConstructAttr::get(::mlir::MLIRContext *context, ::mlir::acc::Construct value) {
1442 return Base::get(context, std::move(value));
1443}
1444
1445::mlir::Attribute ConstructAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1446 ::mlir::Builder odsBuilder(odsParser.getContext());
1447 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1448 (void) odsLoc;
1449 ::mlir::FailureOr<::mlir::acc::Construct> _result_value;
1450 // Parse literal '<'
1451 if (odsParser.parseLess()) return {};
1452
1453 // Parse variable 'value'
1454 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::Construct> {
1455 auto loc = odsParser.getCurrentLocation();
1456 std::string enumKeyword;
1457 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1458 return ::mlir::failure();
1459 auto maybeEnum = ::mlir::acc::symbolizeConstruct(enumKeyword);
1460 if (maybeEnum)
1461 return *maybeEnum;
1462 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::Construct" << " to be one of: " << "acc_construct_parallel" << ", " << "acc_construct_kernels" << ", " << "acc_construct_loop" << ", " << "acc_construct_data" << ", " << "acc_construct_enter_data" << ", " << "acc_construct_exit_data" << ", " << "acc_construct_host_data" << ", " << "acc_construct_atomic" << ", " << "acc_construct_declare" << ", " << "acc_construct_init" << ", " << "acc_construct_shutdown" << ", " << "acc_construct_set" << ", " << "acc_construct_update" << ", " << "acc_construct_routine" << ", " << "acc_construct_wait" << ", " << "acc_construct_runtime_api" << ", " << "acc_construct_serial")};
1463 }();
1464 if (::mlir::failed(_result_value)) {
1465 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_ConstructAttr parameter 'value' which is to be a `::mlir::acc::Construct`");
1466 return {};
1467 }
1468 // Parse literal '>'
1469 if (odsParser.parseGreater()) return {};
1470 assert(::mlir::succeeded(_result_value));
1471 return ConstructAttr::get(odsParser.getContext(),
1472 ::mlir::acc::Construct((*_result_value)));
1473}
1474
1475void ConstructAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1476 ::mlir::Builder odsBuilder(getContext());
1477 odsPrinter << "<";
1478 odsPrinter << stringifyConstruct(getValue());
1479 odsPrinter << ">";
1480}
1481
1482::mlir::acc::Construct ConstructAttr::getValue() const {
1483 return getImpl()->value;
1484}
1485
1486
1487} // namespace mlir::acc
1488MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ConstructAttr)
1489namespace mlir::acc {
1490
1491namespace detail {
1492
1493struct VarNameAttrStorage : public ::mlir::AttributeStorage {
1494 using KeyTy = std::tuple<::llvm::StringRef>;
1495 VarNameAttrStorage(::llvm::StringRef name) : name(std::move(name)) {}
1496
1497 KeyTy getAsKey() const {
1498 return KeyTy(name);
1499 }
1500
1501 bool operator==(const KeyTy &tblgenKey) const {
1502 return (name == std::get<0>(tblgenKey));
1503 }
1504
1505 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1506 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1507 }
1508
1509 static VarNameAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1510 auto name = std::move(std::get<0>(tblgenKey));
1511 name = allocator.copyInto(name);
1512 return new (allocator.allocate<VarNameAttrStorage>()) VarNameAttrStorage(std::move(name));
1513 }
1514
1515 ::llvm::StringRef name;
1516};
1517
1518} // namespace detail
1519VarNameAttr VarNameAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef name) {
1520 return Base::get(context, std::move(name));
1521}
1522
1523::mlir::Attribute VarNameAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1524 ::mlir::Builder odsBuilder(odsParser.getContext());
1525 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1526 (void) odsLoc;
1527 ::mlir::FailureOr<std::string> _result_name;
1528 // Parse literal '<'
1529 if (odsParser.parseLess()) return {};
1530
1531 // Parse variable 'name'
1532 _result_name = ::mlir::FieldParser<std::string>::parse(odsParser);
1533 if (::mlir::failed(_result_name)) {
1534 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_VarNameAttr parameter 'name' which is to be a `::llvm::StringRef`");
1535 return {};
1536 }
1537 // Parse literal '>'
1538 if (odsParser.parseGreater()) return {};
1539 assert(::mlir::succeeded(_result_name));
1540 return VarNameAttr::get(odsParser.getContext(),
1541 ::llvm::StringRef((*_result_name)));
1542}
1543
1544void VarNameAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1545 ::mlir::Builder odsBuilder(getContext());
1546 odsPrinter << "<";
1547 odsPrinter.printString(getName());;
1548 odsPrinter << ">";
1549}
1550
1551::llvm::StringRef VarNameAttr::getName() const {
1552 return getImpl()->name;
1553}
1554
1555
1556} // namespace mlir::acc
1557MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::VarNameAttr)
1558namespace mlir::acc {
1559
1560namespace detail {
1561
1562struct RoutineInfoAttrStorage : public ::mlir::AttributeStorage {
1563 using KeyTy = std::tuple<::llvm::ArrayRef<SymbolRefAttr>>;
1564 RoutineInfoAttrStorage(::llvm::ArrayRef<SymbolRefAttr> accRoutines) : accRoutines(std::move(accRoutines)) {}
1565
1566 KeyTy getAsKey() const {
1567 return KeyTy(accRoutines);
1568 }
1569
1570 bool operator==(const KeyTy &tblgenKey) const {
1571 return (accRoutines == std::get<0>(tblgenKey));
1572 }
1573
1574 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1575 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1576 }
1577
1578 static RoutineInfoAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1579 auto accRoutines = std::move(std::get<0>(tblgenKey));
1580 accRoutines = allocator.copyInto(accRoutines);
1581 return new (allocator.allocate<RoutineInfoAttrStorage>()) RoutineInfoAttrStorage(std::move(accRoutines));
1582 }
1583
1584 ::llvm::ArrayRef<SymbolRefAttr> accRoutines;
1585};
1586
1587} // namespace detail
1588RoutineInfoAttr RoutineInfoAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<SymbolRefAttr> accRoutines) {
1589 return Base::get(context, std::move(accRoutines));
1590}
1591
1592::mlir::Attribute RoutineInfoAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1593 ::mlir::Builder odsBuilder(odsParser.getContext());
1594 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1595 (void) odsLoc;
1596 ::mlir::FailureOr<::llvm::SmallVector<SymbolRefAttr>> _result_accRoutines;
1597 // Parse literal '<'
1598 if (odsParser.parseLess()) return {};
1599 // Parse literal '['
1600 if (odsParser.parseLSquare()) return {};
1601
1602 // Parse variable 'accRoutines'
1603 _result_accRoutines = ::mlir::FieldParser<::llvm::SmallVector<SymbolRefAttr>>::parse(odsParser);
1604 if (::mlir::failed(_result_accRoutines)) {
1605 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse RoutineInfoAttr parameter 'accRoutines' which is to be a `::llvm::ArrayRef<SymbolRefAttr>`");
1606 return {};
1607 }
1608 // Parse literal ']'
1609 if (odsParser.parseRSquare()) return {};
1610 // Parse literal '>'
1611 if (odsParser.parseGreater()) return {};
1612 assert(::mlir::succeeded(_result_accRoutines));
1613 return RoutineInfoAttr::get(odsParser.getContext(),
1614 ::llvm::ArrayRef<SymbolRefAttr>((*_result_accRoutines)));
1615}
1616
1617void RoutineInfoAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1618 ::mlir::Builder odsBuilder(getContext());
1619 odsPrinter << "<";
1620 odsPrinter << "[";
1621 odsPrinter.printStrippedAttrOrType(getAccRoutines());
1622 odsPrinter << "]";
1623 odsPrinter << ">";
1624}
1625
1626::llvm::ArrayRef<SymbolRefAttr> RoutineInfoAttr::getAccRoutines() const {
1627 return getImpl()->accRoutines;
1628}
1629
1630
1631} // namespace mlir::acc
1632MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::RoutineInfoAttr)
1633namespace mlir::acc {
1634
1635namespace detail {
1636
1637struct SpecializedRoutineAttrStorage : public ::mlir::AttributeStorage {
1638 using KeyTy = std::tuple<SymbolRefAttr, ParLevelAttr, StringAttr>;
1639 SpecializedRoutineAttrStorage(SymbolRefAttr routine, ParLevelAttr level, StringAttr funcName) : routine(std::move(routine)), level(std::move(level)), funcName(std::move(funcName)) {}
1640
1641 KeyTy getAsKey() const {
1642 return KeyTy(routine, level, funcName);
1643 }
1644
1645 bool operator==(const KeyTy &tblgenKey) const {
1646 return (routine == std::get<0>(tblgenKey)) && (level == std::get<1>(tblgenKey)) && (funcName == std::get<2>(tblgenKey));
1647 }
1648
1649 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1650 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
1651 }
1652
1653 static SpecializedRoutineAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1654 auto routine = std::move(std::get<0>(tblgenKey));
1655 auto level = std::move(std::get<1>(tblgenKey));
1656 auto funcName = std::move(std::get<2>(tblgenKey));
1657 return new (allocator.allocate<SpecializedRoutineAttrStorage>()) SpecializedRoutineAttrStorage(std::move(routine), std::move(level), std::move(funcName));
1658 }
1659
1660 SymbolRefAttr routine;
1661 ParLevelAttr level;
1662 StringAttr funcName;
1663};
1664
1665} // namespace detail
1666SpecializedRoutineAttr SpecializedRoutineAttr::get(::mlir::MLIRContext *context, SymbolRefAttr routine, ParLevelAttr level, StringAttr funcName) {
1667 return Base::get(context, std::move(routine), std::move(level), std::move(funcName));
1668}
1669
1670::mlir::Attribute SpecializedRoutineAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1671 ::mlir::Builder odsBuilder(odsParser.getContext());
1672 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1673 (void) odsLoc;
1674 ::mlir::FailureOr<SymbolRefAttr> _result_routine;
1675 ::mlir::FailureOr<ParLevelAttr> _result_level;
1676 ::mlir::FailureOr<StringAttr> _result_funcName;
1677 // Parse literal '<'
1678 if (odsParser.parseLess()) return {};
1679
1680 // Parse variable 'routine'
1681 _result_routine = ::mlir::FieldParser<SymbolRefAttr>::parse(odsParser);
1682 if (::mlir::failed(_result_routine)) {
1683 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse SpecializedRoutineAttr parameter 'routine' which is to be a `SymbolRefAttr`");
1684 return {};
1685 }
1686 // Parse literal ','
1687 if (odsParser.parseComma()) return {};
1688
1689 // Parse variable 'level'
1690 _result_level = ::mlir::FieldParser<ParLevelAttr>::parse(odsParser);
1691 if (::mlir::failed(_result_level)) {
1692 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse SpecializedRoutineAttr parameter 'level' which is to be a `ParLevelAttr`");
1693 return {};
1694 }
1695 // Parse literal ','
1696 if (odsParser.parseComma()) return {};
1697
1698 // Parse variable 'funcName'
1699 _result_funcName = ::mlir::FieldParser<StringAttr>::parse(odsParser);
1700 if (::mlir::failed(_result_funcName)) {
1701 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse SpecializedRoutineAttr parameter 'funcName' which is to be a `StringAttr`");
1702 return {};
1703 }
1704 // Parse literal '>'
1705 if (odsParser.parseGreater()) return {};
1706 assert(::mlir::succeeded(_result_routine));
1707 assert(::mlir::succeeded(_result_level));
1708 assert(::mlir::succeeded(_result_funcName));
1709 return SpecializedRoutineAttr::get(odsParser.getContext(),
1710 SymbolRefAttr((*_result_routine)),
1711 ParLevelAttr((*_result_level)),
1712 StringAttr((*_result_funcName)));
1713}
1714
1715void SpecializedRoutineAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1716 ::mlir::Builder odsBuilder(getContext());
1717 odsPrinter << "<";
1718 odsPrinter.printStrippedAttrOrType(getRoutine());
1719 odsPrinter << ",";
1720 odsPrinter << ' ';
1721 odsPrinter.printStrippedAttrOrType(getLevel());
1722 odsPrinter << ",";
1723 odsPrinter << ' ';
1724 odsPrinter.printStrippedAttrOrType(getFuncName());
1725 odsPrinter << ">";
1726}
1727
1728SymbolRefAttr SpecializedRoutineAttr::getRoutine() const {
1729 return getImpl()->routine;
1730}
1731
1732ParLevelAttr SpecializedRoutineAttr::getLevel() const {
1733 return getImpl()->level;
1734}
1735
1736StringAttr SpecializedRoutineAttr::getFuncName() const {
1737 return getImpl()->funcName;
1738}
1739
1740
1741} // namespace mlir::acc
1742MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::SpecializedRoutineAttr)
1743namespace mlir::acc {
1744
1745namespace detail {
1746
1747struct DataDescKindAttrStorage : public ::mlir::AttributeStorage {
1748 using KeyTy = std::tuple<::mlir::acc::DataDescKind>;
1749 DataDescKindAttrStorage(::mlir::acc::DataDescKind value) : value(std::move(value)) {}
1750
1751 KeyTy getAsKey() const {
1752 return KeyTy(value);
1753 }
1754
1755 bool operator==(const KeyTy &tblgenKey) const {
1756 return (value == std::get<0>(tblgenKey));
1757 }
1758
1759 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1760 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1761 }
1762
1763 static DataDescKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1764 auto value = std::move(std::get<0>(tblgenKey));
1765 return new (allocator.allocate<DataDescKindAttrStorage>()) DataDescKindAttrStorage(std::move(value));
1766 }
1767
1768 ::mlir::acc::DataDescKind value;
1769};
1770
1771} // namespace detail
1772DataDescKindAttr DataDescKindAttr::get(::mlir::MLIRContext *context, ::mlir::acc::DataDescKind value) {
1773 return Base::get(context, std::move(value));
1774}
1775
1776::mlir::Attribute DataDescKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1777 ::mlir::Builder odsBuilder(odsParser.getContext());
1778 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1779 (void) odsLoc;
1780 ::mlir::FailureOr<::mlir::acc::DataDescKind> _result_value;
1781 // Parse literal '<'
1782 if (odsParser.parseLess()) return {};
1783
1784 // Parse variable 'value'
1785 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::DataDescKind> {
1786 ::mlir::acc::DataDescKind flags = {};
1787 auto loc = odsParser.getCurrentLocation();
1788 std::string enumKeyword;
1789 do {
1790 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1791 return ::mlir::failure();
1792 auto maybeEnum = ::mlir::acc::symbolizeDataDescKind(enumKeyword);
1793 if (!maybeEnum) {
1794 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::DataDescKind" << " to be one of: " << "none" << ", " << "cfi" << ", " << "memref" << ", " << "openacc")};
1795 }
1796 flags = flags | *maybeEnum;
1797 } while(::mlir::succeeded(odsParser.parseOptionalComma()));
1798 return flags;
1799 }();
1800 if (::mlir::failed(_result_value)) {
1801 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_DataDescKindAttr parameter 'value' which is to be a `::mlir::acc::DataDescKind`");
1802 return {};
1803 }
1804 // Parse literal '>'
1805 if (odsParser.parseGreater()) return {};
1806 assert(::mlir::succeeded(_result_value));
1807 return DataDescKindAttr::get(odsParser.getContext(),
1808 ::mlir::acc::DataDescKind((*_result_value)));
1809}
1810
1811void DataDescKindAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1812 ::mlir::Builder odsBuilder(getContext());
1813 odsPrinter << "<";
1814 odsPrinter << stringifyDataDescKind(getValue());
1815 odsPrinter << ">";
1816}
1817
1818::mlir::acc::DataDescKind DataDescKindAttr::getValue() const {
1819 return getImpl()->value;
1820}
1821
1822
1823} // namespace mlir::acc
1824MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::DataDescKindAttr)
1825namespace mlir::acc {
1826
1827namespace detail {
1828
1829struct MapFlagsAttrStorage : public ::mlir::AttributeStorage {
1830 using KeyTy = std::tuple<::mlir::acc::MapFlags>;
1831 MapFlagsAttrStorage(::mlir::acc::MapFlags value) : value(std::move(value)) {}
1832
1833 KeyTy getAsKey() const {
1834 return KeyTy(value);
1835 }
1836
1837 bool operator==(const KeyTy &tblgenKey) const {
1838 return (value == std::get<0>(tblgenKey));
1839 }
1840
1841 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1842 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1843 }
1844
1845 static MapFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1846 auto value = std::move(std::get<0>(tblgenKey));
1847 return new (allocator.allocate<MapFlagsAttrStorage>()) MapFlagsAttrStorage(std::move(value));
1848 }
1849
1850 ::mlir::acc::MapFlags value;
1851};
1852
1853} // namespace detail
1854MapFlagsAttr MapFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::acc::MapFlags value) {
1855 return Base::get(context, std::move(value));
1856}
1857
1858::mlir::Attribute MapFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1859 ::mlir::Builder odsBuilder(odsParser.getContext());
1860 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1861 (void) odsLoc;
1862 ::mlir::FailureOr<::mlir::acc::MapFlags> _result_value;
1863 // Parse literal '<'
1864 if (odsParser.parseLess()) return {};
1865
1866 // Parse variable 'value'
1867 _result_value = [&]() -> ::mlir::FailureOr<::mlir::acc::MapFlags> {
1868 ::mlir::acc::MapFlags flags = {};
1869 auto loc = odsParser.getCurrentLocation();
1870 std::string enumKeyword;
1871 do {
1872 if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword)))
1873 return ::mlir::failure();
1874 auto maybeEnum = ::mlir::acc::symbolizeMapFlags(enumKeyword);
1875 if (!maybeEnum) {
1876 return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::acc::MapFlags" << " to be one of: " << "none" << ", " << "to" << ", " << "from" << ", " << "delete" << ", " << "ptr_and_obj" << ", " << "return_param" << ", " << "private" << ", " << "literal" << ", " << "implicit" << ", " << "devptr" << ", " << "managed_devptr" << ", " << "no_create" << ", " << "gang_private" << ", " << "worker_private" << ", " << "vector_private" << ", " << "init_zero" << ", " << "device_resident" << ", " << "if_present" << ", " << "present" << ", " << "descriptor" << ", " << "reduction" << ", " << "attach" << ", " << "detach" << ", " << "no_device_descriptor" << ", " << "link")};
1877 }
1878 flags = flags | *maybeEnum;
1879 } while(::mlir::succeeded(odsParser.parseOptionalComma()));
1880 return flags;
1881 }();
1882 if (::mlir::failed(_result_value)) {
1883 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_MapFlagsAttr parameter 'value' which is to be a `::mlir::acc::MapFlags`");
1884 return {};
1885 }
1886 // Parse literal '>'
1887 if (odsParser.parseGreater()) return {};
1888 assert(::mlir::succeeded(_result_value));
1889 return MapFlagsAttr::get(odsParser.getContext(),
1890 ::mlir::acc::MapFlags((*_result_value)));
1891}
1892
1893void MapFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1894 ::mlir::Builder odsBuilder(getContext());
1895 odsPrinter << "<";
1896 odsPrinter << stringifyMapFlags(getValue());
1897 odsPrinter << ">";
1898}
1899
1900::mlir::acc::MapFlags MapFlagsAttr::getValue() const {
1901 return getImpl()->value;
1902}
1903
1904
1905} // namespace mlir::acc
1906MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::MapFlagsAttr)
1907namespace mlir::acc {
1908
1909namespace detail {
1910
1911struct GPUParallelDimAttrStorage : public ::mlir::AttributeStorage {
1912 using KeyTy = std::tuple<::mlir::IntegerAttr>;
1913 GPUParallelDimAttrStorage(::mlir::IntegerAttr value) : value(std::move(value)) {}
1914
1915 KeyTy getAsKey() const {
1916 return KeyTy(value);
1917 }
1918
1919 bool operator==(const KeyTy &tblgenKey) const {
1920 return (value == std::get<0>(tblgenKey));
1921 }
1922
1923 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1924 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1925 }
1926
1927 static GPUParallelDimAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1928 auto value = std::move(std::get<0>(tblgenKey));
1929 return new (allocator.allocate<GPUParallelDimAttrStorage>()) GPUParallelDimAttrStorage(std::move(value));
1930 }
1931
1932 ::mlir::IntegerAttr value;
1933};
1934
1935} // namespace detail
1936GPUParallelDimAttr GPUParallelDimAttr::get(::mlir::MLIRContext *context, ::mlir::IntegerAttr value) {
1937 return Base::get(context, std::move(value));
1938}
1939
1940::mlir::IntegerAttr GPUParallelDimAttr::getValue() const {
1941 return getImpl()->value;
1942}
1943
1944
1945} // namespace mlir::acc
1946MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GPUParallelDimAttr)
1947namespace mlir::acc {
1948
1949namespace detail {
1950
1951struct GPUParallelDimsAttrStorage : public ::mlir::AttributeStorage {
1952 using KeyTy = std::tuple<::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr>>;
1953 GPUParallelDimsAttrStorage(::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array) : array(std::move(array)) {}
1954
1955 KeyTy getAsKey() const {
1956 return KeyTy(array);
1957 }
1958
1959 bool operator==(const KeyTy &tblgenKey) const {
1960 return (array == std::get<0>(tblgenKey));
1961 }
1962
1963 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1964 return ::llvm::hash_combine(std::get<0>(tblgenKey));
1965 }
1966
1967 static GPUParallelDimsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
1968 auto array = std::move(std::get<0>(tblgenKey));
1969 array = allocator.copyInto(array);
1970 return new (allocator.allocate<GPUParallelDimsAttrStorage>()) GPUParallelDimsAttrStorage(std::move(array));
1971 }
1972
1973 ::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array;
1974};
1975
1976} // namespace detail
1977GPUParallelDimsAttr GPUParallelDimsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array) {
1978 return Base::get(context, std::move(array));
1979}
1980
1981::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> GPUParallelDimsAttr::getArray() const {
1982 return getImpl()->array;
1983}
1984
1985
1986} // namespace mlir::acc
1987MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GPUParallelDimsAttr)
1988namespace mlir::acc {
1989
1990
1991} // namespace mlir::acc
1992MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::GPUBlockRedundantAttr)
1993namespace mlir::acc {
1994
1995namespace detail {
1996
1997struct ChunkSizeAttrStorage : public ::mlir::AttributeStorage {
1998 using KeyTy = std::tuple<int64_t>;
1999 ChunkSizeAttrStorage(int64_t chunk_size) : chunk_size(std::move(chunk_size)) {}
2000
2001 KeyTy getAsKey() const {
2002 return KeyTy(chunk_size);
2003 }
2004
2005 bool operator==(const KeyTy &tblgenKey) const {
2006 return (chunk_size == std::get<0>(tblgenKey));
2007 }
2008
2009 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2010 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2011 }
2012
2013 static ChunkSizeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
2014 auto chunk_size = std::move(std::get<0>(tblgenKey));
2015 return new (allocator.allocate<ChunkSizeAttrStorage>()) ChunkSizeAttrStorage(std::move(chunk_size));
2016 }
2017
2018 int64_t chunk_size;
2019};
2020
2021} // namespace detail
2022ChunkSizeAttr ChunkSizeAttr::get(::mlir::MLIRContext *context, int64_t chunk_size) {
2023 return Base::get(context, std::move(chunk_size));
2024}
2025
2026::mlir::Attribute ChunkSizeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
2027 ::mlir::Builder odsBuilder(odsParser.getContext());
2028 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2029 (void) odsLoc;
2030 ::mlir::FailureOr<int64_t> _result_chunk_size;
2031 // Parse literal '<'
2032 if (odsParser.parseLess()) return {};
2033
2034 // Parse variable 'chunk_size'
2035 _result_chunk_size = ::mlir::FieldParser<int64_t>::parse(odsParser);
2036 if (::mlir::failed(_result_chunk_size)) {
2037 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse OpenACC_ChunkSizeAttr parameter 'chunk_size' which is to be a `int64_t`");
2038 return {};
2039 }
2040 // Parse literal '>'
2041 if (odsParser.parseGreater()) return {};
2042 assert(::mlir::succeeded(_result_chunk_size));
2043 return ChunkSizeAttr::get(odsParser.getContext(),
2044 int64_t((*_result_chunk_size)));
2045}
2046
2047void ChunkSizeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2048 ::mlir::Builder odsBuilder(getContext());
2049 odsPrinter << "<";
2050 odsPrinter.printStrippedAttrOrType(getChunkSize());
2051 odsPrinter << ">";
2052}
2053
2054int64_t ChunkSizeAttr::getChunkSize() const {
2055 return getImpl()->chunk_size;
2056}
2057
2058
2059} // namespace mlir::acc
2060MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ChunkSizeAttr)
2061namespace mlir::acc {
2062
2063namespace detail {
2064
2065struct ActiveParDimsAttrStorage : public ::mlir::AttributeStorage {
2066 using KeyTy = std::tuple<::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr>>;
2067 ActiveParDimsAttrStorage(::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array) : array(std::move(array)) {}
2068
2069 KeyTy getAsKey() const {
2070 return KeyTy(array);
2071 }
2072
2073 bool operator==(const KeyTy &tblgenKey) const {
2074 return (array == std::get<0>(tblgenKey));
2075 }
2076
2077 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2078 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2079 }
2080
2081 static ActiveParDimsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
2082 auto array = std::move(std::get<0>(tblgenKey));
2083 array = allocator.copyInto(array);
2084 return new (allocator.allocate<ActiveParDimsAttrStorage>()) ActiveParDimsAttrStorage(std::move(array));
2085 }
2086
2087 ::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array;
2088};
2089
2090} // namespace detail
2091ActiveParDimsAttr ActiveParDimsAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> array) {
2092 return Base::get(context, std::move(array));
2093}
2094
2095::llvm::ArrayRef<::mlir::acc::GPUParallelDimAttr> ActiveParDimsAttr::getArray() const {
2096 return getImpl()->array;
2097}
2098
2099
2100} // namespace mlir::acc
2101MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::acc::ActiveParDimsAttr)
2102namespace mlir::acc {
2103
2104
2105/// Parse an attribute registered to this dialect.
2106::mlir::Attribute OpenACCDialect::parseAttribute(::mlir::DialectAsmParser &parser,
2107 ::mlir::Type type) const {
2108 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
2109 ::llvm::StringRef attrTag;
2110 {
2111 ::mlir::Attribute attr;
2112 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
2113 if (parseResult.has_value())
2114 return attr;
2115 }
2116
2117 parser.emitError(typeLoc) << "unknown attribute `"
2118 << attrTag << "` in dialect `" << getNamespace() << "`";
2119 return {};
2120}
2121/// Print an attribute registered to this dialect.
2122void OpenACCDialect::printAttribute(::mlir::Attribute attr,
2123 ::mlir::DialectAsmPrinter &printer) const {
2124 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
2125 return;
2126
2127}
2128
2129} // namespace mlir::acc
2130
2131#endif // GET_ATTRDEF_CLASSES
2132
2133