File: | build/source/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc |
Warning: | line 739, 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::DINamespaceAttr, |
22 | ::mlir::LLVM::DINullTypeAttr, |
23 | ::mlir::LLVM::DISubprogramAttr, |
24 | ::mlir::LLVM::DISubrangeAttr, |
25 | ::mlir::LLVM::DISubroutineTypeAttr, |
26 | ::mlir::LLVM::FastmathFlagsAttr, |
27 | ::mlir::LLVM::MemoryEffectsAttr, |
28 | ::mlir::LLVM::LinkageAttr, |
29 | ::mlir::LLVM::LoopAnnotationAttr, |
30 | ::mlir::LLVM::LoopDistributeAttr, |
31 | ::mlir::LLVM::LoopInterleaveAttr, |
32 | ::mlir::LLVM::LoopLICMAttr, |
33 | ::mlir::LLVM::LoopPeeledAttr, |
34 | ::mlir::LLVM::LoopPipelineAttr, |
35 | ::mlir::LLVM::LoopUnrollAndJamAttr, |
36 | ::mlir::LLVM::LoopUnrollAttr, |
37 | ::mlir::LLVM::LoopUnswitchAttr, |
38 | ::mlir::LLVM::LoopVectorizeAttr |
39 | |
40 | #endif // GET_ATTRDEF_LIST |
41 | |
42 | #ifdef GET_ATTRDEF_CLASSES |
43 | #undef GET_ATTRDEF_CLASSES |
44 | |
45 | static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { |
46 | return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) |
47 | .Case(::mlir::LLVM::CConvAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
48 | value = ::mlir::LLVM::CConvAttr::parse(parser, type); |
49 | return ::mlir::success(!!value); |
50 | }) |
51 | .Case(::mlir::LLVM::DIBasicTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
52 | value = ::mlir::LLVM::DIBasicTypeAttr::parse(parser, type); |
53 | return ::mlir::success(!!value); |
54 | }) |
55 | .Case(::mlir::LLVM::DICompileUnitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
56 | value = ::mlir::LLVM::DICompileUnitAttr::parse(parser, type); |
57 | return ::mlir::success(!!value); |
58 | }) |
59 | .Case(::mlir::LLVM::DICompositeTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
60 | value = ::mlir::LLVM::DICompositeTypeAttr::parse(parser, type); |
61 | return ::mlir::success(!!value); |
62 | }) |
63 | .Case(::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
64 | value = ::mlir::LLVM::DIDerivedTypeAttr::parse(parser, type); |
65 | return ::mlir::success(!!value); |
66 | }) |
67 | .Case(::mlir::LLVM::DIFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
68 | value = ::mlir::LLVM::DIFileAttr::parse(parser, type); |
69 | return ::mlir::success(!!value); |
70 | }) |
71 | .Case(::mlir::LLVM::DILexicalBlockAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
72 | value = ::mlir::LLVM::DILexicalBlockAttr::parse(parser, type); |
73 | return ::mlir::success(!!value); |
74 | }) |
75 | .Case(::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
76 | value = ::mlir::LLVM::DILexicalBlockFileAttr::parse(parser, type); |
77 | return ::mlir::success(!!value); |
78 | }) |
79 | .Case(::mlir::LLVM::DILocalVariableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
80 | value = ::mlir::LLVM::DILocalVariableAttr::parse(parser, type); |
81 | return ::mlir::success(!!value); |
82 | }) |
83 | .Case(::mlir::LLVM::DINamespaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
84 | value = ::mlir::LLVM::DINamespaceAttr::parse(parser, type); |
85 | return ::mlir::success(!!value); |
86 | }) |
87 | .Case(::mlir::LLVM::DINullTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
88 | value = ::mlir::LLVM::DINullTypeAttr::get(parser.getContext()); |
89 | return ::mlir::success(!!value); |
90 | }) |
91 | .Case(::mlir::LLVM::DISubprogramAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
92 | value = ::mlir::LLVM::DISubprogramAttr::parse(parser, type); |
93 | return ::mlir::success(!!value); |
94 | }) |
95 | .Case(::mlir::LLVM::DISubrangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
96 | value = ::mlir::LLVM::DISubrangeAttr::parse(parser, type); |
97 | return ::mlir::success(!!value); |
98 | }) |
99 | .Case(::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
100 | value = ::mlir::LLVM::DISubroutineTypeAttr::parse(parser, type); |
101 | return ::mlir::success(!!value); |
102 | }) |
103 | .Case(::mlir::LLVM::FastmathFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
104 | value = ::mlir::LLVM::FastmathFlagsAttr::parse(parser, type); |
105 | return ::mlir::success(!!value); |
106 | }) |
107 | .Case(::mlir::LLVM::MemoryEffectsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
108 | value = ::mlir::LLVM::MemoryEffectsAttr::parse(parser, type); |
109 | return ::mlir::success(!!value); |
110 | }) |
111 | .Case(::mlir::LLVM::LinkageAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
112 | value = ::mlir::LLVM::LinkageAttr::parse(parser, type); |
113 | return ::mlir::success(!!value); |
114 | }) |
115 | .Case(::mlir::LLVM::LoopAnnotationAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
116 | value = ::mlir::LLVM::LoopAnnotationAttr::parse(parser, type); |
117 | return ::mlir::success(!!value); |
118 | }) |
119 | .Case(::mlir::LLVM::LoopDistributeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
120 | value = ::mlir::LLVM::LoopDistributeAttr::parse(parser, type); |
121 | return ::mlir::success(!!value); |
122 | }) |
123 | .Case(::mlir::LLVM::LoopInterleaveAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
124 | value = ::mlir::LLVM::LoopInterleaveAttr::parse(parser, type); |
125 | return ::mlir::success(!!value); |
126 | }) |
127 | .Case(::mlir::LLVM::LoopLICMAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
128 | value = ::mlir::LLVM::LoopLICMAttr::parse(parser, type); |
129 | return ::mlir::success(!!value); |
130 | }) |
131 | .Case(::mlir::LLVM::LoopPeeledAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
132 | value = ::mlir::LLVM::LoopPeeledAttr::parse(parser, type); |
133 | return ::mlir::success(!!value); |
134 | }) |
135 | .Case(::mlir::LLVM::LoopPipelineAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
136 | value = ::mlir::LLVM::LoopPipelineAttr::parse(parser, type); |
137 | return ::mlir::success(!!value); |
138 | }) |
139 | .Case(::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
140 | value = ::mlir::LLVM::LoopUnrollAndJamAttr::parse(parser, type); |
141 | return ::mlir::success(!!value); |
142 | }) |
143 | .Case(::mlir::LLVM::LoopUnrollAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
144 | value = ::mlir::LLVM::LoopUnrollAttr::parse(parser, type); |
145 | return ::mlir::success(!!value); |
146 | }) |
147 | .Case(::mlir::LLVM::LoopUnswitchAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
148 | value = ::mlir::LLVM::LoopUnswitchAttr::parse(parser, type); |
149 | return ::mlir::success(!!value); |
150 | }) |
151 | .Case(::mlir::LLVM::LoopVectorizeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
152 | value = ::mlir::LLVM::LoopVectorizeAttr::parse(parser, type); |
153 | return ::mlir::success(!!value); |
154 | }) |
155 | .Default([&](llvm::StringRef keyword, llvm::SMLoc) { |
156 | *mnemonic = keyword; |
157 | return std::nullopt; |
158 | }); |
159 | } |
160 | |
161 | static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { |
162 | return ::llvm::TypeSwitch<::mlir::Attribute, ::mlir::LogicalResult>(def) .Case<::mlir::LLVM::CConvAttr>([&](auto t) { |
163 | printer << ::mlir::LLVM::CConvAttr::getMnemonic(); |
164 | t.print(printer); |
165 | return ::mlir::success(); |
166 | }) |
167 | .Case<::mlir::LLVM::DIBasicTypeAttr>([&](auto t) { |
168 | printer << ::mlir::LLVM::DIBasicTypeAttr::getMnemonic(); |
169 | t.print(printer); |
170 | return ::mlir::success(); |
171 | }) |
172 | .Case<::mlir::LLVM::DICompileUnitAttr>([&](auto t) { |
173 | printer << ::mlir::LLVM::DICompileUnitAttr::getMnemonic(); |
174 | t.print(printer); |
175 | return ::mlir::success(); |
176 | }) |
177 | .Case<::mlir::LLVM::DICompositeTypeAttr>([&](auto t) { |
178 | printer << ::mlir::LLVM::DICompositeTypeAttr::getMnemonic(); |
179 | t.print(printer); |
180 | return ::mlir::success(); |
181 | }) |
182 | .Case<::mlir::LLVM::DIDerivedTypeAttr>([&](auto t) { |
183 | printer << ::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(); |
184 | t.print(printer); |
185 | return ::mlir::success(); |
186 | }) |
187 | .Case<::mlir::LLVM::DIFileAttr>([&](auto t) { |
188 | printer << ::mlir::LLVM::DIFileAttr::getMnemonic(); |
189 | t.print(printer); |
190 | return ::mlir::success(); |
191 | }) |
192 | .Case<::mlir::LLVM::DILexicalBlockAttr>([&](auto t) { |
193 | printer << ::mlir::LLVM::DILexicalBlockAttr::getMnemonic(); |
194 | t.print(printer); |
195 | return ::mlir::success(); |
196 | }) |
197 | .Case<::mlir::LLVM::DILexicalBlockFileAttr>([&](auto t) { |
198 | printer << ::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(); |
199 | t.print(printer); |
200 | return ::mlir::success(); |
201 | }) |
202 | .Case<::mlir::LLVM::DILocalVariableAttr>([&](auto t) { |
203 | printer << ::mlir::LLVM::DILocalVariableAttr::getMnemonic(); |
204 | t.print(printer); |
205 | return ::mlir::success(); |
206 | }) |
207 | .Case<::mlir::LLVM::DINamespaceAttr>([&](auto t) { |
208 | printer << ::mlir::LLVM::DINamespaceAttr::getMnemonic(); |
209 | t.print(printer); |
210 | return ::mlir::success(); |
211 | }) |
212 | .Case<::mlir::LLVM::DINullTypeAttr>([&](auto t) { |
213 | printer << ::mlir::LLVM::DINullTypeAttr::getMnemonic(); |
214 | return ::mlir::success(); |
215 | }) |
216 | .Case<::mlir::LLVM::DISubprogramAttr>([&](auto t) { |
217 | printer << ::mlir::LLVM::DISubprogramAttr::getMnemonic(); |
218 | t.print(printer); |
219 | return ::mlir::success(); |
220 | }) |
221 | .Case<::mlir::LLVM::DISubrangeAttr>([&](auto t) { |
222 | printer << ::mlir::LLVM::DISubrangeAttr::getMnemonic(); |
223 | t.print(printer); |
224 | return ::mlir::success(); |
225 | }) |
226 | .Case<::mlir::LLVM::DISubroutineTypeAttr>([&](auto t) { |
227 | printer << ::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(); |
228 | t.print(printer); |
229 | return ::mlir::success(); |
230 | }) |
231 | .Case<::mlir::LLVM::FastmathFlagsAttr>([&](auto t) { |
232 | printer << ::mlir::LLVM::FastmathFlagsAttr::getMnemonic(); |
233 | t.print(printer); |
234 | return ::mlir::success(); |
235 | }) |
236 | .Case<::mlir::LLVM::MemoryEffectsAttr>([&](auto t) { |
237 | printer << ::mlir::LLVM::MemoryEffectsAttr::getMnemonic(); |
238 | t.print(printer); |
239 | return ::mlir::success(); |
240 | }) |
241 | .Case<::mlir::LLVM::LinkageAttr>([&](auto t) { |
242 | printer << ::mlir::LLVM::LinkageAttr::getMnemonic(); |
243 | t.print(printer); |
244 | return ::mlir::success(); |
245 | }) |
246 | .Case<::mlir::LLVM::LoopAnnotationAttr>([&](auto t) { |
247 | printer << ::mlir::LLVM::LoopAnnotationAttr::getMnemonic(); |
248 | t.print(printer); |
249 | return ::mlir::success(); |
250 | }) |
251 | .Case<::mlir::LLVM::LoopDistributeAttr>([&](auto t) { |
252 | printer << ::mlir::LLVM::LoopDistributeAttr::getMnemonic(); |
253 | t.print(printer); |
254 | return ::mlir::success(); |
255 | }) |
256 | .Case<::mlir::LLVM::LoopInterleaveAttr>([&](auto t) { |
257 | printer << ::mlir::LLVM::LoopInterleaveAttr::getMnemonic(); |
258 | t.print(printer); |
259 | return ::mlir::success(); |
260 | }) |
261 | .Case<::mlir::LLVM::LoopLICMAttr>([&](auto t) { |
262 | printer << ::mlir::LLVM::LoopLICMAttr::getMnemonic(); |
263 | t.print(printer); |
264 | return ::mlir::success(); |
265 | }) |
266 | .Case<::mlir::LLVM::LoopPeeledAttr>([&](auto t) { |
267 | printer << ::mlir::LLVM::LoopPeeledAttr::getMnemonic(); |
268 | t.print(printer); |
269 | return ::mlir::success(); |
270 | }) |
271 | .Case<::mlir::LLVM::LoopPipelineAttr>([&](auto t) { |
272 | printer << ::mlir::LLVM::LoopPipelineAttr::getMnemonic(); |
273 | t.print(printer); |
274 | return ::mlir::success(); |
275 | }) |
276 | .Case<::mlir::LLVM::LoopUnrollAndJamAttr>([&](auto t) { |
277 | printer << ::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(); |
278 | t.print(printer); |
279 | return ::mlir::success(); |
280 | }) |
281 | .Case<::mlir::LLVM::LoopUnrollAttr>([&](auto t) { |
282 | printer << ::mlir::LLVM::LoopUnrollAttr::getMnemonic(); |
283 | t.print(printer); |
284 | return ::mlir::success(); |
285 | }) |
286 | .Case<::mlir::LLVM::LoopUnswitchAttr>([&](auto t) { |
287 | printer << ::mlir::LLVM::LoopUnswitchAttr::getMnemonic(); |
288 | t.print(printer); |
289 | return ::mlir::success(); |
290 | }) |
291 | .Case<::mlir::LLVM::LoopVectorizeAttr>([&](auto t) { |
292 | printer << ::mlir::LLVM::LoopVectorizeAttr::getMnemonic(); |
293 | t.print(printer); |
294 | return ::mlir::success(); |
295 | }) |
296 | .Default([](auto) { return ::mlir::failure(); }); |
297 | } |
298 | |
299 | namespace mlir { |
300 | namespace LLVM { |
301 | namespace detail { |
302 | struct CConvAttrStorage : public ::mlir::AttributeStorage { |
303 | using KeyTy = std::tuple<CConv>; |
304 | CConvAttrStorage(CConv CallingConv) : CallingConv(CallingConv) {} |
305 | |
306 | KeyTy getAsKey() const { |
307 | return KeyTy(CallingConv); |
308 | } |
309 | |
310 | bool operator==(const KeyTy &tblgenKey) const { |
311 | return (CallingConv == std::get<0>(tblgenKey)); |
312 | } |
313 | |
314 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
315 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
316 | } |
317 | |
318 | static CConvAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
319 | auto CallingConv = std::get<0>(tblgenKey); |
320 | return new (allocator.allocate<CConvAttrStorage>()) CConvAttrStorage(CallingConv); |
321 | } |
322 | |
323 | CConv CallingConv; |
324 | }; |
325 | } // namespace detail |
326 | CConvAttr CConvAttr::get(::mlir::MLIRContext *context, CConv CallingConv) { |
327 | return Base::get(context, CallingConv); |
328 | } |
329 | |
330 | ::mlir::Attribute CConvAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
331 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
332 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
333 | (void) odsLoc; |
334 | ::mlir::FailureOr<CConv> _result_CallingConv; |
335 | // Parse literal '<' |
336 | if (odsParser.parseLess()) return {}; |
337 | |
338 | // Parse variable 'CallingConv' |
339 | _result_CallingConv = ::mlir::FieldParser<CConv>::parse(odsParser); |
340 | if (::mlir::failed(_result_CallingConv)) { |
341 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CConvAttr parameter 'CallingConv' which is to be a `CConv`"); |
342 | return {}; |
343 | } |
344 | // Parse literal '>' |
345 | if (odsParser.parseGreater()) return {}; |
346 | 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" , 346, __extension__ __PRETTY_FUNCTION__)); |
347 | return CConvAttr::get(odsParser.getContext(), |
348 | CConv((*_result_CallingConv))); |
349 | } |
350 | |
351 | void CConvAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
352 | ::mlir::Builder odsBuilder(getContext()); |
353 | odsPrinter << "<"; |
354 | odsPrinter.printStrippedAttrOrType(getCallingConv()); |
355 | odsPrinter << ">"; |
356 | } |
357 | |
358 | CConv CConvAttr::getCallingConv() const { |
359 | return getImpl()->CallingConv; |
360 | } |
361 | |
362 | } // namespace LLVM |
363 | } // namespace mlir |
364 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CConvAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::CConvAttr>::id = {}; } } |
365 | namespace mlir { |
366 | namespace LLVM { |
367 | namespace detail { |
368 | struct DIBasicTypeAttrStorage : public ::mlir::AttributeStorage { |
369 | using KeyTy = std::tuple<unsigned, StringAttr, uint64_t, unsigned>; |
370 | DIBasicTypeAttrStorage(unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) : tag(tag), name(name), sizeInBits(sizeInBits), encoding(encoding) {} |
371 | |
372 | KeyTy getAsKey() const { |
373 | return KeyTy(tag, name, sizeInBits, encoding); |
374 | } |
375 | |
376 | bool operator==(const KeyTy &tblgenKey) const { |
377 | return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (sizeInBits == std::get<2>(tblgenKey)) && (encoding == std::get<3>(tblgenKey)); |
378 | } |
379 | |
380 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
381 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); |
382 | } |
383 | |
384 | static DIBasicTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
385 | auto tag = std::get<0>(tblgenKey); |
386 | auto name = std::get<1>(tblgenKey); |
387 | auto sizeInBits = std::get<2>(tblgenKey); |
388 | auto encoding = std::get<3>(tblgenKey); |
389 | return new (allocator.allocate<DIBasicTypeAttrStorage>()) DIBasicTypeAttrStorage(tag, name, sizeInBits, encoding); |
390 | } |
391 | |
392 | unsigned tag; |
393 | StringAttr name; |
394 | uint64_t sizeInBits; |
395 | unsigned encoding; |
396 | }; |
397 | } // namespace detail |
398 | DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) { |
399 | return Base::get(context, tag, name, sizeInBits, encoding); |
400 | } |
401 | |
402 | DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, const Twine &name, uint64_t sizeInBits, unsigned encoding) { |
403 | return Base::get(context, tag, StringAttr::get(context, name), sizeInBits, |
404 | encoding); |
405 | } |
406 | |
407 | ::mlir::Attribute DIBasicTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
408 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
409 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
410 | (void) odsLoc; |
411 | ::mlir::FailureOr<unsigned> _result_tag; |
412 | ::mlir::FailureOr<StringAttr> _result_name; |
413 | ::mlir::FailureOr<uint64_t> _result_sizeInBits; |
414 | ::mlir::FailureOr<unsigned> _result_encoding; |
415 | // Parse literal '<' |
416 | if (odsParser.parseLess()) return {}; |
417 | // Parse parameter struct |
418 | bool _seen_tag = false; |
419 | bool _seen_name = false; |
420 | bool _seen_sizeInBits = false; |
421 | bool _seen_encoding = false; |
422 | { |
423 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
424 | // Parse literal '=' |
425 | if (odsParser.parseEqual()) return {}; |
426 | if (!_seen_tag && _paramKey == "tag") { |
427 | _seen_tag = true; |
428 | |
429 | // Parse variable 'tag' |
430 | _result_tag = [&]() -> FailureOr<unsigned> { |
431 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
432 | StringRef name; |
433 | if (odsParser.parseKeyword(&name)) |
434 | return failure(); |
435 | |
436 | if (unsigned tag = llvm::dwarf::getTag(name)) |
437 | return tag; |
438 | return odsParser.emitError(tagLoc) |
439 | << "invalid debug info debug info tag name: " << name; |
440 | }() ; |
441 | if (::mlir::failed(_result_tag)) { |
442 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'tag' which is to be a `unsigned`"); |
443 | return {}; |
444 | } |
445 | } else if (!_seen_name && _paramKey == "name") { |
446 | _seen_name = true; |
447 | |
448 | // Parse variable 'name' |
449 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
450 | if (::mlir::failed(_result_name)) { |
451 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'name' which is to be a `StringAttr`"); |
452 | return {}; |
453 | } |
454 | } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { |
455 | _seen_sizeInBits = true; |
456 | |
457 | // Parse variable 'sizeInBits' |
458 | _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
459 | if (::mlir::failed(_result_sizeInBits)) { |
460 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); |
461 | return {}; |
462 | } |
463 | } else if (!_seen_encoding && _paramKey == "encoding") { |
464 | _seen_encoding = true; |
465 | |
466 | // Parse variable 'encoding' |
467 | _result_encoding = [&]() -> FailureOr<unsigned> { |
468 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
469 | StringRef name; |
470 | if (odsParser.parseKeyword(&name)) |
471 | return failure(); |
472 | |
473 | if (unsigned tag = llvm::dwarf::getAttributeEncoding(name)) |
474 | return tag; |
475 | return odsParser.emitError(tagLoc) |
476 | << "invalid debug info debug info encoding name: " << name; |
477 | }() ; |
478 | if (::mlir::failed(_result_encoding)) { |
479 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'encoding' which is to be a `unsigned`"); |
480 | return {}; |
481 | } |
482 | } else { |
483 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
484 | return {}; |
485 | } |
486 | return true; |
487 | }; |
488 | do { |
489 | ::llvm::StringRef _paramKey; |
490 | if (odsParser.parseKeyword(&_paramKey)) { |
491 | odsParser.emitError(odsParser.getCurrentLocation(), |
492 | "expected a parameter name in struct"); |
493 | return {}; |
494 | } |
495 | if (!_loop_body(_paramKey)) return {}; |
496 | } while(!odsParser.parseOptionalComma()); |
497 | if (!_seen_tag) { |
498 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; |
499 | return {}; |
500 | } |
501 | if (!_seen_name) { |
502 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; |
503 | return {}; |
504 | } |
505 | } |
506 | // Parse literal '>' |
507 | if (odsParser.parseGreater()) return {}; |
508 | 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" , 508, __extension__ __PRETTY_FUNCTION__)); |
509 | 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" , 509, __extension__ __PRETTY_FUNCTION__)); |
510 | return DIBasicTypeAttr::get(odsParser.getContext(), |
511 | unsigned((*_result_tag)), |
512 | StringAttr((*_result_name)), |
513 | uint64_t((_result_sizeInBits.value_or(uint64_t()))), |
514 | unsigned((_result_encoding.value_or(0)))); |
515 | } |
516 | |
517 | void DIBasicTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
518 | ::mlir::Builder odsBuilder(getContext()); |
519 | odsPrinter << "<"; |
520 | { |
521 | bool _firstPrinted = true; |
522 | if (!_firstPrinted) odsPrinter << ", "; |
523 | _firstPrinted = false; |
524 | odsPrinter << "tag = "; |
525 | odsPrinter << llvm::dwarf::TagString(getTag()); |
526 | if (!_firstPrinted) odsPrinter << ", "; |
527 | _firstPrinted = false; |
528 | odsPrinter << "name = "; |
529 | odsPrinter.printStrippedAttrOrType(getName()); |
530 | if (!(getSizeInBits() == uint64_t())) { |
531 | if (!_firstPrinted) odsPrinter << ", "; |
532 | _firstPrinted = false; |
533 | odsPrinter << "sizeInBits = "; |
534 | if (!(getSizeInBits() == uint64_t())) { |
535 | odsPrinter.printStrippedAttrOrType(getSizeInBits()); |
536 | } |
537 | } |
538 | if (!(getEncoding() == 0)) { |
539 | if (!_firstPrinted) odsPrinter << ", "; |
540 | _firstPrinted = false; |
541 | odsPrinter << "encoding = "; |
542 | if (!(getEncoding() == 0)) { |
543 | odsPrinter << llvm::dwarf::AttributeEncodingString(getEncoding()); |
544 | } |
545 | } |
546 | } |
547 | odsPrinter << ">"; |
548 | } |
549 | |
550 | unsigned DIBasicTypeAttr::getTag() const { |
551 | return getImpl()->tag; |
552 | } |
553 | |
554 | StringAttr DIBasicTypeAttr::getName() const { |
555 | return getImpl()->name; |
556 | } |
557 | |
558 | uint64_t DIBasicTypeAttr::getSizeInBits() const { |
559 | return getImpl()->sizeInBits; |
560 | } |
561 | |
562 | unsigned DIBasicTypeAttr::getEncoding() const { |
563 | return getImpl()->encoding; |
564 | } |
565 | |
566 | } // namespace LLVM |
567 | } // namespace mlir |
568 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIBasicTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DIBasicTypeAttr>::id = {}; } } |
569 | namespace mlir { |
570 | namespace LLVM { |
571 | namespace detail { |
572 | struct DICompileUnitAttrStorage : public ::mlir::AttributeStorage { |
573 | using KeyTy = std::tuple<unsigned, DIFileAttr, StringAttr, bool, DIEmissionKind>; |
574 | DICompileUnitAttrStorage(unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) : sourceLanguage(sourceLanguage), file(file), producer(producer), isOptimized(isOptimized), emissionKind(emissionKind) {} |
575 | |
576 | KeyTy getAsKey() const { |
577 | return KeyTy(sourceLanguage, file, producer, isOptimized, emissionKind); |
578 | } |
579 | |
580 | bool operator==(const KeyTy &tblgenKey) const { |
581 | 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)); |
582 | } |
583 | |
584 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
585 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); |
586 | } |
587 | |
588 | static DICompileUnitAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
589 | auto sourceLanguage = std::get<0>(tblgenKey); |
590 | auto file = std::get<1>(tblgenKey); |
591 | auto producer = std::get<2>(tblgenKey); |
592 | auto isOptimized = std::get<3>(tblgenKey); |
593 | auto emissionKind = std::get<4>(tblgenKey); |
594 | return new (allocator.allocate<DICompileUnitAttrStorage>()) DICompileUnitAttrStorage(sourceLanguage, file, producer, isOptimized, emissionKind); |
595 | } |
596 | |
597 | unsigned sourceLanguage; |
598 | DIFileAttr file; |
599 | StringAttr producer; |
600 | bool isOptimized; |
601 | DIEmissionKind emissionKind; |
602 | }; |
603 | } // namespace detail |
604 | DICompileUnitAttr DICompileUnitAttr::get(::mlir::MLIRContext *context, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind) { |
605 | return Base::get(context, sourceLanguage, file, producer, isOptimized, emissionKind); |
606 | } |
607 | |
608 | ::mlir::Attribute DICompileUnitAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
609 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
610 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
611 | (void) odsLoc; |
612 | ::mlir::FailureOr<unsigned> _result_sourceLanguage; |
613 | ::mlir::FailureOr<DIFileAttr> _result_file; |
614 | ::mlir::FailureOr<StringAttr> _result_producer; |
615 | ::mlir::FailureOr<bool> _result_isOptimized; |
616 | ::mlir::FailureOr<DIEmissionKind> _result_emissionKind; |
617 | // Parse literal '<' |
618 | if (odsParser.parseLess()) return {}; |
619 | // Parse parameter struct |
620 | bool _seen_sourceLanguage = false; |
621 | bool _seen_file = false; |
622 | bool _seen_producer = false; |
623 | bool _seen_isOptimized = false; |
624 | bool _seen_emissionKind = false; |
625 | { |
626 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
627 | // Parse literal '=' |
628 | if (odsParser.parseEqual()) return {}; |
629 | if (!_seen_sourceLanguage && _paramKey == "sourceLanguage") { |
630 | _seen_sourceLanguage = true; |
631 | |
632 | // Parse variable 'sourceLanguage' |
633 | _result_sourceLanguage = [&]() -> FailureOr<unsigned> { |
634 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
635 | StringRef name; |
636 | if (odsParser.parseKeyword(&name)) |
637 | return failure(); |
638 | |
639 | if (unsigned tag = llvm::dwarf::getLanguage(name)) |
640 | return tag; |
641 | return odsParser.emitError(tagLoc) |
642 | << "invalid debug info debug info language name: " << name; |
643 | }() ; |
644 | if (::mlir::failed(_result_sourceLanguage)) { |
645 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'sourceLanguage' which is to be a `unsigned`"); |
646 | return {}; |
647 | } |
648 | } else if (!_seen_file && _paramKey == "file") { |
649 | _seen_file = true; |
650 | |
651 | // Parse variable 'file' |
652 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
653 | if (::mlir::failed(_result_file)) { |
654 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'file' which is to be a `DIFileAttr`"); |
655 | return {}; |
656 | } |
657 | } else if (!_seen_producer && _paramKey == "producer") { |
658 | _seen_producer = true; |
659 | |
660 | // Parse variable 'producer' |
661 | _result_producer = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
662 | if (::mlir::failed(_result_producer)) { |
663 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'producer' which is to be a `StringAttr`"); |
664 | return {}; |
665 | } |
666 | } else if (!_seen_isOptimized && _paramKey == "isOptimized") { |
667 | _seen_isOptimized = true; |
668 | |
669 | // Parse variable 'isOptimized' |
670 | _result_isOptimized = ::mlir::FieldParser<bool>::parse(odsParser); |
671 | if (::mlir::failed(_result_isOptimized)) { |
672 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isOptimized' which is to be a `bool`"); |
673 | return {}; |
674 | } |
675 | } else if (!_seen_emissionKind && _paramKey == "emissionKind") { |
676 | _seen_emissionKind = true; |
677 | |
678 | // Parse variable 'emissionKind' |
679 | _result_emissionKind = ::mlir::FieldParser<DIEmissionKind>::parse(odsParser); |
680 | if (::mlir::failed(_result_emissionKind)) { |
681 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'emissionKind' which is to be a `DIEmissionKind`"); |
682 | return {}; |
683 | } |
684 | } else { |
685 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
686 | return {}; |
687 | } |
688 | return true; |
689 | }; |
690 | for (unsigned odsStructIndex = 0; odsStructIndex < 5; ++odsStructIndex) { |
691 | ::llvm::StringRef _paramKey; |
692 | if (odsParser.parseKeyword(&_paramKey)) { |
693 | odsParser.emitError(odsParser.getCurrentLocation(), |
694 | "expected a parameter name in struct"); |
695 | return {}; |
696 | } |
697 | if (!_loop_body(_paramKey)) return {}; |
698 | if ((odsStructIndex != 5 - 1) && odsParser.parseComma()) |
699 | return {}; |
700 | } |
701 | } |
702 | // Parse literal '>' |
703 | if (odsParser.parseGreater()) return {}; |
704 | 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" , 704, __extension__ __PRETTY_FUNCTION__)); |
705 | 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" , 705, __extension__ __PRETTY_FUNCTION__)); |
706 | 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" , 706, __extension__ __PRETTY_FUNCTION__)); |
707 | 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" , 707, __extension__ __PRETTY_FUNCTION__)); |
708 | 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" , 708, __extension__ __PRETTY_FUNCTION__)); |
709 | return DICompileUnitAttr::get(odsParser.getContext(), |
710 | unsigned((*_result_sourceLanguage)), |
711 | DIFileAttr((*_result_file)), |
712 | StringAttr((*_result_producer)), |
713 | bool((*_result_isOptimized)), |
714 | DIEmissionKind((*_result_emissionKind))); |
715 | } |
716 | |
717 | void DICompileUnitAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
718 | ::mlir::Builder odsBuilder(getContext()); |
719 | odsPrinter << "<"; |
720 | { |
721 | bool _firstPrinted = true; |
722 | if (!_firstPrinted) odsPrinter << ", "; |
723 | _firstPrinted = false; |
724 | odsPrinter << "sourceLanguage = "; |
725 | odsPrinter << llvm::dwarf::LanguageString(getSourceLanguage()); |
726 | if (!_firstPrinted) odsPrinter << ", "; |
727 | _firstPrinted = false; |
728 | odsPrinter << "file = "; |
729 | odsPrinter.printStrippedAttrOrType(getFile()); |
730 | if (!_firstPrinted) odsPrinter << ", "; |
731 | _firstPrinted = false; |
732 | odsPrinter << "producer = "; |
733 | odsPrinter.printStrippedAttrOrType(getProducer()); |
734 | if (!_firstPrinted) odsPrinter << ", "; |
735 | _firstPrinted = false; |
736 | odsPrinter << "isOptimized = "; |
737 | odsPrinter.printStrippedAttrOrType(getIsOptimized()); |
738 | if (!_firstPrinted) odsPrinter << ", "; |
739 | _firstPrinted = false; |
Value stored to '_firstPrinted' is never read | |
740 | odsPrinter << "emissionKind = "; |
741 | odsPrinter.printStrippedAttrOrType(getEmissionKind()); |
742 | } |
743 | odsPrinter << ">"; |
744 | } |
745 | |
746 | unsigned DICompileUnitAttr::getSourceLanguage() const { |
747 | return getImpl()->sourceLanguage; |
748 | } |
749 | |
750 | DIFileAttr DICompileUnitAttr::getFile() const { |
751 | return getImpl()->file; |
752 | } |
753 | |
754 | StringAttr DICompileUnitAttr::getProducer() const { |
755 | return getImpl()->producer; |
756 | } |
757 | |
758 | bool DICompileUnitAttr::getIsOptimized() const { |
759 | return getImpl()->isOptimized; |
760 | } |
761 | |
762 | DIEmissionKind DICompileUnitAttr::getEmissionKind() const { |
763 | return getImpl()->emissionKind; |
764 | } |
765 | |
766 | } // namespace LLVM |
767 | } // namespace mlir |
768 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompileUnitAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DICompileUnitAttr>::id = {}; } } |
769 | namespace mlir { |
770 | namespace LLVM { |
771 | namespace detail { |
772 | struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage { |
773 | using KeyTy = std::tuple<unsigned, StringAttr, DIFileAttr, uint32_t, DIScopeAttr, DITypeAttr, DIFlags, uint64_t, uint64_t, ::llvm::ArrayRef<DINodeAttr>>; |
774 | 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) {} |
775 | |
776 | KeyTy getAsKey() const { |
777 | return KeyTy(tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements); |
778 | } |
779 | |
780 | bool operator==(const KeyTy &tblgenKey) const { |
781 | 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::ArrayRef<DINodeAttr>(elements) == ::llvm::ArrayRef<DINodeAttr>(std::get<9>(tblgenKey))); |
782 | } |
783 | |
784 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
785 | 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)); |
786 | } |
787 | |
788 | static DICompositeTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
789 | auto tag = std::get<0>(tblgenKey); |
790 | auto name = std::get<1>(tblgenKey); |
791 | auto file = std::get<2>(tblgenKey); |
792 | auto line = std::get<3>(tblgenKey); |
793 | auto scope = std::get<4>(tblgenKey); |
794 | auto baseType = std::get<5>(tblgenKey); |
795 | auto flags = std::get<6>(tblgenKey); |
796 | auto sizeInBits = std::get<7>(tblgenKey); |
797 | auto alignInBits = std::get<8>(tblgenKey); |
798 | auto elements = std::get<9>(tblgenKey); |
799 | elements = allocator.copyInto(elements); |
800 | return new (allocator.allocate<DICompositeTypeAttrStorage>()) DICompositeTypeAttrStorage(tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements); |
801 | } |
802 | |
803 | unsigned tag; |
804 | StringAttr name; |
805 | DIFileAttr file; |
806 | uint32_t line; |
807 | DIScopeAttr scope; |
808 | DITypeAttr baseType; |
809 | DIFlags flags; |
810 | uint64_t sizeInBits; |
811 | uint64_t alignInBits; |
812 | ::llvm::ArrayRef<DINodeAttr> elements; |
813 | }; |
814 | } // namespace detail |
815 | 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) { |
816 | return Base::get(context, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, elements); |
817 | } |
818 | |
819 | ::mlir::Attribute DICompositeTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
820 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
821 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
822 | (void) odsLoc; |
823 | ::mlir::FailureOr<unsigned> _result_tag; |
824 | ::mlir::FailureOr<StringAttr> _result_name; |
825 | ::mlir::FailureOr<DIFileAttr> _result_file; |
826 | ::mlir::FailureOr<uint32_t> _result_line; |
827 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
828 | ::mlir::FailureOr<DITypeAttr> _result_baseType; |
829 | ::mlir::FailureOr<DIFlags> _result_flags; |
830 | ::mlir::FailureOr<uint64_t> _result_sizeInBits; |
831 | ::mlir::FailureOr<uint64_t> _result_alignInBits; |
832 | ::mlir::FailureOr<::llvm::SmallVector<DINodeAttr>> _result_elements; |
833 | // Parse literal '<' |
834 | if (odsParser.parseLess()) return {}; |
835 | // Parse parameter struct |
836 | bool _seen_tag = false; |
837 | bool _seen_name = false; |
838 | bool _seen_file = false; |
839 | bool _seen_line = false; |
840 | bool _seen_scope = false; |
841 | bool _seen_baseType = false; |
842 | bool _seen_flags = false; |
843 | bool _seen_sizeInBits = false; |
844 | bool _seen_alignInBits = false; |
845 | bool _seen_elements = false; |
846 | { |
847 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
848 | // Parse literal '=' |
849 | if (odsParser.parseEqual()) return {}; |
850 | if (!_seen_tag && _paramKey == "tag") { |
851 | _seen_tag = true; |
852 | |
853 | // Parse variable 'tag' |
854 | _result_tag = [&]() -> FailureOr<unsigned> { |
855 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
856 | StringRef name; |
857 | if (odsParser.parseKeyword(&name)) |
858 | return failure(); |
859 | |
860 | if (unsigned tag = llvm::dwarf::getTag(name)) |
861 | return tag; |
862 | return odsParser.emitError(tagLoc) |
863 | << "invalid debug info debug info tag name: " << name; |
864 | }() ; |
865 | if (::mlir::failed(_result_tag)) { |
866 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'tag' which is to be a `unsigned`"); |
867 | return {}; |
868 | } |
869 | } else if (!_seen_name && _paramKey == "name") { |
870 | _seen_name = true; |
871 | |
872 | // Parse variable 'name' |
873 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
874 | if (::mlir::failed(_result_name)) { |
875 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'name' which is to be a `StringAttr`"); |
876 | return {}; |
877 | } |
878 | } else if (!_seen_file && _paramKey == "file") { |
879 | _seen_file = true; |
880 | |
881 | // Parse variable 'file' |
882 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
883 | if (::mlir::failed(_result_file)) { |
884 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'file' which is to be a `DIFileAttr`"); |
885 | return {}; |
886 | } |
887 | } else if (!_seen_line && _paramKey == "line") { |
888 | _seen_line = true; |
889 | |
890 | // Parse variable 'line' |
891 | _result_line = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
892 | if (::mlir::failed(_result_line)) { |
893 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'line' which is to be a `uint32_t`"); |
894 | return {}; |
895 | } |
896 | } else if (!_seen_scope && _paramKey == "scope") { |
897 | _seen_scope = true; |
898 | |
899 | // Parse variable 'scope' |
900 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
901 | if (::mlir::failed(_result_scope)) { |
902 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'scope' which is to be a `DIScopeAttr`"); |
903 | return {}; |
904 | } |
905 | } else if (!_seen_baseType && _paramKey == "baseType") { |
906 | _seen_baseType = true; |
907 | |
908 | // Parse variable 'baseType' |
909 | _result_baseType = ::mlir::FieldParser<DITypeAttr>::parse(odsParser); |
910 | if (::mlir::failed(_result_baseType)) { |
911 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); |
912 | return {}; |
913 | } |
914 | } else if (!_seen_flags && _paramKey == "flags") { |
915 | _seen_flags = true; |
916 | |
917 | // Parse variable 'flags' |
918 | _result_flags = ::mlir::FieldParser<DIFlags>::parse(odsParser); |
919 | if (::mlir::failed(_result_flags)) { |
920 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'flags' which is to be a `DIFlags`"); |
921 | return {}; |
922 | } |
923 | } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { |
924 | _seen_sizeInBits = true; |
925 | |
926 | // Parse variable 'sizeInBits' |
927 | _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
928 | if (::mlir::failed(_result_sizeInBits)) { |
929 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); |
930 | return {}; |
931 | } |
932 | } else if (!_seen_alignInBits && _paramKey == "alignInBits") { |
933 | _seen_alignInBits = true; |
934 | |
935 | // Parse variable 'alignInBits' |
936 | _result_alignInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
937 | if (::mlir::failed(_result_alignInBits)) { |
938 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'alignInBits' which is to be a `uint64_t`"); |
939 | return {}; |
940 | } |
941 | } else if (!_seen_elements && _paramKey == "elements") { |
942 | _seen_elements = true; |
943 | |
944 | // Parse variable 'elements' |
945 | _result_elements = ::mlir::FieldParser<::llvm::SmallVector<DINodeAttr>>::parse(odsParser); |
946 | if (::mlir::failed(_result_elements)) { |
947 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'elements' which is to be a `::llvm::ArrayRef<DINodeAttr>`"); |
948 | return {}; |
949 | } |
950 | } else { |
951 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
952 | return {}; |
953 | } |
954 | return true; |
955 | }; |
956 | do { |
957 | ::llvm::StringRef _paramKey; |
958 | if (odsParser.parseKeyword(&_paramKey)) { |
959 | odsParser.emitError(odsParser.getCurrentLocation(), |
960 | "expected a parameter name in struct"); |
961 | return {}; |
962 | } |
963 | if (!_loop_body(_paramKey)) return {}; |
964 | } while(!odsParser.parseOptionalComma()); |
965 | if (!_seen_tag) { |
966 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; |
967 | return {}; |
968 | } |
969 | if (!_seen_name) { |
970 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; |
971 | return {}; |
972 | } |
973 | } |
974 | // Parse literal '>' |
975 | if (odsParser.parseGreater()) return {}; |
976 | 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" , 976, __extension__ __PRETTY_FUNCTION__)); |
977 | 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" , 977, __extension__ __PRETTY_FUNCTION__)); |
978 | return DICompositeTypeAttr::get(odsParser.getContext(), |
979 | unsigned((*_result_tag)), |
980 | StringAttr((*_result_name)), |
981 | DIFileAttr((_result_file.value_or(DIFileAttr()))), |
982 | uint32_t((_result_line.value_or(uint32_t()))), |
983 | DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), |
984 | DITypeAttr((_result_baseType.value_or(DITypeAttr()))), |
985 | DIFlags((_result_flags.value_or(DIFlags()))), |
986 | uint64_t((_result_sizeInBits.value_or(uint64_t()))), |
987 | uint64_t((_result_alignInBits.value_or(uint64_t()))), |
988 | ::llvm::ArrayRef<DINodeAttr>((_result_elements.value_or(::llvm::SmallVector<DINodeAttr>())))); |
989 | } |
990 | |
991 | void DICompositeTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
992 | ::mlir::Builder odsBuilder(getContext()); |
993 | odsPrinter << "<"; |
994 | { |
995 | bool _firstPrinted = true; |
996 | if (!_firstPrinted) odsPrinter << ", "; |
997 | _firstPrinted = false; |
998 | odsPrinter << "tag = "; |
999 | odsPrinter << llvm::dwarf::TagString(getTag()); |
1000 | if (!_firstPrinted) odsPrinter << ", "; |
1001 | _firstPrinted = false; |
1002 | odsPrinter << "name = "; |
1003 | odsPrinter.printStrippedAttrOrType(getName()); |
1004 | if (!(getFile() == DIFileAttr())) { |
1005 | if (!_firstPrinted) odsPrinter << ", "; |
1006 | _firstPrinted = false; |
1007 | odsPrinter << "file = "; |
1008 | if (!(getFile() == DIFileAttr())) { |
1009 | odsPrinter.printStrippedAttrOrType(getFile()); |
1010 | } |
1011 | } |
1012 | if (!(getLine() == uint32_t())) { |
1013 | if (!_firstPrinted) odsPrinter << ", "; |
1014 | _firstPrinted = false; |
1015 | odsPrinter << "line = "; |
1016 | if (!(getLine() == uint32_t())) { |
1017 | odsPrinter.printStrippedAttrOrType(getLine()); |
1018 | } |
1019 | } |
1020 | if (!(getScope() == DIScopeAttr())) { |
1021 | if (!_firstPrinted) odsPrinter << ", "; |
1022 | _firstPrinted = false; |
1023 | odsPrinter << "scope = "; |
1024 | if (!(getScope() == DIScopeAttr())) { |
1025 | odsPrinter.printStrippedAttrOrType(getScope()); |
1026 | } |
1027 | } |
1028 | if (!(getBaseType() == DITypeAttr())) { |
1029 | if (!_firstPrinted) odsPrinter << ", "; |
1030 | _firstPrinted = false; |
1031 | odsPrinter << "baseType = "; |
1032 | if (!(getBaseType() == DITypeAttr())) { |
1033 | odsPrinter.printStrippedAttrOrType(getBaseType()); |
1034 | } |
1035 | } |
1036 | if (!(getFlags() == DIFlags())) { |
1037 | if (!_firstPrinted) odsPrinter << ", "; |
1038 | _firstPrinted = false; |
1039 | odsPrinter << "flags = "; |
1040 | if (!(getFlags() == DIFlags())) { |
1041 | odsPrinter.printStrippedAttrOrType(getFlags()); |
1042 | } |
1043 | } |
1044 | if (!(getSizeInBits() == uint64_t())) { |
1045 | if (!_firstPrinted) odsPrinter << ", "; |
1046 | _firstPrinted = false; |
1047 | odsPrinter << "sizeInBits = "; |
1048 | if (!(getSizeInBits() == uint64_t())) { |
1049 | odsPrinter.printStrippedAttrOrType(getSizeInBits()); |
1050 | } |
1051 | } |
1052 | if (!(getAlignInBits() == uint64_t())) { |
1053 | if (!_firstPrinted) odsPrinter << ", "; |
1054 | _firstPrinted = false; |
1055 | odsPrinter << "alignInBits = "; |
1056 | if (!(getAlignInBits() == uint64_t())) { |
1057 | odsPrinter.printStrippedAttrOrType(getAlignInBits()); |
1058 | } |
1059 | } |
1060 | if (!(::llvm::ArrayRef<DINodeAttr>(getElements()) == ::llvm::ArrayRef<DINodeAttr>(::llvm::SmallVector<DINodeAttr>()))) { |
1061 | if (!_firstPrinted) odsPrinter << ", "; |
1062 | _firstPrinted = false; |
1063 | odsPrinter << "elements = "; |
1064 | if (!(::llvm::ArrayRef<DINodeAttr>(getElements()) == ::llvm::ArrayRef<DINodeAttr>(::llvm::SmallVector<DINodeAttr>()))) { |
1065 | odsPrinter.printStrippedAttrOrType(getElements()); |
1066 | } |
1067 | } |
1068 | } |
1069 | odsPrinter << ">"; |
1070 | } |
1071 | |
1072 | unsigned DICompositeTypeAttr::getTag() const { |
1073 | return getImpl()->tag; |
1074 | } |
1075 | |
1076 | StringAttr DICompositeTypeAttr::getName() const { |
1077 | return getImpl()->name; |
1078 | } |
1079 | |
1080 | DIFileAttr DICompositeTypeAttr::getFile() const { |
1081 | return getImpl()->file; |
1082 | } |
1083 | |
1084 | uint32_t DICompositeTypeAttr::getLine() const { |
1085 | return getImpl()->line; |
1086 | } |
1087 | |
1088 | DIScopeAttr DICompositeTypeAttr::getScope() const { |
1089 | return getImpl()->scope; |
1090 | } |
1091 | |
1092 | DITypeAttr DICompositeTypeAttr::getBaseType() const { |
1093 | return getImpl()->baseType; |
1094 | } |
1095 | |
1096 | DIFlags DICompositeTypeAttr::getFlags() const { |
1097 | return getImpl()->flags; |
1098 | } |
1099 | |
1100 | uint64_t DICompositeTypeAttr::getSizeInBits() const { |
1101 | return getImpl()->sizeInBits; |
1102 | } |
1103 | |
1104 | uint64_t DICompositeTypeAttr::getAlignInBits() const { |
1105 | return getImpl()->alignInBits; |
1106 | } |
1107 | |
1108 | ::llvm::ArrayRef<DINodeAttr> DICompositeTypeAttr::getElements() const { |
1109 | return getImpl()->elements; |
1110 | } |
1111 | |
1112 | } // namespace LLVM |
1113 | } // namespace mlir |
1114 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompositeTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DICompositeTypeAttr>::id = {}; } } |
1115 | namespace mlir { |
1116 | namespace LLVM { |
1117 | namespace detail { |
1118 | struct DIDerivedTypeAttrStorage : public ::mlir::AttributeStorage { |
1119 | using KeyTy = std::tuple<unsigned, StringAttr, DITypeAttr, uint64_t, uint32_t, uint64_t>; |
1120 | 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) {} |
1121 | |
1122 | KeyTy getAsKey() const { |
1123 | return KeyTy(tag, name, baseType, sizeInBits, alignInBits, offsetInBits); |
1124 | } |
1125 | |
1126 | bool operator==(const KeyTy &tblgenKey) const { |
1127 | 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)); |
1128 | } |
1129 | |
1130 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1131 | 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)); |
1132 | } |
1133 | |
1134 | static DIDerivedTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1135 | auto tag = std::get<0>(tblgenKey); |
1136 | auto name = std::get<1>(tblgenKey); |
1137 | auto baseType = std::get<2>(tblgenKey); |
1138 | auto sizeInBits = std::get<3>(tblgenKey); |
1139 | auto alignInBits = std::get<4>(tblgenKey); |
1140 | auto offsetInBits = std::get<5>(tblgenKey); |
1141 | return new (allocator.allocate<DIDerivedTypeAttrStorage>()) DIDerivedTypeAttrStorage(tag, name, baseType, sizeInBits, alignInBits, offsetInBits); |
1142 | } |
1143 | |
1144 | unsigned tag; |
1145 | StringAttr name; |
1146 | DITypeAttr baseType; |
1147 | uint64_t sizeInBits; |
1148 | uint32_t alignInBits; |
1149 | uint64_t offsetInBits; |
1150 | }; |
1151 | } // namespace detail |
1152 | DIDerivedTypeAttr DIDerivedTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits) { |
1153 | return Base::get(context, tag, name, baseType, sizeInBits, alignInBits, offsetInBits); |
1154 | } |
1155 | |
1156 | ::mlir::Attribute DIDerivedTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1157 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1158 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1159 | (void) odsLoc; |
1160 | ::mlir::FailureOr<unsigned> _result_tag; |
1161 | ::mlir::FailureOr<StringAttr> _result_name; |
1162 | ::mlir::FailureOr<DITypeAttr> _result_baseType; |
1163 | ::mlir::FailureOr<uint64_t> _result_sizeInBits; |
1164 | ::mlir::FailureOr<uint32_t> _result_alignInBits; |
1165 | ::mlir::FailureOr<uint64_t> _result_offsetInBits; |
1166 | // Parse literal '<' |
1167 | if (odsParser.parseLess()) return {}; |
1168 | // Parse parameter struct |
1169 | bool _seen_tag = false; |
1170 | bool _seen_name = false; |
1171 | bool _seen_baseType = false; |
1172 | bool _seen_sizeInBits = false; |
1173 | bool _seen_alignInBits = false; |
1174 | bool _seen_offsetInBits = false; |
1175 | { |
1176 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1177 | // Parse literal '=' |
1178 | if (odsParser.parseEqual()) return {}; |
1179 | if (!_seen_tag && _paramKey == "tag") { |
1180 | _seen_tag = true; |
1181 | |
1182 | // Parse variable 'tag' |
1183 | _result_tag = [&]() -> FailureOr<unsigned> { |
1184 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
1185 | StringRef name; |
1186 | if (odsParser.parseKeyword(&name)) |
1187 | return failure(); |
1188 | |
1189 | if (unsigned tag = llvm::dwarf::getTag(name)) |
1190 | return tag; |
1191 | return odsParser.emitError(tagLoc) |
1192 | << "invalid debug info debug info tag name: " << name; |
1193 | }() ; |
1194 | if (::mlir::failed(_result_tag)) { |
1195 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'tag' which is to be a `unsigned`"); |
1196 | return {}; |
1197 | } |
1198 | } else if (!_seen_name && _paramKey == "name") { |
1199 | _seen_name = true; |
1200 | |
1201 | // Parse variable 'name' |
1202 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
1203 | if (::mlir::failed(_result_name)) { |
1204 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'name' which is to be a `StringAttr`"); |
1205 | return {}; |
1206 | } |
1207 | } else if (!_seen_baseType && _paramKey == "baseType") { |
1208 | _seen_baseType = true; |
1209 | |
1210 | // Parse variable 'baseType' |
1211 | _result_baseType = ::mlir::FieldParser<DITypeAttr>::parse(odsParser); |
1212 | if (::mlir::failed(_result_baseType)) { |
1213 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); |
1214 | return {}; |
1215 | } |
1216 | } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { |
1217 | _seen_sizeInBits = true; |
1218 | |
1219 | // Parse variable 'sizeInBits' |
1220 | _result_sizeInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
1221 | if (::mlir::failed(_result_sizeInBits)) { |
1222 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); |
1223 | return {}; |
1224 | } |
1225 | } else if (!_seen_alignInBits && _paramKey == "alignInBits") { |
1226 | _seen_alignInBits = true; |
1227 | |
1228 | // Parse variable 'alignInBits' |
1229 | _result_alignInBits = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
1230 | if (::mlir::failed(_result_alignInBits)) { |
1231 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'alignInBits' which is to be a `uint32_t`"); |
1232 | return {}; |
1233 | } |
1234 | } else if (!_seen_offsetInBits && _paramKey == "offsetInBits") { |
1235 | _seen_offsetInBits = true; |
1236 | |
1237 | // Parse variable 'offsetInBits' |
1238 | _result_offsetInBits = ::mlir::FieldParser<uint64_t>::parse(odsParser); |
1239 | if (::mlir::failed(_result_offsetInBits)) { |
1240 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'offsetInBits' which is to be a `uint64_t`"); |
1241 | return {}; |
1242 | } |
1243 | } else { |
1244 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1245 | return {}; |
1246 | } |
1247 | return true; |
1248 | }; |
1249 | do { |
1250 | ::llvm::StringRef _paramKey; |
1251 | if (odsParser.parseKeyword(&_paramKey)) { |
1252 | odsParser.emitError(odsParser.getCurrentLocation(), |
1253 | "expected a parameter name in struct"); |
1254 | return {}; |
1255 | } |
1256 | if (!_loop_body(_paramKey)) return {}; |
1257 | } while(!odsParser.parseOptionalComma()); |
1258 | if (!_seen_tag) { |
1259 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "tag"; |
1260 | return {}; |
1261 | } |
1262 | } |
1263 | // Parse literal '>' |
1264 | if (odsParser.parseGreater()) return {}; |
1265 | 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" , 1265, __extension__ __PRETTY_FUNCTION__)); |
1266 | return DIDerivedTypeAttr::get(odsParser.getContext(), |
1267 | unsigned((*_result_tag)), |
1268 | StringAttr((_result_name.value_or(StringAttr()))), |
1269 | DITypeAttr((_result_baseType.value_or(DITypeAttr()))), |
1270 | uint64_t((_result_sizeInBits.value_or(uint64_t()))), |
1271 | uint32_t((_result_alignInBits.value_or(uint32_t()))), |
1272 | uint64_t((_result_offsetInBits.value_or(uint64_t())))); |
1273 | } |
1274 | |
1275 | void DIDerivedTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1276 | ::mlir::Builder odsBuilder(getContext()); |
1277 | odsPrinter << "<"; |
1278 | { |
1279 | bool _firstPrinted = true; |
1280 | if (!_firstPrinted) odsPrinter << ", "; |
1281 | _firstPrinted = false; |
1282 | odsPrinter << "tag = "; |
1283 | odsPrinter << llvm::dwarf::TagString(getTag()); |
1284 | if (!(getName() == StringAttr())) { |
1285 | if (!_firstPrinted) odsPrinter << ", "; |
1286 | _firstPrinted = false; |
1287 | odsPrinter << "name = "; |
1288 | if (!(getName() == StringAttr())) { |
1289 | odsPrinter.printStrippedAttrOrType(getName()); |
1290 | } |
1291 | } |
1292 | if (!(getBaseType() == DITypeAttr())) { |
1293 | if (!_firstPrinted) odsPrinter << ", "; |
1294 | _firstPrinted = false; |
1295 | odsPrinter << "baseType = "; |
1296 | if (!(getBaseType() == DITypeAttr())) { |
1297 | odsPrinter.printStrippedAttrOrType(getBaseType()); |
1298 | } |
1299 | } |
1300 | if (!(getSizeInBits() == uint64_t())) { |
1301 | if (!_firstPrinted) odsPrinter << ", "; |
1302 | _firstPrinted = false; |
1303 | odsPrinter << "sizeInBits = "; |
1304 | if (!(getSizeInBits() == uint64_t())) { |
1305 | odsPrinter.printStrippedAttrOrType(getSizeInBits()); |
1306 | } |
1307 | } |
1308 | if (!(getAlignInBits() == uint32_t())) { |
1309 | if (!_firstPrinted) odsPrinter << ", "; |
1310 | _firstPrinted = false; |
1311 | odsPrinter << "alignInBits = "; |
1312 | if (!(getAlignInBits() == uint32_t())) { |
1313 | odsPrinter.printStrippedAttrOrType(getAlignInBits()); |
1314 | } |
1315 | } |
1316 | if (!(getOffsetInBits() == uint64_t())) { |
1317 | if (!_firstPrinted) odsPrinter << ", "; |
1318 | _firstPrinted = false; |
1319 | odsPrinter << "offsetInBits = "; |
1320 | if (!(getOffsetInBits() == uint64_t())) { |
1321 | odsPrinter.printStrippedAttrOrType(getOffsetInBits()); |
1322 | } |
1323 | } |
1324 | } |
1325 | odsPrinter << ">"; |
1326 | } |
1327 | |
1328 | unsigned DIDerivedTypeAttr::getTag() const { |
1329 | return getImpl()->tag; |
1330 | } |
1331 | |
1332 | StringAttr DIDerivedTypeAttr::getName() const { |
1333 | return getImpl()->name; |
1334 | } |
1335 | |
1336 | DITypeAttr DIDerivedTypeAttr::getBaseType() const { |
1337 | return getImpl()->baseType; |
1338 | } |
1339 | |
1340 | uint64_t DIDerivedTypeAttr::getSizeInBits() const { |
1341 | return getImpl()->sizeInBits; |
1342 | } |
1343 | |
1344 | uint32_t DIDerivedTypeAttr::getAlignInBits() const { |
1345 | return getImpl()->alignInBits; |
1346 | } |
1347 | |
1348 | uint64_t DIDerivedTypeAttr::getOffsetInBits() const { |
1349 | return getImpl()->offsetInBits; |
1350 | } |
1351 | |
1352 | } // namespace LLVM |
1353 | } // namespace mlir |
1354 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIDerivedTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DIDerivedTypeAttr>::id = {}; } } |
1355 | namespace mlir { |
1356 | namespace LLVM { |
1357 | namespace detail { |
1358 | struct DIFileAttrStorage : public ::mlir::AttributeStorage { |
1359 | using KeyTy = std::tuple<StringAttr, StringAttr>; |
1360 | DIFileAttrStorage(StringAttr name, StringAttr directory) : name(name), directory(directory) {} |
1361 | |
1362 | KeyTy getAsKey() const { |
1363 | return KeyTy(name, directory); |
1364 | } |
1365 | |
1366 | bool operator==(const KeyTy &tblgenKey) const { |
1367 | return (name == std::get<0>(tblgenKey)) && (directory == std::get<1>(tblgenKey)); |
1368 | } |
1369 | |
1370 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1371 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
1372 | } |
1373 | |
1374 | static DIFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1375 | auto name = std::get<0>(tblgenKey); |
1376 | auto directory = std::get<1>(tblgenKey); |
1377 | return new (allocator.allocate<DIFileAttrStorage>()) DIFileAttrStorage(name, directory); |
1378 | } |
1379 | |
1380 | StringAttr name; |
1381 | StringAttr directory; |
1382 | }; |
1383 | } // namespace detail |
1384 | DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringAttr name, StringAttr directory) { |
1385 | return Base::get(context, name, directory); |
1386 | } |
1387 | |
1388 | DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringRef name, StringRef directory) { |
1389 | return Base::get(context, StringAttr::get(context, name), |
1390 | StringAttr::get(context, directory)); |
1391 | } |
1392 | |
1393 | ::mlir::Attribute DIFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1394 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1395 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1396 | (void) odsLoc; |
1397 | ::mlir::FailureOr<StringAttr> _result_name; |
1398 | ::mlir::FailureOr<StringAttr> _result_directory; |
1399 | // Parse literal '<' |
1400 | if (odsParser.parseLess()) return {}; |
1401 | |
1402 | // Parse variable 'name' |
1403 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
1404 | if (::mlir::failed(_result_name)) { |
1405 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'name' which is to be a `StringAttr`"); |
1406 | return {}; |
1407 | } |
1408 | // Parse literal 'in' |
1409 | if (odsParser.parseKeyword("in")) return {}; |
1410 | |
1411 | // Parse variable 'directory' |
1412 | _result_directory = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
1413 | if (::mlir::failed(_result_directory)) { |
1414 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'directory' which is to be a `StringAttr`"); |
1415 | return {}; |
1416 | } |
1417 | // Parse literal '>' |
1418 | if (odsParser.parseGreater()) return {}; |
1419 | 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" , 1419, __extension__ __PRETTY_FUNCTION__)); |
1420 | 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" , 1420, __extension__ __PRETTY_FUNCTION__)); |
1421 | return DIFileAttr::get(odsParser.getContext(), |
1422 | StringAttr((*_result_name)), |
1423 | StringAttr((*_result_directory))); |
1424 | } |
1425 | |
1426 | void DIFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1427 | ::mlir::Builder odsBuilder(getContext()); |
1428 | odsPrinter << "<"; |
1429 | odsPrinter.printStrippedAttrOrType(getName()); |
1430 | odsPrinter << ' ' << "in"; |
1431 | odsPrinter << ' '; |
1432 | odsPrinter.printStrippedAttrOrType(getDirectory()); |
1433 | odsPrinter << ">"; |
1434 | } |
1435 | |
1436 | StringAttr DIFileAttr::getName() const { |
1437 | return getImpl()->name; |
1438 | } |
1439 | |
1440 | StringAttr DIFileAttr::getDirectory() const { |
1441 | return getImpl()->directory; |
1442 | } |
1443 | |
1444 | } // namespace LLVM |
1445 | } // namespace mlir |
1446 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIFileAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DIFileAttr>::id = {}; } } |
1447 | namespace mlir { |
1448 | namespace LLVM { |
1449 | namespace detail { |
1450 | struct DILexicalBlockAttrStorage : public ::mlir::AttributeStorage { |
1451 | using KeyTy = std::tuple<DIScopeAttr, DIFileAttr, unsigned, unsigned>; |
1452 | DILexicalBlockAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) : scope(scope), file(file), line(line), column(column) {} |
1453 | |
1454 | KeyTy getAsKey() const { |
1455 | return KeyTy(scope, file, line, column); |
1456 | } |
1457 | |
1458 | bool operator==(const KeyTy &tblgenKey) const { |
1459 | return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (line == std::get<2>(tblgenKey)) && (column == std::get<3>(tblgenKey)); |
1460 | } |
1461 | |
1462 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1463 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); |
1464 | } |
1465 | |
1466 | static DILexicalBlockAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1467 | auto scope = std::get<0>(tblgenKey); |
1468 | auto file = std::get<1>(tblgenKey); |
1469 | auto line = std::get<2>(tblgenKey); |
1470 | auto column = std::get<3>(tblgenKey); |
1471 | return new (allocator.allocate<DILexicalBlockAttrStorage>()) DILexicalBlockAttrStorage(scope, file, line, column); |
1472 | } |
1473 | |
1474 | DIScopeAttr scope; |
1475 | DIFileAttr file; |
1476 | unsigned line; |
1477 | unsigned column; |
1478 | }; |
1479 | } // namespace detail |
1480 | DILexicalBlockAttr DILexicalBlockAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { |
1481 | return Base::get(context, scope, file, line, column); |
1482 | } |
1483 | |
1484 | DILexicalBlockAttr DILexicalBlockAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { |
1485 | return Base::get(file.getContext(), scope, file, line, column); |
1486 | } |
1487 | |
1488 | ::mlir::Attribute DILexicalBlockAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1489 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1490 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1491 | (void) odsLoc; |
1492 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
1493 | ::mlir::FailureOr<DIFileAttr> _result_file; |
1494 | ::mlir::FailureOr<unsigned> _result_line; |
1495 | ::mlir::FailureOr<unsigned> _result_column; |
1496 | // Parse literal '<' |
1497 | if (odsParser.parseLess()) return {}; |
1498 | // Parse parameter struct |
1499 | bool _seen_scope = false; |
1500 | bool _seen_file = false; |
1501 | bool _seen_line = false; |
1502 | bool _seen_column = false; |
1503 | { |
1504 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1505 | // Parse literal '=' |
1506 | if (odsParser.parseEqual()) return {}; |
1507 | if (!_seen_scope && _paramKey == "scope") { |
1508 | _seen_scope = true; |
1509 | |
1510 | // Parse variable 'scope' |
1511 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
1512 | if (::mlir::failed(_result_scope)) { |
1513 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'scope' which is to be a `DIScopeAttr`"); |
1514 | return {}; |
1515 | } |
1516 | } else if (!_seen_file && _paramKey == "file") { |
1517 | _seen_file = true; |
1518 | |
1519 | // Parse variable 'file' |
1520 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
1521 | if (::mlir::failed(_result_file)) { |
1522 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'file' which is to be a `DIFileAttr`"); |
1523 | return {}; |
1524 | } |
1525 | } else if (!_seen_line && _paramKey == "line") { |
1526 | _seen_line = true; |
1527 | |
1528 | // Parse variable 'line' |
1529 | _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1530 | if (::mlir::failed(_result_line)) { |
1531 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'line' which is to be a `unsigned`"); |
1532 | return {}; |
1533 | } |
1534 | } else if (!_seen_column && _paramKey == "column") { |
1535 | _seen_column = true; |
1536 | |
1537 | // Parse variable 'column' |
1538 | _result_column = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1539 | if (::mlir::failed(_result_column)) { |
1540 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'column' which is to be a `unsigned`"); |
1541 | return {}; |
1542 | } |
1543 | } else { |
1544 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1545 | return {}; |
1546 | } |
1547 | return true; |
1548 | }; |
1549 | do { |
1550 | ::llvm::StringRef _paramKey; |
1551 | if (odsParser.parseKeyword(&_paramKey)) { |
1552 | odsParser.emitError(odsParser.getCurrentLocation(), |
1553 | "expected a parameter name in struct"); |
1554 | return {}; |
1555 | } |
1556 | if (!_loop_body(_paramKey)) return {}; |
1557 | } while(!odsParser.parseOptionalComma()); |
1558 | if (!_seen_scope) { |
1559 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; |
1560 | return {}; |
1561 | } |
1562 | } |
1563 | // Parse literal '>' |
1564 | if (odsParser.parseGreater()) return {}; |
1565 | 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" , 1565, __extension__ __PRETTY_FUNCTION__)); |
1566 | return DILexicalBlockAttr::get(odsParser.getContext(), |
1567 | DIScopeAttr((*_result_scope)), |
1568 | DIFileAttr((_result_file.value_or(DIFileAttr()))), |
1569 | unsigned((_result_line.value_or(unsigned()))), |
1570 | unsigned((_result_column.value_or(unsigned())))); |
1571 | } |
1572 | |
1573 | void DILexicalBlockAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1574 | ::mlir::Builder odsBuilder(getContext()); |
1575 | odsPrinter << "<"; |
1576 | { |
1577 | bool _firstPrinted = true; |
1578 | if (!_firstPrinted) odsPrinter << ", "; |
1579 | _firstPrinted = false; |
1580 | odsPrinter << "scope = "; |
1581 | odsPrinter.printStrippedAttrOrType(getScope()); |
1582 | if (!(getFile() == DIFileAttr())) { |
1583 | if (!_firstPrinted) odsPrinter << ", "; |
1584 | _firstPrinted = false; |
1585 | odsPrinter << "file = "; |
1586 | if (!(getFile() == DIFileAttr())) { |
1587 | odsPrinter.printStrippedAttrOrType(getFile()); |
1588 | } |
1589 | } |
1590 | if (!(getLine() == unsigned())) { |
1591 | if (!_firstPrinted) odsPrinter << ", "; |
1592 | _firstPrinted = false; |
1593 | odsPrinter << "line = "; |
1594 | if (!(getLine() == unsigned())) { |
1595 | odsPrinter.printStrippedAttrOrType(getLine()); |
1596 | } |
1597 | } |
1598 | if (!(getColumn() == unsigned())) { |
1599 | if (!_firstPrinted) odsPrinter << ", "; |
1600 | _firstPrinted = false; |
1601 | odsPrinter << "column = "; |
1602 | if (!(getColumn() == unsigned())) { |
1603 | odsPrinter.printStrippedAttrOrType(getColumn()); |
1604 | } |
1605 | } |
1606 | } |
1607 | odsPrinter << ">"; |
1608 | } |
1609 | |
1610 | DIScopeAttr DILexicalBlockAttr::getScope() const { |
1611 | return getImpl()->scope; |
1612 | } |
1613 | |
1614 | DIFileAttr DILexicalBlockAttr::getFile() const { |
1615 | return getImpl()->file; |
1616 | } |
1617 | |
1618 | unsigned DILexicalBlockAttr::getLine() const { |
1619 | return getImpl()->line; |
1620 | } |
1621 | |
1622 | unsigned DILexicalBlockAttr::getColumn() const { |
1623 | return getImpl()->column; |
1624 | } |
1625 | |
1626 | } // namespace LLVM |
1627 | } // namespace mlir |
1628 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DILexicalBlockAttr>::id = {}; } } |
1629 | namespace mlir { |
1630 | namespace LLVM { |
1631 | namespace detail { |
1632 | struct DILexicalBlockFileAttrStorage : public ::mlir::AttributeStorage { |
1633 | using KeyTy = std::tuple<DIScopeAttr, DIFileAttr, unsigned>; |
1634 | DILexicalBlockFileAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) : scope(scope), file(file), discriminator(discriminator) {} |
1635 | |
1636 | KeyTy getAsKey() const { |
1637 | return KeyTy(scope, file, discriminator); |
1638 | } |
1639 | |
1640 | bool operator==(const KeyTy &tblgenKey) const { |
1641 | return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (discriminator == std::get<2>(tblgenKey)); |
1642 | } |
1643 | |
1644 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1645 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); |
1646 | } |
1647 | |
1648 | static DILexicalBlockFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1649 | auto scope = std::get<0>(tblgenKey); |
1650 | auto file = std::get<1>(tblgenKey); |
1651 | auto discriminator = std::get<2>(tblgenKey); |
1652 | return new (allocator.allocate<DILexicalBlockFileAttrStorage>()) DILexicalBlockFileAttrStorage(scope, file, discriminator); |
1653 | } |
1654 | |
1655 | DIScopeAttr scope; |
1656 | DIFileAttr file; |
1657 | unsigned discriminator; |
1658 | }; |
1659 | } // namespace detail |
1660 | DILexicalBlockFileAttr DILexicalBlockFileAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { |
1661 | return Base::get(context, scope, file, discriminator); |
1662 | } |
1663 | |
1664 | DILexicalBlockFileAttr DILexicalBlockFileAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { |
1665 | return Base::get(file.getContext(), scope, file, discriminator); |
1666 | } |
1667 | |
1668 | ::mlir::Attribute DILexicalBlockFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1669 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1670 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1671 | (void) odsLoc; |
1672 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
1673 | ::mlir::FailureOr<DIFileAttr> _result_file; |
1674 | ::mlir::FailureOr<unsigned> _result_discriminator; |
1675 | // Parse literal '<' |
1676 | if (odsParser.parseLess()) return {}; |
1677 | // Parse parameter struct |
1678 | bool _seen_scope = false; |
1679 | bool _seen_file = false; |
1680 | bool _seen_discriminator = false; |
1681 | { |
1682 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1683 | // Parse literal '=' |
1684 | if (odsParser.parseEqual()) return {}; |
1685 | if (!_seen_scope && _paramKey == "scope") { |
1686 | _seen_scope = true; |
1687 | |
1688 | // Parse variable 'scope' |
1689 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
1690 | if (::mlir::failed(_result_scope)) { |
1691 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'scope' which is to be a `DIScopeAttr`"); |
1692 | return {}; |
1693 | } |
1694 | } else if (!_seen_file && _paramKey == "file") { |
1695 | _seen_file = true; |
1696 | |
1697 | // Parse variable 'file' |
1698 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
1699 | if (::mlir::failed(_result_file)) { |
1700 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'file' which is to be a `DIFileAttr`"); |
1701 | return {}; |
1702 | } |
1703 | } else if (!_seen_discriminator && _paramKey == "discriminator") { |
1704 | _seen_discriminator = true; |
1705 | |
1706 | // Parse variable 'discriminator' |
1707 | _result_discriminator = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1708 | if (::mlir::failed(_result_discriminator)) { |
1709 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'discriminator' which is to be a `unsigned`"); |
1710 | return {}; |
1711 | } |
1712 | } else { |
1713 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1714 | return {}; |
1715 | } |
1716 | return true; |
1717 | }; |
1718 | do { |
1719 | ::llvm::StringRef _paramKey; |
1720 | if (odsParser.parseKeyword(&_paramKey)) { |
1721 | odsParser.emitError(odsParser.getCurrentLocation(), |
1722 | "expected a parameter name in struct"); |
1723 | return {}; |
1724 | } |
1725 | if (!_loop_body(_paramKey)) return {}; |
1726 | } while(!odsParser.parseOptionalComma()); |
1727 | if (!_seen_scope) { |
1728 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; |
1729 | return {}; |
1730 | } |
1731 | if (!_seen_discriminator) { |
1732 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "discriminator"; |
1733 | return {}; |
1734 | } |
1735 | } |
1736 | // Parse literal '>' |
1737 | if (odsParser.parseGreater()) return {}; |
1738 | 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" , 1738, __extension__ __PRETTY_FUNCTION__)); |
1739 | assert(::mlir::succeeded(_result_discriminator))(static_cast <bool> (::mlir::succeeded(_result_discriminator )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_discriminator)" , "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc" , 1739, __extension__ __PRETTY_FUNCTION__)); |
1740 | return DILexicalBlockFileAttr::get(odsParser.getContext(), |
1741 | DIScopeAttr((*_result_scope)), |
1742 | DIFileAttr((_result_file.value_or(DIFileAttr()))), |
1743 | unsigned((*_result_discriminator))); |
1744 | } |
1745 | |
1746 | void DILexicalBlockFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1747 | ::mlir::Builder odsBuilder(getContext()); |
1748 | odsPrinter << "<"; |
1749 | { |
1750 | bool _firstPrinted = true; |
1751 | if (!_firstPrinted) odsPrinter << ", "; |
1752 | _firstPrinted = false; |
1753 | odsPrinter << "scope = "; |
1754 | odsPrinter.printStrippedAttrOrType(getScope()); |
1755 | if (!(getFile() == DIFileAttr())) { |
1756 | if (!_firstPrinted) odsPrinter << ", "; |
1757 | _firstPrinted = false; |
1758 | odsPrinter << "file = "; |
1759 | if (!(getFile() == DIFileAttr())) { |
1760 | odsPrinter.printStrippedAttrOrType(getFile()); |
1761 | } |
1762 | } |
1763 | if (!_firstPrinted) odsPrinter << ", "; |
1764 | _firstPrinted = false; |
1765 | odsPrinter << "discriminator = "; |
1766 | odsPrinter.printStrippedAttrOrType(getDiscriminator()); |
1767 | } |
1768 | odsPrinter << ">"; |
1769 | } |
1770 | |
1771 | DIScopeAttr DILexicalBlockFileAttr::getScope() const { |
1772 | return getImpl()->scope; |
1773 | } |
1774 | |
1775 | DIFileAttr DILexicalBlockFileAttr::getFile() const { |
1776 | return getImpl()->file; |
1777 | } |
1778 | |
1779 | unsigned DILexicalBlockFileAttr::getDiscriminator() const { |
1780 | return getImpl()->discriminator; |
1781 | } |
1782 | |
1783 | } // namespace LLVM |
1784 | } // namespace mlir |
1785 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockFileAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DILexicalBlockFileAttr>::id = {}; } } |
1786 | namespace mlir { |
1787 | namespace LLVM { |
1788 | namespace detail { |
1789 | struct DILocalVariableAttrStorage : public ::mlir::AttributeStorage { |
1790 | using KeyTy = std::tuple<DIScopeAttr, StringAttr, DIFileAttr, unsigned, unsigned, unsigned, DITypeAttr>; |
1791 | 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) {} |
1792 | |
1793 | KeyTy getAsKey() const { |
1794 | return KeyTy(scope, name, file, line, arg, alignInBits, type); |
1795 | } |
1796 | |
1797 | bool operator==(const KeyTy &tblgenKey) const { |
1798 | 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)); |
1799 | } |
1800 | |
1801 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
1802 | 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)); |
1803 | } |
1804 | |
1805 | static DILocalVariableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
1806 | auto scope = std::get<0>(tblgenKey); |
1807 | auto name = std::get<1>(tblgenKey); |
1808 | auto file = std::get<2>(tblgenKey); |
1809 | auto line = std::get<3>(tblgenKey); |
1810 | auto arg = std::get<4>(tblgenKey); |
1811 | auto alignInBits = std::get<5>(tblgenKey); |
1812 | auto type = std::get<6>(tblgenKey); |
1813 | return new (allocator.allocate<DILocalVariableAttrStorage>()) DILocalVariableAttrStorage(scope, name, file, line, arg, alignInBits, type); |
1814 | } |
1815 | |
1816 | DIScopeAttr scope; |
1817 | StringAttr name; |
1818 | DIFileAttr file; |
1819 | unsigned line; |
1820 | unsigned arg; |
1821 | unsigned alignInBits; |
1822 | DITypeAttr type; |
1823 | }; |
1824 | } // namespace detail |
1825 | DILocalVariableAttr DILocalVariableAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) { |
1826 | return Base::get(context, scope, name, file, line, arg, alignInBits, type); |
1827 | } |
1828 | |
1829 | DILocalVariableAttr DILocalVariableAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type) { |
1830 | MLIRContext *ctx = file.getContext(); |
1831 | return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line, |
1832 | arg, alignInBits, type); |
1833 | } |
1834 | |
1835 | ::mlir::Attribute DILocalVariableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
1836 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
1837 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
1838 | (void) odsLoc; |
1839 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
1840 | ::mlir::FailureOr<StringAttr> _result_name; |
1841 | ::mlir::FailureOr<DIFileAttr> _result_file; |
1842 | ::mlir::FailureOr<unsigned> _result_line; |
1843 | ::mlir::FailureOr<unsigned> _result_arg; |
1844 | ::mlir::FailureOr<unsigned> _result_alignInBits; |
1845 | ::mlir::FailureOr<DITypeAttr> _result_type; |
1846 | // Parse literal '<' |
1847 | if (odsParser.parseLess()) return {}; |
1848 | // Parse parameter struct |
1849 | bool _seen_scope = false; |
1850 | bool _seen_name = false; |
1851 | bool _seen_file = false; |
1852 | bool _seen_line = false; |
1853 | bool _seen_arg = false; |
1854 | bool _seen_alignInBits = false; |
1855 | bool _seen_type = false; |
1856 | { |
1857 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
1858 | // Parse literal '=' |
1859 | if (odsParser.parseEqual()) return {}; |
1860 | if (!_seen_scope && _paramKey == "scope") { |
1861 | _seen_scope = true; |
1862 | |
1863 | // Parse variable 'scope' |
1864 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
1865 | if (::mlir::failed(_result_scope)) { |
1866 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'scope' which is to be a `DIScopeAttr`"); |
1867 | return {}; |
1868 | } |
1869 | } else if (!_seen_name && _paramKey == "name") { |
1870 | _seen_name = true; |
1871 | |
1872 | // Parse variable 'name' |
1873 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
1874 | if (::mlir::failed(_result_name)) { |
1875 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'name' which is to be a `StringAttr`"); |
1876 | return {}; |
1877 | } |
1878 | } else if (!_seen_file && _paramKey == "file") { |
1879 | _seen_file = true; |
1880 | |
1881 | // Parse variable 'file' |
1882 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
1883 | if (::mlir::failed(_result_file)) { |
1884 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'file' which is to be a `DIFileAttr`"); |
1885 | return {}; |
1886 | } |
1887 | } else if (!_seen_line && _paramKey == "line") { |
1888 | _seen_line = true; |
1889 | |
1890 | // Parse variable 'line' |
1891 | _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1892 | if (::mlir::failed(_result_line)) { |
1893 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'line' which is to be a `unsigned`"); |
1894 | return {}; |
1895 | } |
1896 | } else if (!_seen_arg && _paramKey == "arg") { |
1897 | _seen_arg = true; |
1898 | |
1899 | // Parse variable 'arg' |
1900 | _result_arg = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1901 | if (::mlir::failed(_result_arg)) { |
1902 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'arg' which is to be a `unsigned`"); |
1903 | return {}; |
1904 | } |
1905 | } else if (!_seen_alignInBits && _paramKey == "alignInBits") { |
1906 | _seen_alignInBits = true; |
1907 | |
1908 | // Parse variable 'alignInBits' |
1909 | _result_alignInBits = ::mlir::FieldParser<unsigned>::parse(odsParser); |
1910 | if (::mlir::failed(_result_alignInBits)) { |
1911 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'alignInBits' which is to be a `unsigned`"); |
1912 | return {}; |
1913 | } |
1914 | } else if (!_seen_type && _paramKey == "type") { |
1915 | _seen_type = true; |
1916 | |
1917 | // Parse variable 'type' |
1918 | _result_type = ::mlir::FieldParser<DITypeAttr>::parse(odsParser); |
1919 | if (::mlir::failed(_result_type)) { |
1920 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'type' which is to be a `DITypeAttr`"); |
1921 | return {}; |
1922 | } |
1923 | } else { |
1924 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
1925 | return {}; |
1926 | } |
1927 | return true; |
1928 | }; |
1929 | do { |
1930 | ::llvm::StringRef _paramKey; |
1931 | if (odsParser.parseKeyword(&_paramKey)) { |
1932 | odsParser.emitError(odsParser.getCurrentLocation(), |
1933 | "expected a parameter name in struct"); |
1934 | return {}; |
1935 | } |
1936 | if (!_loop_body(_paramKey)) return {}; |
1937 | } while(!odsParser.parseOptionalComma()); |
1938 | if (!_seen_scope) { |
1939 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; |
1940 | return {}; |
1941 | } |
1942 | if (!_seen_name) { |
1943 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; |
1944 | return {}; |
1945 | } |
1946 | } |
1947 | // Parse literal '>' |
1948 | if (odsParser.parseGreater()) return {}; |
1949 | 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" , 1949, __extension__ __PRETTY_FUNCTION__)); |
1950 | 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" , 1950, __extension__ __PRETTY_FUNCTION__)); |
1951 | return DILocalVariableAttr::get(odsParser.getContext(), |
1952 | DIScopeAttr((*_result_scope)), |
1953 | StringAttr((*_result_name)), |
1954 | DIFileAttr((_result_file.value_or(DIFileAttr()))), |
1955 | unsigned((_result_line.value_or(unsigned()))), |
1956 | unsigned((_result_arg.value_or(unsigned()))), |
1957 | unsigned((_result_alignInBits.value_or(unsigned()))), |
1958 | DITypeAttr((_result_type.value_or(DITypeAttr())))); |
1959 | } |
1960 | |
1961 | void DILocalVariableAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
1962 | ::mlir::Builder odsBuilder(getContext()); |
1963 | odsPrinter << "<"; |
1964 | { |
1965 | bool _firstPrinted = true; |
1966 | if (!_firstPrinted) odsPrinter << ", "; |
1967 | _firstPrinted = false; |
1968 | odsPrinter << "scope = "; |
1969 | odsPrinter.printStrippedAttrOrType(getScope()); |
1970 | if (!_firstPrinted) odsPrinter << ", "; |
1971 | _firstPrinted = false; |
1972 | odsPrinter << "name = "; |
1973 | odsPrinter.printStrippedAttrOrType(getName()); |
1974 | if (!(getFile() == DIFileAttr())) { |
1975 | if (!_firstPrinted) odsPrinter << ", "; |
1976 | _firstPrinted = false; |
1977 | odsPrinter << "file = "; |
1978 | if (!(getFile() == DIFileAttr())) { |
1979 | odsPrinter.printStrippedAttrOrType(getFile()); |
1980 | } |
1981 | } |
1982 | if (!(getLine() == unsigned())) { |
1983 | if (!_firstPrinted) odsPrinter << ", "; |
1984 | _firstPrinted = false; |
1985 | odsPrinter << "line = "; |
1986 | if (!(getLine() == unsigned())) { |
1987 | odsPrinter.printStrippedAttrOrType(getLine()); |
1988 | } |
1989 | } |
1990 | if (!(getArg() == unsigned())) { |
1991 | if (!_firstPrinted) odsPrinter << ", "; |
1992 | _firstPrinted = false; |
1993 | odsPrinter << "arg = "; |
1994 | if (!(getArg() == unsigned())) { |
1995 | odsPrinter.printStrippedAttrOrType(getArg()); |
1996 | } |
1997 | } |
1998 | if (!(getAlignInBits() == unsigned())) { |
1999 | if (!_firstPrinted) odsPrinter << ", "; |
2000 | _firstPrinted = false; |
2001 | odsPrinter << "alignInBits = "; |
2002 | if (!(getAlignInBits() == unsigned())) { |
2003 | odsPrinter.printStrippedAttrOrType(getAlignInBits()); |
2004 | } |
2005 | } |
2006 | if (!(getType() == DITypeAttr())) { |
2007 | if (!_firstPrinted) odsPrinter << ", "; |
2008 | _firstPrinted = false; |
2009 | odsPrinter << "type = "; |
2010 | if (!(getType() == DITypeAttr())) { |
2011 | odsPrinter.printStrippedAttrOrType(getType()); |
2012 | } |
2013 | } |
2014 | } |
2015 | odsPrinter << ">"; |
2016 | } |
2017 | |
2018 | DIScopeAttr DILocalVariableAttr::getScope() const { |
2019 | return getImpl()->scope; |
2020 | } |
2021 | |
2022 | StringAttr DILocalVariableAttr::getName() const { |
2023 | return getImpl()->name; |
2024 | } |
2025 | |
2026 | DIFileAttr DILocalVariableAttr::getFile() const { |
2027 | return getImpl()->file; |
2028 | } |
2029 | |
2030 | unsigned DILocalVariableAttr::getLine() const { |
2031 | return getImpl()->line; |
2032 | } |
2033 | |
2034 | unsigned DILocalVariableAttr::getArg() const { |
2035 | return getImpl()->arg; |
2036 | } |
2037 | |
2038 | unsigned DILocalVariableAttr::getAlignInBits() const { |
2039 | return getImpl()->alignInBits; |
2040 | } |
2041 | |
2042 | DITypeAttr DILocalVariableAttr::getType() const { |
2043 | return getImpl()->type; |
2044 | } |
2045 | |
2046 | } // namespace LLVM |
2047 | } // namespace mlir |
2048 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILocalVariableAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DILocalVariableAttr>::id = {}; } } |
2049 | namespace mlir { |
2050 | namespace LLVM { |
2051 | namespace detail { |
2052 | struct DINamespaceAttrStorage : public ::mlir::AttributeStorage { |
2053 | using KeyTy = std::tuple<StringAttr, DIScopeAttr, bool>; |
2054 | DINamespaceAttrStorage(StringAttr name, DIScopeAttr scope, bool exportSymbols) : name(name), scope(scope), exportSymbols(exportSymbols) {} |
2055 | |
2056 | KeyTy getAsKey() const { |
2057 | return KeyTy(name, scope, exportSymbols); |
2058 | } |
2059 | |
2060 | bool operator==(const KeyTy &tblgenKey) const { |
2061 | return (name == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (exportSymbols == std::get<2>(tblgenKey)); |
2062 | } |
2063 | |
2064 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2065 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); |
2066 | } |
2067 | |
2068 | static DINamespaceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2069 | auto name = std::get<0>(tblgenKey); |
2070 | auto scope = std::get<1>(tblgenKey); |
2071 | auto exportSymbols = std::get<2>(tblgenKey); |
2072 | return new (allocator.allocate<DINamespaceAttrStorage>()) DINamespaceAttrStorage(name, scope, exportSymbols); |
2073 | } |
2074 | |
2075 | StringAttr name; |
2076 | DIScopeAttr scope; |
2077 | bool exportSymbols; |
2078 | }; |
2079 | } // namespace detail |
2080 | DINamespaceAttr DINamespaceAttr::get(::mlir::MLIRContext *context, StringAttr name, DIScopeAttr scope, bool exportSymbols) { |
2081 | return Base::get(context, name, scope, exportSymbols); |
2082 | } |
2083 | |
2084 | ::mlir::Attribute DINamespaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2085 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2086 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2087 | (void) odsLoc; |
2088 | ::mlir::FailureOr<StringAttr> _result_name; |
2089 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
2090 | ::mlir::FailureOr<bool> _result_exportSymbols; |
2091 | // Parse literal '<' |
2092 | if (odsParser.parseLess()) return {}; |
2093 | // Parse parameter struct |
2094 | bool _seen_name = false; |
2095 | bool _seen_scope = false; |
2096 | bool _seen_exportSymbols = false; |
2097 | { |
2098 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
2099 | // Parse literal '=' |
2100 | if (odsParser.parseEqual()) return {}; |
2101 | if (!_seen_name && _paramKey == "name") { |
2102 | _seen_name = true; |
2103 | |
2104 | // Parse variable 'name' |
2105 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
2106 | if (::mlir::failed(_result_name)) { |
2107 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'name' which is to be a `StringAttr`"); |
2108 | return {}; |
2109 | } |
2110 | } else if (!_seen_scope && _paramKey == "scope") { |
2111 | _seen_scope = true; |
2112 | |
2113 | // Parse variable 'scope' |
2114 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
2115 | if (::mlir::failed(_result_scope)) { |
2116 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'scope' which is to be a `DIScopeAttr`"); |
2117 | return {}; |
2118 | } |
2119 | } else if (!_seen_exportSymbols && _paramKey == "exportSymbols") { |
2120 | _seen_exportSymbols = true; |
2121 | |
2122 | // Parse variable 'exportSymbols' |
2123 | _result_exportSymbols = ::mlir::FieldParser<bool>::parse(odsParser); |
2124 | if (::mlir::failed(_result_exportSymbols)) { |
2125 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'exportSymbols' which is to be a `bool`"); |
2126 | return {}; |
2127 | } |
2128 | } else { |
2129 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
2130 | return {}; |
2131 | } |
2132 | return true; |
2133 | }; |
2134 | do { |
2135 | ::llvm::StringRef _paramKey; |
2136 | if (odsParser.parseKeyword(&_paramKey)) { |
2137 | odsParser.emitError(odsParser.getCurrentLocation(), |
2138 | "expected a parameter name in struct"); |
2139 | return {}; |
2140 | } |
2141 | if (!_loop_body(_paramKey)) return {}; |
2142 | } while(!odsParser.parseOptionalComma()); |
2143 | if (!_seen_name) { |
2144 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; |
2145 | return {}; |
2146 | } |
2147 | if (!_seen_exportSymbols) { |
2148 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "exportSymbols"; |
2149 | return {}; |
2150 | } |
2151 | } |
2152 | // Parse literal '>' |
2153 | if (odsParser.parseGreater()) return {}; |
2154 | 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" , 2154, __extension__ __PRETTY_FUNCTION__)); |
2155 | assert(::mlir::succeeded(_result_exportSymbols))(static_cast <bool> (::mlir::succeeded(_result_exportSymbols )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_exportSymbols)" , "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc" , 2155, __extension__ __PRETTY_FUNCTION__)); |
2156 | return DINamespaceAttr::get(odsParser.getContext(), |
2157 | StringAttr((*_result_name)), |
2158 | DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), |
2159 | bool((*_result_exportSymbols))); |
2160 | } |
2161 | |
2162 | void DINamespaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2163 | ::mlir::Builder odsBuilder(getContext()); |
2164 | odsPrinter << "<"; |
2165 | { |
2166 | bool _firstPrinted = true; |
2167 | if (!_firstPrinted) odsPrinter << ", "; |
2168 | _firstPrinted = false; |
2169 | odsPrinter << "name = "; |
2170 | odsPrinter.printStrippedAttrOrType(getName()); |
2171 | if (!(getScope() == DIScopeAttr())) { |
2172 | if (!_firstPrinted) odsPrinter << ", "; |
2173 | _firstPrinted = false; |
2174 | odsPrinter << "scope = "; |
2175 | if (!(getScope() == DIScopeAttr())) { |
2176 | odsPrinter.printStrippedAttrOrType(getScope()); |
2177 | } |
2178 | } |
2179 | if (!_firstPrinted) odsPrinter << ", "; |
2180 | _firstPrinted = false; |
2181 | odsPrinter << "exportSymbols = "; |
2182 | odsPrinter.printStrippedAttrOrType(getExportSymbols()); |
2183 | } |
2184 | odsPrinter << ">"; |
2185 | } |
2186 | |
2187 | StringAttr DINamespaceAttr::getName() const { |
2188 | return getImpl()->name; |
2189 | } |
2190 | |
2191 | DIScopeAttr DINamespaceAttr::getScope() const { |
2192 | return getImpl()->scope; |
2193 | } |
2194 | |
2195 | bool DINamespaceAttr::getExportSymbols() const { |
2196 | return getImpl()->exportSymbols; |
2197 | } |
2198 | |
2199 | } // namespace LLVM |
2200 | } // namespace mlir |
2201 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINamespaceAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DINamespaceAttr>::id = {}; } } |
2202 | namespace mlir { |
2203 | namespace LLVM { |
2204 | } // namespace LLVM |
2205 | } // namespace mlir |
2206 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINullTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DINullTypeAttr>::id = {}; } } |
2207 | namespace mlir { |
2208 | namespace LLVM { |
2209 | namespace detail { |
2210 | struct DISubprogramAttrStorage : public ::mlir::AttributeStorage { |
2211 | using KeyTy = std::tuple<DICompileUnitAttr, DIScopeAttr, StringAttr, StringAttr, DIFileAttr, unsigned, unsigned, DISubprogramFlags, DISubroutineTypeAttr>; |
2212 | 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) {} |
2213 | |
2214 | KeyTy getAsKey() const { |
2215 | return KeyTy(compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type); |
2216 | } |
2217 | |
2218 | bool operator==(const KeyTy &tblgenKey) const { |
2219 | 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)); |
2220 | } |
2221 | |
2222 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2223 | 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)); |
2224 | } |
2225 | |
2226 | static DISubprogramAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2227 | auto compileUnit = std::get<0>(tblgenKey); |
2228 | auto scope = std::get<1>(tblgenKey); |
2229 | auto name = std::get<2>(tblgenKey); |
2230 | auto linkageName = std::get<3>(tblgenKey); |
2231 | auto file = std::get<4>(tblgenKey); |
2232 | auto line = std::get<5>(tblgenKey); |
2233 | auto scopeLine = std::get<6>(tblgenKey); |
2234 | auto subprogramFlags = std::get<7>(tblgenKey); |
2235 | auto type = std::get<8>(tblgenKey); |
2236 | return new (allocator.allocate<DISubprogramAttrStorage>()) DISubprogramAttrStorage(compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type); |
2237 | } |
2238 | |
2239 | DICompileUnitAttr compileUnit; |
2240 | DIScopeAttr scope; |
2241 | StringAttr name; |
2242 | StringAttr linkageName; |
2243 | DIFileAttr file; |
2244 | unsigned line; |
2245 | unsigned scopeLine; |
2246 | DISubprogramFlags subprogramFlags; |
2247 | DISubroutineTypeAttr type; |
2248 | }; |
2249 | } // namespace detail |
2250 | DISubprogramAttr DISubprogramAttr::get(::mlir::MLIRContext *context, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) { |
2251 | return Base::get(context, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type); |
2252 | } |
2253 | |
2254 | DISubprogramAttr DISubprogramAttr::get(DICompileUnitAttr compileUnit, DIScopeAttr scope, StringRef name, StringRef linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type) { |
2255 | MLIRContext *ctx = file.getContext(); |
2256 | return Base::get(ctx, compileUnit, scope, StringAttr::get(ctx, name), |
2257 | StringAttr::get(ctx, linkageName), file, line, |
2258 | scopeLine, subprogramFlags, type); |
2259 | } |
2260 | |
2261 | ::mlir::Attribute DISubprogramAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2262 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2263 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2264 | (void) odsLoc; |
2265 | ::mlir::FailureOr<DICompileUnitAttr> _result_compileUnit; |
2266 | ::mlir::FailureOr<DIScopeAttr> _result_scope; |
2267 | ::mlir::FailureOr<StringAttr> _result_name; |
2268 | ::mlir::FailureOr<StringAttr> _result_linkageName; |
2269 | ::mlir::FailureOr<DIFileAttr> _result_file; |
2270 | ::mlir::FailureOr<unsigned> _result_line; |
2271 | ::mlir::FailureOr<unsigned> _result_scopeLine; |
2272 | ::mlir::FailureOr<DISubprogramFlags> _result_subprogramFlags; |
2273 | ::mlir::FailureOr<DISubroutineTypeAttr> _result_type; |
2274 | // Parse literal '<' |
2275 | if (odsParser.parseLess()) return {}; |
2276 | // Parse parameter struct |
2277 | bool _seen_compileUnit = false; |
2278 | bool _seen_scope = false; |
2279 | bool _seen_name = false; |
2280 | bool _seen_linkageName = false; |
2281 | bool _seen_file = false; |
2282 | bool _seen_line = false; |
2283 | bool _seen_scopeLine = false; |
2284 | bool _seen_subprogramFlags = false; |
2285 | bool _seen_type = false; |
2286 | { |
2287 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
2288 | // Parse literal '=' |
2289 | if (odsParser.parseEqual()) return {}; |
2290 | if (!_seen_compileUnit && _paramKey == "compileUnit") { |
2291 | _seen_compileUnit = true; |
2292 | |
2293 | // Parse variable 'compileUnit' |
2294 | _result_compileUnit = ::mlir::FieldParser<DICompileUnitAttr>::parse(odsParser); |
2295 | if (::mlir::failed(_result_compileUnit)) { |
2296 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'compileUnit' which is to be a `DICompileUnitAttr`"); |
2297 | return {}; |
2298 | } |
2299 | } else if (!_seen_scope && _paramKey == "scope") { |
2300 | _seen_scope = true; |
2301 | |
2302 | // Parse variable 'scope' |
2303 | _result_scope = ::mlir::FieldParser<DIScopeAttr>::parse(odsParser); |
2304 | if (::mlir::failed(_result_scope)) { |
2305 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scope' which is to be a `DIScopeAttr`"); |
2306 | return {}; |
2307 | } |
2308 | } else if (!_seen_name && _paramKey == "name") { |
2309 | _seen_name = true; |
2310 | |
2311 | // Parse variable 'name' |
2312 | _result_name = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
2313 | if (::mlir::failed(_result_name)) { |
2314 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'name' which is to be a `StringAttr`"); |
2315 | return {}; |
2316 | } |
2317 | } else if (!_seen_linkageName && _paramKey == "linkageName") { |
2318 | _seen_linkageName = true; |
2319 | |
2320 | // Parse variable 'linkageName' |
2321 | _result_linkageName = ::mlir::FieldParser<StringAttr>::parse(odsParser); |
2322 | if (::mlir::failed(_result_linkageName)) { |
2323 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'linkageName' which is to be a `StringAttr`"); |
2324 | return {}; |
2325 | } |
2326 | } else if (!_seen_file && _paramKey == "file") { |
2327 | _seen_file = true; |
2328 | |
2329 | // Parse variable 'file' |
2330 | _result_file = ::mlir::FieldParser<DIFileAttr>::parse(odsParser); |
2331 | if (::mlir::failed(_result_file)) { |
2332 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'file' which is to be a `DIFileAttr`"); |
2333 | return {}; |
2334 | } |
2335 | } else if (!_seen_line && _paramKey == "line") { |
2336 | _seen_line = true; |
2337 | |
2338 | // Parse variable 'line' |
2339 | _result_line = ::mlir::FieldParser<unsigned>::parse(odsParser); |
2340 | if (::mlir::failed(_result_line)) { |
2341 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'line' which is to be a `unsigned`"); |
2342 | return {}; |
2343 | } |
2344 | } else if (!_seen_scopeLine && _paramKey == "scopeLine") { |
2345 | _seen_scopeLine = true; |
2346 | |
2347 | // Parse variable 'scopeLine' |
2348 | _result_scopeLine = ::mlir::FieldParser<unsigned>::parse(odsParser); |
2349 | if (::mlir::failed(_result_scopeLine)) { |
2350 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scopeLine' which is to be a `unsigned`"); |
2351 | return {}; |
2352 | } |
2353 | } else if (!_seen_subprogramFlags && _paramKey == "subprogramFlags") { |
2354 | _seen_subprogramFlags = true; |
2355 | |
2356 | // Parse variable 'subprogramFlags' |
2357 | _result_subprogramFlags = ::mlir::FieldParser<DISubprogramFlags>::parse(odsParser); |
2358 | if (::mlir::failed(_result_subprogramFlags)) { |
2359 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'subprogramFlags' which is to be a `DISubprogramFlags`"); |
2360 | return {}; |
2361 | } |
2362 | } else if (!_seen_type && _paramKey == "type") { |
2363 | _seen_type = true; |
2364 | |
2365 | // Parse variable 'type' |
2366 | _result_type = ::mlir::FieldParser<DISubroutineTypeAttr>::parse(odsParser); |
2367 | if (::mlir::failed(_result_type)) { |
2368 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'type' which is to be a `DISubroutineTypeAttr`"); |
2369 | return {}; |
2370 | } |
2371 | } else { |
2372 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
2373 | return {}; |
2374 | } |
2375 | return true; |
2376 | }; |
2377 | do { |
2378 | ::llvm::StringRef _paramKey; |
2379 | if (odsParser.parseKeyword(&_paramKey)) { |
2380 | odsParser.emitError(odsParser.getCurrentLocation(), |
2381 | "expected a parameter name in struct"); |
2382 | return {}; |
2383 | } |
2384 | if (!_loop_body(_paramKey)) return {}; |
2385 | } while(!odsParser.parseOptionalComma()); |
2386 | if (!_seen_scope) { |
2387 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; |
2388 | return {}; |
2389 | } |
2390 | if (!_seen_name) { |
2391 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; |
2392 | return {}; |
2393 | } |
2394 | if (!_seen_file) { |
2395 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "file"; |
2396 | return {}; |
2397 | } |
2398 | if (!_seen_subprogramFlags) { |
2399 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "subprogramFlags"; |
2400 | return {}; |
2401 | } |
2402 | } |
2403 | // Parse literal '>' |
2404 | if (odsParser.parseGreater()) return {}; |
2405 | 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" , 2405, __extension__ __PRETTY_FUNCTION__)); |
2406 | 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" , 2406, __extension__ __PRETTY_FUNCTION__)); |
2407 | 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" , 2407, __extension__ __PRETTY_FUNCTION__)); |
2408 | 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" , 2408, __extension__ __PRETTY_FUNCTION__)); |
2409 | return DISubprogramAttr::get(odsParser.getContext(), |
2410 | DICompileUnitAttr((_result_compileUnit.value_or(DICompileUnitAttr()))), |
2411 | DIScopeAttr((*_result_scope)), |
2412 | StringAttr((*_result_name)), |
2413 | StringAttr((_result_linkageName.value_or(StringAttr()))), |
2414 | DIFileAttr((*_result_file)), |
2415 | unsigned((_result_line.value_or(unsigned()))), |
2416 | unsigned((_result_scopeLine.value_or(unsigned()))), |
2417 | DISubprogramFlags((*_result_subprogramFlags)), |
2418 | DISubroutineTypeAttr((_result_type.value_or(DISubroutineTypeAttr())))); |
2419 | } |
2420 | |
2421 | void DISubprogramAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2422 | ::mlir::Builder odsBuilder(getContext()); |
2423 | odsPrinter << "<"; |
2424 | { |
2425 | bool _firstPrinted = true; |
2426 | if (!(getCompileUnit() == DICompileUnitAttr())) { |
2427 | if (!_firstPrinted) odsPrinter << ", "; |
2428 | _firstPrinted = false; |
2429 | odsPrinter << "compileUnit = "; |
2430 | if (!(getCompileUnit() == DICompileUnitAttr())) { |
2431 | odsPrinter.printStrippedAttrOrType(getCompileUnit()); |
2432 | } |
2433 | } |
2434 | if (!_firstPrinted) odsPrinter << ", "; |
2435 | _firstPrinted = false; |
2436 | odsPrinter << "scope = "; |
2437 | odsPrinter.printStrippedAttrOrType(getScope()); |
2438 | if (!_firstPrinted) odsPrinter << ", "; |
2439 | _firstPrinted = false; |
2440 | odsPrinter << "name = "; |
2441 | odsPrinter.printStrippedAttrOrType(getName()); |
2442 | if (!(getLinkageName() == StringAttr())) { |
2443 | if (!_firstPrinted) odsPrinter << ", "; |
2444 | _firstPrinted = false; |
2445 | odsPrinter << "linkageName = "; |
2446 | if (!(getLinkageName() == StringAttr())) { |
2447 | odsPrinter.printStrippedAttrOrType(getLinkageName()); |
2448 | } |
2449 | } |
2450 | if (!_firstPrinted) odsPrinter << ", "; |
2451 | _firstPrinted = false; |
2452 | odsPrinter << "file = "; |
2453 | odsPrinter.printStrippedAttrOrType(getFile()); |
2454 | if (!(getLine() == unsigned())) { |
2455 | if (!_firstPrinted) odsPrinter << ", "; |
2456 | _firstPrinted = false; |
2457 | odsPrinter << "line = "; |
2458 | if (!(getLine() == unsigned())) { |
2459 | odsPrinter.printStrippedAttrOrType(getLine()); |
2460 | } |
2461 | } |
2462 | if (!(getScopeLine() == unsigned())) { |
2463 | if (!_firstPrinted) odsPrinter << ", "; |
2464 | _firstPrinted = false; |
2465 | odsPrinter << "scopeLine = "; |
2466 | if (!(getScopeLine() == unsigned())) { |
2467 | odsPrinter.printStrippedAttrOrType(getScopeLine()); |
2468 | } |
2469 | } |
2470 | if (!_firstPrinted) odsPrinter << ", "; |
2471 | _firstPrinted = false; |
2472 | odsPrinter << "subprogramFlags = "; |
2473 | odsPrinter.printStrippedAttrOrType(getSubprogramFlags()); |
2474 | if (!(getType() == DISubroutineTypeAttr())) { |
2475 | if (!_firstPrinted) odsPrinter << ", "; |
2476 | _firstPrinted = false; |
2477 | odsPrinter << "type = "; |
2478 | if (!(getType() == DISubroutineTypeAttr())) { |
2479 | odsPrinter.printStrippedAttrOrType(getType()); |
2480 | } |
2481 | } |
2482 | } |
2483 | odsPrinter << ">"; |
2484 | } |
2485 | |
2486 | DICompileUnitAttr DISubprogramAttr::getCompileUnit() const { |
2487 | return getImpl()->compileUnit; |
2488 | } |
2489 | |
2490 | DIScopeAttr DISubprogramAttr::getScope() const { |
2491 | return getImpl()->scope; |
2492 | } |
2493 | |
2494 | StringAttr DISubprogramAttr::getName() const { |
2495 | return getImpl()->name; |
2496 | } |
2497 | |
2498 | StringAttr DISubprogramAttr::getLinkageName() const { |
2499 | return getImpl()->linkageName; |
2500 | } |
2501 | |
2502 | DIFileAttr DISubprogramAttr::getFile() const { |
2503 | return getImpl()->file; |
2504 | } |
2505 | |
2506 | unsigned DISubprogramAttr::getLine() const { |
2507 | return getImpl()->line; |
2508 | } |
2509 | |
2510 | unsigned DISubprogramAttr::getScopeLine() const { |
2511 | return getImpl()->scopeLine; |
2512 | } |
2513 | |
2514 | DISubprogramFlags DISubprogramAttr::getSubprogramFlags() const { |
2515 | return getImpl()->subprogramFlags; |
2516 | } |
2517 | |
2518 | DISubroutineTypeAttr DISubprogramAttr::getType() const { |
2519 | return getImpl()->type; |
2520 | } |
2521 | |
2522 | } // namespace LLVM |
2523 | } // namespace mlir |
2524 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubprogramAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DISubprogramAttr>::id = {}; } } |
2525 | namespace mlir { |
2526 | namespace LLVM { |
2527 | namespace detail { |
2528 | struct DISubrangeAttrStorage : public ::mlir::AttributeStorage { |
2529 | using KeyTy = std::tuple<IntegerAttr, IntegerAttr, IntegerAttr, IntegerAttr>; |
2530 | DISubrangeAttrStorage(IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) : count(count), lowerBound(lowerBound), upperBound(upperBound), stride(stride) {} |
2531 | |
2532 | KeyTy getAsKey() const { |
2533 | return KeyTy(count, lowerBound, upperBound, stride); |
2534 | } |
2535 | |
2536 | bool operator==(const KeyTy &tblgenKey) const { |
2537 | return (count == std::get<0>(tblgenKey)) && (lowerBound == std::get<1>(tblgenKey)) && (upperBound == std::get<2>(tblgenKey)) && (stride == std::get<3>(tblgenKey)); |
2538 | } |
2539 | |
2540 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2541 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); |
2542 | } |
2543 | |
2544 | static DISubrangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2545 | auto count = std::get<0>(tblgenKey); |
2546 | auto lowerBound = std::get<1>(tblgenKey); |
2547 | auto upperBound = std::get<2>(tblgenKey); |
2548 | auto stride = std::get<3>(tblgenKey); |
2549 | return new (allocator.allocate<DISubrangeAttrStorage>()) DISubrangeAttrStorage(count, lowerBound, upperBound, stride); |
2550 | } |
2551 | |
2552 | IntegerAttr count; |
2553 | IntegerAttr lowerBound; |
2554 | IntegerAttr upperBound; |
2555 | IntegerAttr stride; |
2556 | }; |
2557 | } // namespace detail |
2558 | DISubrangeAttr DISubrangeAttr::get(::mlir::MLIRContext *context, IntegerAttr count, IntegerAttr lowerBound, IntegerAttr upperBound, IntegerAttr stride) { |
2559 | return Base::get(context, count, lowerBound, upperBound, stride); |
2560 | } |
2561 | |
2562 | ::mlir::Attribute DISubrangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2563 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2564 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2565 | (void) odsLoc; |
2566 | ::mlir::FailureOr<IntegerAttr> _result_count; |
2567 | ::mlir::FailureOr<IntegerAttr> _result_lowerBound; |
2568 | ::mlir::FailureOr<IntegerAttr> _result_upperBound; |
2569 | ::mlir::FailureOr<IntegerAttr> _result_stride; |
2570 | // Parse literal '<' |
2571 | if (odsParser.parseLess()) return {}; |
2572 | // Parse parameter struct |
2573 | bool _seen_count = false; |
2574 | bool _seen_lowerBound = false; |
2575 | bool _seen_upperBound = false; |
2576 | bool _seen_stride = false; |
2577 | { |
2578 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
2579 | // Parse literal '=' |
2580 | if (odsParser.parseEqual()) return {}; |
2581 | if (!_seen_count && _paramKey == "count") { |
2582 | _seen_count = true; |
2583 | |
2584 | // Parse variable 'count' |
2585 | _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
2586 | if (::mlir::failed(_result_count)) { |
2587 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'count' which is to be a `IntegerAttr`"); |
2588 | return {}; |
2589 | } |
2590 | } else if (!_seen_lowerBound && _paramKey == "lowerBound") { |
2591 | _seen_lowerBound = true; |
2592 | |
2593 | // Parse variable 'lowerBound' |
2594 | _result_lowerBound = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
2595 | if (::mlir::failed(_result_lowerBound)) { |
2596 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'lowerBound' which is to be a `IntegerAttr`"); |
2597 | return {}; |
2598 | } |
2599 | } else if (!_seen_upperBound && _paramKey == "upperBound") { |
2600 | _seen_upperBound = true; |
2601 | |
2602 | // Parse variable 'upperBound' |
2603 | _result_upperBound = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
2604 | if (::mlir::failed(_result_upperBound)) { |
2605 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'upperBound' which is to be a `IntegerAttr`"); |
2606 | return {}; |
2607 | } |
2608 | } else if (!_seen_stride && _paramKey == "stride") { |
2609 | _seen_stride = true; |
2610 | |
2611 | // Parse variable 'stride' |
2612 | _result_stride = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
2613 | if (::mlir::failed(_result_stride)) { |
2614 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'stride' which is to be a `IntegerAttr`"); |
2615 | return {}; |
2616 | } |
2617 | } else { |
2618 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
2619 | return {}; |
2620 | } |
2621 | return true; |
2622 | }; |
2623 | ::llvm::StringRef _paramKey; |
2624 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
2625 | if (!_loop_body(_paramKey)) return {}; |
2626 | while (!odsParser.parseOptionalComma()) { |
2627 | ::llvm::StringRef _paramKey; |
2628 | if (odsParser.parseKeyword(&_paramKey)) { |
2629 | odsParser.emitError(odsParser.getCurrentLocation(), |
2630 | "expected a parameter name in struct"); |
2631 | return {}; |
2632 | } |
2633 | if (!_loop_body(_paramKey)) return {}; |
2634 | } |
2635 | } |
2636 | } |
2637 | // Parse literal '>' |
2638 | if (odsParser.parseGreater()) return {}; |
2639 | return DISubrangeAttr::get(odsParser.getContext(), |
2640 | IntegerAttr((_result_count.value_or(IntegerAttr()))), |
2641 | IntegerAttr((_result_lowerBound.value_or(IntegerAttr()))), |
2642 | IntegerAttr((_result_upperBound.value_or(IntegerAttr()))), |
2643 | IntegerAttr((_result_stride.value_or(IntegerAttr())))); |
2644 | } |
2645 | |
2646 | void DISubrangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2647 | ::mlir::Builder odsBuilder(getContext()); |
2648 | odsPrinter << "<"; |
2649 | { |
2650 | bool _firstPrinted = true; |
2651 | if (!(getCount() == IntegerAttr())) { |
2652 | if (!_firstPrinted) odsPrinter << ", "; |
2653 | _firstPrinted = false; |
2654 | odsPrinter << "count = "; |
2655 | if (!(getCount() == IntegerAttr())) { |
2656 | odsPrinter.printStrippedAttrOrType(getCount()); |
2657 | } |
2658 | } |
2659 | if (!(getLowerBound() == IntegerAttr())) { |
2660 | if (!_firstPrinted) odsPrinter << ", "; |
2661 | _firstPrinted = false; |
2662 | odsPrinter << "lowerBound = "; |
2663 | if (!(getLowerBound() == IntegerAttr())) { |
2664 | odsPrinter.printStrippedAttrOrType(getLowerBound()); |
2665 | } |
2666 | } |
2667 | if (!(getUpperBound() == IntegerAttr())) { |
2668 | if (!_firstPrinted) odsPrinter << ", "; |
2669 | _firstPrinted = false; |
2670 | odsPrinter << "upperBound = "; |
2671 | if (!(getUpperBound() == IntegerAttr())) { |
2672 | odsPrinter.printStrippedAttrOrType(getUpperBound()); |
2673 | } |
2674 | } |
2675 | if (!(getStride() == IntegerAttr())) { |
2676 | if (!_firstPrinted) odsPrinter << ", "; |
2677 | _firstPrinted = false; |
2678 | odsPrinter << "stride = "; |
2679 | if (!(getStride() == IntegerAttr())) { |
2680 | odsPrinter.printStrippedAttrOrType(getStride()); |
2681 | } |
2682 | } |
2683 | } |
2684 | odsPrinter << ">"; |
2685 | } |
2686 | |
2687 | IntegerAttr DISubrangeAttr::getCount() const { |
2688 | return getImpl()->count; |
2689 | } |
2690 | |
2691 | IntegerAttr DISubrangeAttr::getLowerBound() const { |
2692 | return getImpl()->lowerBound; |
2693 | } |
2694 | |
2695 | IntegerAttr DISubrangeAttr::getUpperBound() const { |
2696 | return getImpl()->upperBound; |
2697 | } |
2698 | |
2699 | IntegerAttr DISubrangeAttr::getStride() const { |
2700 | return getImpl()->stride; |
2701 | } |
2702 | |
2703 | } // namespace LLVM |
2704 | } // namespace mlir |
2705 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubrangeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DISubrangeAttr>::id = {}; } } |
2706 | namespace mlir { |
2707 | namespace LLVM { |
2708 | namespace detail { |
2709 | struct DISubroutineTypeAttrStorage : public ::mlir::AttributeStorage { |
2710 | using KeyTy = std::tuple<unsigned, ::llvm::ArrayRef<DITypeAttr>>; |
2711 | DISubroutineTypeAttrStorage(unsigned callingConvention, ::llvm::ArrayRef<DITypeAttr> types) : callingConvention(callingConvention), types(types) {} |
2712 | |
2713 | KeyTy getAsKey() const { |
2714 | return KeyTy(callingConvention, types); |
2715 | } |
2716 | |
2717 | bool operator==(const KeyTy &tblgenKey) const { |
2718 | return (callingConvention == std::get<0>(tblgenKey)) && (::llvm::ArrayRef<DITypeAttr>(types) == ::llvm::ArrayRef<DITypeAttr>(std::get<1>(tblgenKey))); |
2719 | } |
2720 | |
2721 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2722 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
2723 | } |
2724 | |
2725 | static DISubroutineTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2726 | auto callingConvention = std::get<0>(tblgenKey); |
2727 | auto types = std::get<1>(tblgenKey); |
2728 | types = allocator.copyInto(types); |
2729 | return new (allocator.allocate<DISubroutineTypeAttrStorage>()) DISubroutineTypeAttrStorage(callingConvention, types); |
2730 | } |
2731 | |
2732 | unsigned callingConvention; |
2733 | ::llvm::ArrayRef<DITypeAttr> types; |
2734 | }; |
2735 | } // namespace detail |
2736 | DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, unsigned callingConvention, ::llvm::ArrayRef<DITypeAttr> types) { |
2737 | return Base::get(context, callingConvention, types); |
2738 | } |
2739 | |
2740 | DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, ArrayRef<DITypeAttr> types) { |
2741 | return Base::get(context, /*callingConvention=*/0, types); |
2742 | } |
2743 | |
2744 | ::mlir::Attribute DISubroutineTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2745 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2746 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2747 | (void) odsLoc; |
2748 | ::mlir::FailureOr<unsigned> _result_callingConvention; |
2749 | ::mlir::FailureOr<::llvm::SmallVector<DITypeAttr>> _result_types; |
2750 | // Parse literal '<' |
2751 | if (odsParser.parseLess()) return {}; |
2752 | // Parse parameter struct |
2753 | bool _seen_callingConvention = false; |
2754 | bool _seen_types = false; |
2755 | { |
2756 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
2757 | // Parse literal '=' |
2758 | if (odsParser.parseEqual()) return {}; |
2759 | if (!_seen_callingConvention && _paramKey == "callingConvention") { |
2760 | _seen_callingConvention = true; |
2761 | |
2762 | // Parse variable 'callingConvention' |
2763 | _result_callingConvention = [&]() -> FailureOr<unsigned> { |
2764 | SMLoc tagLoc = odsParser.getCurrentLocation(); |
2765 | StringRef name; |
2766 | if (odsParser.parseKeyword(&name)) |
2767 | return failure(); |
2768 | |
2769 | if (unsigned tag = llvm::dwarf::getCallingConvention(name)) |
2770 | return tag; |
2771 | return odsParser.emitError(tagLoc) |
2772 | << "invalid debug info debug info calling convention name: " << name; |
2773 | }() ; |
2774 | if (::mlir::failed(_result_callingConvention)) { |
2775 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'callingConvention' which is to be a `unsigned`"); |
2776 | return {}; |
2777 | } |
2778 | } else if (!_seen_types && _paramKey == "types") { |
2779 | _seen_types = true; |
2780 | |
2781 | // Parse variable 'types' |
2782 | _result_types = ::mlir::FieldParser<::llvm::SmallVector<DITypeAttr>>::parse(odsParser); |
2783 | if (::mlir::failed(_result_types)) { |
2784 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'types' which is to be a `::llvm::ArrayRef<DITypeAttr>`"); |
2785 | return {}; |
2786 | } |
2787 | } else { |
2788 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
2789 | return {}; |
2790 | } |
2791 | return true; |
2792 | }; |
2793 | ::llvm::StringRef _paramKey; |
2794 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
2795 | if (!_loop_body(_paramKey)) return {}; |
2796 | while (!odsParser.parseOptionalComma()) { |
2797 | ::llvm::StringRef _paramKey; |
2798 | if (odsParser.parseKeyword(&_paramKey)) { |
2799 | odsParser.emitError(odsParser.getCurrentLocation(), |
2800 | "expected a parameter name in struct"); |
2801 | return {}; |
2802 | } |
2803 | if (!_loop_body(_paramKey)) return {}; |
2804 | } |
2805 | } |
2806 | } |
2807 | // Parse literal '>' |
2808 | if (odsParser.parseGreater()) return {}; |
2809 | return DISubroutineTypeAttr::get(odsParser.getContext(), |
2810 | unsigned((_result_callingConvention.value_or(0))), |
2811 | ::llvm::ArrayRef<DITypeAttr>((_result_types.value_or(::llvm::SmallVector<DITypeAttr>())))); |
2812 | } |
2813 | |
2814 | void DISubroutineTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2815 | ::mlir::Builder odsBuilder(getContext()); |
2816 | odsPrinter << "<"; |
2817 | { |
2818 | bool _firstPrinted = true; |
2819 | if (!(getCallingConvention() == 0)) { |
2820 | if (!_firstPrinted) odsPrinter << ", "; |
2821 | _firstPrinted = false; |
2822 | odsPrinter << "callingConvention = "; |
2823 | if (!(getCallingConvention() == 0)) { |
2824 | odsPrinter << llvm::dwarf::ConventionString(getCallingConvention()); |
2825 | } |
2826 | } |
2827 | if (!(::llvm::ArrayRef<DITypeAttr>(getTypes()) == ::llvm::ArrayRef<DITypeAttr>(::llvm::SmallVector<DITypeAttr>()))) { |
2828 | if (!_firstPrinted) odsPrinter << ", "; |
2829 | _firstPrinted = false; |
2830 | odsPrinter << "types = "; |
2831 | if (!(::llvm::ArrayRef<DITypeAttr>(getTypes()) == ::llvm::ArrayRef<DITypeAttr>(::llvm::SmallVector<DITypeAttr>()))) { |
2832 | odsPrinter.printStrippedAttrOrType(getTypes()); |
2833 | } |
2834 | } |
2835 | } |
2836 | odsPrinter << ">"; |
2837 | } |
2838 | |
2839 | unsigned DISubroutineTypeAttr::getCallingConvention() const { |
2840 | return getImpl()->callingConvention; |
2841 | } |
2842 | |
2843 | ::llvm::ArrayRef<DITypeAttr> DISubroutineTypeAttr::getTypes() const { |
2844 | return getImpl()->types; |
2845 | } |
2846 | |
2847 | } // namespace LLVM |
2848 | } // namespace mlir |
2849 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubroutineTypeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::DISubroutineTypeAttr>::id = {}; } } |
2850 | namespace mlir { |
2851 | namespace LLVM { |
2852 | namespace detail { |
2853 | struct FastmathFlagsAttrStorage : public ::mlir::AttributeStorage { |
2854 | using KeyTy = std::tuple<::mlir::LLVM::FastmathFlags>; |
2855 | FastmathFlagsAttrStorage(::mlir::LLVM::FastmathFlags value) : value(value) {} |
2856 | |
2857 | KeyTy getAsKey() const { |
2858 | return KeyTy(value); |
2859 | } |
2860 | |
2861 | bool operator==(const KeyTy &tblgenKey) const { |
2862 | return (value == std::get<0>(tblgenKey)); |
2863 | } |
2864 | |
2865 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2866 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
2867 | } |
2868 | |
2869 | static FastmathFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2870 | auto value = std::get<0>(tblgenKey); |
2871 | return new (allocator.allocate<FastmathFlagsAttrStorage>()) FastmathFlagsAttrStorage(value); |
2872 | } |
2873 | |
2874 | ::mlir::LLVM::FastmathFlags value; |
2875 | }; |
2876 | } // namespace detail |
2877 | FastmathFlagsAttr FastmathFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::LLVM::FastmathFlags value) { |
2878 | return Base::get(context, value); |
2879 | } |
2880 | |
2881 | ::mlir::Attribute FastmathFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2882 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2883 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2884 | (void) odsLoc; |
2885 | ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> _result_value; |
2886 | // Parse literal '<' |
2887 | if (odsParser.parseLess()) return {}; |
2888 | |
2889 | // Parse variable 'value' |
2890 | _result_value = [&]() -> ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> { |
2891 | ::mlir::LLVM::FastmathFlags flags = {}; |
2892 | auto loc = odsParser.getCurrentLocation(); |
2893 | ::llvm::StringRef enumKeyword; |
2894 | do { |
2895 | if (::mlir::failed(odsParser.parseKeyword(&enumKeyword))) |
2896 | return ::mlir::failure(); |
2897 | auto maybeEnum = ::mlir::LLVM::symbolizeFastmathFlags(enumKeyword); |
2898 | if (!maybeEnum) { |
2899 | return {(::mlir::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::LLVM::FastmathFlags" << " to be one of: " << "none" << ", " << "nnan" << ", " << "ninf" << ", " << "nsz" << ", " << "arcp" << ", " << "contract" << ", " << "afn" << ", " << "reassoc" << ", " << "fast")}; |
2900 | } |
2901 | flags = flags | *maybeEnum; |
2902 | } while(::mlir::succeeded(odsParser.parseOptionalComma())); |
2903 | return flags; |
2904 | }(); |
2905 | if (::mlir::failed(_result_value)) { |
2906 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_FastmathFlagsAttr parameter 'value' which is to be a `::mlir::LLVM::FastmathFlags`"); |
2907 | return {}; |
2908 | } |
2909 | // Parse literal '>' |
2910 | if (odsParser.parseGreater()) return {}; |
2911 | 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" , 2911, __extension__ __PRETTY_FUNCTION__)); |
2912 | return FastmathFlagsAttr::get(odsParser.getContext(), |
2913 | ::mlir::LLVM::FastmathFlags((*_result_value))); |
2914 | } |
2915 | |
2916 | void FastmathFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
2917 | ::mlir::Builder odsBuilder(getContext()); |
2918 | odsPrinter << "<"; |
2919 | odsPrinter << stringifyFastmathFlags(getValue()); |
2920 | odsPrinter << ">"; |
2921 | } |
2922 | |
2923 | ::mlir::LLVM::FastmathFlags FastmathFlagsAttr::getValue() const { |
2924 | return getImpl()->value; |
2925 | } |
2926 | |
2927 | } // namespace LLVM |
2928 | } // namespace mlir |
2929 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FastmathFlagsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::FastmathFlagsAttr>::id = {}; } } |
2930 | namespace mlir { |
2931 | namespace LLVM { |
2932 | namespace detail { |
2933 | struct MemoryEffectsAttrStorage : public ::mlir::AttributeStorage { |
2934 | using KeyTy = std::tuple<ModRefInfo, ModRefInfo, ModRefInfo>; |
2935 | MemoryEffectsAttrStorage(ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem) : other(other), argMem(argMem), inaccessibleMem(inaccessibleMem) {} |
2936 | |
2937 | KeyTy getAsKey() const { |
2938 | return KeyTy(other, argMem, inaccessibleMem); |
2939 | } |
2940 | |
2941 | bool operator==(const KeyTy &tblgenKey) const { |
2942 | return (other == std::get<0>(tblgenKey)) && (argMem == std::get<1>(tblgenKey)) && (inaccessibleMem == std::get<2>(tblgenKey)); |
2943 | } |
2944 | |
2945 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
2946 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); |
2947 | } |
2948 | |
2949 | static MemoryEffectsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
2950 | auto other = std::get<0>(tblgenKey); |
2951 | auto argMem = std::get<1>(tblgenKey); |
2952 | auto inaccessibleMem = std::get<2>(tblgenKey); |
2953 | return new (allocator.allocate<MemoryEffectsAttrStorage>()) MemoryEffectsAttrStorage(other, argMem, inaccessibleMem); |
2954 | } |
2955 | |
2956 | ModRefInfo other; |
2957 | ModRefInfo argMem; |
2958 | ModRefInfo inaccessibleMem; |
2959 | }; |
2960 | } // namespace detail |
2961 | MemoryEffectsAttr MemoryEffectsAttr::get(::mlir::MLIRContext *context, ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem) { |
2962 | return Base::get(context, other, argMem, inaccessibleMem); |
2963 | } |
2964 | |
2965 | ::mlir::Attribute MemoryEffectsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
2966 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
2967 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
2968 | (void) odsLoc; |
2969 | ::mlir::FailureOr<ModRefInfo> _result_other; |
2970 | ::mlir::FailureOr<ModRefInfo> _result_argMem; |
2971 | ::mlir::FailureOr<ModRefInfo> _result_inaccessibleMem; |
2972 | // Parse literal '<' |
2973 | if (odsParser.parseLess()) return {}; |
2974 | // Parse parameter struct |
2975 | bool _seen_other = false; |
2976 | bool _seen_argMem = false; |
2977 | bool _seen_inaccessibleMem = false; |
2978 | { |
2979 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
2980 | // Parse literal '=' |
2981 | if (odsParser.parseEqual()) return {}; |
2982 | if (!_seen_other && _paramKey == "other") { |
2983 | _seen_other = true; |
2984 | |
2985 | // Parse variable 'other' |
2986 | _result_other = ::mlir::FieldParser<ModRefInfo>::parse(odsParser); |
2987 | if (::mlir::failed(_result_other)) { |
2988 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'other' which is to be a `ModRefInfo`"); |
2989 | return {}; |
2990 | } |
2991 | } else if (!_seen_argMem && _paramKey == "argMem") { |
2992 | _seen_argMem = true; |
2993 | |
2994 | // Parse variable 'argMem' |
2995 | _result_argMem = ::mlir::FieldParser<ModRefInfo>::parse(odsParser); |
2996 | if (::mlir::failed(_result_argMem)) { |
2997 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'argMem' which is to be a `ModRefInfo`"); |
2998 | return {}; |
2999 | } |
3000 | } else if (!_seen_inaccessibleMem && _paramKey == "inaccessibleMem") { |
3001 | _seen_inaccessibleMem = true; |
3002 | |
3003 | // Parse variable 'inaccessibleMem' |
3004 | _result_inaccessibleMem = ::mlir::FieldParser<ModRefInfo>::parse(odsParser); |
3005 | if (::mlir::failed(_result_inaccessibleMem)) { |
3006 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'inaccessibleMem' which is to be a `ModRefInfo`"); |
3007 | return {}; |
3008 | } |
3009 | } else { |
3010 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
3011 | return {}; |
3012 | } |
3013 | return true; |
3014 | }; |
3015 | for (unsigned odsStructIndex = 0; odsStructIndex < 3; ++odsStructIndex) { |
3016 | ::llvm::StringRef _paramKey; |
3017 | if (odsParser.parseKeyword(&_paramKey)) { |
3018 | odsParser.emitError(odsParser.getCurrentLocation(), |
3019 | "expected a parameter name in struct"); |
3020 | return {}; |
3021 | } |
3022 | if (!_loop_body(_paramKey)) return {}; |
3023 | if ((odsStructIndex != 3 - 1) && odsParser.parseComma()) |
3024 | return {}; |
3025 | } |
3026 | } |
3027 | // Parse literal '>' |
3028 | if (odsParser.parseGreater()) return {}; |
3029 | assert(::mlir::succeeded(_result_other))(static_cast <bool> (::mlir::succeeded(_result_other)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_other)" , "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc" , 3029, __extension__ __PRETTY_FUNCTION__)); |
3030 | assert(::mlir::succeeded(_result_argMem))(static_cast <bool> (::mlir::succeeded(_result_argMem)) ? void (0) : __assert_fail ("::mlir::succeeded(_result_argMem)" , "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc" , 3030, __extension__ __PRETTY_FUNCTION__)); |
3031 | assert(::mlir::succeeded(_result_inaccessibleMem))(static_cast <bool> (::mlir::succeeded(_result_inaccessibleMem )) ? void (0) : __assert_fail ("::mlir::succeeded(_result_inaccessibleMem)" , "tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc" , 3031, __extension__ __PRETTY_FUNCTION__)); |
3032 | return MemoryEffectsAttr::get(odsParser.getContext(), |
3033 | ModRefInfo((*_result_other)), |
3034 | ModRefInfo((*_result_argMem)), |
3035 | ModRefInfo((*_result_inaccessibleMem))); |
3036 | } |
3037 | |
3038 | void MemoryEffectsAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3039 | ::mlir::Builder odsBuilder(getContext()); |
3040 | odsPrinter << "<"; |
3041 | { |
3042 | bool _firstPrinted = true; |
3043 | if (!_firstPrinted) odsPrinter << ", "; |
3044 | _firstPrinted = false; |
3045 | odsPrinter << "other = "; |
3046 | odsPrinter.printStrippedAttrOrType(getOther()); |
3047 | if (!_firstPrinted) odsPrinter << ", "; |
3048 | _firstPrinted = false; |
3049 | odsPrinter << "argMem = "; |
3050 | odsPrinter.printStrippedAttrOrType(getArgMem()); |
3051 | if (!_firstPrinted) odsPrinter << ", "; |
3052 | _firstPrinted = false; |
3053 | odsPrinter << "inaccessibleMem = "; |
3054 | odsPrinter.printStrippedAttrOrType(getInaccessibleMem()); |
3055 | } |
3056 | odsPrinter << ">"; |
3057 | } |
3058 | |
3059 | ModRefInfo MemoryEffectsAttr::getOther() const { |
3060 | return getImpl()->other; |
3061 | } |
3062 | |
3063 | ModRefInfo MemoryEffectsAttr::getArgMem() const { |
3064 | return getImpl()->argMem; |
3065 | } |
3066 | |
3067 | ModRefInfo MemoryEffectsAttr::getInaccessibleMem() const { |
3068 | return getImpl()->inaccessibleMem; |
3069 | } |
3070 | |
3071 | } // namespace LLVM |
3072 | } // namespace mlir |
3073 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemoryEffectsAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::MemoryEffectsAttr>::id = {}; } } |
3074 | namespace mlir { |
3075 | namespace LLVM { |
3076 | namespace detail { |
3077 | struct LinkageAttrStorage : public ::mlir::AttributeStorage { |
3078 | using KeyTy = std::tuple<linkage::Linkage>; |
3079 | LinkageAttrStorage(linkage::Linkage linkage) : linkage(linkage) {} |
3080 | |
3081 | KeyTy getAsKey() const { |
3082 | return KeyTy(linkage); |
3083 | } |
3084 | |
3085 | bool operator==(const KeyTy &tblgenKey) const { |
3086 | return (linkage == std::get<0>(tblgenKey)); |
3087 | } |
3088 | |
3089 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
3090 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
3091 | } |
3092 | |
3093 | static LinkageAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
3094 | auto linkage = std::get<0>(tblgenKey); |
3095 | return new (allocator.allocate<LinkageAttrStorage>()) LinkageAttrStorage(linkage); |
3096 | } |
3097 | |
3098 | linkage::Linkage linkage; |
3099 | }; |
3100 | } // namespace detail |
3101 | LinkageAttr LinkageAttr::get(::mlir::MLIRContext *context, linkage::Linkage linkage) { |
3102 | return Base::get(context, linkage); |
3103 | } |
3104 | |
3105 | ::mlir::Attribute LinkageAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
3106 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
3107 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
3108 | (void) odsLoc; |
3109 | ::mlir::FailureOr<linkage::Linkage> _result_linkage; |
3110 | // Parse literal '<' |
3111 | if (odsParser.parseLess()) return {}; |
3112 | |
3113 | // Parse variable 'linkage' |
3114 | _result_linkage = ::mlir::FieldParser<linkage::Linkage>::parse(odsParser); |
3115 | if (::mlir::failed(_result_linkage)) { |
3116 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LinkageAttr parameter 'linkage' which is to be a `linkage::Linkage`"); |
3117 | return {}; |
3118 | } |
3119 | // Parse literal '>' |
3120 | if (odsParser.parseGreater()) return {}; |
3121 | 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" , 3121, __extension__ __PRETTY_FUNCTION__)); |
3122 | return LinkageAttr::get(odsParser.getContext(), |
3123 | linkage::Linkage((*_result_linkage))); |
3124 | } |
3125 | |
3126 | void LinkageAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3127 | ::mlir::Builder odsBuilder(getContext()); |
3128 | odsPrinter << "<"; |
3129 | odsPrinter.printStrippedAttrOrType(getLinkage()); |
3130 | odsPrinter << ">"; |
3131 | } |
3132 | |
3133 | linkage::Linkage LinkageAttr::getLinkage() const { |
3134 | return getImpl()->linkage; |
3135 | } |
3136 | |
3137 | } // namespace LLVM |
3138 | } // namespace mlir |
3139 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkageAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LinkageAttr>::id = {}; } } |
3140 | namespace mlir { |
3141 | namespace LLVM { |
3142 | namespace detail { |
3143 | struct LoopAnnotationAttrStorage : public ::mlir::AttributeStorage { |
3144 | using KeyTy = std::tuple<BoolAttr, LoopVectorizeAttr, LoopInterleaveAttr, LoopUnrollAttr, LoopUnrollAndJamAttr, LoopLICMAttr, LoopDistributeAttr, LoopPipelineAttr, LoopPeeledAttr, LoopUnswitchAttr, BoolAttr, BoolAttr, ::llvm::ArrayRef<SymbolRefAttr>>; |
3145 | LoopAnnotationAttrStorage(BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, ::llvm::ArrayRef<SymbolRefAttr> parallelAccesses) : disableNonforced(disableNonforced), vectorize(vectorize), interleave(interleave), unroll(unroll), unrollAndJam(unrollAndJam), licm(licm), distribute(distribute), pipeline(pipeline), peeled(peeled), unswitch(unswitch), mustProgress(mustProgress), isVectorized(isVectorized), parallelAccesses(parallelAccesses) {} |
3146 | |
3147 | KeyTy getAsKey() const { |
3148 | return KeyTy(disableNonforced, vectorize, interleave, unroll, unrollAndJam, licm, distribute, pipeline, peeled, unswitch, mustProgress, isVectorized, parallelAccesses); |
3149 | } |
3150 | |
3151 | bool operator==(const KeyTy &tblgenKey) const { |
3152 | return (disableNonforced == std::get<0>(tblgenKey)) && (vectorize == std::get<1>(tblgenKey)) && (interleave == std::get<2>(tblgenKey)) && (unroll == std::get<3>(tblgenKey)) && (unrollAndJam == std::get<4>(tblgenKey)) && (licm == std::get<5>(tblgenKey)) && (distribute == std::get<6>(tblgenKey)) && (pipeline == std::get<7>(tblgenKey)) && (peeled == std::get<8>(tblgenKey)) && (unswitch == std::get<9>(tblgenKey)) && (mustProgress == std::get<10>(tblgenKey)) && (isVectorized == std::get<11>(tblgenKey)) && (::llvm::ArrayRef<SymbolRefAttr>(parallelAccesses) == ::llvm::ArrayRef<SymbolRefAttr>(std::get<12>(tblgenKey))); |
3153 | } |
3154 | |
3155 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
3156 | 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), std::get<10>(tblgenKey), std::get<11>(tblgenKey), std::get<12>(tblgenKey)); |
3157 | } |
3158 | |
3159 | static LoopAnnotationAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
3160 | auto disableNonforced = std::get<0>(tblgenKey); |
3161 | auto vectorize = std::get<1>(tblgenKey); |
3162 | auto interleave = std::get<2>(tblgenKey); |
3163 | auto unroll = std::get<3>(tblgenKey); |
3164 | auto unrollAndJam = std::get<4>(tblgenKey); |
3165 | auto licm = std::get<5>(tblgenKey); |
3166 | auto distribute = std::get<6>(tblgenKey); |
3167 | auto pipeline = std::get<7>(tblgenKey); |
3168 | auto peeled = std::get<8>(tblgenKey); |
3169 | auto unswitch = std::get<9>(tblgenKey); |
3170 | auto mustProgress = std::get<10>(tblgenKey); |
3171 | auto isVectorized = std::get<11>(tblgenKey); |
3172 | auto parallelAccesses = std::get<12>(tblgenKey); |
3173 | parallelAccesses = allocator.copyInto(parallelAccesses); |
3174 | return new (allocator.allocate<LoopAnnotationAttrStorage>()) LoopAnnotationAttrStorage(disableNonforced, vectorize, interleave, unroll, unrollAndJam, licm, distribute, pipeline, peeled, unswitch, mustProgress, isVectorized, parallelAccesses); |
3175 | } |
3176 | |
3177 | BoolAttr disableNonforced; |
3178 | LoopVectorizeAttr vectorize; |
3179 | LoopInterleaveAttr interleave; |
3180 | LoopUnrollAttr unroll; |
3181 | LoopUnrollAndJamAttr unrollAndJam; |
3182 | LoopLICMAttr licm; |
3183 | LoopDistributeAttr distribute; |
3184 | LoopPipelineAttr pipeline; |
3185 | LoopPeeledAttr peeled; |
3186 | LoopUnswitchAttr unswitch; |
3187 | BoolAttr mustProgress; |
3188 | BoolAttr isVectorized; |
3189 | ::llvm::ArrayRef<SymbolRefAttr> parallelAccesses; |
3190 | }; |
3191 | } // namespace detail |
3192 | LoopAnnotationAttr LoopAnnotationAttr::get(::mlir::MLIRContext *context, BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, ::llvm::ArrayRef<SymbolRefAttr> parallelAccesses) { |
3193 | return Base::get(context, disableNonforced, vectorize, interleave, unroll, unrollAndJam, licm, distribute, pipeline, peeled, unswitch, mustProgress, isVectorized, parallelAccesses); |
3194 | } |
3195 | |
3196 | ::mlir::Attribute LoopAnnotationAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
3197 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
3198 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
3199 | (void) odsLoc; |
3200 | ::mlir::FailureOr<BoolAttr> _result_disableNonforced; |
3201 | ::mlir::FailureOr<LoopVectorizeAttr> _result_vectorize; |
3202 | ::mlir::FailureOr<LoopInterleaveAttr> _result_interleave; |
3203 | ::mlir::FailureOr<LoopUnrollAttr> _result_unroll; |
3204 | ::mlir::FailureOr<LoopUnrollAndJamAttr> _result_unrollAndJam; |
3205 | ::mlir::FailureOr<LoopLICMAttr> _result_licm; |
3206 | ::mlir::FailureOr<LoopDistributeAttr> _result_distribute; |
3207 | ::mlir::FailureOr<LoopPipelineAttr> _result_pipeline; |
3208 | ::mlir::FailureOr<LoopPeeledAttr> _result_peeled; |
3209 | ::mlir::FailureOr<LoopUnswitchAttr> _result_unswitch; |
3210 | ::mlir::FailureOr<BoolAttr> _result_mustProgress; |
3211 | ::mlir::FailureOr<BoolAttr> _result_isVectorized; |
3212 | ::mlir::FailureOr<::llvm::SmallVector<SymbolRefAttr>> _result_parallelAccesses; |
3213 | // Parse literal '<' |
3214 | if (odsParser.parseLess()) return {}; |
3215 | // Parse parameter struct |
3216 | bool _seen_disableNonforced = false; |
3217 | bool _seen_vectorize = false; |
3218 | bool _seen_interleave = false; |
3219 | bool _seen_unroll = false; |
3220 | bool _seen_unrollAndJam = false; |
3221 | bool _seen_licm = false; |
3222 | bool _seen_distribute = false; |
3223 | bool _seen_pipeline = false; |
3224 | bool _seen_peeled = false; |
3225 | bool _seen_unswitch = false; |
3226 | bool _seen_mustProgress = false; |
3227 | bool _seen_isVectorized = false; |
3228 | bool _seen_parallelAccesses = false; |
3229 | { |
3230 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
3231 | // Parse literal '=' |
3232 | if (odsParser.parseEqual()) return {}; |
3233 | if (!_seen_disableNonforced && _paramKey == "disableNonforced") { |
3234 | _seen_disableNonforced = true; |
3235 | |
3236 | // Parse variable 'disableNonforced' |
3237 | _result_disableNonforced = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3238 | if (::mlir::failed(_result_disableNonforced)) { |
3239 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'disableNonforced' which is to be a `BoolAttr`"); |
3240 | return {}; |
3241 | } |
3242 | } else if (!_seen_vectorize && _paramKey == "vectorize") { |
3243 | _seen_vectorize = true; |
3244 | |
3245 | // Parse variable 'vectorize' |
3246 | _result_vectorize = ::mlir::FieldParser<LoopVectorizeAttr>::parse(odsParser); |
3247 | if (::mlir::failed(_result_vectorize)) { |
3248 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'vectorize' which is to be a `LoopVectorizeAttr`"); |
3249 | return {}; |
3250 | } |
3251 | } else if (!_seen_interleave && _paramKey == "interleave") { |
3252 | _seen_interleave = true; |
3253 | |
3254 | // Parse variable 'interleave' |
3255 | _result_interleave = ::mlir::FieldParser<LoopInterleaveAttr>::parse(odsParser); |
3256 | if (::mlir::failed(_result_interleave)) { |
3257 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'interleave' which is to be a `LoopInterleaveAttr`"); |
3258 | return {}; |
3259 | } |
3260 | } else if (!_seen_unroll && _paramKey == "unroll") { |
3261 | _seen_unroll = true; |
3262 | |
3263 | // Parse variable 'unroll' |
3264 | _result_unroll = ::mlir::FieldParser<LoopUnrollAttr>::parse(odsParser); |
3265 | if (::mlir::failed(_result_unroll)) { |
3266 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unroll' which is to be a `LoopUnrollAttr`"); |
3267 | return {}; |
3268 | } |
3269 | } else if (!_seen_unrollAndJam && _paramKey == "unrollAndJam") { |
3270 | _seen_unrollAndJam = true; |
3271 | |
3272 | // Parse variable 'unrollAndJam' |
3273 | _result_unrollAndJam = ::mlir::FieldParser<LoopUnrollAndJamAttr>::parse(odsParser); |
3274 | if (::mlir::failed(_result_unrollAndJam)) { |
3275 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unrollAndJam' which is to be a `LoopUnrollAndJamAttr`"); |
3276 | return {}; |
3277 | } |
3278 | } else if (!_seen_licm && _paramKey == "licm") { |
3279 | _seen_licm = true; |
3280 | |
3281 | // Parse variable 'licm' |
3282 | _result_licm = ::mlir::FieldParser<LoopLICMAttr>::parse(odsParser); |
3283 | if (::mlir::failed(_result_licm)) { |
3284 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'licm' which is to be a `LoopLICMAttr`"); |
3285 | return {}; |
3286 | } |
3287 | } else if (!_seen_distribute && _paramKey == "distribute") { |
3288 | _seen_distribute = true; |
3289 | |
3290 | // Parse variable 'distribute' |
3291 | _result_distribute = ::mlir::FieldParser<LoopDistributeAttr>::parse(odsParser); |
3292 | if (::mlir::failed(_result_distribute)) { |
3293 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'distribute' which is to be a `LoopDistributeAttr`"); |
3294 | return {}; |
3295 | } |
3296 | } else if (!_seen_pipeline && _paramKey == "pipeline") { |
3297 | _seen_pipeline = true; |
3298 | |
3299 | // Parse variable 'pipeline' |
3300 | _result_pipeline = ::mlir::FieldParser<LoopPipelineAttr>::parse(odsParser); |
3301 | if (::mlir::failed(_result_pipeline)) { |
3302 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'pipeline' which is to be a `LoopPipelineAttr`"); |
3303 | return {}; |
3304 | } |
3305 | } else if (!_seen_peeled && _paramKey == "peeled") { |
3306 | _seen_peeled = true; |
3307 | |
3308 | // Parse variable 'peeled' |
3309 | _result_peeled = ::mlir::FieldParser<LoopPeeledAttr>::parse(odsParser); |
3310 | if (::mlir::failed(_result_peeled)) { |
3311 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'peeled' which is to be a `LoopPeeledAttr`"); |
3312 | return {}; |
3313 | } |
3314 | } else if (!_seen_unswitch && _paramKey == "unswitch") { |
3315 | _seen_unswitch = true; |
3316 | |
3317 | // Parse variable 'unswitch' |
3318 | _result_unswitch = ::mlir::FieldParser<LoopUnswitchAttr>::parse(odsParser); |
3319 | if (::mlir::failed(_result_unswitch)) { |
3320 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unswitch' which is to be a `LoopUnswitchAttr`"); |
3321 | return {}; |
3322 | } |
3323 | } else if (!_seen_mustProgress && _paramKey == "mustProgress") { |
3324 | _seen_mustProgress = true; |
3325 | |
3326 | // Parse variable 'mustProgress' |
3327 | _result_mustProgress = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3328 | if (::mlir::failed(_result_mustProgress)) { |
3329 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'mustProgress' which is to be a `BoolAttr`"); |
3330 | return {}; |
3331 | } |
3332 | } else if (!_seen_isVectorized && _paramKey == "isVectorized") { |
3333 | _seen_isVectorized = true; |
3334 | |
3335 | // Parse variable 'isVectorized' |
3336 | _result_isVectorized = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3337 | if (::mlir::failed(_result_isVectorized)) { |
3338 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'isVectorized' which is to be a `BoolAttr`"); |
3339 | return {}; |
3340 | } |
3341 | } else if (!_seen_parallelAccesses && _paramKey == "parallelAccesses") { |
3342 | _seen_parallelAccesses = true; |
3343 | |
3344 | // Parse variable 'parallelAccesses' |
3345 | _result_parallelAccesses = ::mlir::FieldParser<::llvm::SmallVector<SymbolRefAttr>>::parse(odsParser); |
3346 | if (::mlir::failed(_result_parallelAccesses)) { |
3347 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'parallelAccesses' which is to be a `::llvm::ArrayRef<SymbolRefAttr>`"); |
3348 | return {}; |
3349 | } |
3350 | } else { |
3351 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
3352 | return {}; |
3353 | } |
3354 | return true; |
3355 | }; |
3356 | ::llvm::StringRef _paramKey; |
3357 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
3358 | if (!_loop_body(_paramKey)) return {}; |
3359 | while (!odsParser.parseOptionalComma()) { |
3360 | ::llvm::StringRef _paramKey; |
3361 | if (odsParser.parseKeyword(&_paramKey)) { |
3362 | odsParser.emitError(odsParser.getCurrentLocation(), |
3363 | "expected a parameter name in struct"); |
3364 | return {}; |
3365 | } |
3366 | if (!_loop_body(_paramKey)) return {}; |
3367 | } |
3368 | } |
3369 | } |
3370 | // Parse literal '>' |
3371 | if (odsParser.parseGreater()) return {}; |
3372 | return LoopAnnotationAttr::get(odsParser.getContext(), |
3373 | BoolAttr((_result_disableNonforced.value_or(BoolAttr()))), |
3374 | LoopVectorizeAttr((_result_vectorize.value_or(LoopVectorizeAttr()))), |
3375 | LoopInterleaveAttr((_result_interleave.value_or(LoopInterleaveAttr()))), |
3376 | LoopUnrollAttr((_result_unroll.value_or(LoopUnrollAttr()))), |
3377 | LoopUnrollAndJamAttr((_result_unrollAndJam.value_or(LoopUnrollAndJamAttr()))), |
3378 | LoopLICMAttr((_result_licm.value_or(LoopLICMAttr()))), |
3379 | LoopDistributeAttr((_result_distribute.value_or(LoopDistributeAttr()))), |
3380 | LoopPipelineAttr((_result_pipeline.value_or(LoopPipelineAttr()))), |
3381 | LoopPeeledAttr((_result_peeled.value_or(LoopPeeledAttr()))), |
3382 | LoopUnswitchAttr((_result_unswitch.value_or(LoopUnswitchAttr()))), |
3383 | BoolAttr((_result_mustProgress.value_or(BoolAttr()))), |
3384 | BoolAttr((_result_isVectorized.value_or(BoolAttr()))), |
3385 | ::llvm::ArrayRef<SymbolRefAttr>((_result_parallelAccesses.value_or(::llvm::SmallVector<SymbolRefAttr>())))); |
3386 | } |
3387 | |
3388 | void LoopAnnotationAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3389 | ::mlir::Builder odsBuilder(getContext()); |
3390 | odsPrinter << "<"; |
3391 | { |
3392 | bool _firstPrinted = true; |
3393 | if (!(getDisableNonforced() == BoolAttr())) { |
3394 | if (!_firstPrinted) odsPrinter << ", "; |
3395 | _firstPrinted = false; |
3396 | odsPrinter << "disableNonforced = "; |
3397 | if (!(getDisableNonforced() == BoolAttr())) { |
3398 | odsPrinter.printStrippedAttrOrType(getDisableNonforced()); |
3399 | } |
3400 | } |
3401 | if (!(getVectorize() == LoopVectorizeAttr())) { |
3402 | if (!_firstPrinted) odsPrinter << ", "; |
3403 | _firstPrinted = false; |
3404 | odsPrinter << "vectorize = "; |
3405 | if (!(getVectorize() == LoopVectorizeAttr())) { |
3406 | odsPrinter.printStrippedAttrOrType(getVectorize()); |
3407 | } |
3408 | } |
3409 | if (!(getInterleave() == LoopInterleaveAttr())) { |
3410 | if (!_firstPrinted) odsPrinter << ", "; |
3411 | _firstPrinted = false; |
3412 | odsPrinter << "interleave = "; |
3413 | if (!(getInterleave() == LoopInterleaveAttr())) { |
3414 | odsPrinter.printStrippedAttrOrType(getInterleave()); |
3415 | } |
3416 | } |
3417 | if (!(getUnroll() == LoopUnrollAttr())) { |
3418 | if (!_firstPrinted) odsPrinter << ", "; |
3419 | _firstPrinted = false; |
3420 | odsPrinter << "unroll = "; |
3421 | if (!(getUnroll() == LoopUnrollAttr())) { |
3422 | odsPrinter.printStrippedAttrOrType(getUnroll()); |
3423 | } |
3424 | } |
3425 | if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { |
3426 | if (!_firstPrinted) odsPrinter << ", "; |
3427 | _firstPrinted = false; |
3428 | odsPrinter << "unrollAndJam = "; |
3429 | if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { |
3430 | odsPrinter.printStrippedAttrOrType(getUnrollAndJam()); |
3431 | } |
3432 | } |
3433 | if (!(getLicm() == LoopLICMAttr())) { |
3434 | if (!_firstPrinted) odsPrinter << ", "; |
3435 | _firstPrinted = false; |
3436 | odsPrinter << "licm = "; |
3437 | if (!(getLicm() == LoopLICMAttr())) { |
3438 | odsPrinter.printStrippedAttrOrType(getLicm()); |
3439 | } |
3440 | } |
3441 | if (!(getDistribute() == LoopDistributeAttr())) { |
3442 | if (!_firstPrinted) odsPrinter << ", "; |
3443 | _firstPrinted = false; |
3444 | odsPrinter << "distribute = "; |
3445 | if (!(getDistribute() == LoopDistributeAttr())) { |
3446 | odsPrinter.printStrippedAttrOrType(getDistribute()); |
3447 | } |
3448 | } |
3449 | if (!(getPipeline() == LoopPipelineAttr())) { |
3450 | if (!_firstPrinted) odsPrinter << ", "; |
3451 | _firstPrinted = false; |
3452 | odsPrinter << "pipeline = "; |
3453 | if (!(getPipeline() == LoopPipelineAttr())) { |
3454 | odsPrinter.printStrippedAttrOrType(getPipeline()); |
3455 | } |
3456 | } |
3457 | if (!(getPeeled() == LoopPeeledAttr())) { |
3458 | if (!_firstPrinted) odsPrinter << ", "; |
3459 | _firstPrinted = false; |
3460 | odsPrinter << "peeled = "; |
3461 | if (!(getPeeled() == LoopPeeledAttr())) { |
3462 | odsPrinter.printStrippedAttrOrType(getPeeled()); |
3463 | } |
3464 | } |
3465 | if (!(getUnswitch() == LoopUnswitchAttr())) { |
3466 | if (!_firstPrinted) odsPrinter << ", "; |
3467 | _firstPrinted = false; |
3468 | odsPrinter << "unswitch = "; |
3469 | if (!(getUnswitch() == LoopUnswitchAttr())) { |
3470 | odsPrinter.printStrippedAttrOrType(getUnswitch()); |
3471 | } |
3472 | } |
3473 | if (!(getMustProgress() == BoolAttr())) { |
3474 | if (!_firstPrinted) odsPrinter << ", "; |
3475 | _firstPrinted = false; |
3476 | odsPrinter << "mustProgress = "; |
3477 | if (!(getMustProgress() == BoolAttr())) { |
3478 | odsPrinter.printStrippedAttrOrType(getMustProgress()); |
3479 | } |
3480 | } |
3481 | if (!(getIsVectorized() == BoolAttr())) { |
3482 | if (!_firstPrinted) odsPrinter << ", "; |
3483 | _firstPrinted = false; |
3484 | odsPrinter << "isVectorized = "; |
3485 | if (!(getIsVectorized() == BoolAttr())) { |
3486 | odsPrinter.printStrippedAttrOrType(getIsVectorized()); |
3487 | } |
3488 | } |
3489 | if (!(::llvm::ArrayRef<SymbolRefAttr>(getParallelAccesses()) == ::llvm::ArrayRef<SymbolRefAttr>(::llvm::SmallVector<SymbolRefAttr>()))) { |
3490 | if (!_firstPrinted) odsPrinter << ", "; |
3491 | _firstPrinted = false; |
3492 | odsPrinter << "parallelAccesses = "; |
3493 | if (!(::llvm::ArrayRef<SymbolRefAttr>(getParallelAccesses()) == ::llvm::ArrayRef<SymbolRefAttr>(::llvm::SmallVector<SymbolRefAttr>()))) { |
3494 | odsPrinter.printStrippedAttrOrType(getParallelAccesses()); |
3495 | } |
3496 | } |
3497 | } |
3498 | odsPrinter << ">"; |
3499 | } |
3500 | |
3501 | BoolAttr LoopAnnotationAttr::getDisableNonforced() const { |
3502 | return getImpl()->disableNonforced; |
3503 | } |
3504 | |
3505 | LoopVectorizeAttr LoopAnnotationAttr::getVectorize() const { |
3506 | return getImpl()->vectorize; |
3507 | } |
3508 | |
3509 | LoopInterleaveAttr LoopAnnotationAttr::getInterleave() const { |
3510 | return getImpl()->interleave; |
3511 | } |
3512 | |
3513 | LoopUnrollAttr LoopAnnotationAttr::getUnroll() const { |
3514 | return getImpl()->unroll; |
3515 | } |
3516 | |
3517 | LoopUnrollAndJamAttr LoopAnnotationAttr::getUnrollAndJam() const { |
3518 | return getImpl()->unrollAndJam; |
3519 | } |
3520 | |
3521 | LoopLICMAttr LoopAnnotationAttr::getLicm() const { |
3522 | return getImpl()->licm; |
3523 | } |
3524 | |
3525 | LoopDistributeAttr LoopAnnotationAttr::getDistribute() const { |
3526 | return getImpl()->distribute; |
3527 | } |
3528 | |
3529 | LoopPipelineAttr LoopAnnotationAttr::getPipeline() const { |
3530 | return getImpl()->pipeline; |
3531 | } |
3532 | |
3533 | LoopPeeledAttr LoopAnnotationAttr::getPeeled() const { |
3534 | return getImpl()->peeled; |
3535 | } |
3536 | |
3537 | LoopUnswitchAttr LoopAnnotationAttr::getUnswitch() const { |
3538 | return getImpl()->unswitch; |
3539 | } |
3540 | |
3541 | BoolAttr LoopAnnotationAttr::getMustProgress() const { |
3542 | return getImpl()->mustProgress; |
3543 | } |
3544 | |
3545 | BoolAttr LoopAnnotationAttr::getIsVectorized() const { |
3546 | return getImpl()->isVectorized; |
3547 | } |
3548 | |
3549 | ::llvm::ArrayRef<SymbolRefAttr> LoopAnnotationAttr::getParallelAccesses() const { |
3550 | return getImpl()->parallelAccesses; |
3551 | } |
3552 | |
3553 | } // namespace LLVM |
3554 | } // namespace mlir |
3555 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopAnnotationAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopAnnotationAttr>::id = {}; } } |
3556 | namespace mlir { |
3557 | namespace LLVM { |
3558 | namespace detail { |
3559 | struct LoopDistributeAttrStorage : public ::mlir::AttributeStorage { |
3560 | using KeyTy = std::tuple<BoolAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr>; |
3561 | LoopDistributeAttrStorage(BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) : disable(disable), followupCoincident(followupCoincident), followupSequential(followupSequential), followupFallback(followupFallback), followupAll(followupAll) {} |
3562 | |
3563 | KeyTy getAsKey() const { |
3564 | return KeyTy(disable, followupCoincident, followupSequential, followupFallback, followupAll); |
3565 | } |
3566 | |
3567 | bool operator==(const KeyTy &tblgenKey) const { |
3568 | return (disable == std::get<0>(tblgenKey)) && (followupCoincident == std::get<1>(tblgenKey)) && (followupSequential == std::get<2>(tblgenKey)) && (followupFallback == std::get<3>(tblgenKey)) && (followupAll == std::get<4>(tblgenKey)); |
3569 | } |
3570 | |
3571 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
3572 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); |
3573 | } |
3574 | |
3575 | static LoopDistributeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
3576 | auto disable = std::get<0>(tblgenKey); |
3577 | auto followupCoincident = std::get<1>(tblgenKey); |
3578 | auto followupSequential = std::get<2>(tblgenKey); |
3579 | auto followupFallback = std::get<3>(tblgenKey); |
3580 | auto followupAll = std::get<4>(tblgenKey); |
3581 | return new (allocator.allocate<LoopDistributeAttrStorage>()) LoopDistributeAttrStorage(disable, followupCoincident, followupSequential, followupFallback, followupAll); |
3582 | } |
3583 | |
3584 | BoolAttr disable; |
3585 | LoopAnnotationAttr followupCoincident; |
3586 | LoopAnnotationAttr followupSequential; |
3587 | LoopAnnotationAttr followupFallback; |
3588 | LoopAnnotationAttr followupAll; |
3589 | }; |
3590 | } // namespace detail |
3591 | LoopDistributeAttr LoopDistributeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) { |
3592 | return Base::get(context, disable, followupCoincident, followupSequential, followupFallback, followupAll); |
3593 | } |
3594 | |
3595 | ::mlir::Attribute LoopDistributeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
3596 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
3597 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
3598 | (void) odsLoc; |
3599 | ::mlir::FailureOr<BoolAttr> _result_disable; |
3600 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupCoincident; |
3601 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupSequential; |
3602 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupFallback; |
3603 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupAll; |
3604 | // Parse literal '<' |
3605 | if (odsParser.parseLess()) return {}; |
3606 | // Parse parameter struct |
3607 | bool _seen_disable = false; |
3608 | bool _seen_followupCoincident = false; |
3609 | bool _seen_followupSequential = false; |
3610 | bool _seen_followupFallback = false; |
3611 | bool _seen_followupAll = false; |
3612 | { |
3613 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
3614 | // Parse literal '=' |
3615 | if (odsParser.parseEqual()) return {}; |
3616 | if (!_seen_disable && _paramKey == "disable") { |
3617 | _seen_disable = true; |
3618 | |
3619 | // Parse variable 'disable' |
3620 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3621 | if (::mlir::failed(_result_disable)) { |
3622 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'disable' which is to be a `BoolAttr`"); |
3623 | return {}; |
3624 | } |
3625 | } else if (!_seen_followupCoincident && _paramKey == "followupCoincident") { |
3626 | _seen_followupCoincident = true; |
3627 | |
3628 | // Parse variable 'followupCoincident' |
3629 | _result_followupCoincident = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
3630 | if (::mlir::failed(_result_followupCoincident)) { |
3631 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupCoincident' which is to be a `LoopAnnotationAttr`"); |
3632 | return {}; |
3633 | } |
3634 | } else if (!_seen_followupSequential && _paramKey == "followupSequential") { |
3635 | _seen_followupSequential = true; |
3636 | |
3637 | // Parse variable 'followupSequential' |
3638 | _result_followupSequential = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
3639 | if (::mlir::failed(_result_followupSequential)) { |
3640 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupSequential' which is to be a `LoopAnnotationAttr`"); |
3641 | return {}; |
3642 | } |
3643 | } else if (!_seen_followupFallback && _paramKey == "followupFallback") { |
3644 | _seen_followupFallback = true; |
3645 | |
3646 | // Parse variable 'followupFallback' |
3647 | _result_followupFallback = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
3648 | if (::mlir::failed(_result_followupFallback)) { |
3649 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupFallback' which is to be a `LoopAnnotationAttr`"); |
3650 | return {}; |
3651 | } |
3652 | } else if (!_seen_followupAll && _paramKey == "followupAll") { |
3653 | _seen_followupAll = true; |
3654 | |
3655 | // Parse variable 'followupAll' |
3656 | _result_followupAll = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
3657 | if (::mlir::failed(_result_followupAll)) { |
3658 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); |
3659 | return {}; |
3660 | } |
3661 | } else { |
3662 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
3663 | return {}; |
3664 | } |
3665 | return true; |
3666 | }; |
3667 | ::llvm::StringRef _paramKey; |
3668 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
3669 | if (!_loop_body(_paramKey)) return {}; |
3670 | while (!odsParser.parseOptionalComma()) { |
3671 | ::llvm::StringRef _paramKey; |
3672 | if (odsParser.parseKeyword(&_paramKey)) { |
3673 | odsParser.emitError(odsParser.getCurrentLocation(), |
3674 | "expected a parameter name in struct"); |
3675 | return {}; |
3676 | } |
3677 | if (!_loop_body(_paramKey)) return {}; |
3678 | } |
3679 | } |
3680 | } |
3681 | // Parse literal '>' |
3682 | if (odsParser.parseGreater()) return {}; |
3683 | return LoopDistributeAttr::get(odsParser.getContext(), |
3684 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
3685 | LoopAnnotationAttr((_result_followupCoincident.value_or(LoopAnnotationAttr()))), |
3686 | LoopAnnotationAttr((_result_followupSequential.value_or(LoopAnnotationAttr()))), |
3687 | LoopAnnotationAttr((_result_followupFallback.value_or(LoopAnnotationAttr()))), |
3688 | LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); |
3689 | } |
3690 | |
3691 | void LoopDistributeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3692 | ::mlir::Builder odsBuilder(getContext()); |
3693 | odsPrinter << "<"; |
3694 | { |
3695 | bool _firstPrinted = true; |
3696 | if (!(getDisable() == BoolAttr())) { |
3697 | if (!_firstPrinted) odsPrinter << ", "; |
3698 | _firstPrinted = false; |
3699 | odsPrinter << "disable = "; |
3700 | if (!(getDisable() == BoolAttr())) { |
3701 | odsPrinter.printStrippedAttrOrType(getDisable()); |
3702 | } |
3703 | } |
3704 | if (!(getFollowupCoincident() == LoopAnnotationAttr())) { |
3705 | if (!_firstPrinted) odsPrinter << ", "; |
3706 | _firstPrinted = false; |
3707 | odsPrinter << "followupCoincident = "; |
3708 | if (!(getFollowupCoincident() == LoopAnnotationAttr())) { |
3709 | odsPrinter.printStrippedAttrOrType(getFollowupCoincident()); |
3710 | } |
3711 | } |
3712 | if (!(getFollowupSequential() == LoopAnnotationAttr())) { |
3713 | if (!_firstPrinted) odsPrinter << ", "; |
3714 | _firstPrinted = false; |
3715 | odsPrinter << "followupSequential = "; |
3716 | if (!(getFollowupSequential() == LoopAnnotationAttr())) { |
3717 | odsPrinter.printStrippedAttrOrType(getFollowupSequential()); |
3718 | } |
3719 | } |
3720 | if (!(getFollowupFallback() == LoopAnnotationAttr())) { |
3721 | if (!_firstPrinted) odsPrinter << ", "; |
3722 | _firstPrinted = false; |
3723 | odsPrinter << "followupFallback = "; |
3724 | if (!(getFollowupFallback() == LoopAnnotationAttr())) { |
3725 | odsPrinter.printStrippedAttrOrType(getFollowupFallback()); |
3726 | } |
3727 | } |
3728 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
3729 | if (!_firstPrinted) odsPrinter << ", "; |
3730 | _firstPrinted = false; |
3731 | odsPrinter << "followupAll = "; |
3732 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
3733 | odsPrinter.printStrippedAttrOrType(getFollowupAll()); |
3734 | } |
3735 | } |
3736 | } |
3737 | odsPrinter << ">"; |
3738 | } |
3739 | |
3740 | BoolAttr LoopDistributeAttr::getDisable() const { |
3741 | return getImpl()->disable; |
3742 | } |
3743 | |
3744 | LoopAnnotationAttr LoopDistributeAttr::getFollowupCoincident() const { |
3745 | return getImpl()->followupCoincident; |
3746 | } |
3747 | |
3748 | LoopAnnotationAttr LoopDistributeAttr::getFollowupSequential() const { |
3749 | return getImpl()->followupSequential; |
3750 | } |
3751 | |
3752 | LoopAnnotationAttr LoopDistributeAttr::getFollowupFallback() const { |
3753 | return getImpl()->followupFallback; |
3754 | } |
3755 | |
3756 | LoopAnnotationAttr LoopDistributeAttr::getFollowupAll() const { |
3757 | return getImpl()->followupAll; |
3758 | } |
3759 | |
3760 | } // namespace LLVM |
3761 | } // namespace mlir |
3762 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopDistributeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopDistributeAttr>::id = {}; } } |
3763 | namespace mlir { |
3764 | namespace LLVM { |
3765 | namespace detail { |
3766 | struct LoopInterleaveAttrStorage : public ::mlir::AttributeStorage { |
3767 | using KeyTy = std::tuple<IntegerAttr>; |
3768 | LoopInterleaveAttrStorage(IntegerAttr count) : count(count) {} |
3769 | |
3770 | KeyTy getAsKey() const { |
3771 | return KeyTy(count); |
3772 | } |
3773 | |
3774 | bool operator==(const KeyTy &tblgenKey) const { |
3775 | return (count == std::get<0>(tblgenKey)); |
3776 | } |
3777 | |
3778 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
3779 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
3780 | } |
3781 | |
3782 | static LoopInterleaveAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
3783 | auto count = std::get<0>(tblgenKey); |
3784 | return new (allocator.allocate<LoopInterleaveAttrStorage>()) LoopInterleaveAttrStorage(count); |
3785 | } |
3786 | |
3787 | IntegerAttr count; |
3788 | }; |
3789 | } // namespace detail |
3790 | LoopInterleaveAttr LoopInterleaveAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { |
3791 | return Base::get(context, count); |
3792 | } |
3793 | |
3794 | ::mlir::Attribute LoopInterleaveAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
3795 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
3796 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
3797 | (void) odsLoc; |
3798 | ::mlir::FailureOr<IntegerAttr> _result_count; |
3799 | // Parse literal '<' |
3800 | if (odsParser.parseLess()) return {}; |
3801 | // Parse parameter struct |
3802 | bool _seen_count = false; |
3803 | { |
3804 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
3805 | // Parse literal '=' |
3806 | if (odsParser.parseEqual()) return {}; |
3807 | if (!_seen_count && _paramKey == "count") { |
3808 | _seen_count = true; |
3809 | |
3810 | // Parse variable 'count' |
3811 | _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
3812 | if (::mlir::failed(_result_count)) { |
3813 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopInterleaveAttr parameter 'count' which is to be a `IntegerAttr`"); |
3814 | return {}; |
3815 | } |
3816 | } else { |
3817 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
3818 | return {}; |
3819 | } |
3820 | return true; |
3821 | }; |
3822 | for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { |
3823 | ::llvm::StringRef _paramKey; |
3824 | if (odsParser.parseKeyword(&_paramKey)) { |
3825 | odsParser.emitError(odsParser.getCurrentLocation(), |
3826 | "expected a parameter name in struct"); |
3827 | return {}; |
3828 | } |
3829 | if (!_loop_body(_paramKey)) return {}; |
3830 | if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) |
3831 | return {}; |
3832 | } |
3833 | } |
3834 | // Parse literal '>' |
3835 | if (odsParser.parseGreater()) return {}; |
3836 | 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" , 3836, __extension__ __PRETTY_FUNCTION__)); |
3837 | return LoopInterleaveAttr::get(odsParser.getContext(), |
3838 | IntegerAttr((*_result_count))); |
3839 | } |
3840 | |
3841 | void LoopInterleaveAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3842 | ::mlir::Builder odsBuilder(getContext()); |
3843 | odsPrinter << "<"; |
3844 | { |
3845 | bool _firstPrinted = true; |
3846 | if (!_firstPrinted) odsPrinter << ", "; |
3847 | _firstPrinted = false; |
3848 | odsPrinter << "count = "; |
3849 | odsPrinter.printStrippedAttrOrType(getCount()); |
3850 | } |
3851 | odsPrinter << ">"; |
3852 | } |
3853 | |
3854 | IntegerAttr LoopInterleaveAttr::getCount() const { |
3855 | return getImpl()->count; |
3856 | } |
3857 | |
3858 | } // namespace LLVM |
3859 | } // namespace mlir |
3860 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopInterleaveAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopInterleaveAttr>::id = {}; } } |
3861 | namespace mlir { |
3862 | namespace LLVM { |
3863 | namespace detail { |
3864 | struct LoopLICMAttrStorage : public ::mlir::AttributeStorage { |
3865 | using KeyTy = std::tuple<BoolAttr, BoolAttr>; |
3866 | LoopLICMAttrStorage(BoolAttr disable, BoolAttr versioningDisable) : disable(disable), versioningDisable(versioningDisable) {} |
3867 | |
3868 | KeyTy getAsKey() const { |
3869 | return KeyTy(disable, versioningDisable); |
3870 | } |
3871 | |
3872 | bool operator==(const KeyTy &tblgenKey) const { |
3873 | return (disable == std::get<0>(tblgenKey)) && (versioningDisable == std::get<1>(tblgenKey)); |
3874 | } |
3875 | |
3876 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
3877 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
3878 | } |
3879 | |
3880 | static LoopLICMAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
3881 | auto disable = std::get<0>(tblgenKey); |
3882 | auto versioningDisable = std::get<1>(tblgenKey); |
3883 | return new (allocator.allocate<LoopLICMAttrStorage>()) LoopLICMAttrStorage(disable, versioningDisable); |
3884 | } |
3885 | |
3886 | BoolAttr disable; |
3887 | BoolAttr versioningDisable; |
3888 | }; |
3889 | } // namespace detail |
3890 | LoopLICMAttr LoopLICMAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr versioningDisable) { |
3891 | return Base::get(context, disable, versioningDisable); |
3892 | } |
3893 | |
3894 | ::mlir::Attribute LoopLICMAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
3895 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
3896 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
3897 | (void) odsLoc; |
3898 | ::mlir::FailureOr<BoolAttr> _result_disable; |
3899 | ::mlir::FailureOr<BoolAttr> _result_versioningDisable; |
3900 | // Parse literal '<' |
3901 | if (odsParser.parseLess()) return {}; |
3902 | // Parse parameter struct |
3903 | bool _seen_disable = false; |
3904 | bool _seen_versioningDisable = false; |
3905 | { |
3906 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
3907 | // Parse literal '=' |
3908 | if (odsParser.parseEqual()) return {}; |
3909 | if (!_seen_disable && _paramKey == "disable") { |
3910 | _seen_disable = true; |
3911 | |
3912 | // Parse variable 'disable' |
3913 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3914 | if (::mlir::failed(_result_disable)) { |
3915 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'disable' which is to be a `BoolAttr`"); |
3916 | return {}; |
3917 | } |
3918 | } else if (!_seen_versioningDisable && _paramKey == "versioningDisable") { |
3919 | _seen_versioningDisable = true; |
3920 | |
3921 | // Parse variable 'versioningDisable' |
3922 | _result_versioningDisable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
3923 | if (::mlir::failed(_result_versioningDisable)) { |
3924 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'versioningDisable' which is to be a `BoolAttr`"); |
3925 | return {}; |
3926 | } |
3927 | } else { |
3928 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
3929 | return {}; |
3930 | } |
3931 | return true; |
3932 | }; |
3933 | ::llvm::StringRef _paramKey; |
3934 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
3935 | if (!_loop_body(_paramKey)) return {}; |
3936 | while (!odsParser.parseOptionalComma()) { |
3937 | ::llvm::StringRef _paramKey; |
3938 | if (odsParser.parseKeyword(&_paramKey)) { |
3939 | odsParser.emitError(odsParser.getCurrentLocation(), |
3940 | "expected a parameter name in struct"); |
3941 | return {}; |
3942 | } |
3943 | if (!_loop_body(_paramKey)) return {}; |
3944 | } |
3945 | } |
3946 | } |
3947 | // Parse literal '>' |
3948 | if (odsParser.parseGreater()) return {}; |
3949 | return LoopLICMAttr::get(odsParser.getContext(), |
3950 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
3951 | BoolAttr((_result_versioningDisable.value_or(BoolAttr())))); |
3952 | } |
3953 | |
3954 | void LoopLICMAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
3955 | ::mlir::Builder odsBuilder(getContext()); |
3956 | odsPrinter << "<"; |
3957 | { |
3958 | bool _firstPrinted = true; |
3959 | if (!(getDisable() == BoolAttr())) { |
3960 | if (!_firstPrinted) odsPrinter << ", "; |
3961 | _firstPrinted = false; |
3962 | odsPrinter << "disable = "; |
3963 | if (!(getDisable() == BoolAttr())) { |
3964 | odsPrinter.printStrippedAttrOrType(getDisable()); |
3965 | } |
3966 | } |
3967 | if (!(getVersioningDisable() == BoolAttr())) { |
3968 | if (!_firstPrinted) odsPrinter << ", "; |
3969 | _firstPrinted = false; |
3970 | odsPrinter << "versioningDisable = "; |
3971 | if (!(getVersioningDisable() == BoolAttr())) { |
3972 | odsPrinter.printStrippedAttrOrType(getVersioningDisable()); |
3973 | } |
3974 | } |
3975 | } |
3976 | odsPrinter << ">"; |
3977 | } |
3978 | |
3979 | BoolAttr LoopLICMAttr::getDisable() const { |
3980 | return getImpl()->disable; |
3981 | } |
3982 | |
3983 | BoolAttr LoopLICMAttr::getVersioningDisable() const { |
3984 | return getImpl()->versioningDisable; |
3985 | } |
3986 | |
3987 | } // namespace LLVM |
3988 | } // namespace mlir |
3989 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopLICMAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopLICMAttr>::id = {}; } } |
3990 | namespace mlir { |
3991 | namespace LLVM { |
3992 | namespace detail { |
3993 | struct LoopPeeledAttrStorage : public ::mlir::AttributeStorage { |
3994 | using KeyTy = std::tuple<IntegerAttr>; |
3995 | LoopPeeledAttrStorage(IntegerAttr count) : count(count) {} |
3996 | |
3997 | KeyTy getAsKey() const { |
3998 | return KeyTy(count); |
3999 | } |
4000 | |
4001 | bool operator==(const KeyTy &tblgenKey) const { |
4002 | return (count == std::get<0>(tblgenKey)); |
4003 | } |
4004 | |
4005 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4006 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
4007 | } |
4008 | |
4009 | static LoopPeeledAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4010 | auto count = std::get<0>(tblgenKey); |
4011 | return new (allocator.allocate<LoopPeeledAttrStorage>()) LoopPeeledAttrStorage(count); |
4012 | } |
4013 | |
4014 | IntegerAttr count; |
4015 | }; |
4016 | } // namespace detail |
4017 | LoopPeeledAttr LoopPeeledAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { |
4018 | return Base::get(context, count); |
4019 | } |
4020 | |
4021 | ::mlir::Attribute LoopPeeledAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4022 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4023 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4024 | (void) odsLoc; |
4025 | ::mlir::FailureOr<IntegerAttr> _result_count; |
4026 | // Parse literal '<' |
4027 | if (odsParser.parseLess()) return {}; |
4028 | // Parse parameter struct |
4029 | bool _seen_count = false; |
4030 | { |
4031 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4032 | // Parse literal '=' |
4033 | if (odsParser.parseEqual()) return {}; |
4034 | if (!_seen_count && _paramKey == "count") { |
4035 | _seen_count = true; |
4036 | |
4037 | // Parse variable 'count' |
4038 | _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
4039 | if (::mlir::failed(_result_count)) { |
4040 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPeeledAttr parameter 'count' which is to be a `IntegerAttr`"); |
4041 | return {}; |
4042 | } |
4043 | } else { |
4044 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4045 | return {}; |
4046 | } |
4047 | return true; |
4048 | }; |
4049 | ::llvm::StringRef _paramKey; |
4050 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4051 | if (!_loop_body(_paramKey)) return {}; |
4052 | while (!odsParser.parseOptionalComma()) { |
4053 | ::llvm::StringRef _paramKey; |
4054 | if (odsParser.parseKeyword(&_paramKey)) { |
4055 | odsParser.emitError(odsParser.getCurrentLocation(), |
4056 | "expected a parameter name in struct"); |
4057 | return {}; |
4058 | } |
4059 | if (!_loop_body(_paramKey)) return {}; |
4060 | } |
4061 | } |
4062 | } |
4063 | // Parse literal '>' |
4064 | if (odsParser.parseGreater()) return {}; |
4065 | return LoopPeeledAttr::get(odsParser.getContext(), |
4066 | IntegerAttr((_result_count.value_or(IntegerAttr())))); |
4067 | } |
4068 | |
4069 | void LoopPeeledAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
4070 | ::mlir::Builder odsBuilder(getContext()); |
4071 | odsPrinter << "<"; |
4072 | { |
4073 | bool _firstPrinted = true; |
4074 | if (!(getCount() == IntegerAttr())) { |
4075 | if (!_firstPrinted) odsPrinter << ", "; |
4076 | _firstPrinted = false; |
4077 | odsPrinter << "count = "; |
4078 | if (!(getCount() == IntegerAttr())) { |
4079 | odsPrinter.printStrippedAttrOrType(getCount()); |
4080 | } |
4081 | } |
4082 | } |
4083 | odsPrinter << ">"; |
4084 | } |
4085 | |
4086 | IntegerAttr LoopPeeledAttr::getCount() const { |
4087 | return getImpl()->count; |
4088 | } |
4089 | |
4090 | } // namespace LLVM |
4091 | } // namespace mlir |
4092 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPeeledAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopPeeledAttr>::id = {}; } } |
4093 | namespace mlir { |
4094 | namespace LLVM { |
4095 | namespace detail { |
4096 | struct LoopPipelineAttrStorage : public ::mlir::AttributeStorage { |
4097 | using KeyTy = std::tuple<BoolAttr, IntegerAttr>; |
4098 | LoopPipelineAttrStorage(BoolAttr disable, IntegerAttr initiationinterval) : disable(disable), initiationinterval(initiationinterval) {} |
4099 | |
4100 | KeyTy getAsKey() const { |
4101 | return KeyTy(disable, initiationinterval); |
4102 | } |
4103 | |
4104 | bool operator==(const KeyTy &tblgenKey) const { |
4105 | return (disable == std::get<0>(tblgenKey)) && (initiationinterval == std::get<1>(tblgenKey)); |
4106 | } |
4107 | |
4108 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4109 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
4110 | } |
4111 | |
4112 | static LoopPipelineAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4113 | auto disable = std::get<0>(tblgenKey); |
4114 | auto initiationinterval = std::get<1>(tblgenKey); |
4115 | return new (allocator.allocate<LoopPipelineAttrStorage>()) LoopPipelineAttrStorage(disable, initiationinterval); |
4116 | } |
4117 | |
4118 | BoolAttr disable; |
4119 | IntegerAttr initiationinterval; |
4120 | }; |
4121 | } // namespace detail |
4122 | LoopPipelineAttr LoopPipelineAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr initiationinterval) { |
4123 | return Base::get(context, disable, initiationinterval); |
4124 | } |
4125 | |
4126 | ::mlir::Attribute LoopPipelineAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4127 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4128 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4129 | (void) odsLoc; |
4130 | ::mlir::FailureOr<BoolAttr> _result_disable; |
4131 | ::mlir::FailureOr<IntegerAttr> _result_initiationinterval; |
4132 | // Parse literal '<' |
4133 | if (odsParser.parseLess()) return {}; |
4134 | // Parse parameter struct |
4135 | bool _seen_disable = false; |
4136 | bool _seen_initiationinterval = false; |
4137 | { |
4138 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4139 | // Parse literal '=' |
4140 | if (odsParser.parseEqual()) return {}; |
4141 | if (!_seen_disable && _paramKey == "disable") { |
4142 | _seen_disable = true; |
4143 | |
4144 | // Parse variable 'disable' |
4145 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4146 | if (::mlir::failed(_result_disable)) { |
4147 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'disable' which is to be a `BoolAttr`"); |
4148 | return {}; |
4149 | } |
4150 | } else if (!_seen_initiationinterval && _paramKey == "initiationinterval") { |
4151 | _seen_initiationinterval = true; |
4152 | |
4153 | // Parse variable 'initiationinterval' |
4154 | _result_initiationinterval = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
4155 | if (::mlir::failed(_result_initiationinterval)) { |
4156 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'initiationinterval' which is to be a `IntegerAttr`"); |
4157 | return {}; |
4158 | } |
4159 | } else { |
4160 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4161 | return {}; |
4162 | } |
4163 | return true; |
4164 | }; |
4165 | ::llvm::StringRef _paramKey; |
4166 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4167 | if (!_loop_body(_paramKey)) return {}; |
4168 | while (!odsParser.parseOptionalComma()) { |
4169 | ::llvm::StringRef _paramKey; |
4170 | if (odsParser.parseKeyword(&_paramKey)) { |
4171 | odsParser.emitError(odsParser.getCurrentLocation(), |
4172 | "expected a parameter name in struct"); |
4173 | return {}; |
4174 | } |
4175 | if (!_loop_body(_paramKey)) return {}; |
4176 | } |
4177 | } |
4178 | } |
4179 | // Parse literal '>' |
4180 | if (odsParser.parseGreater()) return {}; |
4181 | return LoopPipelineAttr::get(odsParser.getContext(), |
4182 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
4183 | IntegerAttr((_result_initiationinterval.value_or(IntegerAttr())))); |
4184 | } |
4185 | |
4186 | void LoopPipelineAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
4187 | ::mlir::Builder odsBuilder(getContext()); |
4188 | odsPrinter << "<"; |
4189 | { |
4190 | bool _firstPrinted = true; |
4191 | if (!(getDisable() == BoolAttr())) { |
4192 | if (!_firstPrinted) odsPrinter << ", "; |
4193 | _firstPrinted = false; |
4194 | odsPrinter << "disable = "; |
4195 | if (!(getDisable() == BoolAttr())) { |
4196 | odsPrinter.printStrippedAttrOrType(getDisable()); |
4197 | } |
4198 | } |
4199 | if (!(getInitiationinterval() == IntegerAttr())) { |
4200 | if (!_firstPrinted) odsPrinter << ", "; |
4201 | _firstPrinted = false; |
4202 | odsPrinter << "initiationinterval = "; |
4203 | if (!(getInitiationinterval() == IntegerAttr())) { |
4204 | odsPrinter.printStrippedAttrOrType(getInitiationinterval()); |
4205 | } |
4206 | } |
4207 | } |
4208 | odsPrinter << ">"; |
4209 | } |
4210 | |
4211 | BoolAttr LoopPipelineAttr::getDisable() const { |
4212 | return getImpl()->disable; |
4213 | } |
4214 | |
4215 | IntegerAttr LoopPipelineAttr::getInitiationinterval() const { |
4216 | return getImpl()->initiationinterval; |
4217 | } |
4218 | |
4219 | } // namespace LLVM |
4220 | } // namespace mlir |
4221 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPipelineAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopPipelineAttr>::id = {}; } } |
4222 | namespace mlir { |
4223 | namespace LLVM { |
4224 | namespace detail { |
4225 | struct LoopUnrollAndJamAttrStorage : public ::mlir::AttributeStorage { |
4226 | using KeyTy = std::tuple<BoolAttr, IntegerAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr>; |
4227 | LoopUnrollAndJamAttrStorage(BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) : disable(disable), count(count), followupOuter(followupOuter), followupInner(followupInner), followupRemainderOuter(followupRemainderOuter), followupRemainderInner(followupRemainderInner), followupAll(followupAll) {} |
4228 | |
4229 | KeyTy getAsKey() const { |
4230 | return KeyTy(disable, count, followupOuter, followupInner, followupRemainderOuter, followupRemainderInner, followupAll); |
4231 | } |
4232 | |
4233 | bool operator==(const KeyTy &tblgenKey) const { |
4234 | return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (followupOuter == std::get<2>(tblgenKey)) && (followupInner == std::get<3>(tblgenKey)) && (followupRemainderOuter == std::get<4>(tblgenKey)) && (followupRemainderInner == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); |
4235 | } |
4236 | |
4237 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4238 | 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)); |
4239 | } |
4240 | |
4241 | static LoopUnrollAndJamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4242 | auto disable = std::get<0>(tblgenKey); |
4243 | auto count = std::get<1>(tblgenKey); |
4244 | auto followupOuter = std::get<2>(tblgenKey); |
4245 | auto followupInner = std::get<3>(tblgenKey); |
4246 | auto followupRemainderOuter = std::get<4>(tblgenKey); |
4247 | auto followupRemainderInner = std::get<5>(tblgenKey); |
4248 | auto followupAll = std::get<6>(tblgenKey); |
4249 | return new (allocator.allocate<LoopUnrollAndJamAttrStorage>()) LoopUnrollAndJamAttrStorage(disable, count, followupOuter, followupInner, followupRemainderOuter, followupRemainderInner, followupAll); |
4250 | } |
4251 | |
4252 | BoolAttr disable; |
4253 | IntegerAttr count; |
4254 | LoopAnnotationAttr followupOuter; |
4255 | LoopAnnotationAttr followupInner; |
4256 | LoopAnnotationAttr followupRemainderOuter; |
4257 | LoopAnnotationAttr followupRemainderInner; |
4258 | LoopAnnotationAttr followupAll; |
4259 | }; |
4260 | } // namespace detail |
4261 | LoopUnrollAndJamAttr LoopUnrollAndJamAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) { |
4262 | return Base::get(context, disable, count, followupOuter, followupInner, followupRemainderOuter, followupRemainderInner, followupAll); |
4263 | } |
4264 | |
4265 | ::mlir::Attribute LoopUnrollAndJamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4266 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4267 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4268 | (void) odsLoc; |
4269 | ::mlir::FailureOr<BoolAttr> _result_disable; |
4270 | ::mlir::FailureOr<IntegerAttr> _result_count; |
4271 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupOuter; |
4272 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupInner; |
4273 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupRemainderOuter; |
4274 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupRemainderInner; |
4275 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupAll; |
4276 | // Parse literal '<' |
4277 | if (odsParser.parseLess()) return {}; |
4278 | // Parse parameter struct |
4279 | bool _seen_disable = false; |
4280 | bool _seen_count = false; |
4281 | bool _seen_followupOuter = false; |
4282 | bool _seen_followupInner = false; |
4283 | bool _seen_followupRemainderOuter = false; |
4284 | bool _seen_followupRemainderInner = false; |
4285 | bool _seen_followupAll = false; |
4286 | { |
4287 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4288 | // Parse literal '=' |
4289 | if (odsParser.parseEqual()) return {}; |
4290 | if (!_seen_disable && _paramKey == "disable") { |
4291 | _seen_disable = true; |
4292 | |
4293 | // Parse variable 'disable' |
4294 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4295 | if (::mlir::failed(_result_disable)) { |
4296 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'disable' which is to be a `BoolAttr`"); |
4297 | return {}; |
4298 | } |
4299 | } else if (!_seen_count && _paramKey == "count") { |
4300 | _seen_count = true; |
4301 | |
4302 | // Parse variable 'count' |
4303 | _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
4304 | if (::mlir::failed(_result_count)) { |
4305 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'count' which is to be a `IntegerAttr`"); |
4306 | return {}; |
4307 | } |
4308 | } else if (!_seen_followupOuter && _paramKey == "followupOuter") { |
4309 | _seen_followupOuter = true; |
4310 | |
4311 | // Parse variable 'followupOuter' |
4312 | _result_followupOuter = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4313 | if (::mlir::failed(_result_followupOuter)) { |
4314 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupOuter' which is to be a `LoopAnnotationAttr`"); |
4315 | return {}; |
4316 | } |
4317 | } else if (!_seen_followupInner && _paramKey == "followupInner") { |
4318 | _seen_followupInner = true; |
4319 | |
4320 | // Parse variable 'followupInner' |
4321 | _result_followupInner = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4322 | if (::mlir::failed(_result_followupInner)) { |
4323 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupInner' which is to be a `LoopAnnotationAttr`"); |
4324 | return {}; |
4325 | } |
4326 | } else if (!_seen_followupRemainderOuter && _paramKey == "followupRemainderOuter") { |
4327 | _seen_followupRemainderOuter = true; |
4328 | |
4329 | // Parse variable 'followupRemainderOuter' |
4330 | _result_followupRemainderOuter = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4331 | if (::mlir::failed(_result_followupRemainderOuter)) { |
4332 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderOuter' which is to be a `LoopAnnotationAttr`"); |
4333 | return {}; |
4334 | } |
4335 | } else if (!_seen_followupRemainderInner && _paramKey == "followupRemainderInner") { |
4336 | _seen_followupRemainderInner = true; |
4337 | |
4338 | // Parse variable 'followupRemainderInner' |
4339 | _result_followupRemainderInner = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4340 | if (::mlir::failed(_result_followupRemainderInner)) { |
4341 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderInner' which is to be a `LoopAnnotationAttr`"); |
4342 | return {}; |
4343 | } |
4344 | } else if (!_seen_followupAll && _paramKey == "followupAll") { |
4345 | _seen_followupAll = true; |
4346 | |
4347 | // Parse variable 'followupAll' |
4348 | _result_followupAll = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4349 | if (::mlir::failed(_result_followupAll)) { |
4350 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); |
4351 | return {}; |
4352 | } |
4353 | } else { |
4354 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4355 | return {}; |
4356 | } |
4357 | return true; |
4358 | }; |
4359 | ::llvm::StringRef _paramKey; |
4360 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4361 | if (!_loop_body(_paramKey)) return {}; |
4362 | while (!odsParser.parseOptionalComma()) { |
4363 | ::llvm::StringRef _paramKey; |
4364 | if (odsParser.parseKeyword(&_paramKey)) { |
4365 | odsParser.emitError(odsParser.getCurrentLocation(), |
4366 | "expected a parameter name in struct"); |
4367 | return {}; |
4368 | } |
4369 | if (!_loop_body(_paramKey)) return {}; |
4370 | } |
4371 | } |
4372 | } |
4373 | // Parse literal '>' |
4374 | if (odsParser.parseGreater()) return {}; |
4375 | return LoopUnrollAndJamAttr::get(odsParser.getContext(), |
4376 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
4377 | IntegerAttr((_result_count.value_or(IntegerAttr()))), |
4378 | LoopAnnotationAttr((_result_followupOuter.value_or(LoopAnnotationAttr()))), |
4379 | LoopAnnotationAttr((_result_followupInner.value_or(LoopAnnotationAttr()))), |
4380 | LoopAnnotationAttr((_result_followupRemainderOuter.value_or(LoopAnnotationAttr()))), |
4381 | LoopAnnotationAttr((_result_followupRemainderInner.value_or(LoopAnnotationAttr()))), |
4382 | LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); |
4383 | } |
4384 | |
4385 | void LoopUnrollAndJamAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
4386 | ::mlir::Builder odsBuilder(getContext()); |
4387 | odsPrinter << "<"; |
4388 | { |
4389 | bool _firstPrinted = true; |
4390 | if (!(getDisable() == BoolAttr())) { |
4391 | if (!_firstPrinted) odsPrinter << ", "; |
4392 | _firstPrinted = false; |
4393 | odsPrinter << "disable = "; |
4394 | if (!(getDisable() == BoolAttr())) { |
4395 | odsPrinter.printStrippedAttrOrType(getDisable()); |
4396 | } |
4397 | } |
4398 | if (!(getCount() == IntegerAttr())) { |
4399 | if (!_firstPrinted) odsPrinter << ", "; |
4400 | _firstPrinted = false; |
4401 | odsPrinter << "count = "; |
4402 | if (!(getCount() == IntegerAttr())) { |
4403 | odsPrinter.printStrippedAttrOrType(getCount()); |
4404 | } |
4405 | } |
4406 | if (!(getFollowupOuter() == LoopAnnotationAttr())) { |
4407 | if (!_firstPrinted) odsPrinter << ", "; |
4408 | _firstPrinted = false; |
4409 | odsPrinter << "followupOuter = "; |
4410 | if (!(getFollowupOuter() == LoopAnnotationAttr())) { |
4411 | odsPrinter.printStrippedAttrOrType(getFollowupOuter()); |
4412 | } |
4413 | } |
4414 | if (!(getFollowupInner() == LoopAnnotationAttr())) { |
4415 | if (!_firstPrinted) odsPrinter << ", "; |
4416 | _firstPrinted = false; |
4417 | odsPrinter << "followupInner = "; |
4418 | if (!(getFollowupInner() == LoopAnnotationAttr())) { |
4419 | odsPrinter.printStrippedAttrOrType(getFollowupInner()); |
4420 | } |
4421 | } |
4422 | if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { |
4423 | if (!_firstPrinted) odsPrinter << ", "; |
4424 | _firstPrinted = false; |
4425 | odsPrinter << "followupRemainderOuter = "; |
4426 | if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { |
4427 | odsPrinter.printStrippedAttrOrType(getFollowupRemainderOuter()); |
4428 | } |
4429 | } |
4430 | if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { |
4431 | if (!_firstPrinted) odsPrinter << ", "; |
4432 | _firstPrinted = false; |
4433 | odsPrinter << "followupRemainderInner = "; |
4434 | if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { |
4435 | odsPrinter.printStrippedAttrOrType(getFollowupRemainderInner()); |
4436 | } |
4437 | } |
4438 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
4439 | if (!_firstPrinted) odsPrinter << ", "; |
4440 | _firstPrinted = false; |
4441 | odsPrinter << "followupAll = "; |
4442 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
4443 | odsPrinter.printStrippedAttrOrType(getFollowupAll()); |
4444 | } |
4445 | } |
4446 | } |
4447 | odsPrinter << ">"; |
4448 | } |
4449 | |
4450 | BoolAttr LoopUnrollAndJamAttr::getDisable() const { |
4451 | return getImpl()->disable; |
4452 | } |
4453 | |
4454 | IntegerAttr LoopUnrollAndJamAttr::getCount() const { |
4455 | return getImpl()->count; |
4456 | } |
4457 | |
4458 | LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupOuter() const { |
4459 | return getImpl()->followupOuter; |
4460 | } |
4461 | |
4462 | LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupInner() const { |
4463 | return getImpl()->followupInner; |
4464 | } |
4465 | |
4466 | LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderOuter() const { |
4467 | return getImpl()->followupRemainderOuter; |
4468 | } |
4469 | |
4470 | LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderInner() const { |
4471 | return getImpl()->followupRemainderInner; |
4472 | } |
4473 | |
4474 | LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupAll() const { |
4475 | return getImpl()->followupAll; |
4476 | } |
4477 | |
4478 | } // namespace LLVM |
4479 | } // namespace mlir |
4480 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAndJamAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopUnrollAndJamAttr>::id = {}; } } |
4481 | namespace mlir { |
4482 | namespace LLVM { |
4483 | namespace detail { |
4484 | struct LoopUnrollAttrStorage : public ::mlir::AttributeStorage { |
4485 | using KeyTy = std::tuple<BoolAttr, IntegerAttr, BoolAttr, BoolAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr>; |
4486 | LoopUnrollAttrStorage(BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) : disable(disable), count(count), runtimeDisable(runtimeDisable), full(full), followupUnrolled(followupUnrolled), followupRemainder(followupRemainder), followupAll(followupAll) {} |
4487 | |
4488 | KeyTy getAsKey() const { |
4489 | return KeyTy(disable, count, runtimeDisable, full, followupUnrolled, followupRemainder, followupAll); |
4490 | } |
4491 | |
4492 | bool operator==(const KeyTy &tblgenKey) const { |
4493 | return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (runtimeDisable == std::get<2>(tblgenKey)) && (full == std::get<3>(tblgenKey)) && (followupUnrolled == std::get<4>(tblgenKey)) && (followupRemainder == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); |
4494 | } |
4495 | |
4496 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4497 | 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)); |
4498 | } |
4499 | |
4500 | static LoopUnrollAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4501 | auto disable = std::get<0>(tblgenKey); |
4502 | auto count = std::get<1>(tblgenKey); |
4503 | auto runtimeDisable = std::get<2>(tblgenKey); |
4504 | auto full = std::get<3>(tblgenKey); |
4505 | auto followupUnrolled = std::get<4>(tblgenKey); |
4506 | auto followupRemainder = std::get<5>(tblgenKey); |
4507 | auto followupAll = std::get<6>(tblgenKey); |
4508 | return new (allocator.allocate<LoopUnrollAttrStorage>()) LoopUnrollAttrStorage(disable, count, runtimeDisable, full, followupUnrolled, followupRemainder, followupAll); |
4509 | } |
4510 | |
4511 | BoolAttr disable; |
4512 | IntegerAttr count; |
4513 | BoolAttr runtimeDisable; |
4514 | BoolAttr full; |
4515 | LoopAnnotationAttr followupUnrolled; |
4516 | LoopAnnotationAttr followupRemainder; |
4517 | LoopAnnotationAttr followupAll; |
4518 | }; |
4519 | } // namespace detail |
4520 | LoopUnrollAttr LoopUnrollAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) { |
4521 | return Base::get(context, disable, count, runtimeDisable, full, followupUnrolled, followupRemainder, followupAll); |
4522 | } |
4523 | |
4524 | ::mlir::Attribute LoopUnrollAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4525 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4526 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4527 | (void) odsLoc; |
4528 | ::mlir::FailureOr<BoolAttr> _result_disable; |
4529 | ::mlir::FailureOr<IntegerAttr> _result_count; |
4530 | ::mlir::FailureOr<BoolAttr> _result_runtimeDisable; |
4531 | ::mlir::FailureOr<BoolAttr> _result_full; |
4532 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupUnrolled; |
4533 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupRemainder; |
4534 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupAll; |
4535 | // Parse literal '<' |
4536 | if (odsParser.parseLess()) return {}; |
4537 | // Parse parameter struct |
4538 | bool _seen_disable = false; |
4539 | bool _seen_count = false; |
4540 | bool _seen_runtimeDisable = false; |
4541 | bool _seen_full = false; |
4542 | bool _seen_followupUnrolled = false; |
4543 | bool _seen_followupRemainder = false; |
4544 | bool _seen_followupAll = false; |
4545 | { |
4546 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4547 | // Parse literal '=' |
4548 | if (odsParser.parseEqual()) return {}; |
4549 | if (!_seen_disable && _paramKey == "disable") { |
4550 | _seen_disable = true; |
4551 | |
4552 | // Parse variable 'disable' |
4553 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4554 | if (::mlir::failed(_result_disable)) { |
4555 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'disable' which is to be a `BoolAttr`"); |
4556 | return {}; |
4557 | } |
4558 | } else if (!_seen_count && _paramKey == "count") { |
4559 | _seen_count = true; |
4560 | |
4561 | // Parse variable 'count' |
4562 | _result_count = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
4563 | if (::mlir::failed(_result_count)) { |
4564 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'count' which is to be a `IntegerAttr`"); |
4565 | return {}; |
4566 | } |
4567 | } else if (!_seen_runtimeDisable && _paramKey == "runtimeDisable") { |
4568 | _seen_runtimeDisable = true; |
4569 | |
4570 | // Parse variable 'runtimeDisable' |
4571 | _result_runtimeDisable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4572 | if (::mlir::failed(_result_runtimeDisable)) { |
4573 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'runtimeDisable' which is to be a `BoolAttr`"); |
4574 | return {}; |
4575 | } |
4576 | } else if (!_seen_full && _paramKey == "full") { |
4577 | _seen_full = true; |
4578 | |
4579 | // Parse variable 'full' |
4580 | _result_full = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4581 | if (::mlir::failed(_result_full)) { |
4582 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'full' which is to be a `BoolAttr`"); |
4583 | return {}; |
4584 | } |
4585 | } else if (!_seen_followupUnrolled && _paramKey == "followupUnrolled") { |
4586 | _seen_followupUnrolled = true; |
4587 | |
4588 | // Parse variable 'followupUnrolled' |
4589 | _result_followupUnrolled = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4590 | if (::mlir::failed(_result_followupUnrolled)) { |
4591 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupUnrolled' which is to be a `LoopAnnotationAttr`"); |
4592 | return {}; |
4593 | } |
4594 | } else if (!_seen_followupRemainder && _paramKey == "followupRemainder") { |
4595 | _seen_followupRemainder = true; |
4596 | |
4597 | // Parse variable 'followupRemainder' |
4598 | _result_followupRemainder = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4599 | if (::mlir::failed(_result_followupRemainder)) { |
4600 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupRemainder' which is to be a `LoopAnnotationAttr`"); |
4601 | return {}; |
4602 | } |
4603 | } else if (!_seen_followupAll && _paramKey == "followupAll") { |
4604 | _seen_followupAll = true; |
4605 | |
4606 | // Parse variable 'followupAll' |
4607 | _result_followupAll = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4608 | if (::mlir::failed(_result_followupAll)) { |
4609 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); |
4610 | return {}; |
4611 | } |
4612 | } else { |
4613 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4614 | return {}; |
4615 | } |
4616 | return true; |
4617 | }; |
4618 | ::llvm::StringRef _paramKey; |
4619 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4620 | if (!_loop_body(_paramKey)) return {}; |
4621 | while (!odsParser.parseOptionalComma()) { |
4622 | ::llvm::StringRef _paramKey; |
4623 | if (odsParser.parseKeyword(&_paramKey)) { |
4624 | odsParser.emitError(odsParser.getCurrentLocation(), |
4625 | "expected a parameter name in struct"); |
4626 | return {}; |
4627 | } |
4628 | if (!_loop_body(_paramKey)) return {}; |
4629 | } |
4630 | } |
4631 | } |
4632 | // Parse literal '>' |
4633 | if (odsParser.parseGreater()) return {}; |
4634 | return LoopUnrollAttr::get(odsParser.getContext(), |
4635 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
4636 | IntegerAttr((_result_count.value_or(IntegerAttr()))), |
4637 | BoolAttr((_result_runtimeDisable.value_or(BoolAttr()))), |
4638 | BoolAttr((_result_full.value_or(BoolAttr()))), |
4639 | LoopAnnotationAttr((_result_followupUnrolled.value_or(LoopAnnotationAttr()))), |
4640 | LoopAnnotationAttr((_result_followupRemainder.value_or(LoopAnnotationAttr()))), |
4641 | LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); |
4642 | } |
4643 | |
4644 | void LoopUnrollAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
4645 | ::mlir::Builder odsBuilder(getContext()); |
4646 | odsPrinter << "<"; |
4647 | { |
4648 | bool _firstPrinted = true; |
4649 | if (!(getDisable() == BoolAttr())) { |
4650 | if (!_firstPrinted) odsPrinter << ", "; |
4651 | _firstPrinted = false; |
4652 | odsPrinter << "disable = "; |
4653 | if (!(getDisable() == BoolAttr())) { |
4654 | odsPrinter.printStrippedAttrOrType(getDisable()); |
4655 | } |
4656 | } |
4657 | if (!(getCount() == IntegerAttr())) { |
4658 | if (!_firstPrinted) odsPrinter << ", "; |
4659 | _firstPrinted = false; |
4660 | odsPrinter << "count = "; |
4661 | if (!(getCount() == IntegerAttr())) { |
4662 | odsPrinter.printStrippedAttrOrType(getCount()); |
4663 | } |
4664 | } |
4665 | if (!(getRuntimeDisable() == BoolAttr())) { |
4666 | if (!_firstPrinted) odsPrinter << ", "; |
4667 | _firstPrinted = false; |
4668 | odsPrinter << "runtimeDisable = "; |
4669 | if (!(getRuntimeDisable() == BoolAttr())) { |
4670 | odsPrinter.printStrippedAttrOrType(getRuntimeDisable()); |
4671 | } |
4672 | } |
4673 | if (!(getFull() == BoolAttr())) { |
4674 | if (!_firstPrinted) odsPrinter << ", "; |
4675 | _firstPrinted = false; |
4676 | odsPrinter << "full = "; |
4677 | if (!(getFull() == BoolAttr())) { |
4678 | odsPrinter.printStrippedAttrOrType(getFull()); |
4679 | } |
4680 | } |
4681 | if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { |
4682 | if (!_firstPrinted) odsPrinter << ", "; |
4683 | _firstPrinted = false; |
4684 | odsPrinter << "followupUnrolled = "; |
4685 | if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { |
4686 | odsPrinter.printStrippedAttrOrType(getFollowupUnrolled()); |
4687 | } |
4688 | } |
4689 | if (!(getFollowupRemainder() == LoopAnnotationAttr())) { |
4690 | if (!_firstPrinted) odsPrinter << ", "; |
4691 | _firstPrinted = false; |
4692 | odsPrinter << "followupRemainder = "; |
4693 | if (!(getFollowupRemainder() == LoopAnnotationAttr())) { |
4694 | odsPrinter.printStrippedAttrOrType(getFollowupRemainder()); |
4695 | } |
4696 | } |
4697 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
4698 | if (!_firstPrinted) odsPrinter << ", "; |
4699 | _firstPrinted = false; |
4700 | odsPrinter << "followupAll = "; |
4701 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
4702 | odsPrinter.printStrippedAttrOrType(getFollowupAll()); |
4703 | } |
4704 | } |
4705 | } |
4706 | odsPrinter << ">"; |
4707 | } |
4708 | |
4709 | BoolAttr LoopUnrollAttr::getDisable() const { |
4710 | return getImpl()->disable; |
4711 | } |
4712 | |
4713 | IntegerAttr LoopUnrollAttr::getCount() const { |
4714 | return getImpl()->count; |
4715 | } |
4716 | |
4717 | BoolAttr LoopUnrollAttr::getRuntimeDisable() const { |
4718 | return getImpl()->runtimeDisable; |
4719 | } |
4720 | |
4721 | BoolAttr LoopUnrollAttr::getFull() const { |
4722 | return getImpl()->full; |
4723 | } |
4724 | |
4725 | LoopAnnotationAttr LoopUnrollAttr::getFollowupUnrolled() const { |
4726 | return getImpl()->followupUnrolled; |
4727 | } |
4728 | |
4729 | LoopAnnotationAttr LoopUnrollAttr::getFollowupRemainder() const { |
4730 | return getImpl()->followupRemainder; |
4731 | } |
4732 | |
4733 | LoopAnnotationAttr LoopUnrollAttr::getFollowupAll() const { |
4734 | return getImpl()->followupAll; |
4735 | } |
4736 | |
4737 | } // namespace LLVM |
4738 | } // namespace mlir |
4739 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopUnrollAttr>::id = {}; } } |
4740 | namespace mlir { |
4741 | namespace LLVM { |
4742 | namespace detail { |
4743 | struct LoopUnswitchAttrStorage : public ::mlir::AttributeStorage { |
4744 | using KeyTy = std::tuple<BoolAttr>; |
4745 | LoopUnswitchAttrStorage(BoolAttr partialDisable) : partialDisable(partialDisable) {} |
4746 | |
4747 | KeyTy getAsKey() const { |
4748 | return KeyTy(partialDisable); |
4749 | } |
4750 | |
4751 | bool operator==(const KeyTy &tblgenKey) const { |
4752 | return (partialDisable == std::get<0>(tblgenKey)); |
4753 | } |
4754 | |
4755 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4756 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
4757 | } |
4758 | |
4759 | static LoopUnswitchAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4760 | auto partialDisable = std::get<0>(tblgenKey); |
4761 | return new (allocator.allocate<LoopUnswitchAttrStorage>()) LoopUnswitchAttrStorage(partialDisable); |
4762 | } |
4763 | |
4764 | BoolAttr partialDisable; |
4765 | }; |
4766 | } // namespace detail |
4767 | LoopUnswitchAttr LoopUnswitchAttr::get(::mlir::MLIRContext *context, BoolAttr partialDisable) { |
4768 | return Base::get(context, partialDisable); |
4769 | } |
4770 | |
4771 | ::mlir::Attribute LoopUnswitchAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4772 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4773 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4774 | (void) odsLoc; |
4775 | ::mlir::FailureOr<BoolAttr> _result_partialDisable; |
4776 | // Parse literal '<' |
4777 | if (odsParser.parseLess()) return {}; |
4778 | // Parse parameter struct |
4779 | bool _seen_partialDisable = false; |
4780 | { |
4781 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4782 | // Parse literal '=' |
4783 | if (odsParser.parseEqual()) return {}; |
4784 | if (!_seen_partialDisable && _paramKey == "partialDisable") { |
4785 | _seen_partialDisable = true; |
4786 | |
4787 | // Parse variable 'partialDisable' |
4788 | _result_partialDisable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4789 | if (::mlir::failed(_result_partialDisable)) { |
4790 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnswitchAttr parameter 'partialDisable' which is to be a `BoolAttr`"); |
4791 | return {}; |
4792 | } |
4793 | } else { |
4794 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4795 | return {}; |
4796 | } |
4797 | return true; |
4798 | }; |
4799 | ::llvm::StringRef _paramKey; |
4800 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4801 | if (!_loop_body(_paramKey)) return {}; |
4802 | while (!odsParser.parseOptionalComma()) { |
4803 | ::llvm::StringRef _paramKey; |
4804 | if (odsParser.parseKeyword(&_paramKey)) { |
4805 | odsParser.emitError(odsParser.getCurrentLocation(), |
4806 | "expected a parameter name in struct"); |
4807 | return {}; |
4808 | } |
4809 | if (!_loop_body(_paramKey)) return {}; |
4810 | } |
4811 | } |
4812 | } |
4813 | // Parse literal '>' |
4814 | if (odsParser.parseGreater()) return {}; |
4815 | return LoopUnswitchAttr::get(odsParser.getContext(), |
4816 | BoolAttr((_result_partialDisable.value_or(BoolAttr())))); |
4817 | } |
4818 | |
4819 | void LoopUnswitchAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
4820 | ::mlir::Builder odsBuilder(getContext()); |
4821 | odsPrinter << "<"; |
4822 | { |
4823 | bool _firstPrinted = true; |
4824 | if (!(getPartialDisable() == BoolAttr())) { |
4825 | if (!_firstPrinted) odsPrinter << ", "; |
4826 | _firstPrinted = false; |
4827 | odsPrinter << "partialDisable = "; |
4828 | if (!(getPartialDisable() == BoolAttr())) { |
4829 | odsPrinter.printStrippedAttrOrType(getPartialDisable()); |
4830 | } |
4831 | } |
4832 | } |
4833 | odsPrinter << ">"; |
4834 | } |
4835 | |
4836 | BoolAttr LoopUnswitchAttr::getPartialDisable() const { |
4837 | return getImpl()->partialDisable; |
4838 | } |
4839 | |
4840 | } // namespace LLVM |
4841 | } // namespace mlir |
4842 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnswitchAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopUnswitchAttr>::id = {}; } } |
4843 | namespace mlir { |
4844 | namespace LLVM { |
4845 | namespace detail { |
4846 | struct LoopVectorizeAttrStorage : public ::mlir::AttributeStorage { |
4847 | using KeyTy = std::tuple<BoolAttr, BoolAttr, BoolAttr, IntegerAttr, LoopAnnotationAttr, LoopAnnotationAttr, LoopAnnotationAttr>; |
4848 | LoopVectorizeAttrStorage(BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) : disable(disable), predicateEnable(predicateEnable), scalableEnable(scalableEnable), width(width), followupVectorized(followupVectorized), followupEpilogue(followupEpilogue), followupAll(followupAll) {} |
4849 | |
4850 | KeyTy getAsKey() const { |
4851 | return KeyTy(disable, predicateEnable, scalableEnable, width, followupVectorized, followupEpilogue, followupAll); |
4852 | } |
4853 | |
4854 | bool operator==(const KeyTy &tblgenKey) const { |
4855 | return (disable == std::get<0>(tblgenKey)) && (predicateEnable == std::get<1>(tblgenKey)) && (scalableEnable == std::get<2>(tblgenKey)) && (width == std::get<3>(tblgenKey)) && (followupVectorized == std::get<4>(tblgenKey)) && (followupEpilogue == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); |
4856 | } |
4857 | |
4858 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
4859 | 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)); |
4860 | } |
4861 | |
4862 | static LoopVectorizeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, const KeyTy &tblgenKey) { |
4863 | auto disable = std::get<0>(tblgenKey); |
4864 | auto predicateEnable = std::get<1>(tblgenKey); |
4865 | auto scalableEnable = std::get<2>(tblgenKey); |
4866 | auto width = std::get<3>(tblgenKey); |
4867 | auto followupVectorized = std::get<4>(tblgenKey); |
4868 | auto followupEpilogue = std::get<5>(tblgenKey); |
4869 | auto followupAll = std::get<6>(tblgenKey); |
4870 | return new (allocator.allocate<LoopVectorizeAttrStorage>()) LoopVectorizeAttrStorage(disable, predicateEnable, scalableEnable, width, followupVectorized, followupEpilogue, followupAll); |
4871 | } |
4872 | |
4873 | BoolAttr disable; |
4874 | BoolAttr predicateEnable; |
4875 | BoolAttr scalableEnable; |
4876 | IntegerAttr width; |
4877 | LoopAnnotationAttr followupVectorized; |
4878 | LoopAnnotationAttr followupEpilogue; |
4879 | LoopAnnotationAttr followupAll; |
4880 | }; |
4881 | } // namespace detail |
4882 | LoopVectorizeAttr LoopVectorizeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) { |
4883 | return Base::get(context, disable, predicateEnable, scalableEnable, width, followupVectorized, followupEpilogue, followupAll); |
4884 | } |
4885 | |
4886 | ::mlir::Attribute LoopVectorizeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
4887 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
4888 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
4889 | (void) odsLoc; |
4890 | ::mlir::FailureOr<BoolAttr> _result_disable; |
4891 | ::mlir::FailureOr<BoolAttr> _result_predicateEnable; |
4892 | ::mlir::FailureOr<BoolAttr> _result_scalableEnable; |
4893 | ::mlir::FailureOr<IntegerAttr> _result_width; |
4894 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupVectorized; |
4895 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupEpilogue; |
4896 | ::mlir::FailureOr<LoopAnnotationAttr> _result_followupAll; |
4897 | // Parse literal '<' |
4898 | if (odsParser.parseLess()) return {}; |
4899 | // Parse parameter struct |
4900 | bool _seen_disable = false; |
4901 | bool _seen_predicateEnable = false; |
4902 | bool _seen_scalableEnable = false; |
4903 | bool _seen_width = false; |
4904 | bool _seen_followupVectorized = false; |
4905 | bool _seen_followupEpilogue = false; |
4906 | bool _seen_followupAll = false; |
4907 | { |
4908 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
4909 | // Parse literal '=' |
4910 | if (odsParser.parseEqual()) return {}; |
4911 | if (!_seen_disable && _paramKey == "disable") { |
4912 | _seen_disable = true; |
4913 | |
4914 | // Parse variable 'disable' |
4915 | _result_disable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4916 | if (::mlir::failed(_result_disable)) { |
4917 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'disable' which is to be a `BoolAttr`"); |
4918 | return {}; |
4919 | } |
4920 | } else if (!_seen_predicateEnable && _paramKey == "predicateEnable") { |
4921 | _seen_predicateEnable = true; |
4922 | |
4923 | // Parse variable 'predicateEnable' |
4924 | _result_predicateEnable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4925 | if (::mlir::failed(_result_predicateEnable)) { |
4926 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'predicateEnable' which is to be a `BoolAttr`"); |
4927 | return {}; |
4928 | } |
4929 | } else if (!_seen_scalableEnable && _paramKey == "scalableEnable") { |
4930 | _seen_scalableEnable = true; |
4931 | |
4932 | // Parse variable 'scalableEnable' |
4933 | _result_scalableEnable = ::mlir::FieldParser<BoolAttr>::parse(odsParser); |
4934 | if (::mlir::failed(_result_scalableEnable)) { |
4935 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'scalableEnable' which is to be a `BoolAttr`"); |
4936 | return {}; |
4937 | } |
4938 | } else if (!_seen_width && _paramKey == "width") { |
4939 | _seen_width = true; |
4940 | |
4941 | // Parse variable 'width' |
4942 | _result_width = ::mlir::FieldParser<IntegerAttr>::parse(odsParser); |
4943 | if (::mlir::failed(_result_width)) { |
4944 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'width' which is to be a `IntegerAttr`"); |
4945 | return {}; |
4946 | } |
4947 | } else if (!_seen_followupVectorized && _paramKey == "followupVectorized") { |
4948 | _seen_followupVectorized = true; |
4949 | |
4950 | // Parse variable 'followupVectorized' |
4951 | _result_followupVectorized = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4952 | if (::mlir::failed(_result_followupVectorized)) { |
4953 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupVectorized' which is to be a `LoopAnnotationAttr`"); |
4954 | return {}; |
4955 | } |
4956 | } else if (!_seen_followupEpilogue && _paramKey == "followupEpilogue") { |
4957 | _seen_followupEpilogue = true; |
4958 | |
4959 | // Parse variable 'followupEpilogue' |
4960 | _result_followupEpilogue = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4961 | if (::mlir::failed(_result_followupEpilogue)) { |
4962 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupEpilogue' which is to be a `LoopAnnotationAttr`"); |
4963 | return {}; |
4964 | } |
4965 | } else if (!_seen_followupAll && _paramKey == "followupAll") { |
4966 | _seen_followupAll = true; |
4967 | |
4968 | // Parse variable 'followupAll' |
4969 | _result_followupAll = ::mlir::FieldParser<LoopAnnotationAttr>::parse(odsParser); |
4970 | if (::mlir::failed(_result_followupAll)) { |
4971 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); |
4972 | return {}; |
4973 | } |
4974 | } else { |
4975 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; |
4976 | return {}; |
4977 | } |
4978 | return true; |
4979 | }; |
4980 | ::llvm::StringRef _paramKey; |
4981 | if (!odsParser.parseOptionalKeyword(&_paramKey)) { |
4982 | if (!_loop_body(_paramKey)) return {}; |
4983 | while (!odsParser.parseOptionalComma()) { |
4984 | ::llvm::StringRef _paramKey; |
4985 | if (odsParser.parseKeyword(&_paramKey)) { |
4986 | odsParser.emitError(odsParser.getCurrentLocation(), |
4987 | "expected a parameter name in struct"); |
4988 | return {}; |
4989 | } |
4990 | if (!_loop_body(_paramKey)) return {}; |
4991 | } |
4992 | } |
4993 | } |
4994 | // Parse literal '>' |
4995 | if (odsParser.parseGreater()) return {}; |
4996 | return LoopVectorizeAttr::get(odsParser.getContext(), |
4997 | BoolAttr((_result_disable.value_or(BoolAttr()))), |
4998 | BoolAttr((_result_predicateEnable.value_or(BoolAttr()))), |
4999 | BoolAttr((_result_scalableEnable.value_or(BoolAttr()))), |
5000 | IntegerAttr((_result_width.value_or(IntegerAttr()))), |
5001 | LoopAnnotationAttr((_result_followupVectorized.value_or(LoopAnnotationAttr()))), |
5002 | LoopAnnotationAttr((_result_followupEpilogue.value_or(LoopAnnotationAttr()))), |
5003 | LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); |
5004 | } |
5005 | |
5006 | void LoopVectorizeAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
5007 | ::mlir::Builder odsBuilder(getContext()); |
5008 | odsPrinter << "<"; |
5009 | { |
5010 | bool _firstPrinted = true; |
5011 | if (!(getDisable() == BoolAttr())) { |
5012 | if (!_firstPrinted) odsPrinter << ", "; |
5013 | _firstPrinted = false; |
5014 | odsPrinter << "disable = "; |
5015 | if (!(getDisable() == BoolAttr())) { |
5016 | odsPrinter.printStrippedAttrOrType(getDisable()); |
5017 | } |
5018 | } |
5019 | if (!(getPredicateEnable() == BoolAttr())) { |
5020 | if (!_firstPrinted) odsPrinter << ", "; |
5021 | _firstPrinted = false; |
5022 | odsPrinter << "predicateEnable = "; |
5023 | if (!(getPredicateEnable() == BoolAttr())) { |
5024 | odsPrinter.printStrippedAttrOrType(getPredicateEnable()); |
5025 | } |
5026 | } |
5027 | if (!(getScalableEnable() == BoolAttr())) { |
5028 | if (!_firstPrinted) odsPrinter << ", "; |
5029 | _firstPrinted = false; |
5030 | odsPrinter << "scalableEnable = "; |
5031 | if (!(getScalableEnable() == BoolAttr())) { |
5032 | odsPrinter.printStrippedAttrOrType(getScalableEnable()); |
5033 | } |
5034 | } |
5035 | if (!(getWidth() == IntegerAttr())) { |
5036 | if (!_firstPrinted) odsPrinter << ", "; |
5037 | _firstPrinted = false; |
5038 | odsPrinter << "width = "; |
5039 | if (!(getWidth() == IntegerAttr())) { |
5040 | odsPrinter.printStrippedAttrOrType(getWidth()); |
5041 | } |
5042 | } |
5043 | if (!(getFollowupVectorized() == LoopAnnotationAttr())) { |
5044 | if (!_firstPrinted) odsPrinter << ", "; |
5045 | _firstPrinted = false; |
5046 | odsPrinter << "followupVectorized = "; |
5047 | if (!(getFollowupVectorized() == LoopAnnotationAttr())) { |
5048 | odsPrinter.printStrippedAttrOrType(getFollowupVectorized()); |
5049 | } |
5050 | } |
5051 | if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { |
5052 | if (!_firstPrinted) odsPrinter << ", "; |
5053 | _firstPrinted = false; |
5054 | odsPrinter << "followupEpilogue = "; |
5055 | if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { |
5056 | odsPrinter.printStrippedAttrOrType(getFollowupEpilogue()); |
5057 | } |
5058 | } |
5059 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
5060 | if (!_firstPrinted) odsPrinter << ", "; |
5061 | _firstPrinted = false; |
5062 | odsPrinter << "followupAll = "; |
5063 | if (!(getFollowupAll() == LoopAnnotationAttr())) { |
5064 | odsPrinter.printStrippedAttrOrType(getFollowupAll()); |
5065 | } |
5066 | } |
5067 | } |
5068 | odsPrinter << ">"; |
5069 | } |
5070 | |
5071 | BoolAttr LoopVectorizeAttr::getDisable() const { |
5072 | return getImpl()->disable; |
5073 | } |
5074 | |
5075 | BoolAttr LoopVectorizeAttr::getPredicateEnable() const { |
5076 | return getImpl()->predicateEnable; |
5077 | } |
5078 | |
5079 | BoolAttr LoopVectorizeAttr::getScalableEnable() const { |
5080 | return getImpl()->scalableEnable; |
5081 | } |
5082 | |
5083 | IntegerAttr LoopVectorizeAttr::getWidth() const { |
5084 | return getImpl()->width; |
5085 | } |
5086 | |
5087 | LoopAnnotationAttr LoopVectorizeAttr::getFollowupVectorized() const { |
5088 | return getImpl()->followupVectorized; |
5089 | } |
5090 | |
5091 | LoopAnnotationAttr LoopVectorizeAttr::getFollowupEpilogue() const { |
5092 | return getImpl()->followupEpilogue; |
5093 | } |
5094 | |
5095 | LoopAnnotationAttr LoopVectorizeAttr::getFollowupAll() const { |
5096 | return getImpl()->followupAll; |
5097 | } |
5098 | |
5099 | } // namespace LLVM |
5100 | } // namespace mlir |
5101 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopVectorizeAttr)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver < ::mlir::LLVM::LoopVectorizeAttr>::id = {}; } } |
5102 | namespace mlir { |
5103 | namespace LLVM { |
5104 | |
5105 | /// Parse an attribute registered to this dialect. |
5106 | ::mlir::Attribute LLVMDialect::parseAttribute(::mlir::DialectAsmParser &parser, |
5107 | ::mlir::Type type) const { |
5108 | ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); |
5109 | ::llvm::StringRef attrTag; |
5110 | { |
5111 | ::mlir::Attribute attr; |
5112 | auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); |
5113 | if (parseResult.has_value()) |
5114 | return attr; |
5115 | } |
5116 | |
5117 | parser.emitError(typeLoc) << "unknown attribute `" |
5118 | << attrTag << "` in dialect `" << getNamespace() << "`"; |
5119 | return {}; |
5120 | } |
5121 | /// Print an attribute registered to this dialect. |
5122 | void LLVMDialect::printAttribute(::mlir::Attribute attr, |
5123 | ::mlir::DialectAsmPrinter &printer) const { |
5124 | if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) |
5125 | return; |
5126 | |
5127 | } |
5128 | } // namespace LLVM |
5129 | } // namespace mlir |
5130 | |
5131 | #endif // GET_ATTRDEF_CLASSES |
5132 |