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