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