LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#ifdef GET_OP_LIST
11#undef GET_OP_LIST
12
18#endif // GET_OP_LIST
19
20#ifdef GET_OP_CLASSES
21#undef GET_OP_CLASSES
22
23
24//===----------------------------------------------------------------------===//
25// Local Utility Method Definitions
26//===----------------------------------------------------------------------===//
27
28namespace llzk {
29namespace component {
30
31static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
32 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
33 unsigned valueIndex) {
34 if (!((::llvm::isa<::llzk::component::StructType>(type)))) {
35 return op->emitOpError(valueKind) << " #" << valueIndex
36 << " must be circuit component, but got " << type;
37 }
38 return ::mlir::success();
39}
40
41static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
42 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
43 unsigned valueIndex) {
44 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
45 return op->emitOpError(valueKind) << " #" << valueIndex
46 << " must be variadic of index, but got " << type;
47 }
48 return ::mlir::success();
49}
50
51static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
52 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
53 unsigned valueIndex) {
54 if (!((::llzk::isValidType(type)))) {
55 return op->emitOpError(valueKind) << " #" << valueIndex
56 << " must be a valid LLZK type, but got " << type;
57 }
58 return ::mlir::success();
59}
60
61static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
62 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
63 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
64 return emitError() << "attribute '" << attrName
65 << "' failed to satisfy constraint: string attribute";
66 return ::mlir::success();
67}
68static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
69 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
70 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
71 return op->emitOpError();
72 });
73}
74
75static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
76 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
77 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llzk::isValidType(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
78 return emitError() << "attribute '" << attrName
79 << "' failed to satisfy constraint: type attribute of a valid LLZK type";
80 return ::mlir::success();
81}
82static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
83 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
84 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
85 return op->emitOpError();
86 });
87}
88
89static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
90 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
91 if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
92 return emitError() << "attribute '" << attrName
93 << "' failed to satisfy constraint: unit attribute";
94 return ::mlir::success();
95}
96static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
97 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
98 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
99 return op->emitOpError();
100 });
101}
102
103static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
104 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
105 if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
106 return emitError() << "attribute '" << attrName
107 << "' failed to satisfy constraint: flat symbol reference attribute";
108 return ::mlir::success();
109}
110static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
111 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
112 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
113 return op->emitOpError();
114 });
115}
116
117static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
118 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
119 if (attr && !(((::llvm::isa<::mlir::SymbolRefAttr>(attr))) || (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType())))) || ((::llvm::isa<::mlir::AffineMapAttr>(attr)))))
120 return emitError() << "attribute '" << attrName
121 << "' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute";
122 return ::mlir::success();
123}
124static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
125 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
126 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
127 return op->emitOpError();
128 });
129}
130
131static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
132 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
133 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
134 return emitError() << "attribute '" << attrName
135 << "' failed to satisfy constraint: i32 dense array attribute";
136 return ::mlir::success();
137}
138static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
139 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
140 return __mlir_ods_local_attr_constraint_Ops6(attr, attrName, [op]() {
141 return op->emitOpError();
142 });
143}
144
145static ::llvm::LogicalResult __mlir_ods_local_region_constraint_Ops1(
146 ::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
147 unsigned regionIndex) {
148 if (!((::llvm::hasNItems(region, 1)))) {
149 return op->emitOpError("region #") << regionIndex
150 << (regionName.empty() ? " " : " ('" + regionName + "') ")
151 << "failed to verify constraint: region with 1 blocks";
152 }
153 return ::mlir::success();
154}
155} // namespace component
156} // namespace llzk
157namespace llzk {
158namespace component {
159
160//===----------------------------------------------------------------------===//
161// ::llzk::component::CreateStructOp definitions
162//===----------------------------------------------------------------------===//
163
164namespace detail {
165} // namespace detail
167
168::llvm::LogicalResult CreateStructOpAdaptor::verify(::mlir::Location loc) {
169 return ::mlir::success();
170}
171
172void CreateStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) {
173 odsState.addTypes(result);
174}
175
176void CreateStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
177 assert(resultTypes.size() == 1u && "mismatched number of results");
178 odsState.addTypes(resultTypes);
179}
180
181void CreateStructOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
182 assert(operands.size() == 0u && "mismatched number of parameters");
183 odsState.addOperands(operands);
184 odsState.addAttributes(attributes);
185 assert(resultTypes.size() == 1u && "mismatched number of return types");
186 odsState.addTypes(resultTypes);
187}
188
190 {
191 unsigned index = 0; (void)index;
192 auto valueGroup0 = getODSResults(0);
193
194 for (auto v : valueGroup0) {
195 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
196 return ::mlir::failure();
197 }
198 }
199 return ::mlir::success();
200}
201
202::llvm::LogicalResult CreateStructOp::verifyInvariants() {
203 return verifyInvariantsImpl();
204}
205
206::mlir::ParseResult CreateStructOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
207 ::mlir::Type resultRawType{};
208 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
209 if (parser.parseColon())
210 return ::mlir::failure();
211
212 {
214 if (parser.parseCustomTypeWithFallback(type))
215 return ::mlir::failure();
216 resultRawType = type;
217 }
218 {
219 auto loc = parser.getCurrentLocation();(void)loc;
220 if (parser.parseOptionalAttrDict(result.attributes))
221 return ::mlir::failure();
222 }
223 result.addTypes(resultTypes);
224 return ::mlir::success();
225}
226
227void CreateStructOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
228 _odsPrinter << ' ' << ":";
229 _odsPrinter << ' ';
230 {
231 auto type = getResult().getType();
232 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
233 _odsPrinter.printStrippedAttrOrType(validType);
234 else
235 _odsPrinter << type;
236 }
237 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
238 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
239}
240
241} // namespace component
242} // namespace llzk
243MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::CreateStructOp)
244
245namespace llzk {
246namespace component {
247
248//===----------------------------------------------------------------------===//
249// ::llzk::component::MemberDefOp definitions
250//===----------------------------------------------------------------------===//
251
252namespace detail {
253MemberDefOpGenericAdaptorBase::MemberDefOpGenericAdaptorBase(MemberDefOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
254
256 auto attr = getSymNameAttr();
257 return attr.getValue();
258}
259
261 auto attr = getTypeAttr();
262 return ::llvm::cast<::mlir::Type>(attr.getValue());
263}
264
266 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().column);
267 if (!attr)
268 attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
269 return attr;
270}
271
273 auto attr = getColumnAttr();
274 if (!attr)
275 return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
276 return attr != nullptr;
277}
278
280 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().signal);
281 if (!attr)
282 attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
283 return attr;
284}
285
287 auto attr = getSignalAttr();
288 if (!attr)
289 return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
290 return attr != nullptr;
291}
292
293} // namespace detail
295
296::llvm::LogicalResult MemberDefOpAdaptor::verify(::mlir::Location loc) {
297 auto tblgen_column = getProperties().column; (void)tblgen_column;
298 auto tblgen_signal = getProperties().signal; (void)tblgen_signal;
299 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
300 if (!tblgen_sym_name) return emitError(loc, "'struct.member' op ""requires attribute 'sym_name'");
301 auto tblgen_type = getProperties().type; (void)tblgen_type;
302 if (!tblgen_type) return emitError(loc, "'struct.member' op ""requires attribute 'type'");
303
304 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
305 return emitError(loc, "'struct.member' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
306
307 if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((::llzk::isValidType(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue())))))
308 return emitError(loc, "'struct.member' op ""attribute 'type' failed to satisfy constraint: type attribute of a valid LLZK type");
309
310 if (tblgen_column && !((::llvm::isa<::mlir::UnitAttr>(tblgen_column))))
311 return emitError(loc, "'struct.member' op ""attribute 'column' failed to satisfy constraint: unit attribute");
312
313 if (tblgen_signal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_signal))))
314 return emitError(loc, "'struct.member' op ""attribute 'signal' failed to satisfy constraint: unit attribute");
315 return ::mlir::success();
316}
317
318::llvm::LogicalResult MemberDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
319 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
320 if (!dict) {
321 emitError() << "expected DictionaryAttr to set properties";
322 return ::mlir::failure();
323 }
324
325 {
326 auto &propStorage = prop.column;
327 auto attr = dict.get("column");
328 if (attr) {
329 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
330 if (convertedAttr) {
331 propStorage = convertedAttr;
332 } else {
333 emitError() << "Invalid attribute `column` in property conversion: " << attr;
334 return ::mlir::failure();
335 }
336 }
337 }
338
339 {
340 auto &propStorage = prop.signal;
341 auto attr = dict.get("signal");
342 if (attr) {
343 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
344 if (convertedAttr) {
345 propStorage = convertedAttr;
346 } else {
347 emitError() << "Invalid attribute `signal` in property conversion: " << attr;
348 return ::mlir::failure();
349 }
350 }
351 }
352
353 {
354 auto &propStorage = prop.sym_name;
355 auto attr = dict.get("sym_name");
356 if (attr) {
357 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
358 if (convertedAttr) {
359 propStorage = convertedAttr;
360 } else {
361 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
362 return ::mlir::failure();
363 }
364 }
365 }
366
367 {
368 auto &propStorage = prop.type;
369 auto attr = dict.get("type");
370 if (attr) {
371 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
372 if (convertedAttr) {
373 propStorage = convertedAttr;
374 } else {
375 emitError() << "Invalid attribute `type` in property conversion: " << attr;
376 return ::mlir::failure();
377 }
378 }
379 }
380 return ::mlir::success();
381}
382
383::mlir::Attribute MemberDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
384 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
385 ::mlir::Builder odsBuilder{ctx};
386
387 {
388 const auto &propStorage = prop.column;
389 if (propStorage)
390 attrs.push_back(odsBuilder.getNamedAttr("column",
391 propStorage));
392 }
393
394 {
395 const auto &propStorage = prop.signal;
396 if (propStorage)
397 attrs.push_back(odsBuilder.getNamedAttr("signal",
398 propStorage));
399 }
400
401 {
402 const auto &propStorage = prop.sym_name;
403 if (propStorage)
404 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
405 propStorage));
406 }
407
408 {
409 const auto &propStorage = prop.type;
410 if (propStorage)
411 attrs.push_back(odsBuilder.getNamedAttr("type",
412 propStorage));
413 }
414
415 if (!attrs.empty())
416 return odsBuilder.getDictionaryAttr(attrs);
417 return {};
418}
419
420llvm::hash_code MemberDefOp::computePropertiesHash(const Properties &prop) {
421 return llvm::hash_combine(
422 llvm::hash_value(prop.column.getAsOpaquePointer()),
423 llvm::hash_value(prop.signal.getAsOpaquePointer()),
424 llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
425 llvm::hash_value(prop.type.getAsOpaquePointer()));
426}
427
428std::optional<mlir::Attribute> MemberDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
429 if (name == "column")
430 return prop.column;
431
432 if (name == "signal")
433 return prop.signal;
434
435 if (name == "sym_name")
436 return prop.sym_name;
437
438 if (name == "type")
439 return prop.type;
440 return std::nullopt;
441}
442
443void MemberDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
444 if (name == "column") {
445 prop.column = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.column)>>(value);
446 return;
447 }
448
449 if (name == "signal") {
450 prop.signal = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.signal)>>(value);
451 return;
452 }
453
454 if (name == "sym_name") {
455 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
456 return;
457 }
458
459 if (name == "type") {
460 prop.type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.type)>>(value);
461 return;
462 }
463}
464
465void MemberDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
466 if (prop.column) attrs.append("column", prop.column);
467
468 if (prop.signal) attrs.append("signal", prop.signal);
469
470 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
471
472 if (prop.type) attrs.append("type", prop.type);
473}
474
475::llvm::LogicalResult MemberDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
476 {
477 ::mlir::Attribute attr = attrs.get(getColumnAttrName(opName));
478 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "column", emitError)))
479 return ::mlir::failure();
480 }
481
482 {
483 ::mlir::Attribute attr = attrs.get(getSignalAttrName(opName));
484 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "signal", emitError)))
485 return ::mlir::failure();
486 }
487
488 {
489 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
490 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "sym_name", emitError)))
491 return ::mlir::failure();
492 }
493
494 {
495 ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName));
496 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "type", emitError)))
497 return ::mlir::failure();
498 }
499 return ::mlir::success();
500}
501
502::llvm::LogicalResult MemberDefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
503 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
504 if (::mlir::failed(reader.readOptionalAttribute(prop.column)))
505 return ::mlir::failure();
506
507 if (::mlir::failed(reader.readOptionalAttribute(prop.signal)))
508 return ::mlir::failure();
509
510 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
511 return ::mlir::failure();
512
513 if (::mlir::failed(reader.readAttribute(prop.type)))
514 return ::mlir::failure();
515 return ::mlir::success();
516}
517
518void MemberDefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
519 auto &prop = getProperties(); (void)prop;
520
521 writer.writeOptionalAttribute(prop.column);
522
523 writer.writeOptionalAttribute(prop.signal);
524 writer.writeAttribute(prop.sym_name);
525 writer.writeAttribute(prop.type);
526}
527
528::llvm::StringRef MemberDefOp::getSymName() {
529 auto attr = getSymNameAttr();
530 return attr.getValue();
531}
532
533::mlir::Type MemberDefOp::getType() {
534 auto attr = getTypeAttr();
535 return ::llvm::cast<::mlir::Type>(attr.getValue());
536}
537
539 auto attr = getColumnAttr();
540 if (!attr)
541 return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
542 return attr != nullptr;
543}
544
546 auto attr = getSignalAttr();
547 if (!attr)
548 return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
549 return attr != nullptr;
550}
551
552void MemberDefOp::setSymName(::llvm::StringRef attrValue) {
553 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
554}
555
556void MemberDefOp::setType(::mlir::Type attrValue) {
557 getProperties().type = ::mlir::TypeAttr::get(attrValue);
558}
559
560void MemberDefOp::setColumn(bool attrValue) {
561 auto &odsProp = getProperties().column;
562 if (attrValue)
563 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
564 else
565 odsProp = nullptr;
566}
567
568void MemberDefOp::setSignal(bool attrValue) {
569 auto &odsProp = getProperties().signal;
570 if (attrValue)
571 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
572 else
573 odsProp = nullptr;
574}
575
576void MemberDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, bool isSignal, bool isColumn) {
577 build(odsBuilder, odsState, {}, {}, attributes, isSignal, isColumn);
578}
579
580::llvm::LogicalResult MemberDefOp::verifyInvariantsImpl() {
581 auto tblgen_column = getProperties().column; (void)tblgen_column;
582 auto tblgen_signal = getProperties().signal; (void)tblgen_signal;
583 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
584 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
585 auto tblgen_type = getProperties().type; (void)tblgen_type;
586 if (!tblgen_type) return emitOpError("requires attribute 'type'");
587
588 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_sym_name, "sym_name")))
589 return ::mlir::failure();
590
591 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_type, "type")))
592 return ::mlir::failure();
593
594 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_column, "column")))
595 return ::mlir::failure();
596
597 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_signal, "signal")))
598 return ::mlir::failure();
599 return ::mlir::success();
600}
601
602::llvm::LogicalResult MemberDefOp::verifyInvariants() {
603 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
604 return ::mlir::success();
605 return ::mlir::failure();
606}
607
608::mlir::ParseResult MemberDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
609 ::mlir::StringAttr sym_nameAttr;
610 ::mlir::TypeAttr typeAttr;
611
612 if (parser.parseSymbolName(sym_nameAttr))
613 return ::mlir::failure();
614 if (sym_nameAttr) result.getOrAddProperties<MemberDefOp::Properties>().sym_name = sym_nameAttr;
615 if (parser.parseColon())
616 return ::mlir::failure();
617
618 if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
619 return ::mlir::failure();
620 }
621 if (typeAttr) result.getOrAddProperties<MemberDefOp::Properties>().type = typeAttr;
622 {
623 auto loc = parser.getCurrentLocation();(void)loc;
624 if (parser.parseOptionalAttrDict(result.attributes))
625 return ::mlir::failure();
626 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
627 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
628 })))
629 return ::mlir::failure();
630 }
631 return ::mlir::success();
632}
633
634void MemberDefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
635 _odsPrinter << ' ';
636 _odsPrinter.printSymbolName(getSymNameAttr().getValue());
637 _odsPrinter << ' ' << ":";
638 _odsPrinter << ' ';
639 _odsPrinter.printAttributeWithoutType(getTypeAttr());
640 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
641 elidedAttrs.push_back("sym_name");
642 elidedAttrs.push_back("type");
643 {
644 ::mlir::Builder odsBuilder(getContext());
645 ::mlir::Attribute attr = getColumnAttr();
646 if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
647 elidedAttrs.push_back("column");
648 }
649 {
650 ::mlir::Builder odsBuilder(getContext());
651 ::mlir::Attribute attr = getSignalAttr();
652 if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
653 elidedAttrs.push_back("signal");
654 }
655 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
656}
657
658} // namespace component
659} // namespace llzk
660MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::MemberDefOp)
661
662namespace llzk {
663namespace component {
664
665//===----------------------------------------------------------------------===//
666// ::llzk::component::MemberReadOp definitions
667//===----------------------------------------------------------------------===//
668
669namespace detail {
670MemberReadOpGenericAdaptorBase::MemberReadOpGenericAdaptorBase(MemberReadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
671
672std::pair<unsigned, unsigned> MemberReadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
673 bool isVariadic[] = {false, true};
674 int prevVariadicCount = 0;
675 for (unsigned i = 0; i < index; ++i)
676 if (isVariadic[i]) ++prevVariadicCount;
677
678 // Calculate how many dynamic values a static variadic operand corresponds to.
679 // This assumes all static variadic operands have the same dynamic value count.
680 int variadicSize = (odsOperandsSize - 1) / 1;
681 // `index` passed in as the parameter is the static index which counts each
682 // operand (variadic or not) as size 1. So here for each previous static variadic
683 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
684 // value pack for this static operand starts.
685 int start = index + (variadicSize - 1) * prevVariadicCount;
686 int size = isVariadic[index] ? variadicSize : 1;
687 return {start, size};
688}
689
691 auto attr = getMemberNameAttr();
692 return attr.getValue();
693}
694
695::std::optional<::mlir::Attribute> MemberReadOpGenericAdaptorBase::getTableOffset() {
696 auto attr = getTableOffsetAttr();
697 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
698}
699
701 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
702 return attr;
703}
704
706 auto attr = getNumDimsPerMapAttr();
707 return attr;
708}
709
711 auto attr = getMapOpGroupSizesAttr();
712 return attr;
713}
714
715} // namespace detail
717
718::llvm::LogicalResult MemberReadOpAdaptor::verify(::mlir::Location loc) {
719 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
720 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'struct.readm' op ""requires attribute 'mapOpGroupSizes'");
721 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
722 if (!tblgen_member_name) return emitError(loc, "'struct.readm' op ""requires attribute 'member_name'");
723 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
724 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
725
726 if (tblgen_member_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_member_name))))
727 return emitError(loc, "'struct.readm' op ""attribute 'member_name' failed to satisfy constraint: flat symbol reference attribute");
728
729 if (tblgen_tableOffset && !(((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_tableOffset))) || (((::llvm::isa<::mlir::IntegerAttr>(tblgen_tableOffset))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_tableOffset).getType())))) || ((::llvm::isa<::mlir::AffineMapAttr>(tblgen_tableOffset)))))
730 return emitError(loc, "'struct.readm' op ""attribute 'tableOffset' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute");
731
732 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
733 return emitError(loc, "'struct.readm' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
734
735 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
736 return emitError(loc, "'struct.readm' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
737 return ::mlir::success();
738}
739
740std::pair<unsigned, unsigned> MemberReadOp::getODSOperandIndexAndLength(unsigned index) {
741 bool isVariadic[] = {false, true};
742 int prevVariadicCount = 0;
743 for (unsigned i = 0; i < index; ++i)
744 if (isVariadic[i]) ++prevVariadicCount;
745
746 // Calculate how many dynamic values a static variadic operand corresponds to.
747 // This assumes all static variadic operands have the same dynamic value count.
748 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
749 // `index` passed in as the parameter is the static index which counts each
750 // operand (variadic or not) as size 1. So here for each previous static variadic
751 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
752 // value pack for this static operand starts.
753 int start = index + (variadicSize - 1) * prevVariadicCount;
754 int size = isVariadic[index] ? variadicSize : 1;
755 return {start, size};
756}
757
758::mlir::MutableOperandRangeRange MemberReadOp::getMapOperandsMutable() {
759 auto range = getODSOperandIndexAndLength(1);
760 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
761 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
762}
763
764::llvm::LogicalResult MemberReadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
765 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
766 if (!dict) {
767 emitError() << "expected DictionaryAttr to set properties";
768 return ::mlir::failure();
769 }
770
771 {
772 auto &propStorage = prop.mapOpGroupSizes;
773 auto attr = dict.get("mapOpGroupSizes");
774 if (attr) {
775 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
776 if (convertedAttr) {
777 propStorage = convertedAttr;
778 } else {
779 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
780 return ::mlir::failure();
781 }
782 }
783 }
784
785 {
786 auto &propStorage = prop.member_name;
787 auto attr = dict.get("member_name");
788 if (attr) {
789 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
790 if (convertedAttr) {
791 propStorage = convertedAttr;
792 } else {
793 emitError() << "Invalid attribute `member_name` in property conversion: " << attr;
794 return ::mlir::failure();
795 }
796 }
797 }
798
799 {
800 auto &propStorage = prop.numDimsPerMap;
801 auto attr = dict.get("numDimsPerMap");
802 if (attr) {
803 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
804 if (convertedAttr) {
805 propStorage = convertedAttr;
806 } else {
807 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
808 return ::mlir::failure();
809 }
810 }
811 }
812
813 {
814 auto &propStorage = prop.tableOffset;
815 auto attr = dict.get("tableOffset");
816 if (attr) {
817 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
818 if (convertedAttr) {
819 propStorage = convertedAttr;
820 } else {
821 emitError() << "Invalid attribute `tableOffset` in property conversion: " << attr;
822 return ::mlir::failure();
823 }
824 }
825 }
826 return ::mlir::success();
827}
828
829::mlir::Attribute MemberReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
830 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
831 ::mlir::Builder odsBuilder{ctx};
832
833 {
834 const auto &propStorage = prop.mapOpGroupSizes;
835 if (propStorage)
836 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
837 propStorage));
838 }
839
840 {
841 const auto &propStorage = prop.member_name;
842 if (propStorage)
843 attrs.push_back(odsBuilder.getNamedAttr("member_name",
844 propStorage));
845 }
846
847 {
848 const auto &propStorage = prop.numDimsPerMap;
849 if (propStorage)
850 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
851 propStorage));
852 }
853
854 {
855 const auto &propStorage = prop.tableOffset;
856 if (propStorage)
857 attrs.push_back(odsBuilder.getNamedAttr("tableOffset",
858 propStorage));
859 }
860
861 if (!attrs.empty())
862 return odsBuilder.getDictionaryAttr(attrs);
863 return {};
864}
865
867 return llvm::hash_combine(
868 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
869 llvm::hash_value(prop.member_name.getAsOpaquePointer()),
870 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
871 llvm::hash_value(prop.tableOffset.getAsOpaquePointer()));
872}
873
874std::optional<mlir::Attribute> MemberReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
875 if (name == "mapOpGroupSizes")
876 return prop.mapOpGroupSizes;
877
878 if (name == "member_name")
879 return prop.member_name;
880
881 if (name == "numDimsPerMap")
882 return prop.numDimsPerMap;
883
884 if (name == "tableOffset")
885 return prop.tableOffset;
886 return std::nullopt;
887}
888
889void MemberReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
890 if (name == "mapOpGroupSizes") {
891 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
892 return;
893 }
894
895 if (name == "member_name") {
896 prop.member_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.member_name)>>(value);
897 return;
898 }
899
900 if (name == "numDimsPerMap") {
901 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
902 return;
903 }
904
905 if (name == "tableOffset") {
906 prop.tableOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tableOffset)>>(value);
907 return;
908 }
909}
910
911void MemberReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
912 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
913
914 if (prop.member_name) attrs.append("member_name", prop.member_name);
915
916 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
917
918 if (prop.tableOffset) attrs.append("tableOffset", prop.tableOffset);
919}
920
921::llvm::LogicalResult MemberReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
922 {
923 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
924 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr, "mapOpGroupSizes", emitError)))
925 return ::mlir::failure();
926 }
927
928 {
929 ::mlir::Attribute attr = attrs.get(getMemberNameAttrName(opName));
930 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "member_name", emitError)))
931 return ::mlir::failure();
932 }
933
934 {
935 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
936 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr, "numDimsPerMap", emitError)))
937 return ::mlir::failure();
938 }
939
940 {
941 ::mlir::Attribute attr = attrs.get(getTableOffsetAttrName(opName));
942 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "tableOffset", emitError)))
943 return ::mlir::failure();
944 }
945 return ::mlir::success();
946}
947
948::llvm::LogicalResult MemberReadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
949 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
950 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
951 return ::mlir::failure();
952
953 if (::mlir::failed(reader.readAttribute(prop.member_name)))
954 return ::mlir::failure();
955
956 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
957 return ::mlir::failure();
958
959 if (::mlir::failed(reader.readOptionalAttribute(prop.tableOffset)))
960 return ::mlir::failure();
961 return ::mlir::success();
962}
963
964void MemberReadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
965 auto &prop = getProperties(); (void)prop;
966 writer.writeAttribute(prop.mapOpGroupSizes);
967 writer.writeAttribute(prop.member_name);
968
969 writer.writeOptionalAttribute(prop.numDimsPerMap);
970
971 writer.writeOptionalAttribute(prop.tableOffset);
972}
973
974::llvm::StringRef MemberReadOp::getMemberName() {
975 auto attr = getMemberNameAttr();
976 return attr.getValue();
977}
978
979::std::optional<::mlir::Attribute> MemberReadOp::getTableOffset() {
980 auto attr = getTableOffsetAttr();
981 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
982}
983
984::llvm::ArrayRef<int32_t> MemberReadOp::getNumDimsPerMap() {
985 auto attr = getNumDimsPerMapAttr();
986 return attr;
987}
988
989::llvm::ArrayRef<int32_t> MemberReadOp::getMapOpGroupSizes() {
990 auto attr = getMapOpGroupSizesAttr();
991 return attr;
992}
993
994void MemberReadOp::setMemberName(::llvm::StringRef attrValue) {
995 getProperties().member_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
996}
997
998void MemberReadOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
999 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1000}
1001
1002void MemberReadOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
1003 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1004}
1005
1006void MemberReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr member, ::mlir::SymbolRefAttr dist) {
1007 build(odsBuilder, odsState, resultType, component, member, dist, ::mlir::ValueRange(), std::nullopt);
1008
1009}
1010
1011void MemberReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr member, ::mlir::IntegerAttr dist) {
1012 build(odsBuilder, odsState, resultType, component, member, dist, ::mlir::ValueRange(), std::nullopt);
1013
1014}
1015
1016void MemberReadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
1017 ::mlir::Builder odsBuilder(opName.getContext());
1018 if (!properties.numDimsPerMap)
1019 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
1020}
1021
1022::llvm::LogicalResult MemberReadOp::verifyInvariantsImpl() {
1023 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
1024 if (!tblgen_mapOpGroupSizes) return emitOpError("requires attribute 'mapOpGroupSizes'");
1025 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1026 if (!tblgen_member_name) return emitOpError("requires attribute 'member_name'");
1027 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
1028 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
1029
1030 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_member_name, "member_name")))
1031 return ::mlir::failure();
1032
1033 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_tableOffset, "tableOffset")))
1034 return ::mlir::failure();
1035
1036 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
1037 return ::mlir::failure();
1038
1039 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
1040 return ::mlir::failure();
1041 {
1042 unsigned index = 0; (void)index;
1043 auto valueGroup0 = getODSOperands(0);
1044
1045 for (auto v : valueGroup0) {
1046 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1047 return ::mlir::failure();
1048 }
1049 auto valueGroup1 = getODSOperands(1);
1050 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
1051 return ::mlir::failure();
1052
1053 for (auto v : valueGroup1) {
1054 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
1055 return ::mlir::failure();
1056 }
1057 }
1058 {
1059 unsigned index = 0; (void)index;
1060 auto valueGroup0 = getODSResults(0);
1061
1062 for (auto v : valueGroup0) {
1063 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "result", index++)))
1064 return ::mlir::failure();
1065 }
1066 }
1067 return ::mlir::success();
1068}
1069
1070::llvm::LogicalResult MemberReadOp::verifyInvariants() {
1071 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1072 return ::mlir::success();
1073 return ::mlir::failure();
1074}
1075
1076::mlir::ParseResult MemberReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1077 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1078 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1079 (void)componentOperandsLoc;
1080 ::mlir::FlatSymbolRefAttr member_nameAttr;
1081 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
1082 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
1083 ::llvm::SMLoc mapOperandsOperandsLoc;
1084 (void)mapOperandsOperandsLoc;
1085 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
1086 ::mlir::Type componentRawType{};
1087 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1088 ::mlir::Type valRawType{};
1089 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1090
1091 componentOperandsLoc = parser.getCurrentLocation();
1092 if (parser.parseOperand(componentRawOperand))
1093 return ::mlir::failure();
1094 if (parser.parseLSquare())
1095 return ::mlir::failure();
1096
1097 if (parser.parseCustomAttributeWithFallback(member_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1098 return ::mlir::failure();
1099 }
1100 if (member_nameAttr) result.getOrAddProperties<MemberReadOp::Properties>().member_name = member_nameAttr;
1101 if (parser.parseRSquare())
1102 return ::mlir::failure();
1103 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
1104 {
1105 mapOperandsOperandsLoc = parser.getCurrentLocation();
1106 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
1107 auto odsResult = parseMultiDimAndSymbolList(parser, mapOperandsOperandGroups, numDimsPerMapAttr);
1108 if (odsResult) return ::mlir::failure();
1109 for (const auto &subRange : mapOperandsOperandGroups) {
1110 mapOperandsOperands.append(subRange.begin(), subRange.end());
1111 mapOperandsOperandGroupSizes.push_back(subRange.size());
1112 }
1113 if (numDimsPerMapAttr)
1114 result.getOrAddProperties<MemberReadOp::Properties>().numDimsPerMap = numDimsPerMapAttr;
1115 }
1116 if (parser.parseRBrace())
1117 return ::mlir::failure();
1118 }
1119 if (parser.parseColon())
1120 return ::mlir::failure();
1121
1122 {
1124 if (parser.parseCustomTypeWithFallback(type))
1125 return ::mlir::failure();
1126 componentRawType = type;
1127 }
1128 if (parser.parseComma())
1129 return ::mlir::failure();
1130
1131 {
1132 ::mlir::Type type;
1133 if (parser.parseCustomTypeWithFallback(type))
1134 return ::mlir::failure();
1135 valRawType = type;
1136 }
1137 {
1138 auto loc = parser.getCurrentLocation();(void)loc;
1139 if (parser.parseOptionalAttrDict(result.attributes))
1140 return ::mlir::failure();
1141 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1142 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1143 })))
1144 return ::mlir::failure();
1145 }
1146 result.getOrAddProperties<MemberReadOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
1147 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1148 result.addTypes(valTypes);
1149 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1150 return ::mlir::failure();
1151 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
1152 return ::mlir::failure();
1153 return ::mlir::success();
1154}
1155
1156void MemberReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1157 _odsPrinter << ' ';
1158 _odsPrinter << getComponent();
1159 _odsPrinter << "[";
1160 _odsPrinter.printAttributeWithoutType(getMemberNameAttr());
1161 _odsPrinter << "]";
1162 if (((!getMapOperands().empty()) || (getNumDimsPerMapAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI32ArrayAttr({})))) {
1163 _odsPrinter << ' ' << "{";
1165 _odsPrinter << "}";
1166 }
1167 _odsPrinter << ' ' << ":";
1168 _odsPrinter << ' ';
1169 {
1170 auto type = getComponent().getType();
1171 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1172 _odsPrinter.printStrippedAttrOrType(validType);
1173 else
1174 _odsPrinter << type;
1175 }
1176 _odsPrinter << ",";
1177 _odsPrinter << ' ';
1178 {
1179 auto type = getVal().getType();
1180 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1181 _odsPrinter.printStrippedAttrOrType(validType);
1182 else
1183 _odsPrinter << type;
1184 }
1185 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1186 elidedAttrs.push_back("mapOpGroupSizes");
1187 elidedAttrs.push_back("member_name");
1188 elidedAttrs.push_back("numDimsPerMap");
1189 {
1190 ::mlir::Builder odsBuilder(getContext());
1191 ::mlir::Attribute attr = getNumDimsPerMapAttr();
1192 if(attr && (attr == odsBuilder.getDenseI32ArrayAttr({})))
1193 elidedAttrs.push_back("numDimsPerMap");
1194 }
1195 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1196}
1197
1198void MemberReadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1199 effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
1200}
1201
1204 return true;
1205}
1206} // namespace component
1207} // namespace llzk
1208MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::MemberReadOp)
1209
1210namespace llzk {
1211namespace component {
1212
1213//===----------------------------------------------------------------------===//
1214// ::llzk::component::MemberWriteOp definitions
1215//===----------------------------------------------------------------------===//
1216
1217namespace detail {
1219
1221 auto attr = getMemberNameAttr();
1222 return attr.getValue();
1223}
1224
1225} // namespace detail
1227
1228::llvm::LogicalResult MemberWriteOpAdaptor::verify(::mlir::Location loc) {
1229 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1230 if (!tblgen_member_name) return emitError(loc, "'struct.writem' op ""requires attribute 'member_name'");
1231
1232 if (tblgen_member_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_member_name))))
1233 return emitError(loc, "'struct.writem' op ""attribute 'member_name' failed to satisfy constraint: flat symbol reference attribute");
1234 return ::mlir::success();
1235}
1236
1237::llvm::LogicalResult MemberWriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1238 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1239 if (!dict) {
1240 emitError() << "expected DictionaryAttr to set properties";
1241 return ::mlir::failure();
1242 }
1243
1244 {
1245 auto &propStorage = prop.member_name;
1246 auto attr = dict.get("member_name");
1247 if (attr) {
1248 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1249 if (convertedAttr) {
1250 propStorage = convertedAttr;
1251 } else {
1252 emitError() << "Invalid attribute `member_name` in property conversion: " << attr;
1253 return ::mlir::failure();
1254 }
1255 }
1256 }
1257 return ::mlir::success();
1258}
1259
1260::mlir::Attribute MemberWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1261 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1262 ::mlir::Builder odsBuilder{ctx};
1263
1264 {
1265 const auto &propStorage = prop.member_name;
1266 if (propStorage)
1267 attrs.push_back(odsBuilder.getNamedAttr("member_name",
1268 propStorage));
1269 }
1270
1271 if (!attrs.empty())
1272 return odsBuilder.getDictionaryAttr(attrs);
1273 return {};
1274}
1275
1277 return llvm::hash_combine(
1278 llvm::hash_value(prop.member_name.getAsOpaquePointer()));
1279}
1280
1281std::optional<mlir::Attribute> MemberWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1282 if (name == "member_name")
1283 return prop.member_name;
1284 return std::nullopt;
1285}
1286
1287void MemberWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1288 if (name == "member_name") {
1289 prop.member_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.member_name)>>(value);
1290 return;
1291 }
1292}
1293
1294void MemberWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1295 if (prop.member_name) attrs.append("member_name", prop.member_name);
1296}
1297
1298::llvm::LogicalResult MemberWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1299 {
1300 ::mlir::Attribute attr = attrs.get(getMemberNameAttrName(opName));
1301 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "member_name", emitError)))
1302 return ::mlir::failure();
1303 }
1304 return ::mlir::success();
1305}
1306
1307::llvm::LogicalResult MemberWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1308 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1309 if (::mlir::failed(reader.readAttribute(prop.member_name)))
1310 return ::mlir::failure();
1311 return ::mlir::success();
1312}
1313
1314void MemberWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1315 auto &prop = getProperties(); (void)prop;
1316 writer.writeAttribute(prop.member_name);
1317}
1318
1319::llvm::StringRef MemberWriteOp::getMemberName() {
1320 auto attr = getMemberNameAttr();
1321 return attr.getValue();
1322}
1323
1324void MemberWriteOp::setMemberName(::llvm::StringRef attrValue) {
1325 getProperties().member_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
1326}
1327
1328void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1329 odsState.addOperands(component);
1330 odsState.addOperands(val);
1331 odsState.getOrAddProperties<Properties>().member_name = member_name;
1332}
1333
1334void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1335 odsState.addOperands(component);
1336 odsState.addOperands(val);
1337 odsState.getOrAddProperties<Properties>().member_name = member_name;
1338 assert(resultTypes.size() == 0u && "mismatched number of results");
1339 odsState.addTypes(resultTypes);
1340}
1341
1342void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::llvm::StringRef member_name, ::mlir::Value val) {
1343 odsState.addOperands(component);
1344 odsState.addOperands(val);
1345 odsState.getOrAddProperties<Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1346}
1347
1348void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::llvm::StringRef member_name, ::mlir::Value val) {
1349 odsState.addOperands(component);
1350 odsState.addOperands(val);
1351 odsState.getOrAddProperties<Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1352 assert(resultTypes.size() == 0u && "mismatched number of results");
1353 odsState.addTypes(resultTypes);
1354}
1355
1356void MemberWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1357 assert(operands.size() == 2u && "mismatched number of parameters");
1358 odsState.addOperands(operands);
1359 odsState.addAttributes(attributes);
1360 assert(resultTypes.size() == 0u && "mismatched number of return types");
1361 odsState.addTypes(resultTypes);
1362
1363 if (!attributes.empty()) {
1364 ::mlir::OpaqueProperties properties =
1365 &odsState.getOrAddProperties<MemberWriteOp::Properties>();
1366 std::optional<::mlir::RegisteredOperationName> info =
1367 odsState.name.getRegisteredInfo();
1368 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1369 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
1370 ::llvm::report_fatal_error("Property conversion failed.");
1371 }
1372}
1373
1375 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1376 if (!tblgen_member_name) return emitOpError("requires attribute 'member_name'");
1377
1378 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_member_name, "member_name")))
1379 return ::mlir::failure();
1380 {
1381 unsigned index = 0; (void)index;
1382 auto valueGroup0 = getODSOperands(0);
1383
1384 for (auto v : valueGroup0) {
1385 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1386 return ::mlir::failure();
1387 }
1388 auto valueGroup1 = getODSOperands(1);
1389
1390 for (auto v : valueGroup1) {
1391 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
1392 return ::mlir::failure();
1393 }
1394 }
1395 return ::mlir::success();
1396}
1397
1398::llvm::LogicalResult MemberWriteOp::verifyInvariants() {
1399 return verifyInvariantsImpl();
1400}
1401
1402::mlir::ParseResult MemberWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1403 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1404 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1405 (void)componentOperandsLoc;
1406 ::mlir::FlatSymbolRefAttr member_nameAttr;
1407 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1408 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1409 (void)valOperandsLoc;
1410 ::mlir::Type componentRawType{};
1411 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1412 ::mlir::Type valRawType{};
1413 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1414
1415 componentOperandsLoc = parser.getCurrentLocation();
1416 if (parser.parseOperand(componentRawOperand))
1417 return ::mlir::failure();
1418 if (parser.parseLSquare())
1419 return ::mlir::failure();
1420
1421 if (parser.parseCustomAttributeWithFallback(member_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1422 return ::mlir::failure();
1423 }
1424 if (member_nameAttr) result.getOrAddProperties<MemberWriteOp::Properties>().member_name = member_nameAttr;
1425 if (parser.parseRSquare())
1426 return ::mlir::failure();
1427 if (parser.parseEqual())
1428 return ::mlir::failure();
1429
1430 valOperandsLoc = parser.getCurrentLocation();
1431 if (parser.parseOperand(valRawOperand))
1432 return ::mlir::failure();
1433 if (parser.parseColon())
1434 return ::mlir::failure();
1435
1436 {
1438 if (parser.parseCustomTypeWithFallback(type))
1439 return ::mlir::failure();
1440 componentRawType = type;
1441 }
1442 if (parser.parseComma())
1443 return ::mlir::failure();
1444
1445 {
1446 ::mlir::Type type;
1447 if (parser.parseCustomTypeWithFallback(type))
1448 return ::mlir::failure();
1449 valRawType = type;
1450 }
1451 {
1452 auto loc = parser.getCurrentLocation();(void)loc;
1453 if (parser.parseOptionalAttrDict(result.attributes))
1454 return ::mlir::failure();
1455 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1456 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1457 })))
1458 return ::mlir::failure();
1459 }
1460 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1461 return ::mlir::failure();
1462 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1463 return ::mlir::failure();
1464 return ::mlir::success();
1465}
1466
1467void MemberWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1468 _odsPrinter << ' ';
1469 _odsPrinter << getComponent();
1470 _odsPrinter << "[";
1471 _odsPrinter.printAttributeWithoutType(getMemberNameAttr());
1472 _odsPrinter << "]";
1473 _odsPrinter << ' ' << "=";
1474 _odsPrinter << ' ';
1475 _odsPrinter << getVal();
1476 _odsPrinter << ' ' << ":";
1477 _odsPrinter << ' ';
1478 {
1479 auto type = getComponent().getType();
1480 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1481 _odsPrinter.printStrippedAttrOrType(validType);
1482 else
1483 _odsPrinter << type;
1484 }
1485 _odsPrinter << ",";
1486 _odsPrinter << ' ';
1487 {
1488 auto type = getVal().getType();
1489 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1490 _odsPrinter.printStrippedAttrOrType(validType);
1491 else
1492 _odsPrinter << type;
1493 }
1494 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1495 elidedAttrs.push_back("member_name");
1496 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1497}
1498
1499void MemberWriteOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1500 effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::mlir::SideEffects::DefaultResource::get());
1501}
1502
1505 return false;
1506}
1507} // namespace component
1508} // namespace llzk
1509MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::MemberWriteOp)
1510
1511namespace llzk {
1512namespace component {
1513
1514//===----------------------------------------------------------------------===//
1515// ::llzk::component::StructDefOp definitions
1516//===----------------------------------------------------------------------===//
1517
1518namespace detail {
1520
1522 auto attr = getSymNameAttr();
1523 return attr.getValue();
1524}
1525
1526} // namespace detail
1528
1529::llvm::LogicalResult StructDefOpAdaptor::verify(::mlir::Location loc) {
1530 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1531 if (!tblgen_sym_name) return emitError(loc, "'struct.def' op ""requires attribute 'sym_name'");
1532
1533 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1534 return emitError(loc, "'struct.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1535 return ::mlir::success();
1536}
1537
1538::llvm::LogicalResult StructDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1539 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1540 if (!dict) {
1541 emitError() << "expected DictionaryAttr to set properties";
1542 return ::mlir::failure();
1543 }
1544
1545 {
1546 auto &propStorage = prop.sym_name;
1547 auto attr = dict.get("sym_name");
1548 if (attr) {
1549 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1550 if (convertedAttr) {
1551 propStorage = convertedAttr;
1552 } else {
1553 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
1554 return ::mlir::failure();
1555 }
1556 }
1557 }
1558 return ::mlir::success();
1559}
1560
1561::mlir::Attribute StructDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1562 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1563 ::mlir::Builder odsBuilder{ctx};
1564
1565 {
1566 const auto &propStorage = prop.sym_name;
1567 if (propStorage)
1568 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
1569 propStorage));
1570 }
1571
1572 if (!attrs.empty())
1573 return odsBuilder.getDictionaryAttr(attrs);
1574 return {};
1575}
1576
1578 return llvm::hash_combine(
1579 llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
1580}
1581
1582std::optional<mlir::Attribute> StructDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1583 if (name == "sym_name")
1584 return prop.sym_name;
1585 return std::nullopt;
1586}
1587
1588void StructDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1589 if (name == "sym_name") {
1590 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
1591 return;
1592 }
1593}
1594
1595void StructDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1596 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
1597}
1598
1599::llvm::LogicalResult StructDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1600 {
1601 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
1602 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "sym_name", emitError)))
1603 return ::mlir::failure();
1604 }
1605 return ::mlir::success();
1606}
1607
1608::llvm::StringRef StructDefOp::getSymName() {
1609 auto attr = getSymNameAttr();
1610 return attr.getValue();
1611}
1612
1613void StructDefOp::setSymName(::llvm::StringRef attrValue) {
1614 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1615}
1616
1617void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) {
1618 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1619 (void)odsState.addRegion();
1620}
1621
1622void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) {
1623 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1624 (void)odsState.addRegion();
1625 assert(resultTypes.size() == 0u && "mismatched number of results");
1626 odsState.addTypes(resultTypes);
1627}
1628
1629void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) {
1630 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1631 (void)odsState.addRegion();
1632}
1633
1634void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
1635 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1636 (void)odsState.addRegion();
1637 assert(resultTypes.size() == 0u && "mismatched number of results");
1638 odsState.addTypes(resultTypes);
1639}
1640
1641void StructDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1642 assert(operands.size() == 0u && "mismatched number of parameters");
1643 odsState.addOperands(operands);
1644 odsState.addAttributes(attributes);
1645 for (unsigned i = 0; i != 1; ++i)
1646 (void)odsState.addRegion();
1647 assert(resultTypes.size() == 0u && "mismatched number of return types");
1648 odsState.addTypes(resultTypes);
1649
1650 if (!attributes.empty()) {
1651 ::mlir::OpaqueProperties properties =
1652 &odsState.getOrAddProperties<StructDefOp::Properties>();
1653 std::optional<::mlir::RegisteredOperationName> info =
1654 odsState.name.getRegisteredInfo();
1655 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1656 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
1657 ::llvm::report_fatal_error("Property conversion failed.");
1658 }
1659}
1660
1661::llvm::LogicalResult StructDefOp::verifyInvariantsImpl() {
1662 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1663 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
1664
1665 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_sym_name, "sym_name")))
1666 return ::mlir::failure();
1667 {
1668 unsigned index = 0; (void)index;
1669
1670 for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1671 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*this, region, "bodyRegion", index++)))
1672 return ::mlir::failure();
1673 }
1674 return ::mlir::success();
1675}
1676
1677::llvm::LogicalResult StructDefOp::verifyInvariants() {
1678 return verifyInvariantsImpl();
1679}
1680
1681::mlir::ParseResult StructDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1682 ::mlir::StringAttr sym_nameAttr;
1683 std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
1684
1685 if (parser.parseSymbolName(sym_nameAttr))
1686 return ::mlir::failure();
1687 if (sym_nameAttr) result.getOrAddProperties<StructDefOp::Properties>().sym_name = sym_nameAttr;
1688
1689 if (parser.parseRegion(*bodyRegionRegion))
1690 return ::mlir::failure();
1691
1692 if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
1693 {
1694 auto loc = parser.getCurrentLocation();(void)loc;
1695 if (parser.parseOptionalAttrDict(result.attributes))
1696 return ::mlir::failure();
1697 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1698 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1699 })))
1700 return ::mlir::failure();
1701 }
1702 result.addRegion(std::move(bodyRegionRegion));
1703 return ::mlir::success();
1704}
1705
1706void StructDefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1707 _odsPrinter << ' ';
1708 _odsPrinter.printSymbolName(getSymNameAttr().getValue());
1709 _odsPrinter << ' ';
1710 _odsPrinter.printRegion(getBodyRegion());
1711 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1712 elidedAttrs.push_back("sym_name");
1713 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1714}
1715
1716} // namespace component
1717} // namespace llzk
1718MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::StructDefOp)
1719
1720
1721#endif // GET_OP_CLASSES
1722
CreateStructOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:74
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:168
CreateStructOpAdaptor(CreateStructOp op)
Definition Ops.cpp.inc:166
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result)
Definition Ops.cpp.inc:172
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:137
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:189
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:202
::mlir::TypedValue<::llzk::component::StructType > getResult()
Definition Ops.h.inc:143
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:206
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:227
MemberDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:272
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:296
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:528
void setSignal(bool attrValue)
Definition Ops.cpp.inc:568
::mlir::StringAttr getTypeAttrName()
Definition Ops.h.inc:345
::mlir::StringAttr getColumnAttrName()
Definition Ops.h.inc:321
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:602
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:428
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:318
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:465
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:475
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:608
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:580
::mlir::UnitAttr getSignalAttr()
Definition Ops.h.inc:401
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:634
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:383
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, bool isSignal=false, bool isColumn=false)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:502
void setColumn(bool attrValue)
Definition Ops.cpp.inc:560
::mlir::TypeAttr getTypeAttr()
Definition Ops.h.inc:391
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:443
::mlir::StringAttr getSignalAttrName()
Definition Ops.h.inc:329
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:420
::mlir::StringAttr getSymNameAttr()
Definition Ops.h.inc:386
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:518
void setType(::mlir::Type attrValue)
Definition Ops.cpp.inc:556
::llvm::LogicalResult verify()
Definition Ops.cpp:615
FoldAdaptor::Properties Properties
Definition Ops.h.inc:315
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:552
::mlir::UnitAttr getColumnAttr()
Definition Ops.h.inc:396
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:337
MemberReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:583
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:718
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:758
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:874
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:911
::mlir::TypedValue<::llzk::component::StructType > getComponent()
Definition Ops.h.inc:691
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:866
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:889
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:1002
::mlir::TypedValue<::mlir::Type > getVal()
Definition Ops.h.inc:715
::std::optional<::mlir::Attribute > getTableOffset()
Definition Ops.cpp.inc:979
::mlir::OperandRangeRange getMapOperands()
Definition Ops.h.inc:695
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1203
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:829
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr member)
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1022
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:1016
::mlir::FlatSymbolRefAttr getMemberNameAttr()
Definition Ops.h.inc:728
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:989
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:648
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:998
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:921
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:740
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:709
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1070
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:984
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1198
::llvm::StringRef getMemberName()
Definition Ops.cpp.inc:974
::mlir::StringAttr getTableOffsetAttrName()
Definition Ops.h.inc:672
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1076
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:964
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:948
::llvm::LogicalResult verify()
Definition Ops.cpp:795
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:685
::mlir::Attribute getTableOffsetAttr()
Definition Ops.h.inc:733
void setMemberName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:994
::mlir::StringAttr getMemberNameAttrName()
Definition Ops.h.inc:656
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:743
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1156
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:764
FoldAdaptor::Properties Properties
Definition Ops.h.inc:642
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.h.inc:738
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:664
MemberWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:877
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1228
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1499
::mlir::TypedValue<::llzk::component::StructType > getComponent()
Definition Ops.h.inc:956
void setMemberName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1324
FoldAdaptor::Properties Properties
Definition Ops.h.inc:928
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1294
::mlir::FlatSymbolRefAttr getMemberNameAttr()
Definition Ops.h.inc:993
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1504
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1398
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1467
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1287
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1307
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val)
Definition Ops.cpp.inc:1328
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1314
::llvm::StringRef getMemberName()
Definition Ops.cpp.inc:1319
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1260
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:950
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1374
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1281
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1237
::mlir::TypedValue<::mlir::Type > getVal()
Definition Ops.h.inc:960
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1298
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1402
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1276
::mlir::StringAttr getMemberNameAttrName()
Definition Ops.h.inc:934
StructDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1113
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1529
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1577
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1582
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name)
Definition Ops.cpp.inc:1617
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1588
::mlir::Region & getBodyRegion()
Definition Ops.h.inc:1194
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1595
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1677
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1561
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:1608
FoldAdaptor::Properties Properties
Definition Ops.h.inc:1156
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1599
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1681
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1538
::mlir::StringAttr getSymNameAttr()
Definition Ops.h.inc:1207
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1613
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1661
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:1162
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1706
MemberDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:231
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:227
::std::optional<::mlir::Attribute > getTableOffset()
Definition Ops.cpp.inc:695
MemberReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:541
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:537
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:672
MemberWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:846
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:842
StructDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1074
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:1070
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:188
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
Definition OpHelpers.h:180