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