Bug Summary

File:build/source/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc
Warning:line 620, column 5
Value stored to '_firstPrinted' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name LLVMAttrs.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/build/source/build-llvm/tools/clang/stage2-bins -resource-dir /usr/lib/llvm-16/lib/clang/16 -I tools/mlir/lib/Dialect/LLVMIR -I /build/source/mlir/lib/Dialect/LLVMIR -I include -I /build/source/llvm/include -I /build/source/mlir/include -I tools/mlir/include -D MLIR_CUDA_CONVERSIONS_ENABLED=1 -D MLIR_ROCM_CONVERSIONS_ENABLED=1 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D _FORTIFY_SOURCE=2 -D NDEBUG -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fmacro-prefix-map=/build/source/= -fcoverage-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fcoverage-prefix-map=/build/source/= -source-date-epoch 1670191760 -O2 -Wno-unused-command-line-argument -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-comment -Wno-misleading-indentation -std=c++17 -fdeprecated-macro -fdebug-compilation-dir=/build/source/build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/source/= -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-12-05-012027-15999-1 -x c++ /build/source/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
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::LLVM::CConvAttr,
13::mlir::LLVM::DIBasicTypeAttr,
14::mlir::LLVM::DICompileUnitAttr,
15::mlir::LLVM::DICompositeTypeAttr,
16::mlir::LLVM::DIDerivedTypeAttr,
17::mlir::LLVM::DIFileAttr,
18::mlir::LLVM::DILexicalBlockAttr,
19::mlir::LLVM::DILexicalBlockFileAttr,
20::mlir::LLVM::DILocalVariableAttr,
21::mlir::LLVM::DISubprogramAttr,
22::mlir::LLVM::DISubrangeAttr,
23::mlir::LLVM::DISubroutineTypeAttr,
24::mlir::LLVM::FastmathFlagsAttr,
25::mlir::LLVM::LinkageAttr,
26::mlir::LLVM::LoopOptionsAttr
27
28#endif // GET_ATTRDEF_LIST
29
30#ifdef GET_ATTRDEF_CLASSES
31#undef GET_ATTRDEF_CLASSES
32
33static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
34 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
35 .Case(::mlir::LLVM::CConvAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
36 value = ::mlir::LLVM::CConvAttr::parse(parser, type);
37 return ::mlir::success(!!value);
38 })
39 .Case(::mlir::LLVM::DIBasicTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
40 value = ::mlir::LLVM::DIBasicTypeAttr::parse(parser, type);
41 return ::mlir::success(!!value);
42 })
43 .Case(::mlir::LLVM::DICompileUnitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
44 value = ::mlir::LLVM::DICompileUnitAttr::parse(parser, type);
45 return ::mlir::success(!!value);
46 })
47 .Case(::mlir::LLVM::DICompositeTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
48 value = ::mlir::LLVM::DICompositeTypeAttr::parse(parser, type);
49 return ::mlir::success(!!value);
50 })
51 .Case(::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
52 value = ::mlir::LLVM::DIDerivedTypeAttr::parse(parser, type);
53 return ::mlir::success(!!value);
54 })
55 .Case(::mlir::LLVM::DIFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
56 value = ::mlir::LLVM::DIFileAttr::parse(parser, type);
57 return ::mlir::success(!!value);
58 })
59 .Case(::mlir::LLVM::DILexicalBlockAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
60 value = ::mlir::LLVM::DILexicalBlockAttr::parse(parser, type);
61 return ::mlir::success(!!value);
62 })
63 .Case(::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
64 value = ::mlir::LLVM::DILexicalBlockFileAttr::parse(parser, type);
65 return ::mlir::success(!!value);
66 })
67 .Case(::mlir::LLVM::DILocalVariableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
68 value = ::mlir::LLVM::DILocalVariableAttr::parse(parser, type);
69 return ::mlir::success(!!value);
70 })
71 .Case(::mlir::LLVM::DISubprogramAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
72 value = ::mlir::LLVM::DISubprogramAttr::parse(parser, type);
73 return ::mlir::success(!!value);
74 })
75 .Case(::mlir::LLVM::DISubrangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
76 value = ::mlir::LLVM::DISubrangeAttr::parse(parser, type);
77 return ::mlir::success(!!value);
78 })
79 .Case(::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
80 value = ::mlir::LLVM::DISubroutineTypeAttr::parse(parser, type);
81 return ::mlir::success(!!value);
82 })
83 .Case(::mlir::LLVM::FastmathFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
84 value = ::mlir::LLVM::FastmathFlagsAttr::parse(parser, type);
85 return ::mlir::success(!!value);
86 })
87 .Case(::mlir::LLVM::LinkageAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
88 value = ::mlir::LLVM::LinkageAttr::parse(parser, type);
89 return ::mlir::success(!!value);
90 })
91 .Case(::mlir::LLVM::LoopOptionsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
92 value = ::mlir::LLVM::LoopOptionsAttr::parse(parser, type);
93 return ::mlir::success(!!value);
94 })
95 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
96 *mnemonic = keyword;
97 return std::nullopt;
98 });
99}
100
101static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
102 return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::LLVM::CConvAttr>([&](auto t) {
103 printer << ::mlir::LLVM::CConvAttr::getMnemonic();
104t.print(printer);
105 return ::mlir::success();
106 })
107 .Case<::mlir::LLVM::DIBasicTypeAttr>([&](auto t) {
108 printer << ::mlir::LLVM::DIBasicTypeAttr::getMnemonic();
109t.print(printer);
110 return ::mlir::success();
111 })
112 .Case<::mlir::LLVM::DICompileUnitAttr>([&](auto t) {
113 printer << ::mlir::LLVM::DICompileUnitAttr::getMnemonic();
114t.print(printer);
115 return ::mlir::success();
116 })
117 .Case<::mlir::LLVM::DICompositeTypeAttr>([&](auto t) {
118 printer << ::mlir::LLVM::DICompositeTypeAttr::getMnemonic();
119t.print(printer);
120 return ::mlir::success();
121 })
122 .Case<::mlir::LLVM::DIDerivedTypeAttr>([&](auto t) {
123 printer << ::mlir::LLVM::DIDerivedTypeAttr::getMnemonic();
124t.print(printer);
125 return ::mlir::success();
126 })
127 .Case<::mlir::LLVM::DIFileAttr>([&](auto t) {
128 printer << ::mlir::LLVM::DIFileAttr::getMnemonic();
129t.print(printer);
130 return ::mlir::success();
131 })
132 .Case<::mlir::LLVM::DILexicalBlockAttr>([&](auto t) {
133 printer << ::mlir::LLVM::DILexicalBlockAttr::getMnemonic();
134t.print(printer);
135 return ::mlir::success();
136 })
137 .Case<::mlir::LLVM::DILexicalBlockFileAttr>([&](auto t) {
138 printer << ::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic();
139t.print(printer);
140 return ::mlir::success();
141 })
142 .Case<::mlir::LLVM::DILocalVariableAttr>([&](auto t) {
143 printer << ::mlir::LLVM::DILocalVariableAttr::getMnemonic();
144t.print(printer);
145 return ::mlir::success();
146 })
147 .Case<::mlir::LLVM::DISubprogramAttr>([&](auto t) {
148 printer << ::mlir::LLVM::DISubprogramAttr::getMnemonic();
149t.print(printer);
150 return ::mlir::success();
151 })
152 .Case<::mlir::LLVM::DISubrangeAttr>([&](auto t) {
153 printer << ::mlir::LLVM::DISubrangeAttr::getMnemonic();
154t.print(printer);
155 return ::mlir::success();
156 })
157 .Case<::mlir::LLVM::DISubroutineTypeAttr>([&](auto t) {
158 printer << ::mlir::LLVM::DISubroutineTypeAttr::getMnemonic();
159t.print(printer);
160 return ::mlir::success();
161 })
162 .Case<::mlir::LLVM::FastmathFlagsAttr>([&](auto t) {
163 printer << ::mlir::LLVM::FastmathFlagsAttr::getMnemonic();
164t.print(printer);
165 return ::mlir::success();
166 })
167 .Case<::mlir::LLVM::LinkageAttr>([&](auto t) {
168 printer << ::mlir::LLVM::LinkageAttr::getMnemonic();
169t.print(printer);
170 return ::mlir::success();
171 })
172 .Case<::mlir::LLVM::LoopOptionsAttr>([&](auto t) {
173 printer << ::mlir::LLVM::LoopOptionsAttr::getMnemonic();
174t.print(printer);
175 return ::mlir::success();
176 })
177 .Default([](auto) { return ::mlir::failure(); });
178}
179
180namespace mlir {
181namespace LLVM {
182namespace detail {
183struct CConvAttrStorage : public ::mlir::AttributeStorage {
184 using KeyTy = std::tuple<CConv>;
185 CConvAttrStorage(CConv CallingConv) : CallingConv(CallingConv) {}
186
187 KeyTy getAsKey() const {
188 return KeyTy(CallingConv);
189 }
190
191 bool operator==(const KeyTy &tblgenKey) const {
192 return (CallingConv == std::get<0>(tblgenKey));
193 }
194
195 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
196 return ::llvm::hash_combine(std::get<0>(tblgenKey));
197 }
198
199 static CConvAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
200 auto CallingConv = std::get<0>(tblgenKey);
201 return new (allocator.allocate<CConvAttrStorage>()) CConvAttrStorage(CallingConv);
202 }
203
204 CConv CallingConv;
205};
206} // namespace detail
207CConvAttr CConvAttr::get(::mlir::MLIRContext *context, CConv CallingConv) {
208 return Base::get(context, CallingConv);
209}
210
211::mlir::Attribute CConvAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
212 ::mlir::Builder odsBuilder(odsParser.getContext());
213 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
214 (void) odsLoc;
215 ::mlir::FailureOr<CConv> _result_CallingConv;
216 // Parse literal '<'
217 if (odsParser.parseLess()) return {};
218
219 // Parse variable 'CallingConv'
220 _result_CallingConv = ::mlir::FieldParser<CConv>::parse(odsParser);
221 if (::mlir::failed(_result_CallingConv)) {
222 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CConvAttr parameter 'CallingConv' which is to be a `CConv`");
223 return {};
224 }
225 // Parse literal '>'
226 if (odsParser.parseGreater()) return {};
227 assert(::mlir::succeeded(_result_CallingConv))(static_cast <bool> (::mlir::succeeded(_result_CallingConv
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_CallingConv)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 227, __extension__ __PRETTY_FUNCTION__))
;
228 return CConvAttr::get(odsParser.getContext(),
229 CConv((*_result_CallingConv)));
230}
231
232void CConvAttr::print(::mlir::AsmPrinter &odsPrinter) const {
233 ::mlir::Builder odsBuilder(getContext());
234 odsPrinter << "<";
235 odsPrinter.printStrippedAttrOrType(getCallingConv());
236 odsPrinter << ">";
237}
238
239CConv CConvAttr::getCallingConv() const {
240 return getImpl()->CallingConv;
241}
242
243} // namespace LLVM
244} // namespace mlir
245MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CConvAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::CConvAttr>::id = {}; } }
246namespace mlir {
247namespace LLVM {
248namespace detail {
249struct DIBasicTypeAttrStorage : public ::mlir::AttributeStorage {
250 using KeyTy = std::tuple<unsigned, StringAttr, uint64_t, unsigned>;
251 DIBasicTypeAttrStorage(unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) : tag(tag), name(name), sizeInBits(sizeInBits), encoding(encoding) {}
252
253 KeyTy getAsKey() const {
254 return KeyTy(tag, name, sizeInBits, encoding);
255 }
256
257 bool operator==(const KeyTy &tblgenKey) const {
258 return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (sizeInBits == std::get<2>(tblgenKey)) && (encoding == std::get<3>(tblgenKey));
259 }
260
261 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
262 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
263 }
264
265 static DIBasicTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
266 auto tag = std::get<0>(tblgenKey);
267 auto name = std::get<1>(tblgenKey);
268 auto sizeInBits = std::get<2>(tblgenKey);
269 auto encoding = std::get<3>(tblgenKey);
270 return new (allocator.allocate<DIBasicTypeAttrStorage>()) DIBasicTypeAttrStorage(tag, name, sizeInBits, encoding);
271 }
272
273 unsigned tag;
274 StringAttr name;
275 uint64_t sizeInBits;
276 unsigned encoding;
277};
278} // namespace detail
279DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) {
280 return Base::get(context, tag, name, sizeInBits, encoding);
281}
282
283DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, const Twine &name, uint64_t sizeInBits, unsigned encoding) {
284 return Base::get(context, tag, StringAttr::get(context, name), sizeInBits,
285 encoding);
286}
287
288::mlir::Attribute DIBasicTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
289 ::mlir::Builder odsBuilder(odsParser.getContext());
290 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
291 (void) odsLoc;
292 ::mlir::FailureOr<unsigned> _result_tag;
293 ::mlir::FailureOr<StringAttr> _result_name;
294 ::mlir::FailureOr<uint64_t> _result_sizeInBits;
295 ::mlir::FailureOr<unsigned> _result_encoding;
296 // Parse literal '<'
297 if (odsParser.parseLess()) return {};
298 // Parse parameter struct
299 bool _seen_tag = false;
300 bool _seen_name = false;
301 bool _seen_sizeInBits = false;
302 bool _seen_encoding = false;
303 {
304 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
305 // Parse literal '='
306 if (odsParser.parseEqual()) return {};
307 if (!_seen_tag && _paramKey == "tag") {
308 _seen_tag = true;
309
310 // Parse variable 'tag'
311 _result_tag = [&]() -> FailureOr<unsigned> {
312 SMLoc tagLoc = odsParser.getCurrentLocation();
313 StringRef name;
314 if (odsParser.parseKeyword(&name))
315 return failure();
316
317 if (unsigned tag = llvm::dwarf::getTag(name))
318 return tag;
319 return odsParser.emitError(tagLoc)
320 << "invalid debug info debug info tag name: " << name;
321 }() ;
322 if (::mlir::failed(_result_tag)) {
323 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'tag' which is to be a `unsigned`");
324 return {};
325 }
326 } else if (!_seen_name && _paramKey == "name") {
327 _seen_name = true;
328
329 // Parse variable 'name'
330 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
331 if (::mlir::failed(_result_name)) {
332 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'name' which is to be a `StringAttr`");
333 return {};
334 }
335 } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") {
336 _seen_sizeInBits = true;
337
338 // Parse variable 'sizeInBits'
339 _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser);
340 if (::mlir::failed(_result_sizeInBits)) {
341 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`");
342 return {};
343 }
344 } else if (!_seen_encoding && _paramKey == "encoding") {
345 _seen_encoding = true;
346
347 // Parse variable 'encoding'
348 _result_encoding = [&]() -> FailureOr<unsigned> {
349 SMLoc tagLoc = odsParser.getCurrentLocation();
350 StringRef name;
351 if (odsParser.parseKeyword(&name))
352 return failure();
353
354 if (unsigned tag = llvm::dwarf::getAttributeEncoding(name))
355 return tag;
356 return odsParser.emitError(tagLoc)
357 << "invalid debug info debug info encoding name: " << name;
358 }() ;
359 if (::mlir::failed(_result_encoding)) {
360 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'encoding' which is to be a `unsigned`");
361 return {};
362 }
363 } else {
364 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
365 return {};
366 }
367 return true;
368 };
369 do {
370 ::llvm::StringRef _paramKey;
371 if (odsParser.parseKeyword(&_paramKey)) {
372 odsParser.emitError(odsParser.getCurrentLocation(),
373 "expected a parameter name in struct");
374 return {};
375 }
376 if (!_loop_body(_paramKey)) return {};
377 } while(!odsParser.parseOptionalComma());
378 if (!_seen_tag) {
379 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag";
380 return {};
381 }
382 if (!_seen_name) {
383 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name";
384 return {};
385 }
386 }
387 // Parse literal '>'
388 if (odsParser.parseGreater()) return {};
389 assert(::mlir::succeeded(_result_tag))(static_cast <bool> (::mlir::succeeded(_result_tag)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_tag)", "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 389, __extension__ __PRETTY_FUNCTION__))
;
390 assert(::mlir::succeeded(_result_name))(static_cast <bool> (::mlir::succeeded(_result_name)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_name)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 390, __extension__ __PRETTY_FUNCTION__))
;
391 return DIBasicTypeAttr::get(odsParser.getContext(),
392 unsigned((*_result_tag)),
393 StringAttr((*_result_name)),
394 uint64_t((_result_sizeInBits.value_or(uint64_t()))),
395 unsigned((_result_encoding.value_or(0))));
396}
397
398void DIBasicTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
399 ::mlir::Builder odsBuilder(getContext());
400 odsPrinter << "<";
401 {
402 bool _firstPrinted = true;
403 if (!_firstPrinted) odsPrinter << ", ";
404 _firstPrinted = false;
405 odsPrinter << "tag = ";
406 odsPrinter << llvm::dwarf::TagString(getTag());
407 if (!_firstPrinted) odsPrinter << ", ";
408 _firstPrinted = false;
409 odsPrinter << "name = ";
410 odsPrinter.printStrippedAttrOrType(getName());
411 if (!(getSizeInBits() == uint64_t())) {
412 if (!_firstPrinted) odsPrinter << ", ";
413 _firstPrinted = false;
414 odsPrinter << "sizeInBits = ";
415 if (!(getSizeInBits() == uint64_t())) {
416 odsPrinter.printStrippedAttrOrType(getSizeInBits());
417 }
418 }
419 if (!(getEncoding() == 0)) {
420 if (!_firstPrinted) odsPrinter << ", ";
421 _firstPrinted = false;
422 odsPrinter << "encoding = ";
423 if (!(getEncoding() == 0)) {
424 odsPrinter << llvm::dwarf::AttributeEncodingString(getEncoding());
425 }
426 }
427 }
428 odsPrinter << ">";
429}
430
431unsigned DIBasicTypeAttr::getTag() const {
432 return getImpl()->tag;
433}
434
435StringAttr DIBasicTypeAttr::getName() const {
436 return getImpl()->name;
437}
438
439uint64_t DIBasicTypeAttr::getSizeInBits() const {
440 return getImpl()->sizeInBits;
441}
442
443unsigned DIBasicTypeAttr::getEncoding() const {
444 return getImpl()->encoding;
445}
446
447} // namespace LLVM
448} // namespace mlir
449MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIBasicTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DIBasicTypeAttr>::id = {}; } }
450namespace mlir {
451namespace LLVM {
452namespace detail {
453struct DICompileUnitAttrStorage : public ::mlir::AttributeStorage {
454 using KeyTy = std::tuple<unsigned, DIFileAttr, StringAttr, bool, DIEmissionKind>;
455 DICompileUnitAttrStorage(unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) : sourceLanguage(sourceLanguage), file(file), producer(producer), isOptimized(isOptimized), emissionKind(emissionKind) {}
456
457 KeyTy getAsKey() const {
458 return KeyTy(sourceLanguage, file, producer, isOptimized, emissionKind);
459 }
460
461 bool operator==(const KeyTy &tblgenKey) const {
462 return (sourceLanguage == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (producer == std::get<2>(tblgenKey)) && (isOptimized == std::get<3>(tblgenKey)) && (emissionKind == std::get<4>(tblgenKey));
463 }
464
465 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
466 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey));
467 }
468
469 static DICompileUnitAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
470 auto sourceLanguage = std::get<0>(tblgenKey);
471 auto file = std::get<1>(tblgenKey);
472 auto producer = std::get<2>(tblgenKey);
473 auto isOptimized = std::get<3>(tblgenKey);
474 auto emissionKind = std::get<4>(tblgenKey);
475 return new (allocator.allocate<DICompileUnitAttrStorage>()) DICompileUnitAttrStorage(sourceLanguage, file, producer, isOptimized, emissionKind);
476 }
477
478 unsigned sourceLanguage;
479 DIFileAttr file;
480 StringAttr producer;
481 bool isOptimized;
482 DIEmissionKind emissionKind;
483};
484} // namespace detail
485DICompileUnitAttr DICompileUnitAttr::get(::mlir::MLIRContext *context, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) {
486 return Base::get(context, sourceLanguage, file, producer, isOptimized, emissionKind);
487}
488
489::mlir::Attribute DICompileUnitAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
490 ::mlir::Builder odsBuilder(odsParser.getContext());
491 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
492 (void) odsLoc;
493 ::mlir::FailureOr<unsigned> _result_sourceLanguage;
494 ::mlir::FailureOr<DIFileAttr> _result_file;
495 ::mlir::FailureOr<StringAttr> _result_producer;
496 ::mlir::FailureOr<bool> _result_isOptimized;
497 ::mlir::FailureOr<DIEmissionKind> _result_emissionKind;
498 // Parse literal '<'
499 if (odsParser.parseLess()) return {};
500 // Parse parameter struct
501 bool _seen_sourceLanguage = false;
502 bool _seen_file = false;
503 bool _seen_producer = false;
504 bool _seen_isOptimized = false;
505 bool _seen_emissionKind = false;
506 {
507 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
508 // Parse literal '='
509 if (odsParser.parseEqual()) return {};
510 if (!_seen_sourceLanguage && _paramKey == "sourceLanguage") {
511 _seen_sourceLanguage = true;
512
513 // Parse variable 'sourceLanguage'
514 _result_sourceLanguage = [&]() -> FailureOr<unsigned> {
515 SMLoc tagLoc = odsParser.getCurrentLocation();
516 StringRef name;
517 if (odsParser.parseKeyword(&name))
518 return failure();
519
520 if (unsigned tag = llvm::dwarf::getLanguage(name))
521 return tag;
522 return odsParser.emitError(tagLoc)
523 << "invalid debug info debug info language name: " << name;
524 }() ;
525 if (::mlir::failed(_result_sourceLanguage)) {
526 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'sourceLanguage' which is to be a `unsigned`");
527 return {};
528 }
529 } else if (!_seen_file && _paramKey == "file") {
530 _seen_file = true;
531
532 // Parse variable 'file'
533 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
534 if (::mlir::failed(_result_file)) {
535 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'file' which is to be a `DIFileAttr`");
536 return {};
537 }
538 } else if (!_seen_producer && _paramKey == "producer") {
539 _seen_producer = true;
540
541 // Parse variable 'producer'
542 _result_producer = ::mlir::FieldParser<StringAttr>::parse(odsParser);
543 if (::mlir::failed(_result_producer)) {
544 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'producer' which is to be a `StringAttr`");
545 return {};
546 }
547 } else if (!_seen_isOptimized && _paramKey == "isOptimized") {
548 _seen_isOptimized = true;
549
550 // Parse variable 'isOptimized'
551 _result_isOptimized = ::mlir::FieldParser<bool>::parse(odsParser);
552 if (::mlir::failed(_result_isOptimized)) {
553 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isOptimized' which is to be a `bool`");
554 return {};
555 }
556 } else if (!_seen_emissionKind && _paramKey == "emissionKind") {
557 _seen_emissionKind = true;
558
559 // Parse variable 'emissionKind'
560 _result_emissionKind = ::mlir::FieldParser<DIEmissionKind>::parse(odsParser);
561 if (::mlir::failed(_result_emissionKind)) {
562 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'emissionKind' which is to be a `DIEmissionKind`");
563 return {};
564 }
565 } else {
566 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
567 return {};
568 }
569 return true;
570 };
571 for (unsigned odsStructIndex = 0; odsStructIndex < 5; ++odsStructIndex) {
572 ::llvm::StringRef _paramKey;
573 if (odsParser.parseKeyword(&_paramKey)) {
574 odsParser.emitError(odsParser.getCurrentLocation(),
575 "expected a parameter name in struct");
576 return {};
577 }
578 if (!_loop_body(_paramKey)) return {};
579 if ((odsStructIndex != 5 - 1) && odsParser.parseComma())
580 return {};
581 }
582 }
583 // Parse literal '>'
584 if (odsParser.parseGreater()) return {};
585 assert(::mlir::succeeded(_result_sourceLanguage))(static_cast <bool> (::mlir::succeeded(_result_sourceLanguage
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_sourceLanguage)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 585, __extension__ __PRETTY_FUNCTION__))
;
586 assert(::mlir::succeeded(_result_file))(static_cast <bool> (::mlir::succeeded(_result_file)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_file)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 586, __extension__ __PRETTY_FUNCTION__))
;
587 assert(::mlir::succeeded(_result_producer))(static_cast <bool> (::mlir::succeeded(_result_producer
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_producer)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 587, __extension__ __PRETTY_FUNCTION__))
;
588 assert(::mlir::succeeded(_result_isOptimized))(static_cast <bool> (::mlir::succeeded(_result_isOptimized
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_isOptimized)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 588, __extension__ __PRETTY_FUNCTION__))
;
589 assert(::mlir::succeeded(_result_emissionKind))(static_cast <bool> (::mlir::succeeded(_result_emissionKind
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_emissionKind)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 589, __extension__ __PRETTY_FUNCTION__))
;
590 return DICompileUnitAttr::get(odsParser.getContext(),
591 unsigned((*_result_sourceLanguage)),
592 DIFileAttr((*_result_file)),
593 StringAttr((*_result_producer)),
594 bool((*_result_isOptimized)),
595 DIEmissionKind((*_result_emissionKind)));
596}
597
598void DICompileUnitAttr::print(::mlir::AsmPrinter &odsPrinter) const {
599 ::mlir::Builder odsBuilder(getContext());
600 odsPrinter << "<";
601 {
602 bool _firstPrinted = true;
603 if (!_firstPrinted) odsPrinter << ", ";
604 _firstPrinted = false;
605 odsPrinter << "sourceLanguage = ";
606 odsPrinter << llvm::dwarf::LanguageString(getSourceLanguage());
607 if (!_firstPrinted) odsPrinter << ", ";
608 _firstPrinted = false;
609 odsPrinter << "file = ";
610 odsPrinter.printStrippedAttrOrType(getFile());
611 if (!_firstPrinted) odsPrinter << ", ";
612 _firstPrinted = false;
613 odsPrinter << "producer = ";
614 odsPrinter.printStrippedAttrOrType(getProducer());
615 if (!_firstPrinted) odsPrinter << ", ";
616 _firstPrinted = false;
617 odsPrinter << "isOptimized = ";
618 odsPrinter.printStrippedAttrOrType(getIsOptimized());
619 if (!_firstPrinted) odsPrinter << ", ";
620 _firstPrinted = false;
Value stored to '_firstPrinted' is never read
621 odsPrinter << "emissionKind = ";
622 odsPrinter.printStrippedAttrOrType(getEmissionKind());
623 }
624 odsPrinter << ">";
625}
626
627unsigned DICompileUnitAttr::getSourceLanguage() const {
628 return getImpl()->sourceLanguage;
629}
630
631DIFileAttr DICompileUnitAttr::getFile() const {
632 return getImpl()->file;
633}
634
635StringAttr DICompileUnitAttr::getProducer() const {
636 return getImpl()->producer;
637}
638
639bool DICompileUnitAttr::getIsOptimized() const {
640 return getImpl()->isOptimized;
641}
642
643DIEmissionKind DICompileUnitAttr::getEmissionKind() const {
644 return getImpl()->emissionKind;
645}
646
647} // namespace LLVM
648} // namespace mlir
649MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompileUnitAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DICompileUnitAttr>::id = {}; } }
650namespace mlir {
651namespace LLVM {
652namespace detail {
653struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage {
654 using KeyTy = std::tuple<unsigned, StringAttr, DIFileAttr, uint32_t, DIScopeAttr, DITypeAttr, DIFlags, uint64_t, uint64_t, ::llvm::ArrayRef<DINodeAttr>>;
655 DICompositeTypeAttrStorage(unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, ::llvm::ArrayRef<DINodeAttr> elements) : tag(tag), name(name), file(file), line(line), scope(scope), baseType(baseType), flags(flags), sizeInBits(sizeInBits), alignInBits(alignInBits), elements(elements) {}
656
657 KeyTy getAsKey() const {
658 return KeyTy(tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements);
659 }
660
661 bool operator==(const KeyTy &tblgenKey) const {
662 return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (scope == std::get<4>(tblgenKey)) && (baseType == std::get<5>(tblgenKey)) && (flags == std::get<6>(tblgenKey)) && (sizeInBits == std::get<7>(tblgenKey)) && (alignInBits == std::get<8>(tblgenKey)) && (::llvm::makeArrayRef(elements) == ::llvm::makeArrayRef(std::get<9>(tblgenKey)));
663 }
664
665 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
666 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), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey));
667 }
668
669 static DICompositeTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
670 auto tag = std::get<0>(tblgenKey);
671 auto name = std::get<1>(tblgenKey);
672 auto file = std::get<2>(tblgenKey);
673 auto line = std::get<3>(tblgenKey);
674 auto scope = std::get<4>(tblgenKey);
675 auto baseType = std::get<5>(tblgenKey);
676 auto flags = std::get<6>(tblgenKey);
677 auto sizeInBits = std::get<7>(tblgenKey);
678 auto alignInBits = std::get<8>(tblgenKey);
679 auto elements = std::get<9>(tblgenKey);
680 elements = allocator.copyInto(elements);
681 return new (allocator.allocate<DICompositeTypeAttrStorage>()) DICompositeTypeAttrStorage(tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements);
682 }
683
684 unsigned tag;
685 StringAttr name;
686 DIFileAttr file;
687 uint32_t line;
688 DIScopeAttr scope;
689 DITypeAttr baseType;
690 DIFlags flags;
691 uint64_t sizeInBits;
692 uint64_t alignInBits;
693 ::llvm::ArrayRef<DINodeAttr> elements;
694};
695} // namespace detail
696DICompositeTypeAttr DICompositeTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, ::llvm::ArrayRef<DINodeAttr> elements) {
697 return Base::get(context, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements);
698}
699
700::mlir::Attribute DICompositeTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
701 ::mlir::Builder odsBuilder(odsParser.getContext());
702 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
703 (void) odsLoc;
704 ::mlir::FailureOr<unsigned> _result_tag;
705 ::mlir::FailureOr<StringAttr> _result_name;
706 ::mlir::FailureOr<DIFileAttr> _result_file;
707 ::mlir::FailureOr<uint32_t> _result_line;
708 ::mlir::FailureOr<DIScopeAttr> _result_scope;
709 ::mlir::FailureOr<DITypeAttr> _result_baseType;
710 ::mlir::FailureOr<DIFlags> _result_flags;
711 ::mlir::FailureOr<uint64_t> _result_sizeInBits;
712 ::mlir::FailureOr<uint64_t> _result_alignInBits;
713 ::mlir::FailureOr<::llvm::SmallVector<DINodeAttr>> _result_elements;
714 // Parse literal '<'
715 if (odsParser.parseLess()) return {};
716 // Parse parameter struct
717 bool _seen_tag = false;
718 bool _seen_name = false;
719 bool _seen_file = false;
720 bool _seen_line = false;
721 bool _seen_scope = false;
722 bool _seen_baseType = false;
723 bool _seen_flags = false;
724 bool _seen_sizeInBits = false;
725 bool _seen_alignInBits = false;
726 bool _seen_elements = false;
727 {
728 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
729 // Parse literal '='
730 if (odsParser.parseEqual()) return {};
731 if (!_seen_tag && _paramKey == "tag") {
732 _seen_tag = true;
733
734 // Parse variable 'tag'
735 _result_tag = [&]() -> FailureOr<unsigned> {
736 SMLoc tagLoc = odsParser.getCurrentLocation();
737 StringRef name;
738 if (odsParser.parseKeyword(&name))
739 return failure();
740
741 if (unsigned tag = llvm::dwarf::getTag(name))
742 return tag;
743 return odsParser.emitError(tagLoc)
744 << "invalid debug info debug info tag name: " << name;
745 }() ;
746 if (::mlir::failed(_result_tag)) {
747 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'tag' which is to be a `unsigned`");
748 return {};
749 }
750 } else if (!_seen_name && _paramKey == "name") {
751 _seen_name = true;
752
753 // Parse variable 'name'
754 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
755 if (::mlir::failed(_result_name)) {
756 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'name' which is to be a `StringAttr`");
757 return {};
758 }
759 } else if (!_seen_file && _paramKey == "file") {
760 _seen_file = true;
761
762 // Parse variable 'file'
763 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
764 if (::mlir::failed(_result_file)) {
765 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'file' which is to be a `DIFileAttr`");
766 return {};
767 }
768 } else if (!_seen_line && _paramKey == "line") {
769 _seen_line = true;
770
771 // Parse variable 'line'
772 _result_line = ::mlir::FieldParser<uint32_t>::parse(odsParser);
773 if (::mlir::failed(_result_line)) {
774 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'line' which is to be a `uint32_t`");
775 return {};
776 }
777 } else if (!_seen_scope && _paramKey == "scope") {
778 _seen_scope = true;
779
780 // Parse variable 'scope'
781 _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser);
782 if (::mlir::failed(_result_scope)) {
783 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'scope' which is to be a `DIScopeAttr`");
784 return {};
785 }
786 } else if (!_seen_baseType && _paramKey == "baseType") {
787 _seen_baseType = true;
788
789 // Parse variable 'baseType'
790 _result_baseType = ::mlir::FieldParser<DITypeAttr>::parse(odsParser);
791 if (::mlir::failed(_result_baseType)) {
792 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'baseType' which is to be a `DITypeAttr`");
793 return {};
794 }
795 } else if (!_seen_flags && _paramKey == "flags") {
796 _seen_flags = true;
797
798 // Parse variable 'flags'
799 _result_flags = ::mlir::FieldParser<DIFlags>::parse(odsParser);
800 if (::mlir::failed(_result_flags)) {
801 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'flags' which is to be a `DIFlags`");
802 return {};
803 }
804 } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") {
805 _seen_sizeInBits = true;
806
807 // Parse variable 'sizeInBits'
808 _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser);
809 if (::mlir::failed(_result_sizeInBits)) {
810 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`");
811 return {};
812 }
813 } else if (!_seen_alignInBits && _paramKey == "alignInBits") {
814 _seen_alignInBits = true;
815
816 // Parse variable 'alignInBits'
817 _result_alignInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser);
818 if (::mlir::failed(_result_alignInBits)) {
819 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'alignInBits' which is to be a `uint64_t`");
820 return {};
821 }
822 } else if (!_seen_elements && _paramKey == "elements") {
823 _seen_elements = true;
824
825 // Parse variable 'elements'
826 _result_elements = ::mlir::FieldParser<::llvm::SmallVector<DINodeAttr>>::parse(odsParser);
827 if (::mlir::failed(_result_elements)) {
828 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'elements' which is to be a `::llvm::ArrayRef<DINodeAttr>`");
829 return {};
830 }
831 } else {
832 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
833 return {};
834 }
835 return true;
836 };
837 do {
838 ::llvm::StringRef _paramKey;
839 if (odsParser.parseKeyword(&_paramKey)) {
840 odsParser.emitError(odsParser.getCurrentLocation(),
841 "expected a parameter name in struct");
842 return {};
843 }
844 if (!_loop_body(_paramKey)) return {};
845 } while(!odsParser.parseOptionalComma());
846 if (!_seen_tag) {
847 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag";
848 return {};
849 }
850 if (!_seen_name) {
851 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name";
852 return {};
853 }
854 }
855 // Parse literal '>'
856 if (odsParser.parseGreater()) return {};
857 assert(::mlir::succeeded(_result_tag))(static_cast <bool> (::mlir::succeeded(_result_tag)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_tag)", "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 857, __extension__ __PRETTY_FUNCTION__))
;
858 assert(::mlir::succeeded(_result_name))(static_cast <bool> (::mlir::succeeded(_result_name)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_name)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 858, __extension__ __PRETTY_FUNCTION__))
;
859 return DICompositeTypeAttr::get(odsParser.getContext(),
860 unsigned((*_result_tag)),
861 StringAttr((*_result_name)),
862 DIFileAttr((_result_file.value_or(DIFileAttr()))),
863 uint32_t((_result_line.value_or(uint32_t()))),
864 DIScopeAttr((_result_scope.value_or(DIScopeAttr()))),
865 DITypeAttr((_result_baseType.value_or(DITypeAttr()))),
866 DIFlags((_result_flags.value_or(DIFlags()))),
867 uint64_t((_result_sizeInBits.value_or(uint64_t()))),
868 uint64_t((_result_alignInBits.value_or(uint64_t()))),
869 ::llvm::ArrayRef<DINodeAttr>((_result_elements.value_or(::llvm::SmallVector<DINodeAttr>()))));
870}
871
872void DICompositeTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
873 ::mlir::Builder odsBuilder(getContext());
874 odsPrinter << "<";
875 {
876 bool _firstPrinted = true;
877 if (!_firstPrinted) odsPrinter << ", ";
878 _firstPrinted = false;
879 odsPrinter << "tag = ";
880 odsPrinter << llvm::dwarf::TagString(getTag());
881 if (!_firstPrinted) odsPrinter << ", ";
882 _firstPrinted = false;
883 odsPrinter << "name = ";
884 odsPrinter.printStrippedAttrOrType(getName());
885 if (!(getFile() == DIFileAttr())) {
886 if (!_firstPrinted) odsPrinter << ", ";
887 _firstPrinted = false;
888 odsPrinter << "file = ";
889 if (!(getFile() == DIFileAttr())) {
890 odsPrinter.printStrippedAttrOrType(getFile());
891 }
892 }
893 if (!(getLine() == uint32_t())) {
894 if (!_firstPrinted) odsPrinter << ", ";
895 _firstPrinted = false;
896 odsPrinter << "line = ";
897 if (!(getLine() == uint32_t())) {
898 odsPrinter.printStrippedAttrOrType(getLine());
899 }
900 }
901 if (!(getScope() == DIScopeAttr())) {
902 if (!_firstPrinted) odsPrinter << ", ";
903 _firstPrinted = false;
904 odsPrinter << "scope = ";
905 if (!(getScope() == DIScopeAttr())) {
906 odsPrinter.printStrippedAttrOrType(getScope());
907 }
908 }
909 if (!(getBaseType() == DITypeAttr())) {
910 if (!_firstPrinted) odsPrinter << ", ";
911 _firstPrinted = false;
912 odsPrinter << "baseType = ";
913 if (!(getBaseType() == DITypeAttr())) {
914 odsPrinter.printStrippedAttrOrType(getBaseType());
915 }
916 }
917 if (!(getFlags() == DIFlags())) {
918 if (!_firstPrinted) odsPrinter << ", ";
919 _firstPrinted = false;
920 odsPrinter << "flags = ";
921 if (!(getFlags() == DIFlags())) {
922 odsPrinter.printStrippedAttrOrType(getFlags());
923 }
924 }
925 if (!(getSizeInBits() == uint64_t())) {
926 if (!_firstPrinted) odsPrinter << ", ";
927 _firstPrinted = false;
928 odsPrinter << "sizeInBits = ";
929 if (!(getSizeInBits() == uint64_t())) {
930 odsPrinter.printStrippedAttrOrType(getSizeInBits());
931 }
932 }
933 if (!(getAlignInBits() == uint64_t())) {
934 if (!_firstPrinted) odsPrinter << ", ";
935 _firstPrinted = false;
936 odsPrinter << "alignInBits = ";
937 if (!(getAlignInBits() == uint64_t())) {
938 odsPrinter.printStrippedAttrOrType(getAlignInBits());
939 }
940 }
941 if (!(::llvm::makeArrayRef(getElements()) == ::llvm::makeArrayRef(::llvm::SmallVector<DINodeAttr>()))) {
942 if (!_firstPrinted) odsPrinter << ", ";
943 _firstPrinted = false;
944 odsPrinter << "elements = ";
945 if (!(::llvm::makeArrayRef(getElements()) == ::llvm::makeArrayRef(::llvm::SmallVector<DINodeAttr>()))) {
946 odsPrinter.printStrippedAttrOrType(getElements());
947 }
948 }
949 }
950 odsPrinter << ">";
951}
952
953unsigned DICompositeTypeAttr::getTag() const {
954 return getImpl()->tag;
955}
956
957StringAttr DICompositeTypeAttr::getName() const {
958 return getImpl()->name;
959}
960
961DIFileAttr DICompositeTypeAttr::getFile() const {
962 return getImpl()->file;
963}
964
965uint32_t DICompositeTypeAttr::getLine() const {
966 return getImpl()->line;
967}
968
969DIScopeAttr DICompositeTypeAttr::getScope() const {
970 return getImpl()->scope;
971}
972
973DITypeAttr DICompositeTypeAttr::getBaseType() const {
974 return getImpl()->baseType;
975}
976
977DIFlags DICompositeTypeAttr::getFlags() const {
978 return getImpl()->flags;
979}
980
981uint64_t DICompositeTypeAttr::getSizeInBits() const {
982 return getImpl()->sizeInBits;
983}
984
985uint64_t DICompositeTypeAttr::getAlignInBits() const {
986 return getImpl()->alignInBits;
987}
988
989::llvm::ArrayRef<DINodeAttr> DICompositeTypeAttr::getElements() const {
990 return getImpl()->elements;
991}
992
993} // namespace LLVM
994} // namespace mlir
995MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompositeTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DICompositeTypeAttr>::id = {}; } }
996namespace mlir {
997namespace LLVM {
998namespace detail {
999struct DIDerivedTypeAttrStorage : public ::mlir::AttributeStorage {
1000 using KeyTy = std::tuple<unsigned, StringAttr, DITypeAttr, uint64_t, uint32_t, uint64_t>;
1001 DIDerivedTypeAttrStorage(unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits) : tag(tag), name(name), baseType(baseType), sizeInBits(sizeInBits), alignInBits(alignInBits), offsetInBits(offsetInBits) {}
1002
1003 KeyTy getAsKey() const {
1004 return KeyTy(tag, name, baseType, sizeInBits, alignInBits, offsetInBits);
1005 }
1006
1007 bool operator==(const KeyTy &tblgenKey) const {
1008 return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (baseType == std::get<2>(tblgenKey)) && (sizeInBits == std::get<3>(tblgenKey)) && (alignInBits == std::get<4>(tblgenKey)) && (offsetInBits == std::get<5>(tblgenKey));
1009 }
1010
1011 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1012 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));
1013 }
1014
1015 static DIDerivedTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1016 auto tag = std::get<0>(tblgenKey);
1017 auto name = std::get<1>(tblgenKey);
1018 auto baseType = std::get<2>(tblgenKey);
1019 auto sizeInBits = std::get<3>(tblgenKey);
1020 auto alignInBits = std::get<4>(tblgenKey);
1021 auto offsetInBits = std::get<5>(tblgenKey);
1022 return new (allocator.allocate<DIDerivedTypeAttrStorage>()) DIDerivedTypeAttrStorage(tag, name, baseType, sizeInBits, alignInBits, offsetInBits);
1023 }
1024
1025 unsigned tag;
1026 StringAttr name;
1027 DITypeAttr baseType;
1028 uint64_t sizeInBits;
1029 uint32_t alignInBits;
1030 uint64_t offsetInBits;
1031};
1032} // namespace detail
1033DIDerivedTypeAttr DIDerivedTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits) {
1034 return Base::get(context, tag, name, baseType, sizeInBits, alignInBits, offsetInBits);
1035}
1036
1037::mlir::Attribute DIDerivedTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1038 ::mlir::Builder odsBuilder(odsParser.getContext());
1039 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1040 (void) odsLoc;
1041 ::mlir::FailureOr<unsigned> _result_tag;
1042 ::mlir::FailureOr<StringAttr> _result_name;
1043 ::mlir::FailureOr<DITypeAttr> _result_baseType;
1044 ::mlir::FailureOr<uint64_t> _result_sizeInBits;
1045 ::mlir::FailureOr<uint32_t> _result_alignInBits;
1046 ::mlir::FailureOr<uint64_t> _result_offsetInBits;
1047 // Parse literal '<'
1048 if (odsParser.parseLess()) return {};
1049 // Parse parameter struct
1050 bool _seen_tag = false;
1051 bool _seen_name = false;
1052 bool _seen_baseType = false;
1053 bool _seen_sizeInBits = false;
1054 bool _seen_alignInBits = false;
1055 bool _seen_offsetInBits = false;
1056 {
1057 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1058 // Parse literal '='
1059 if (odsParser.parseEqual()) return {};
1060 if (!_seen_tag && _paramKey == "tag") {
1061 _seen_tag = true;
1062
1063 // Parse variable 'tag'
1064 _result_tag = [&]() -> FailureOr<unsigned> {
1065 SMLoc tagLoc = odsParser.getCurrentLocation();
1066 StringRef name;
1067 if (odsParser.parseKeyword(&name))
1068 return failure();
1069
1070 if (unsigned tag = llvm::dwarf::getTag(name))
1071 return tag;
1072 return odsParser.emitError(tagLoc)
1073 << "invalid debug info debug info tag name: " << name;
1074 }() ;
1075 if (::mlir::failed(_result_tag)) {
1076 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'tag' which is to be a `unsigned`");
1077 return {};
1078 }
1079 } else if (!_seen_name && _paramKey == "name") {
1080 _seen_name = true;
1081
1082 // Parse variable 'name'
1083 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
1084 if (::mlir::failed(_result_name)) {
1085 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'name' which is to be a `StringAttr`");
1086 return {};
1087 }
1088 } else if (!_seen_baseType && _paramKey == "baseType") {
1089 _seen_baseType = true;
1090
1091 // Parse variable 'baseType'
1092 _result_baseType = ::mlir::FieldParser<DITypeAttr>::parse(odsParser);
1093 if (::mlir::failed(_result_baseType)) {
1094 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'baseType' which is to be a `DITypeAttr`");
1095 return {};
1096 }
1097 } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") {
1098 _seen_sizeInBits = true;
1099
1100 // Parse variable 'sizeInBits'
1101 _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser);
1102 if (::mlir::failed(_result_sizeInBits)) {
1103 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`");
1104 return {};
1105 }
1106 } else if (!_seen_alignInBits && _paramKey == "alignInBits") {
1107 _seen_alignInBits = true;
1108
1109 // Parse variable 'alignInBits'
1110 _result_alignInBits = ::mlir::FieldParser<uint32_t>::parse(odsParser);
1111 if (::mlir::failed(_result_alignInBits)) {
1112 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'alignInBits' which is to be a `uint32_t`");
1113 return {};
1114 }
1115 } else if (!_seen_offsetInBits && _paramKey == "offsetInBits") {
1116 _seen_offsetInBits = true;
1117
1118 // Parse variable 'offsetInBits'
1119 _result_offsetInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser);
1120 if (::mlir::failed(_result_offsetInBits)) {
1121 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'offsetInBits' which is to be a `uint64_t`");
1122 return {};
1123 }
1124 } else {
1125 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1126 return {};
1127 }
1128 return true;
1129 };
1130 do {
1131 ::llvm::StringRef _paramKey;
1132 if (odsParser.parseKeyword(&_paramKey)) {
1133 odsParser.emitError(odsParser.getCurrentLocation(),
1134 "expected a parameter name in struct");
1135 return {};
1136 }
1137 if (!_loop_body(_paramKey)) return {};
1138 } while(!odsParser.parseOptionalComma());
1139 if (!_seen_tag) {
1140 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag";
1141 return {};
1142 }
1143 if (!_seen_baseType) {
1144 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "baseType";
1145 return {};
1146 }
1147 }
1148 // Parse literal '>'
1149 if (odsParser.parseGreater()) return {};
1150 assert(::mlir::succeeded(_result_tag))(static_cast <bool> (::mlir::succeeded(_result_tag)) ? void
(0) : __assert_fail ("::mlir::succeeded(_result_tag)", "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1150, __extension__ __PRETTY_FUNCTION__))
;
1151 assert(::mlir::succeeded(_result_baseType))(static_cast <bool> (::mlir::succeeded(_result_baseType
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_baseType)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1151, __extension__ __PRETTY_FUNCTION__))
;
1152 return DIDerivedTypeAttr::get(odsParser.getContext(),
1153 unsigned((*_result_tag)),
1154 StringAttr((_result_name.value_or(StringAttr()))),
1155 DITypeAttr((*_result_baseType)),
1156 uint64_t((_result_sizeInBits.value_or(uint64_t()))),
1157 uint32_t((_result_alignInBits.value_or(uint32_t()))),
1158 uint64_t((_result_offsetInBits.value_or(uint64_t()))));
1159}
1160
1161void DIDerivedTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1162 ::mlir::Builder odsBuilder(getContext());
1163 odsPrinter << "<";
1164 {
1165 bool _firstPrinted = true;
1166 if (!_firstPrinted) odsPrinter << ", ";
1167 _firstPrinted = false;
1168 odsPrinter << "tag = ";
1169 odsPrinter << llvm::dwarf::TagString(getTag());
1170 if (!(getName() == StringAttr())) {
1171 if (!_firstPrinted) odsPrinter << ", ";
1172 _firstPrinted = false;
1173 odsPrinter << "name = ";
1174 if (!(getName() == StringAttr())) {
1175 odsPrinter.printStrippedAttrOrType(getName());
1176 }
1177 }
1178 if (!_firstPrinted) odsPrinter << ", ";
1179 _firstPrinted = false;
1180 odsPrinter << "baseType = ";
1181 odsPrinter.printStrippedAttrOrType(getBaseType());
1182 if (!(getSizeInBits() == uint64_t())) {
1183 if (!_firstPrinted) odsPrinter << ", ";
1184 _firstPrinted = false;
1185 odsPrinter << "sizeInBits = ";
1186 if (!(getSizeInBits() == uint64_t())) {
1187 odsPrinter.printStrippedAttrOrType(getSizeInBits());
1188 }
1189 }
1190 if (!(getAlignInBits() == uint32_t())) {
1191 if (!_firstPrinted) odsPrinter << ", ";
1192 _firstPrinted = false;
1193 odsPrinter << "alignInBits = ";
1194 if (!(getAlignInBits() == uint32_t())) {
1195 odsPrinter.printStrippedAttrOrType(getAlignInBits());
1196 }
1197 }
1198 if (!(getOffsetInBits() == uint64_t())) {
1199 if (!_firstPrinted) odsPrinter << ", ";
1200 _firstPrinted = false;
1201 odsPrinter << "offsetInBits = ";
1202 if (!(getOffsetInBits() == uint64_t())) {
1203 odsPrinter.printStrippedAttrOrType(getOffsetInBits());
1204 }
1205 }
1206 }
1207 odsPrinter << ">";
1208}
1209
1210unsigned DIDerivedTypeAttr::getTag() const {
1211 return getImpl()->tag;
1212}
1213
1214StringAttr DIDerivedTypeAttr::getName() const {
1215 return getImpl()->name;
1216}
1217
1218DITypeAttr DIDerivedTypeAttr::getBaseType() const {
1219 return getImpl()->baseType;
1220}
1221
1222uint64_t DIDerivedTypeAttr::getSizeInBits() const {
1223 return getImpl()->sizeInBits;
1224}
1225
1226uint32_t DIDerivedTypeAttr::getAlignInBits() const {
1227 return getImpl()->alignInBits;
1228}
1229
1230uint64_t DIDerivedTypeAttr::getOffsetInBits() const {
1231 return getImpl()->offsetInBits;
1232}
1233
1234} // namespace LLVM
1235} // namespace mlir
1236MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIDerivedTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DIDerivedTypeAttr>::id = {}; } }
1237namespace mlir {
1238namespace LLVM {
1239namespace detail {
1240struct DIFileAttrStorage : public ::mlir::AttributeStorage {
1241 using KeyTy = std::tuple<StringAttr, StringAttr>;
1242 DIFileAttrStorage(StringAttr name, StringAttr directory) : name(name), directory(directory) {}
1243
1244 KeyTy getAsKey() const {
1245 return KeyTy(name, directory);
1246 }
1247
1248 bool operator==(const KeyTy &tblgenKey) const {
1249 return (name == std::get<0>(tblgenKey)) && (directory == std::get<1>(tblgenKey));
1250 }
1251
1252 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1253 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
1254 }
1255
1256 static DIFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1257 auto name = std::get<0>(tblgenKey);
1258 auto directory = std::get<1>(tblgenKey);
1259 return new (allocator.allocate<DIFileAttrStorage>()) DIFileAttrStorage(name, directory);
1260 }
1261
1262 StringAttr name;
1263 StringAttr directory;
1264};
1265} // namespace detail
1266DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringAttr name, StringAttr directory) {
1267 return Base::get(context, name, directory);
1268}
1269
1270DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringRef name, StringRef directory) {
1271 return Base::get(context, StringAttr::get(context, name),
1272 StringAttr::get(context, directory));
1273}
1274
1275::mlir::Attribute DIFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1276 ::mlir::Builder odsBuilder(odsParser.getContext());
1277 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1278 (void) odsLoc;
1279 ::mlir::FailureOr<StringAttr> _result_name;
1280 ::mlir::FailureOr<StringAttr> _result_directory;
1281 // Parse literal '<'
1282 if (odsParser.parseLess()) return {};
1283
1284 // Parse variable 'name'
1285 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
1286 if (::mlir::failed(_result_name)) {
1287 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'name' which is to be a `StringAttr`");
1288 return {};
1289 }
1290 // Parse literal 'in'
1291 if (odsParser.parseKeyword("in")) return {};
1292
1293 // Parse variable 'directory'
1294 _result_directory = ::mlir::FieldParser<StringAttr>::parse(odsParser);
1295 if (::mlir::failed(_result_directory)) {
1296 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'directory' which is to be a `StringAttr`");
1297 return {};
1298 }
1299 // Parse literal '>'
1300 if (odsParser.parseGreater()) return {};
1301 assert(::mlir::succeeded(_result_name))(static_cast <bool> (::mlir::succeeded(_result_name)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_name)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1301, __extension__ __PRETTY_FUNCTION__))
;
1302 assert(::mlir::succeeded(_result_directory))(static_cast <bool> (::mlir::succeeded(_result_directory
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_directory)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1302, __extension__ __PRETTY_FUNCTION__))
;
1303 return DIFileAttr::get(odsParser.getContext(),
1304 StringAttr((*_result_name)),
1305 StringAttr((*_result_directory)));
1306}
1307
1308void DIFileAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1309 ::mlir::Builder odsBuilder(getContext());
1310 odsPrinter << "<";
1311 odsPrinter.printStrippedAttrOrType(getName());
1312 odsPrinter << ' ' << "in";
1313 odsPrinter << ' ';
1314 odsPrinter.printStrippedAttrOrType(getDirectory());
1315 odsPrinter << ">";
1316}
1317
1318StringAttr DIFileAttr::getName() const {
1319 return getImpl()->name;
1320}
1321
1322StringAttr DIFileAttr::getDirectory() const {
1323 return getImpl()->directory;
1324}
1325
1326} // namespace LLVM
1327} // namespace mlir
1328MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIFileAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DIFileAttr>::id = {}; } }
1329namespace mlir {
1330namespace LLVM {
1331namespace detail {
1332struct DILexicalBlockAttrStorage : public ::mlir::AttributeStorage {
1333 using KeyTy = std::tuple<DIScopeAttr, DIFileAttr, unsigned, unsigned>;
1334 DILexicalBlockAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) : scope(scope), file(file), line(line), column(column) {}
1335
1336 KeyTy getAsKey() const {
1337 return KeyTy(scope, file, line, column);
1338 }
1339
1340 bool operator==(const KeyTy &tblgenKey) const {
1341 return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (line == std::get<2>(tblgenKey)) && (column == std::get<3>(tblgenKey));
1342 }
1343
1344 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1345 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
1346 }
1347
1348 static DILexicalBlockAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1349 auto scope = std::get<0>(tblgenKey);
1350 auto file = std::get<1>(tblgenKey);
1351 auto line = std::get<2>(tblgenKey);
1352 auto column = std::get<3>(tblgenKey);
1353 return new (allocator.allocate<DILexicalBlockAttrStorage>()) DILexicalBlockAttrStorage(scope, file, line, column);
1354 }
1355
1356 DIScopeAttr scope;
1357 DIFileAttr file;
1358 unsigned line;
1359 unsigned column;
1360};
1361} // namespace detail
1362DILexicalBlockAttr DILexicalBlockAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) {
1363 return Base::get(context, scope, file, line, column);
1364}
1365
1366DILexicalBlockAttr DILexicalBlockAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) {
1367 return Base::get(file.getContext(), scope, file, line, column);
1368}
1369
1370::mlir::Attribute DILexicalBlockAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1371 ::mlir::Builder odsBuilder(odsParser.getContext());
1372 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1373 (void) odsLoc;
1374 ::mlir::FailureOr<DIScopeAttr> _result_scope;
1375 ::mlir::FailureOr<DIFileAttr> _result_file;
1376 ::mlir::FailureOr<unsigned> _result_line;
1377 ::mlir::FailureOr<unsigned> _result_column;
1378 // Parse literal '<'
1379 if (odsParser.parseLess()) return {};
1380 // Parse parameter struct
1381 bool _seen_scope = false;
1382 bool _seen_file = false;
1383 bool _seen_line = false;
1384 bool _seen_column = false;
1385 {
1386 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1387 // Parse literal '='
1388 if (odsParser.parseEqual()) return {};
1389 if (!_seen_scope && _paramKey == "scope") {
1390 _seen_scope = true;
1391
1392 // Parse variable 'scope'
1393 _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser);
1394 if (::mlir::failed(_result_scope)) {
1395 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'scope' which is to be a `DIScopeAttr`");
1396 return {};
1397 }
1398 } else if (!_seen_file && _paramKey == "file") {
1399 _seen_file = true;
1400
1401 // Parse variable 'file'
1402 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
1403 if (::mlir::failed(_result_file)) {
1404 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'file' which is to be a `DIFileAttr`");
1405 return {};
1406 }
1407 } else if (!_seen_line && _paramKey == "line") {
1408 _seen_line = true;
1409
1410 // Parse variable 'line'
1411 _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser);
1412 if (::mlir::failed(_result_line)) {
1413 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'line' which is to be a `unsigned`");
1414 return {};
1415 }
1416 } else if (!_seen_column && _paramKey == "column") {
1417 _seen_column = true;
1418
1419 // Parse variable 'column'
1420 _result_column = ::mlir::FieldParser<unsigned>::parse(odsParser);
1421 if (::mlir::failed(_result_column)) {
1422 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'column' which is to be a `unsigned`");
1423 return {};
1424 }
1425 } else {
1426 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1427 return {};
1428 }
1429 return true;
1430 };
1431 do {
1432 ::llvm::StringRef _paramKey;
1433 if (odsParser.parseKeyword(&_paramKey)) {
1434 odsParser.emitError(odsParser.getCurrentLocation(),
1435 "expected a parameter name in struct");
1436 return {};
1437 }
1438 if (!_loop_body(_paramKey)) return {};
1439 } while(!odsParser.parseOptionalComma());
1440 if (!_seen_scope) {
1441 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope";
1442 return {};
1443 }
1444 }
1445 // Parse literal '>'
1446 if (odsParser.parseGreater()) return {};
1447 assert(::mlir::succeeded(_result_scope))(static_cast <bool> (::mlir::succeeded(_result_scope)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_scope)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1447, __extension__ __PRETTY_FUNCTION__))
;
1448 return DILexicalBlockAttr::get(odsParser.getContext(),
1449 DIScopeAttr((*_result_scope)),
1450 DIFileAttr((_result_file.value_or(DIFileAttr()))),
1451 unsigned((_result_line.value_or(unsigned()))),
1452 unsigned((_result_column.value_or(unsigned()))));
1453}
1454
1455void DILexicalBlockAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1456 ::mlir::Builder odsBuilder(getContext());
1457 odsPrinter << "<";
1458 {
1459 bool _firstPrinted = true;
1460 if (!_firstPrinted) odsPrinter << ", ";
1461 _firstPrinted = false;
1462 odsPrinter << "scope = ";
1463 odsPrinter.printStrippedAttrOrType(getScope());
1464 if (!(getFile() == DIFileAttr())) {
1465 if (!_firstPrinted) odsPrinter << ", ";
1466 _firstPrinted = false;
1467 odsPrinter << "file = ";
1468 if (!(getFile() == DIFileAttr())) {
1469 odsPrinter.printStrippedAttrOrType(getFile());
1470 }
1471 }
1472 if (!(getLine() == unsigned())) {
1473 if (!_firstPrinted) odsPrinter << ", ";
1474 _firstPrinted = false;
1475 odsPrinter << "line = ";
1476 if (!(getLine() == unsigned())) {
1477 odsPrinter.printStrippedAttrOrType(getLine());
1478 }
1479 }
1480 if (!(getColumn() == unsigned())) {
1481 if (!_firstPrinted) odsPrinter << ", ";
1482 _firstPrinted = false;
1483 odsPrinter << "column = ";
1484 if (!(getColumn() == unsigned())) {
1485 odsPrinter.printStrippedAttrOrType(getColumn());
1486 }
1487 }
1488 }
1489 odsPrinter << ">";
1490}
1491
1492DIScopeAttr DILexicalBlockAttr::getScope() const {
1493 return getImpl()->scope;
1494}
1495
1496DIFileAttr DILexicalBlockAttr::getFile() const {
1497 return getImpl()->file;
1498}
1499
1500unsigned DILexicalBlockAttr::getLine() const {
1501 return getImpl()->line;
1502}
1503
1504unsigned DILexicalBlockAttr::getColumn() const {
1505 return getImpl()->column;
1506}
1507
1508} // namespace LLVM
1509} // namespace mlir
1510MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DILexicalBlockAttr>::id = {}; } }
1511namespace mlir {
1512namespace LLVM {
1513namespace detail {
1514struct DILexicalBlockFileAttrStorage : public ::mlir::AttributeStorage {
1515 using KeyTy = std::tuple<DIScopeAttr, DIFileAttr, unsigned>;
1516 DILexicalBlockFileAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) : scope(scope), file(file), discriminator(discriminator) {}
1517
1518 KeyTy getAsKey() const {
1519 return KeyTy(scope, file, discriminator);
1520 }
1521
1522 bool operator==(const KeyTy &tblgenKey) const {
1523 return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (discriminator == std::get<2>(tblgenKey));
1524 }
1525
1526 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1527 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
1528 }
1529
1530 static DILexicalBlockFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1531 auto scope = std::get<0>(tblgenKey);
1532 auto file = std::get<1>(tblgenKey);
1533 auto discriminator = std::get<2>(tblgenKey);
1534 return new (allocator.allocate<DILexicalBlockFileAttrStorage>()) DILexicalBlockFileAttrStorage(scope, file, discriminator);
1535 }
1536
1537 DIScopeAttr scope;
1538 DIFileAttr file;
1539 unsigned discriminator;
1540};
1541} // namespace detail
1542DILexicalBlockFileAttr DILexicalBlockFileAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned discriminator) {
1543 return Base::get(context, scope, file, discriminator);
1544}
1545
1546DILexicalBlockFileAttr DILexicalBlockFileAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) {
1547 return Base::get(file.getContext(), scope, file, discriminator);
1548}
1549
1550::mlir::Attribute DILexicalBlockFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1551 ::mlir::Builder odsBuilder(odsParser.getContext());
1552 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1553 (void) odsLoc;
1554 ::mlir::FailureOr<DIScopeAttr> _result_scope;
1555 ::mlir::FailureOr<DIFileAttr> _result_file;
1556 ::mlir::FailureOr<unsigned> _result_discriminator;
1557 // Parse literal '<'
1558 if (odsParser.parseLess()) return {};
1559 // Parse parameter struct
1560 bool _seen_scope = false;
1561 bool _seen_file = false;
1562 bool _seen_discriminator = false;
1563 {
1564 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1565 // Parse literal '='
1566 if (odsParser.parseEqual()) return {};
1567 if (!_seen_scope && _paramKey == "scope") {
1568 _seen_scope = true;
1569
1570 // Parse variable 'scope'
1571 _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser);
1572 if (::mlir::failed(_result_scope)) {
1573 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'scope' which is to be a `DIScopeAttr`");
1574 return {};
1575 }
1576 } else if (!_seen_file && _paramKey == "file") {
1577 _seen_file = true;
1578
1579 // Parse variable 'file'
1580 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
1581 if (::mlir::failed(_result_file)) {
1582 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'file' which is to be a `DIFileAttr`");
1583 return {};
1584 }
1585 } else if (!_seen_discriminator && _paramKey == "discriminator") {
1586 _seen_discriminator = true;
1587
1588 // Parse variable 'discriminator'
1589 _result_discriminator = ::mlir::FieldParser<unsigned>::parse(odsParser);
1590 if (::mlir::failed(_result_discriminator)) {
1591 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'discriminator' which is to be a `unsigned`");
1592 return {};
1593 }
1594 } else {
1595 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1596 return {};
1597 }
1598 return true;
1599 };
1600 do {
1601 ::llvm::StringRef _paramKey;
1602 if (odsParser.parseKeyword(&_paramKey)) {
1603 odsParser.emitError(odsParser.getCurrentLocation(),
1604 "expected a parameter name in struct");
1605 return {};
1606 }
1607 if (!_loop_body(_paramKey)) return {};
1608 } while(!odsParser.parseOptionalComma());
1609 if (!_seen_scope) {
1610 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope";
1611 return {};
1612 }
1613 if (!_seen_discriminator) {
1614 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "discriminator";
1615 return {};
1616 }
1617 }
1618 // Parse literal '>'
1619 if (odsParser.parseGreater()) return {};
1620 assert(::mlir::succeeded(_result_scope))(static_cast <bool> (::mlir::succeeded(_result_scope)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_scope)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1620, __extension__ __PRETTY_FUNCTION__))
;
1621 assert(::mlir::succeeded(_result_discriminator))(static_cast <bool> (::mlir::succeeded(_result_discriminator
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_discriminator)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1621, __extension__ __PRETTY_FUNCTION__))
;
1622 return DILexicalBlockFileAttr::get(odsParser.getContext(),
1623 DIScopeAttr((*_result_scope)),
1624 DIFileAttr((_result_file.value_or(DIFileAttr()))),
1625 unsigned((*_result_discriminator)));
1626}
1627
1628void DILexicalBlockFileAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1629 ::mlir::Builder odsBuilder(getContext());
1630 odsPrinter << "<";
1631 {
1632 bool _firstPrinted = true;
1633 if (!_firstPrinted) odsPrinter << ", ";
1634 _firstPrinted = false;
1635 odsPrinter << "scope = ";
1636 odsPrinter.printStrippedAttrOrType(getScope());
1637 if (!(getFile() == DIFileAttr())) {
1638 if (!_firstPrinted) odsPrinter << ", ";
1639 _firstPrinted = false;
1640 odsPrinter << "file = ";
1641 if (!(getFile() == DIFileAttr())) {
1642 odsPrinter.printStrippedAttrOrType(getFile());
1643 }
1644 }
1645 if (!_firstPrinted) odsPrinter << ", ";
1646 _firstPrinted = false;
1647 odsPrinter << "discriminator = ";
1648 odsPrinter.printStrippedAttrOrType(getDiscriminator());
1649 }
1650 odsPrinter << ">";
1651}
1652
1653DIScopeAttr DILexicalBlockFileAttr::getScope() const {
1654 return getImpl()->scope;
1655}
1656
1657DIFileAttr DILexicalBlockFileAttr::getFile() const {
1658 return getImpl()->file;
1659}
1660
1661unsigned DILexicalBlockFileAttr::getDiscriminator() const {
1662 return getImpl()->discriminator;
1663}
1664
1665} // namespace LLVM
1666} // namespace mlir
1667MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockFileAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DILexicalBlockFileAttr>::id = {}; } }
1668namespace mlir {
1669namespace LLVM {
1670namespace detail {
1671struct DILocalVariableAttrStorage : public ::mlir::AttributeStorage {
1672 using KeyTy = std::tuple<DIScopeAttr, StringAttr, DIFileAttr, unsigned, unsigned, unsigned, DITypeAttr>;
1673 DILocalVariableAttrStorage(DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) : scope(scope), name(name), file(file), line(line), arg(arg), alignInBits(alignInBits), type(type) {}
1674
1675 KeyTy getAsKey() const {
1676 return KeyTy(scope, name, file, line, arg, alignInBits, type);
1677 }
1678
1679 bool operator==(const KeyTy &tblgenKey) const {
1680 return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (arg == std::get<4>(tblgenKey)) && (alignInBits == std::get<5>(tblgenKey)) && (type == std::get<6>(tblgenKey));
1681 }
1682
1683 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1684 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));
1685 }
1686
1687 static DILocalVariableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1688 auto scope = std::get<0>(tblgenKey);
1689 auto name = std::get<1>(tblgenKey);
1690 auto file = std::get<2>(tblgenKey);
1691 auto line = std::get<3>(tblgenKey);
1692 auto arg = std::get<4>(tblgenKey);
1693 auto alignInBits = std::get<5>(tblgenKey);
1694 auto type = std::get<6>(tblgenKey);
1695 return new (allocator.allocate<DILocalVariableAttrStorage>()) DILocalVariableAttrStorage(scope, name, file, line, arg, alignInBits, type);
1696 }
1697
1698 DIScopeAttr scope;
1699 StringAttr name;
1700 DIFileAttr file;
1701 unsigned line;
1702 unsigned arg;
1703 unsigned alignInBits;
1704 DITypeAttr type;
1705};
1706} // namespace detail
1707DILocalVariableAttr DILocalVariableAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) {
1708 return Base::get(context, scope, name, file, line, arg, alignInBits, type);
1709}
1710
1711DILocalVariableAttr DILocalVariableAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) {
1712 MLIRContext *ctx = file.getContext();
1713 return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line,
1714 arg, alignInBits, type);
1715}
1716
1717::mlir::Attribute DILocalVariableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1718 ::mlir::Builder odsBuilder(odsParser.getContext());
1719 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1720 (void) odsLoc;
1721 ::mlir::FailureOr<DIScopeAttr> _result_scope;
1722 ::mlir::FailureOr<StringAttr> _result_name;
1723 ::mlir::FailureOr<DIFileAttr> _result_file;
1724 ::mlir::FailureOr<unsigned> _result_line;
1725 ::mlir::FailureOr<unsigned> _result_arg;
1726 ::mlir::FailureOr<unsigned> _result_alignInBits;
1727 ::mlir::FailureOr<DITypeAttr> _result_type;
1728 // Parse literal '<'
1729 if (odsParser.parseLess()) return {};
1730 // Parse parameter struct
1731 bool _seen_scope = false;
1732 bool _seen_name = false;
1733 bool _seen_file = false;
1734 bool _seen_line = false;
1735 bool _seen_arg = false;
1736 bool _seen_alignInBits = false;
1737 bool _seen_type = false;
1738 {
1739 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
1740 // Parse literal '='
1741 if (odsParser.parseEqual()) return {};
1742 if (!_seen_scope && _paramKey == "scope") {
1743 _seen_scope = true;
1744
1745 // Parse variable 'scope'
1746 _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser);
1747 if (::mlir::failed(_result_scope)) {
1748 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'scope' which is to be a `DIScopeAttr`");
1749 return {};
1750 }
1751 } else if (!_seen_name && _paramKey == "name") {
1752 _seen_name = true;
1753
1754 // Parse variable 'name'
1755 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
1756 if (::mlir::failed(_result_name)) {
1757 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'name' which is to be a `StringAttr`");
1758 return {};
1759 }
1760 } else if (!_seen_file && _paramKey == "file") {
1761 _seen_file = true;
1762
1763 // Parse variable 'file'
1764 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
1765 if (::mlir::failed(_result_file)) {
1766 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'file' which is to be a `DIFileAttr`");
1767 return {};
1768 }
1769 } else if (!_seen_line && _paramKey == "line") {
1770 _seen_line = true;
1771
1772 // Parse variable 'line'
1773 _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser);
1774 if (::mlir::failed(_result_line)) {
1775 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'line' which is to be a `unsigned`");
1776 return {};
1777 }
1778 } else if (!_seen_arg && _paramKey == "arg") {
1779 _seen_arg = true;
1780
1781 // Parse variable 'arg'
1782 _result_arg = ::mlir::FieldParser<unsigned>::parse(odsParser);
1783 if (::mlir::failed(_result_arg)) {
1784 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'arg' which is to be a `unsigned`");
1785 return {};
1786 }
1787 } else if (!_seen_alignInBits && _paramKey == "alignInBits") {
1788 _seen_alignInBits = true;
1789
1790 // Parse variable 'alignInBits'
1791 _result_alignInBits = ::mlir::FieldParser<unsigned>::parse(odsParser);
1792 if (::mlir::failed(_result_alignInBits)) {
1793 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'alignInBits' which is to be a `unsigned`");
1794 return {};
1795 }
1796 } else if (!_seen_type && _paramKey == "type") {
1797 _seen_type = true;
1798
1799 // Parse variable 'type'
1800 _result_type = ::mlir::FieldParser<DITypeAttr>::parse(odsParser);
1801 if (::mlir::failed(_result_type)) {
1802 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'type' which is to be a `DITypeAttr`");
1803 return {};
1804 }
1805 } else {
1806 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
1807 return {};
1808 }
1809 return true;
1810 };
1811 do {
1812 ::llvm::StringRef _paramKey;
1813 if (odsParser.parseKeyword(&_paramKey)) {
1814 odsParser.emitError(odsParser.getCurrentLocation(),
1815 "expected a parameter name in struct");
1816 return {};
1817 }
1818 if (!_loop_body(_paramKey)) return {};
1819 } while(!odsParser.parseOptionalComma());
1820 if (!_seen_scope) {
1821 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope";
1822 return {};
1823 }
1824 if (!_seen_name) {
1825 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name";
1826 return {};
1827 }
1828 }
1829 // Parse literal '>'
1830 if (odsParser.parseGreater()) return {};
1831 assert(::mlir::succeeded(_result_scope))(static_cast <bool> (::mlir::succeeded(_result_scope)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_scope)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1831, __extension__ __PRETTY_FUNCTION__))
;
1832 assert(::mlir::succeeded(_result_name))(static_cast <bool> (::mlir::succeeded(_result_name)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_name)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 1832, __extension__ __PRETTY_FUNCTION__))
;
1833 return DILocalVariableAttr::get(odsParser.getContext(),
1834 DIScopeAttr((*_result_scope)),
1835 StringAttr((*_result_name)),
1836 DIFileAttr((_result_file.value_or(DIFileAttr()))),
1837 unsigned((_result_line.value_or(unsigned()))),
1838 unsigned((_result_arg.value_or(unsigned()))),
1839 unsigned((_result_alignInBits.value_or(unsigned()))),
1840 DITypeAttr((_result_type.value_or(DITypeAttr()))));
1841}
1842
1843void DILocalVariableAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1844 ::mlir::Builder odsBuilder(getContext());
1845 odsPrinter << "<";
1846 {
1847 bool _firstPrinted = true;
1848 if (!_firstPrinted) odsPrinter << ", ";
1849 _firstPrinted = false;
1850 odsPrinter << "scope = ";
1851 odsPrinter.printStrippedAttrOrType(getScope());
1852 if (!_firstPrinted) odsPrinter << ", ";
1853 _firstPrinted = false;
1854 odsPrinter << "name = ";
1855 odsPrinter.printStrippedAttrOrType(getName());
1856 if (!(getFile() == DIFileAttr())) {
1857 if (!_firstPrinted) odsPrinter << ", ";
1858 _firstPrinted = false;
1859 odsPrinter << "file = ";
1860 if (!(getFile() == DIFileAttr())) {
1861 odsPrinter.printStrippedAttrOrType(getFile());
1862 }
1863 }
1864 if (!(getLine() == unsigned())) {
1865 if (!_firstPrinted) odsPrinter << ", ";
1866 _firstPrinted = false;
1867 odsPrinter << "line = ";
1868 if (!(getLine() == unsigned())) {
1869 odsPrinter.printStrippedAttrOrType(getLine());
1870 }
1871 }
1872 if (!(getArg() == unsigned())) {
1873 if (!_firstPrinted) odsPrinter << ", ";
1874 _firstPrinted = false;
1875 odsPrinter << "arg = ";
1876 if (!(getArg() == unsigned())) {
1877 odsPrinter.printStrippedAttrOrType(getArg());
1878 }
1879 }
1880 if (!(getAlignInBits() == unsigned())) {
1881 if (!_firstPrinted) odsPrinter << ", ";
1882 _firstPrinted = false;
1883 odsPrinter << "alignInBits = ";
1884 if (!(getAlignInBits() == unsigned())) {
1885 odsPrinter.printStrippedAttrOrType(getAlignInBits());
1886 }
1887 }
1888 if (!(getType() == DITypeAttr())) {
1889 if (!_firstPrinted) odsPrinter << ", ";
1890 _firstPrinted = false;
1891 odsPrinter << "type = ";
1892 if (!(getType() == DITypeAttr())) {
1893 odsPrinter.printStrippedAttrOrType(getType());
1894 }
1895 }
1896 }
1897 odsPrinter << ">";
1898}
1899
1900DIScopeAttr DILocalVariableAttr::getScope() const {
1901 return getImpl()->scope;
1902}
1903
1904StringAttr DILocalVariableAttr::getName() const {
1905 return getImpl()->name;
1906}
1907
1908DIFileAttr DILocalVariableAttr::getFile() const {
1909 return getImpl()->file;
1910}
1911
1912unsigned DILocalVariableAttr::getLine() const {
1913 return getImpl()->line;
1914}
1915
1916unsigned DILocalVariableAttr::getArg() const {
1917 return getImpl()->arg;
1918}
1919
1920unsigned DILocalVariableAttr::getAlignInBits() const {
1921 return getImpl()->alignInBits;
1922}
1923
1924DITypeAttr DILocalVariableAttr::getType() const {
1925 return getImpl()->type;
1926}
1927
1928} // namespace LLVM
1929} // namespace mlir
1930MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILocalVariableAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DILocalVariableAttr>::id = {}; } }
1931namespace mlir {
1932namespace LLVM {
1933namespace detail {
1934struct DISubprogramAttrStorage : public ::mlir::AttributeStorage {
1935 using KeyTy = std::tuple<DICompileUnitAttr, DIScopeAttr, StringAttr, StringAttr, DIFileAttr, unsigned, unsigned, DISubprogramFlags, DISubroutineTypeAttr>;
1936 DISubprogramAttrStorage(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) : compileUnit(compileUnit), scope(scope), name(name), linkageName(linkageName), file(file), line(line), scopeLine(scopeLine), subprogramFlags(subprogramFlags), type(type) {}
1937
1938 KeyTy getAsKey() const {
1939 return KeyTy(compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type);
1940 }
1941
1942 bool operator==(const KeyTy &tblgenKey) const {
1943 return (compileUnit == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (name == std::get<2>(tblgenKey)) && (linkageName == std::get<3>(tblgenKey)) && (file == std::get<4>(tblgenKey)) && (line == std::get<5>(tblgenKey)) && (scopeLine == std::get<6>(tblgenKey)) && (subprogramFlags == std::get<7>(tblgenKey)) && (type == std::get<8>(tblgenKey));
1944 }
1945
1946 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
1947 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), std::get<7>(tblgenKey), std::get<8>(tblgenKey));
1948 }
1949
1950 static DISubprogramAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
1951 auto compileUnit = std::get<0>(tblgenKey);
1952 auto scope = std::get<1>(tblgenKey);
1953 auto name = std::get<2>(tblgenKey);
1954 auto linkageName = std::get<3>(tblgenKey);
1955 auto file = std::get<4>(tblgenKey);
1956 auto line = std::get<5>(tblgenKey);
1957 auto scopeLine = std::get<6>(tblgenKey);
1958 auto subprogramFlags = std::get<7>(tblgenKey);
1959 auto type = std::get<8>(tblgenKey);
1960 return new (allocator.allocate<DISubprogramAttrStorage>()) DISubprogramAttrStorage(compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type);
1961 }
1962
1963 DICompileUnitAttr compileUnit;
1964 DIScopeAttr scope;
1965 StringAttr name;
1966 StringAttr linkageName;
1967 DIFileAttr file;
1968 unsigned line;
1969 unsigned scopeLine;
1970 DISubprogramFlags subprogramFlags;
1971 DISubroutineTypeAttr type;
1972};
1973} // namespace detail
1974DISubprogramAttr DISubprogramAttr::get(::mlir::MLIRContext *context, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) {
1975 return Base::get(context, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type);
1976}
1977
1978DISubprogramAttr DISubprogramAttr::get(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringRef name, StringRef linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) {
1979 MLIRContext *ctx = file.getContext();
1980 return Base::get(ctx, compileUnit, scope, StringAttr::get(ctx, name),
1981 StringAttr::get(ctx, linkageName), file, line,
1982 scopeLine, subprogramFlags, type);
1983}
1984
1985::mlir::Attribute DISubprogramAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
1986 ::mlir::Builder odsBuilder(odsParser.getContext());
1987 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
1988 (void) odsLoc;
1989 ::mlir::FailureOr<DICompileUnitAttr> _result_compileUnit;
1990 ::mlir::FailureOr<DIScopeAttr> _result_scope;
1991 ::mlir::FailureOr<StringAttr> _result_name;
1992 ::mlir::FailureOr<StringAttr> _result_linkageName;
1993 ::mlir::FailureOr<DIFileAttr> _result_file;
1994 ::mlir::FailureOr<unsigned> _result_line;
1995 ::mlir::FailureOr<unsigned> _result_scopeLine;
1996 ::mlir::FailureOr<DISubprogramFlags> _result_subprogramFlags;
1997 ::mlir::FailureOr<DISubroutineTypeAttr> _result_type;
1998 // Parse literal '<'
1999 if (odsParser.parseLess()) return {};
2000 // Parse parameter struct
2001 bool _seen_compileUnit = false;
2002 bool _seen_scope = false;
2003 bool _seen_name = false;
2004 bool _seen_linkageName = false;
2005 bool _seen_file = false;
2006 bool _seen_line = false;
2007 bool _seen_scopeLine = false;
2008 bool _seen_subprogramFlags = false;
2009 bool _seen_type = false;
2010 {
2011 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2012 // Parse literal '='
2013 if (odsParser.parseEqual()) return {};
2014 if (!_seen_compileUnit && _paramKey == "compileUnit") {
2015 _seen_compileUnit = true;
2016
2017 // Parse variable 'compileUnit'
2018 _result_compileUnit = ::mlir::FieldParser<DICompileUnitAttr>::parse(odsParser);
2019 if (::mlir::failed(_result_compileUnit)) {
2020 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'compileUnit' which is to be a `DICompileUnitAttr`");
2021 return {};
2022 }
2023 } else if (!_seen_scope && _paramKey == "scope") {
2024 _seen_scope = true;
2025
2026 // Parse variable 'scope'
2027 _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser);
2028 if (::mlir::failed(_result_scope)) {
2029 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scope' which is to be a `DIScopeAttr`");
2030 return {};
2031 }
2032 } else if (!_seen_name && _paramKey == "name") {
2033 _seen_name = true;
2034
2035 // Parse variable 'name'
2036 _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser);
2037 if (::mlir::failed(_result_name)) {
2038 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'name' which is to be a `StringAttr`");
2039 return {};
2040 }
2041 } else if (!_seen_linkageName && _paramKey == "linkageName") {
2042 _seen_linkageName = true;
2043
2044 // Parse variable 'linkageName'
2045 _result_linkageName = ::mlir::FieldParser<StringAttr>::parse(odsParser);
2046 if (::mlir::failed(_result_linkageName)) {
2047 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'linkageName' which is to be a `StringAttr`");
2048 return {};
2049 }
2050 } else if (!_seen_file && _paramKey == "file") {
2051 _seen_file = true;
2052
2053 // Parse variable 'file'
2054 _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser);
2055 if (::mlir::failed(_result_file)) {
2056 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'file' which is to be a `DIFileAttr`");
2057 return {};
2058 }
2059 } else if (!_seen_line && _paramKey == "line") {
2060 _seen_line = true;
2061
2062 // Parse variable 'line'
2063 _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser);
2064 if (::mlir::failed(_result_line)) {
2065 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'line' which is to be a `unsigned`");
2066 return {};
2067 }
2068 } else if (!_seen_scopeLine && _paramKey == "scopeLine") {
2069 _seen_scopeLine = true;
2070
2071 // Parse variable 'scopeLine'
2072 _result_scopeLine = ::mlir::FieldParser<unsigned>::parse(odsParser);
2073 if (::mlir::failed(_result_scopeLine)) {
2074 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scopeLine' which is to be a `unsigned`");
2075 return {};
2076 }
2077 } else if (!_seen_subprogramFlags && _paramKey == "subprogramFlags") {
2078 _seen_subprogramFlags = true;
2079
2080 // Parse variable 'subprogramFlags'
2081 _result_subprogramFlags = ::mlir::FieldParser<DISubprogramFlags>::parse(odsParser);
2082 if (::mlir::failed(_result_subprogramFlags)) {
2083 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'subprogramFlags' which is to be a `DISubprogramFlags`");
2084 return {};
2085 }
2086 } else if (!_seen_type && _paramKey == "type") {
2087 _seen_type = true;
2088
2089 // Parse variable 'type'
2090 _result_type = ::mlir::FieldParser<DISubroutineTypeAttr>::parse(odsParser);
2091 if (::mlir::failed(_result_type)) {
2092 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'type' which is to be a `DISubroutineTypeAttr`");
2093 return {};
2094 }
2095 } else {
2096 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2097 return {};
2098 }
2099 return true;
2100 };
2101 do {
2102 ::llvm::StringRef _paramKey;
2103 if (odsParser.parseKeyword(&_paramKey)) {
2104 odsParser.emitError(odsParser.getCurrentLocation(),
2105 "expected a parameter name in struct");
2106 return {};
2107 }
2108 if (!_loop_body(_paramKey)) return {};
2109 } while(!odsParser.parseOptionalComma());
2110 if (!_seen_compileUnit) {
2111 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "compileUnit";
2112 return {};
2113 }
2114 if (!_seen_scope) {
2115 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope";
2116 return {};
2117 }
2118 if (!_seen_name) {
2119 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name";
2120 return {};
2121 }
2122 if (!_seen_file) {
2123 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "file";
2124 return {};
2125 }
2126 if (!_seen_subprogramFlags) {
2127 odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "subprogramFlags";
2128 return {};
2129 }
2130 }
2131 // Parse literal '>'
2132 if (odsParser.parseGreater()) return {};
2133 assert(::mlir::succeeded(_result_compileUnit))(static_cast <bool> (::mlir::succeeded(_result_compileUnit
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_compileUnit)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2133, __extension__ __PRETTY_FUNCTION__))
;
2134 assert(::mlir::succeeded(_result_scope))(static_cast <bool> (::mlir::succeeded(_result_scope)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_scope)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2134, __extension__ __PRETTY_FUNCTION__))
;
2135 assert(::mlir::succeeded(_result_name))(static_cast <bool> (::mlir::succeeded(_result_name)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_name)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2135, __extension__ __PRETTY_FUNCTION__))
;
2136 assert(::mlir::succeeded(_result_file))(static_cast <bool> (::mlir::succeeded(_result_file)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_file)",
"tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2136, __extension__ __PRETTY_FUNCTION__))
;
2137 assert(::mlir::succeeded(_result_subprogramFlags))(static_cast <bool> (::mlir::succeeded(_result_subprogramFlags
)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_subprogramFlags)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2137, __extension__ __PRETTY_FUNCTION__))
;
2138 return DISubprogramAttr::get(odsParser.getContext(),
2139 DICompileUnitAttr((*_result_compileUnit)),
2140 DIScopeAttr((*_result_scope)),
2141 StringAttr((*_result_name)),
2142 StringAttr((_result_linkageName.value_or(StringAttr()))),
2143 DIFileAttr((*_result_file)),
2144 unsigned((_result_line.value_or(unsigned()))),
2145 unsigned((_result_scopeLine.value_or(unsigned()))),
2146 DISubprogramFlags((*_result_subprogramFlags)),
2147 DISubroutineTypeAttr((_result_type.value_or(DISubroutineTypeAttr()))));
2148}
2149
2150void DISubprogramAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2151 ::mlir::Builder odsBuilder(getContext());
2152 odsPrinter << "<";
2153 {
2154 bool _firstPrinted = true;
2155 if (!_firstPrinted) odsPrinter << ", ";
2156 _firstPrinted = false;
2157 odsPrinter << "compileUnit = ";
2158 odsPrinter.printStrippedAttrOrType(getCompileUnit());
2159 if (!_firstPrinted) odsPrinter << ", ";
2160 _firstPrinted = false;
2161 odsPrinter << "scope = ";
2162 odsPrinter.printStrippedAttrOrType(getScope());
2163 if (!_firstPrinted) odsPrinter << ", ";
2164 _firstPrinted = false;
2165 odsPrinter << "name = ";
2166 odsPrinter.printStrippedAttrOrType(getName());
2167 if (!(getLinkageName() == StringAttr())) {
2168 if (!_firstPrinted) odsPrinter << ", ";
2169 _firstPrinted = false;
2170 odsPrinter << "linkageName = ";
2171 if (!(getLinkageName() == StringAttr())) {
2172 odsPrinter.printStrippedAttrOrType(getLinkageName());
2173 }
2174 }
2175 if (!_firstPrinted) odsPrinter << ", ";
2176 _firstPrinted = false;
2177 odsPrinter << "file = ";
2178 odsPrinter.printStrippedAttrOrType(getFile());
2179 if (!(getLine() == unsigned())) {
2180 if (!_firstPrinted) odsPrinter << ", ";
2181 _firstPrinted = false;
2182 odsPrinter << "line = ";
2183 if (!(getLine() == unsigned())) {
2184 odsPrinter.printStrippedAttrOrType(getLine());
2185 }
2186 }
2187 if (!(getScopeLine() == unsigned())) {
2188 if (!_firstPrinted) odsPrinter << ", ";
2189 _firstPrinted = false;
2190 odsPrinter << "scopeLine = ";
2191 if (!(getScopeLine() == unsigned())) {
2192 odsPrinter.printStrippedAttrOrType(getScopeLine());
2193 }
2194 }
2195 if (!_firstPrinted) odsPrinter << ", ";
2196 _firstPrinted = false;
2197 odsPrinter << "subprogramFlags = ";
2198 odsPrinter.printStrippedAttrOrType(getSubprogramFlags());
2199 if (!(getType() == DISubroutineTypeAttr())) {
2200 if (!_firstPrinted) odsPrinter << ", ";
2201 _firstPrinted = false;
2202 odsPrinter << "type = ";
2203 if (!(getType() == DISubroutineTypeAttr())) {
2204 odsPrinter.printStrippedAttrOrType(getType());
2205 }
2206 }
2207 }
2208 odsPrinter << ">";
2209}
2210
2211DICompileUnitAttr DISubprogramAttr::getCompileUnit() const {
2212 return getImpl()->compileUnit;
2213}
2214
2215DIScopeAttr DISubprogramAttr::getScope() const {
2216 return getImpl()->scope;
2217}
2218
2219StringAttr DISubprogramAttr::getName() const {
2220 return getImpl()->name;
2221}
2222
2223StringAttr DISubprogramAttr::getLinkageName() const {
2224 return getImpl()->linkageName;
2225}
2226
2227DIFileAttr DISubprogramAttr::getFile() const {
2228 return getImpl()->file;
2229}
2230
2231unsigned DISubprogramAttr::getLine() const {
2232 return getImpl()->line;
2233}
2234
2235unsigned DISubprogramAttr::getScopeLine() const {
2236 return getImpl()->scopeLine;
2237}
2238
2239DISubprogramFlags DISubprogramAttr::getSubprogramFlags() const {
2240 return getImpl()->subprogramFlags;
2241}
2242
2243DISubroutineTypeAttr DISubprogramAttr::getType() const {
2244 return getImpl()->type;
2245}
2246
2247} // namespace LLVM
2248} // namespace mlir
2249MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubprogramAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DISubprogramAttr>::id = {}; } }
2250namespace mlir {
2251namespace LLVM {
2252namespace detail {
2253struct DISubrangeAttrStorage : public ::mlir::AttributeStorage {
2254 using KeyTy = std::tuple<IntegerAttr, IntegerAttr, IntegerAttr, IntegerAttr>;
2255 DISubrangeAttrStorage(IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) : count(count), lowerBound(lowerBound), upperBound(upperBound), stride(stride) {}
2256
2257 KeyTy getAsKey() const {
2258 return KeyTy(count, lowerBound, upperBound, stride);
2259 }
2260
2261 bool operator==(const KeyTy &tblgenKey) const {
2262 return (count == std::get<0>(tblgenKey)) && (lowerBound == std::get<1>(tblgenKey)) && (upperBound == std::get<2>(tblgenKey)) && (stride == std::get<3>(tblgenKey));
2263 }
2264
2265 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2266 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey));
2267 }
2268
2269 static DISubrangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2270 auto count = std::get<0>(tblgenKey);
2271 auto lowerBound = std::get<1>(tblgenKey);
2272 auto upperBound = std::get<2>(tblgenKey);
2273 auto stride = std::get<3>(tblgenKey);
2274 return new (allocator.allocate<DISubrangeAttrStorage>()) DISubrangeAttrStorage(count, lowerBound, upperBound, stride);
2275 }
2276
2277 IntegerAttr count;
2278 IntegerAttr lowerBound;
2279 IntegerAttr upperBound;
2280 IntegerAttr stride;
2281};
2282} // namespace detail
2283DISubrangeAttr DISubrangeAttr::get(::mlir::MLIRContext *context, IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) {
2284 return Base::get(context, count, lowerBound, upperBound, stride);
2285}
2286
2287::mlir::Attribute DISubrangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
2288 ::mlir::Builder odsBuilder(odsParser.getContext());
2289 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2290 (void) odsLoc;
2291 ::mlir::FailureOr<IntegerAttr> _result_count;
2292 ::mlir::FailureOr<IntegerAttr> _result_lowerBound;
2293 ::mlir::FailureOr<IntegerAttr> _result_upperBound;
2294 ::mlir::FailureOr<IntegerAttr> _result_stride;
2295 // Parse literal '<'
2296 if (odsParser.parseLess()) return {};
2297 // Parse parameter struct
2298 bool _seen_count = false;
2299 bool _seen_lowerBound = false;
2300 bool _seen_upperBound = false;
2301 bool _seen_stride = false;
2302 {
2303 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2304 // Parse literal '='
2305 if (odsParser.parseEqual()) return {};
2306 if (!_seen_count && _paramKey == "count") {
2307 _seen_count = true;
2308
2309 // Parse variable 'count'
2310 _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser);
2311 if (::mlir::failed(_result_count)) {
2312 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'count' which is to be a `IntegerAttr`");
2313 return {};
2314 }
2315 } else if (!_seen_lowerBound && _paramKey == "lowerBound") {
2316 _seen_lowerBound = true;
2317
2318 // Parse variable 'lowerBound'
2319 _result_lowerBound = ::mlir::FieldParser<IntegerAttr>::parse(odsParser);
2320 if (::mlir::failed(_result_lowerBound)) {
2321 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'lowerBound' which is to be a `IntegerAttr`");
2322 return {};
2323 }
2324 } else if (!_seen_upperBound && _paramKey == "upperBound") {
2325 _seen_upperBound = true;
2326
2327 // Parse variable 'upperBound'
2328 _result_upperBound = ::mlir::FieldParser<IntegerAttr>::parse(odsParser);
2329 if (::mlir::failed(_result_upperBound)) {
2330 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'upperBound' which is to be a `IntegerAttr`");
2331 return {};
2332 }
2333 } else if (!_seen_stride && _paramKey == "stride") {
2334 _seen_stride = true;
2335
2336 // Parse variable 'stride'
2337 _result_stride = ::mlir::FieldParser<IntegerAttr>::parse(odsParser);
2338 if (::mlir::failed(_result_stride)) {
2339 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'stride' which is to be a `IntegerAttr`");
2340 return {};
2341 }
2342 } else {
2343 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2344 return {};
2345 }
2346 return true;
2347 };
2348 ::llvm::StringRef _paramKey;
2349 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
2350 if (!_loop_body(_paramKey)) return {};
2351 while (!odsParser.parseOptionalComma()) {
2352 ::llvm::StringRef _paramKey;
2353 if (odsParser.parseKeyword(&_paramKey)) {
2354 odsParser.emitError(odsParser.getCurrentLocation(),
2355 "expected a parameter name in struct");
2356 return {};
2357 }
2358 if (!_loop_body(_paramKey)) return {};
2359 }
2360 }
2361 }
2362 // Parse literal '>'
2363 if (odsParser.parseGreater()) return {};
2364 return DISubrangeAttr::get(odsParser.getContext(),
2365 IntegerAttr((_result_count.value_or(IntegerAttr()))),
2366 IntegerAttr((_result_lowerBound.value_or(IntegerAttr()))),
2367 IntegerAttr((_result_upperBound.value_or(IntegerAttr()))),
2368 IntegerAttr((_result_stride.value_or(IntegerAttr()))));
2369}
2370
2371void DISubrangeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2372 ::mlir::Builder odsBuilder(getContext());
2373 odsPrinter << "<";
2374 {
2375 bool _firstPrinted = true;
2376 if (!(getCount() == IntegerAttr())) {
2377 if (!_firstPrinted) odsPrinter << ", ";
2378 _firstPrinted = false;
2379 odsPrinter << "count = ";
2380 if (!(getCount() == IntegerAttr())) {
2381 odsPrinter.printStrippedAttrOrType(getCount());
2382 }
2383 }
2384 if (!(getLowerBound() == IntegerAttr())) {
2385 if (!_firstPrinted) odsPrinter << ", ";
2386 _firstPrinted = false;
2387 odsPrinter << "lowerBound = ";
2388 if (!(getLowerBound() == IntegerAttr())) {
2389 odsPrinter.printStrippedAttrOrType(getLowerBound());
2390 }
2391 }
2392 if (!(getUpperBound() == IntegerAttr())) {
2393 if (!_firstPrinted) odsPrinter << ", ";
2394 _firstPrinted = false;
2395 odsPrinter << "upperBound = ";
2396 if (!(getUpperBound() == IntegerAttr())) {
2397 odsPrinter.printStrippedAttrOrType(getUpperBound());
2398 }
2399 }
2400 if (!(getStride() == IntegerAttr())) {
2401 if (!_firstPrinted) odsPrinter << ", ";
2402 _firstPrinted = false;
2403 odsPrinter << "stride = ";
2404 if (!(getStride() == IntegerAttr())) {
2405 odsPrinter.printStrippedAttrOrType(getStride());
2406 }
2407 }
2408 }
2409 odsPrinter << ">";
2410}
2411
2412IntegerAttr DISubrangeAttr::getCount() const {
2413 return getImpl()->count;
2414}
2415
2416IntegerAttr DISubrangeAttr::getLowerBound() const {
2417 return getImpl()->lowerBound;
2418}
2419
2420IntegerAttr DISubrangeAttr::getUpperBound() const {
2421 return getImpl()->upperBound;
2422}
2423
2424IntegerAttr DISubrangeAttr::getStride() const {
2425 return getImpl()->stride;
2426}
2427
2428} // namespace LLVM
2429} // namespace mlir
2430MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubrangeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DISubrangeAttr>::id = {}; } }
2431namespace mlir {
2432namespace LLVM {
2433namespace detail {
2434struct DISubroutineTypeAttrStorage : public ::mlir::AttributeStorage {
2435 using KeyTy = std::tuple<unsigned, DITypeAttr, ::llvm::ArrayRef<DITypeAttr>>;
2436 DISubroutineTypeAttrStorage(unsigned callingConvention, DITypeAttr resultType, ::llvm::ArrayRef<DITypeAttr> argumentTypes) : callingConvention(callingConvention), resultType(resultType), argumentTypes(argumentTypes) {}
2437
2438 KeyTy getAsKey() const {
2439 return KeyTy(callingConvention, resultType, argumentTypes);
2440 }
2441
2442 bool operator==(const KeyTy &tblgenKey) const {
2443 return (callingConvention == std::get<0>(tblgenKey)) && (resultType == std::get<1>(tblgenKey)) && (::llvm::makeArrayRef(argumentTypes) == ::llvm::makeArrayRef(std::get<2>(tblgenKey)));
2444 }
2445
2446 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2447 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey));
2448 }
2449
2450 static DISubroutineTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2451 auto callingConvention = std::get<0>(tblgenKey);
2452 auto resultType = std::get<1>(tblgenKey);
2453 auto argumentTypes = std::get<2>(tblgenKey);
2454 argumentTypes = allocator.copyInto(argumentTypes);
2455 return new (allocator.allocate<DISubroutineTypeAttrStorage>()) DISubroutineTypeAttrStorage(callingConvention, resultType, argumentTypes);
2456 }
2457
2458 unsigned callingConvention;
2459 DITypeAttr resultType;
2460 ::llvm::ArrayRef<DITypeAttr> argumentTypes;
2461};
2462} // namespace detail
2463DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, unsigned callingConvention, DITypeAttr resultType, ::llvm::ArrayRef<DITypeAttr> argumentTypes) {
2464 return Base::get(context, callingConvention, resultType, argumentTypes);
2465}
2466
2467DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, DITypeAttr resultType, ArrayRef<DITypeAttr> argumentTypes) {
2468 return Base::get(context, /*callingConvention=*/0, resultType, argumentTypes);
2469}
2470
2471::mlir::Attribute DISubroutineTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
2472 ::mlir::Builder odsBuilder(odsParser.getContext());
2473 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2474 (void) odsLoc;
2475 ::mlir::FailureOr<unsigned> _result_callingConvention;
2476 ::mlir::FailureOr<DITypeAttr> _result_resultType;
2477 ::mlir::FailureOr<::llvm::SmallVector<DITypeAttr>> _result_argumentTypes;
2478 // Parse literal '<'
2479 if (odsParser.parseLess()) return {};
2480 // Parse parameter struct
2481 bool _seen_callingConvention = false;
2482 bool _seen_resultType = false;
2483 bool _seen_argumentTypes = false;
2484 {
2485 const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool {
2486 // Parse literal '='
2487 if (odsParser.parseEqual()) return {};
2488 if (!_seen_callingConvention && _paramKey == "callingConvention") {
2489 _seen_callingConvention = true;
2490
2491 // Parse variable 'callingConvention'
2492 _result_callingConvention = [&]() -> FailureOr<unsigned> {
2493 SMLoc tagLoc = odsParser.getCurrentLocation();
2494 StringRef name;
2495 if (odsParser.parseKeyword(&name))
2496 return failure();
2497
2498 if (unsigned tag = llvm::dwarf::getCallingConvention(name))
2499 return tag;
2500 return odsParser.emitError(tagLoc)
2501 << "invalid debug info debug info calling convention name: " << name;
2502 }() ;
2503 if (::mlir::failed(_result_callingConvention)) {
2504 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'callingConvention' which is to be a `unsigned`");
2505 return {};
2506 }
2507 } else if (!_seen_resultType && _paramKey == "resultType") {
2508 _seen_resultType = true;
2509
2510 // Parse variable 'resultType'
2511 _result_resultType = ::mlir::FieldParser<DITypeAttr>::parse(odsParser);
2512 if (::mlir::failed(_result_resultType)) {
2513 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'resultType' which is to be a `DITypeAttr`");
2514 return {};
2515 }
2516 } else if (!_seen_argumentTypes && _paramKey == "argumentTypes") {
2517 _seen_argumentTypes = true;
2518
2519 // Parse variable 'argumentTypes'
2520 _result_argumentTypes = ::mlir::FieldParser<::llvm::SmallVector<DITypeAttr>>::parse(odsParser);
2521 if (::mlir::failed(_result_argumentTypes)) {
2522 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'argumentTypes' which is to be a `::llvm::ArrayRef<DITypeAttr>`");
2523 return {};
2524 }
2525 } else {
2526 odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey;
2527 return {};
2528 }
2529 return true;
2530 };
2531 ::llvm::StringRef _paramKey;
2532 if (!odsParser.parseOptionalKeyword(&_paramKey)) {
2533 if (!_loop_body(_paramKey)) return {};
2534 while (!odsParser.parseOptionalComma()) {
2535 ::llvm::StringRef _paramKey;
2536 if (odsParser.parseKeyword(&_paramKey)) {
2537 odsParser.emitError(odsParser.getCurrentLocation(),
2538 "expected a parameter name in struct");
2539 return {};
2540 }
2541 if (!_loop_body(_paramKey)) return {};
2542 }
2543 }
2544 }
2545 // Parse literal '>'
2546 if (odsParser.parseGreater()) return {};
2547 return DISubroutineTypeAttr::get(odsParser.getContext(),
2548 unsigned((_result_callingConvention.value_or(0))),
2549 DITypeAttr((_result_resultType.value_or(DITypeAttr()))),
2550 ::llvm::ArrayRef<DITypeAttr>((_result_argumentTypes.value_or(::llvm::SmallVector<DITypeAttr>()))));
2551}
2552
2553void DISubroutineTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2554 ::mlir::Builder odsBuilder(getContext());
2555 odsPrinter << "<";
2556 {
2557 bool _firstPrinted = true;
2558 if (!(getCallingConvention() == 0)) {
2559 if (!_firstPrinted) odsPrinter << ", ";
2560 _firstPrinted = false;
2561 odsPrinter << "callingConvention = ";
2562 if (!(getCallingConvention() == 0)) {
2563 odsPrinter << llvm::dwarf::ConventionString(getCallingConvention());
2564 }
2565 }
2566 if (!(getResultType() == DITypeAttr())) {
2567 if (!_firstPrinted) odsPrinter << ", ";
2568 _firstPrinted = false;
2569 odsPrinter << "resultType = ";
2570 if (!(getResultType() == DITypeAttr())) {
2571 odsPrinter.printStrippedAttrOrType(getResultType());
2572 }
2573 }
2574 if (!(::llvm::makeArrayRef(getArgumentTypes()) == ::llvm::makeArrayRef(::llvm::SmallVector<DITypeAttr>()))) {
2575 if (!_firstPrinted) odsPrinter << ", ";
2576 _firstPrinted = false;
2577 odsPrinter << "argumentTypes = ";
2578 if (!(::llvm::makeArrayRef(getArgumentTypes()) == ::llvm::makeArrayRef(::llvm::SmallVector<DITypeAttr>()))) {
2579 odsPrinter.printStrippedAttrOrType(getArgumentTypes());
2580 }
2581 }
2582 }
2583 odsPrinter << ">";
2584}
2585
2586unsigned DISubroutineTypeAttr::getCallingConvention() const {
2587 return getImpl()->callingConvention;
2588}
2589
2590DITypeAttr DISubroutineTypeAttr::getResultType() const {
2591 return getImpl()->resultType;
2592}
2593
2594::llvm::ArrayRef<DITypeAttr> DISubroutineTypeAttr::getArgumentTypes() const {
2595 return getImpl()->argumentTypes;
2596}
2597
2598} // namespace LLVM
2599} // namespace mlir
2600MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubroutineTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::DISubroutineTypeAttr>::id = {}; } }
2601namespace mlir {
2602namespace LLVM {
2603namespace detail {
2604struct FastmathFlagsAttrStorage : public ::mlir::AttributeStorage {
2605 using KeyTy = std::tuple<::mlir::LLVM::FastmathFlags>;
2606 FastmathFlagsAttrStorage(::mlir::LLVM::FastmathFlags value) : value(value) {}
2607
2608 KeyTy getAsKey() const {
2609 return KeyTy(value);
2610 }
2611
2612 bool operator==(const KeyTy &tblgenKey) const {
2613 return (value == std::get<0>(tblgenKey));
2614 }
2615
2616 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2617 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2618 }
2619
2620 static FastmathFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2621 auto value = std::get<0>(tblgenKey);
2622 return new (allocator.allocate<FastmathFlagsAttrStorage>()) FastmathFlagsAttrStorage(value);
2623 }
2624
2625 ::mlir::LLVM::FastmathFlags value;
2626};
2627} // namespace detail
2628FastmathFlagsAttr FastmathFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::LLVM::FastmathFlags value) {
2629 return Base::get(context, value);
2630}
2631
2632::mlir::Attribute FastmathFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
2633 ::mlir::Builder odsBuilder(odsParser.getContext());
2634 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2635 (void) odsLoc;
2636 ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> _result_value;
2637 // Parse literal '<'
2638 if (odsParser.parseLess()) return {};
2639
2640 // Parse variable 'value'
2641 _result_value = [&]() -> ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> {
2642 ::mlir::LLVM::FastmathFlags flags = {};
2643 auto loc = odsParser.getCurrentLocation();
2644 ::llvm::StringRef enumKeyword;
2645 do {
2646 if (::mlir::failed(odsParser.parseKeyword(&enumKeyword)))
2647 return ::mlir::failure();
2648 auto maybeEnum = ::mlir::LLVM::symbolizeFastmathFlags(enumKeyword);
2649 if (!maybeEnum) {
2650 return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::LLVM::FastmathFlags" << " to be one of: " << "none" << ", " << "nnan" << ", " << "ninf" << ", " << "nsz" << ", " << "arcp" << ", " << "contract" << ", " << "afn" << ", " << "reassoc" << ", " << "fast")};
2651 }
2652 flags = flags | *maybeEnum;
2653 } while(::mlir::succeeded(odsParser.parseOptionalComma()));
2654 return flags;
2655 }();
2656 if (::mlir::failed(_result_value)) {
2657 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_FastmathFlagsAttr parameter 'value' which is to be a `::mlir::LLVM::FastmathFlags`");
2658 return {};
2659 }
2660 // Parse literal '>'
2661 if (odsParser.parseGreater()) return {};
2662 assert(::mlir::succeeded(_result_value))(static_cast <bool> (::mlir::succeeded(_result_value)) ?
void (0) : __assert_fail ("::mlir::succeeded(_result_value)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2662, __extension__ __PRETTY_FUNCTION__))
;
2663 return FastmathFlagsAttr::get(odsParser.getContext(),
2664 ::mlir::LLVM::FastmathFlags((*_result_value)));
2665}
2666
2667void FastmathFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2668 ::mlir::Builder odsBuilder(getContext());
2669 odsPrinter << "<";
2670 odsPrinter << stringifyFastmathFlags(getValue());
2671 odsPrinter << ">";
2672}
2673
2674::mlir::LLVM::FastmathFlags FastmathFlagsAttr::getValue() const {
2675 return getImpl()->value;
2676}
2677
2678} // namespace LLVM
2679} // namespace mlir
2680MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FastmathFlagsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::FastmathFlagsAttr>::id = {}; } }
2681namespace mlir {
2682namespace LLVM {
2683namespace detail {
2684struct LinkageAttrStorage : public ::mlir::AttributeStorage {
2685 using KeyTy = std::tuple<linkage::Linkage>;
2686 LinkageAttrStorage(linkage::Linkage linkage) : linkage(linkage) {}
2687
2688 KeyTy getAsKey() const {
2689 return KeyTy(linkage);
2690 }
2691
2692 bool operator==(const KeyTy &tblgenKey) const {
2693 return (linkage == std::get<0>(tblgenKey));
2694 }
2695
2696 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2697 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2698 }
2699
2700 static LinkageAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2701 auto linkage = std::get<0>(tblgenKey);
2702 return new (allocator.allocate<LinkageAttrStorage>()) LinkageAttrStorage(linkage);
2703 }
2704
2705 linkage::Linkage linkage;
2706};
2707} // namespace detail
2708LinkageAttr LinkageAttr::get(::mlir::MLIRContext *context, linkage::Linkage linkage) {
2709 return Base::get(context, linkage);
2710}
2711
2712::mlir::Attribute LinkageAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) {
2713 ::mlir::Builder odsBuilder(odsParser.getContext());
2714 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
2715 (void) odsLoc;
2716 ::mlir::FailureOr<linkage::Linkage> _result_linkage;
2717 // Parse literal '<'
2718 if (odsParser.parseLess()) return {};
2719
2720 // Parse variable 'linkage'
2721 _result_linkage = ::mlir::FieldParser<linkage::Linkage>::parse(odsParser);
2722 if (::mlir::failed(_result_linkage)) {
2723 odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LinkageAttr parameter 'linkage' which is to be a `linkage::Linkage`");
2724 return {};
2725 }
2726 // Parse literal '>'
2727 if (odsParser.parseGreater()) return {};
2728 assert(::mlir::succeeded(_result_linkage))(static_cast <bool> (::mlir::succeeded(_result_linkage)
) ? void (0) : __assert_fail ("::mlir::succeeded(_result_linkage)"
, "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc"
, 2728, __extension__ __PRETTY_FUNCTION__))
;
2729 return LinkageAttr::get(odsParser.getContext(),
2730 linkage::Linkage((*_result_linkage)));
2731}
2732
2733void LinkageAttr::print(::mlir::AsmPrinter &odsPrinter) const {
2734 ::mlir::Builder odsBuilder(getContext());
2735 odsPrinter << "<";
2736 odsPrinter.printStrippedAttrOrType(getLinkage());
2737 odsPrinter << ">";
2738}
2739
2740linkage::Linkage LinkageAttr::getLinkage() const {
2741 return getImpl()->linkage;
2742}
2743
2744} // namespace LLVM
2745} // namespace mlir
2746MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkageAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::LinkageAttr>::id = {}; } }
2747namespace mlir {
2748namespace LLVM {
2749namespace detail {
2750struct LoopOptionsAttrStorage : public ::mlir::AttributeStorage {
2751 using KeyTy = std::tuple<::llvm::ArrayRef<std::pair<LoopOptionCase, int64_t>>>;
2752 LoopOptionsAttrStorage(::llvm::ArrayRef<std::pair<LoopOptionCase, int64_t>> options) : options(options) {}
2753
2754 KeyTy getAsKey() const {
2755 return KeyTy(options);
2756 }
2757
2758 bool operator==(const KeyTy &tblgenKey) const {
2759 return (options == std::get<0>(tblgenKey));
2760 }
2761
2762 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
2763 return ::llvm::hash_combine(std::get<0>(tblgenKey));
2764 }
2765
2766 static LoopOptionsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) {
2767 auto options = std::get<0>(tblgenKey);
2768 options = allocator.copyInto(options);
2769 return new (allocator.allocate<LoopOptionsAttrStorage>()) LoopOptionsAttrStorage(options);
2770 }
2771
2772 ::llvm::ArrayRef<std::pair<LoopOptionCase, int64_t>> options;
2773};
2774} // namespace detail
2775::llvm::ArrayRef<std::pair<LoopOptionCase, int64_t>> LoopOptionsAttr::getOptions() const {
2776 return getImpl()->options;
2777}
2778
2779} // namespace LLVM
2780} // namespace mlir
2781MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopOptionsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::LLVM::LoopOptionsAttr>::id = {}; } }
2782namespace mlir {
2783namespace LLVM {
2784
2785/// Parse an attribute registered to this dialect.
2786::mlir::Attribute LLVMDialect::parseAttribute(::mlir::DialectAsmParser &parser,
2787 ::mlir::Type type) const {
2788 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
2789 ::llvm::StringRef attrTag;
2790 {
2791 ::mlir::Attribute attr;
2792 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
2793 if (parseResult.has_value())
2794 return attr;
2795 }
2796
2797 parser.emitError(typeLoc) << "unknown attribute `"
2798 << attrTag << "` in dialect `" << getNamespace() << "`";
2799 return {};
2800}
2801/// Print an attribute registered to this dialect.
2802void LLVMDialect::printAttribute(::mlir::Attribute attr,
2803 ::mlir::DialectAsmPrinter &printer) const {
2804 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
2805 return;
2806
2807}
2808} // namespace LLVM
2809} // namespace mlir
2810
2811#endif // GET_ATTRDEF_CLASSES
2812