LLZK 2.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
1200 return true;
1201}
1202} // namespace component
1203} // namespace llzk
1204MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::MemberReadOp)
1205
1206namespace llzk {
1207namespace component {
1208
1209//===----------------------------------------------------------------------===//
1210// ::llzk::component::MemberWriteOp definitions
1211//===----------------------------------------------------------------------===//
1212
1213namespace detail {
1215
1217 auto attr = getMemberNameAttr();
1218 return attr.getValue();
1219}
1220
1221} // namespace detail
1223
1224::llvm::LogicalResult MemberWriteOpAdaptor::verify(::mlir::Location loc) {
1225 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1226 if (!tblgen_member_name) return emitError(loc, "'struct.writem' op ""requires attribute 'member_name'");
1227
1228 if (tblgen_member_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_member_name))))
1229 return emitError(loc, "'struct.writem' op ""attribute 'member_name' failed to satisfy constraint: flat symbol reference attribute");
1230 return ::mlir::success();
1231}
1232
1233::llvm::LogicalResult MemberWriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1234 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1235 if (!dict) {
1236 emitError() << "expected DictionaryAttr to set properties";
1237 return ::mlir::failure();
1238 }
1239
1240 {
1241 auto &propStorage = prop.member_name;
1242 auto attr = dict.get("member_name");
1243 if (attr) {
1244 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1245 if (convertedAttr) {
1246 propStorage = convertedAttr;
1247 } else {
1248 emitError() << "Invalid attribute `member_name` in property conversion: " << attr;
1249 return ::mlir::failure();
1250 }
1251 }
1252 }
1253 return ::mlir::success();
1254}
1255
1256::mlir::Attribute MemberWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1257 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1258 ::mlir::Builder odsBuilder{ctx};
1259
1260 {
1261 const auto &propStorage = prop.member_name;
1262 if (propStorage)
1263 attrs.push_back(odsBuilder.getNamedAttr("member_name",
1264 propStorage));
1265 }
1266
1267 if (!attrs.empty())
1268 return odsBuilder.getDictionaryAttr(attrs);
1269 return {};
1270}
1271
1273 return llvm::hash_combine(
1274 llvm::hash_value(prop.member_name.getAsOpaquePointer()));
1275}
1276
1277std::optional<mlir::Attribute> MemberWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1278 if (name == "member_name")
1279 return prop.member_name;
1280 return std::nullopt;
1281}
1282
1283void MemberWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1284 if (name == "member_name") {
1285 prop.member_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.member_name)>>(value);
1286 return;
1287 }
1288}
1289
1290void MemberWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1291 if (prop.member_name) attrs.append("member_name", prop.member_name);
1292}
1293
1294::llvm::LogicalResult MemberWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1295 {
1296 ::mlir::Attribute attr = attrs.get(getMemberNameAttrName(opName));
1297 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "member_name", emitError)))
1298 return ::mlir::failure();
1299 }
1300 return ::mlir::success();
1301}
1302
1303::llvm::LogicalResult MemberWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1304 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1305 if (::mlir::failed(reader.readAttribute(prop.member_name)))
1306 return ::mlir::failure();
1307 return ::mlir::success();
1308}
1309
1310void MemberWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1311 auto &prop = getProperties(); (void)prop;
1312 writer.writeAttribute(prop.member_name);
1313}
1314
1315::llvm::StringRef MemberWriteOp::getMemberName() {
1316 auto attr = getMemberNameAttr();
1317 return attr.getValue();
1318}
1319
1320void MemberWriteOp::setMemberName(::llvm::StringRef attrValue) {
1321 getProperties().member_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
1322}
1323
1324void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1325 odsState.addOperands(component);
1326 odsState.addOperands(val);
1327 odsState.getOrAddProperties<Properties>().member_name = member_name;
1328}
1329
1330void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1331 odsState.addOperands(component);
1332 odsState.addOperands(val);
1333 odsState.getOrAddProperties<Properties>().member_name = member_name;
1334 assert(resultTypes.size() == 0u && "mismatched number of results");
1335 odsState.addTypes(resultTypes);
1336}
1337
1338void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::llvm::StringRef member_name, ::mlir::Value val) {
1339 odsState.addOperands(component);
1340 odsState.addOperands(val);
1341 odsState.getOrAddProperties<Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1342}
1343
1344void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::llvm::StringRef member_name, ::mlir::Value val) {
1345 odsState.addOperands(component);
1346 odsState.addOperands(val);
1347 odsState.getOrAddProperties<Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1348 assert(resultTypes.size() == 0u && "mismatched number of results");
1349 odsState.addTypes(resultTypes);
1350}
1351
1352void MemberWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1353 assert(operands.size() == 2u && "mismatched number of parameters");
1354 odsState.addOperands(operands);
1355 odsState.addAttributes(attributes);
1356 assert(resultTypes.size() == 0u && "mismatched number of return types");
1357 odsState.addTypes(resultTypes);
1358
1359 if (!attributes.empty()) {
1360 ::mlir::OpaqueProperties properties =
1361 &odsState.getOrAddProperties<MemberWriteOp::Properties>();
1362 std::optional<::mlir::RegisteredOperationName> info =
1363 odsState.name.getRegisteredInfo();
1364 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1365 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
1366 ::llvm::report_fatal_error("Property conversion failed.");
1367 }
1368}
1369
1371 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1372 if (!tblgen_member_name) return emitOpError("requires attribute 'member_name'");
1373
1374 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_member_name, "member_name")))
1375 return ::mlir::failure();
1376 {
1377 unsigned index = 0; (void)index;
1378 auto valueGroup0 = getODSOperands(0);
1379
1380 for (auto v : valueGroup0) {
1381 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1382 return ::mlir::failure();
1383 }
1384 auto valueGroup1 = getODSOperands(1);
1385
1386 for (auto v : valueGroup1) {
1387 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
1388 return ::mlir::failure();
1389 }
1390 }
1391 return ::mlir::success();
1392}
1393
1394::llvm::LogicalResult MemberWriteOp::verifyInvariants() {
1395 return verifyInvariantsImpl();
1396}
1397
1398::mlir::ParseResult MemberWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1399 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1400 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1401 (void)componentOperandsLoc;
1402 ::mlir::FlatSymbolRefAttr member_nameAttr;
1403 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1404 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1405 (void)valOperandsLoc;
1406 ::mlir::Type componentRawType{};
1407 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1408 ::mlir::Type valRawType{};
1409 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1410
1411 componentOperandsLoc = parser.getCurrentLocation();
1412 if (parser.parseOperand(componentRawOperand))
1413 return ::mlir::failure();
1414 if (parser.parseLSquare())
1415 return ::mlir::failure();
1416
1417 if (parser.parseCustomAttributeWithFallback(member_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1418 return ::mlir::failure();
1419 }
1420 if (member_nameAttr) result.getOrAddProperties<MemberWriteOp::Properties>().member_name = member_nameAttr;
1421 if (parser.parseRSquare())
1422 return ::mlir::failure();
1423 if (parser.parseEqual())
1424 return ::mlir::failure();
1425
1426 valOperandsLoc = parser.getCurrentLocation();
1427 if (parser.parseOperand(valRawOperand))
1428 return ::mlir::failure();
1429 if (parser.parseColon())
1430 return ::mlir::failure();
1431
1432 {
1434 if (parser.parseCustomTypeWithFallback(type))
1435 return ::mlir::failure();
1436 componentRawType = type;
1437 }
1438 if (parser.parseComma())
1439 return ::mlir::failure();
1440
1441 {
1442 ::mlir::Type type;
1443 if (parser.parseCustomTypeWithFallback(type))
1444 return ::mlir::failure();
1445 valRawType = type;
1446 }
1447 {
1448 auto loc = parser.getCurrentLocation();(void)loc;
1449 if (parser.parseOptionalAttrDict(result.attributes))
1450 return ::mlir::failure();
1451 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1452 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1453 })))
1454 return ::mlir::failure();
1455 }
1456 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1457 return ::mlir::failure();
1458 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1459 return ::mlir::failure();
1460 return ::mlir::success();
1461}
1462
1463void MemberWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1464 _odsPrinter << ' ';
1465 _odsPrinter << getComponent();
1466 _odsPrinter << "[";
1467 _odsPrinter.printAttributeWithoutType(getMemberNameAttr());
1468 _odsPrinter << "]";
1469 _odsPrinter << ' ' << "=";
1470 _odsPrinter << ' ';
1471 _odsPrinter << getVal();
1472 _odsPrinter << ' ' << ":";
1473 _odsPrinter << ' ';
1474 {
1475 auto type = getComponent().getType();
1476 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1477 _odsPrinter.printStrippedAttrOrType(validType);
1478 else
1479 _odsPrinter << type;
1480 }
1481 _odsPrinter << ",";
1482 _odsPrinter << ' ';
1483 {
1484 auto type = getVal().getType();
1485 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1486 _odsPrinter.printStrippedAttrOrType(validType);
1487 else
1488 _odsPrinter << type;
1489 }
1490 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1491 elidedAttrs.push_back("member_name");
1492 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1493}
1494
1497 return false;
1498}
1499} // namespace component
1500} // namespace llzk
1501MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::MemberWriteOp)
1502
1503namespace llzk {
1504namespace component {
1505
1506//===----------------------------------------------------------------------===//
1507// ::llzk::component::StructDefOp definitions
1508//===----------------------------------------------------------------------===//
1509
1510namespace detail {
1512
1514 auto attr = getSymNameAttr();
1515 return attr.getValue();
1516}
1517
1518} // namespace detail
1520
1521::llvm::LogicalResult StructDefOpAdaptor::verify(::mlir::Location loc) {
1522 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1523 if (!tblgen_sym_name) return emitError(loc, "'struct.def' op ""requires attribute 'sym_name'");
1524
1525 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1526 return emitError(loc, "'struct.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1527 return ::mlir::success();
1528}
1529
1530::llvm::LogicalResult StructDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1531 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1532 if (!dict) {
1533 emitError() << "expected DictionaryAttr to set properties";
1534 return ::mlir::failure();
1535 }
1536
1537 {
1538 auto &propStorage = prop.sym_name;
1539 auto attr = dict.get("sym_name");
1540 if (attr) {
1541 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1542 if (convertedAttr) {
1543 propStorage = convertedAttr;
1544 } else {
1545 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
1546 return ::mlir::failure();
1547 }
1548 }
1549 }
1550 return ::mlir::success();
1551}
1552
1553::mlir::Attribute StructDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1554 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1555 ::mlir::Builder odsBuilder{ctx};
1556
1557 {
1558 const auto &propStorage = prop.sym_name;
1559 if (propStorage)
1560 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
1561 propStorage));
1562 }
1563
1564 if (!attrs.empty())
1565 return odsBuilder.getDictionaryAttr(attrs);
1566 return {};
1567}
1568
1570 return llvm::hash_combine(
1571 llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
1572}
1573
1574std::optional<mlir::Attribute> StructDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1575 if (name == "sym_name")
1576 return prop.sym_name;
1577 return std::nullopt;
1578}
1579
1580void StructDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1581 if (name == "sym_name") {
1582 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
1583 return;
1584 }
1585}
1586
1587void StructDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1588 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
1589}
1590
1591::llvm::LogicalResult StructDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1592 {
1593 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
1594 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "sym_name", emitError)))
1595 return ::mlir::failure();
1596 }
1597 return ::mlir::success();
1598}
1599
1600::llvm::StringRef StructDefOp::getSymName() {
1601 auto attr = getSymNameAttr();
1602 return attr.getValue();
1603}
1604
1605void StructDefOp::setSymName(::llvm::StringRef attrValue) {
1606 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1607}
1608
1609void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) {
1610 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1611 (void)odsState.addRegion();
1612}
1613
1614void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) {
1615 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1616 (void)odsState.addRegion();
1617 assert(resultTypes.size() == 0u && "mismatched number of results");
1618 odsState.addTypes(resultTypes);
1619}
1620
1621void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) {
1622 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1623 (void)odsState.addRegion();
1624}
1625
1626void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
1627 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1628 (void)odsState.addRegion();
1629 assert(resultTypes.size() == 0u && "mismatched number of results");
1630 odsState.addTypes(resultTypes);
1631}
1632
1633void StructDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1634 assert(operands.size() == 0u && "mismatched number of parameters");
1635 odsState.addOperands(operands);
1636 odsState.addAttributes(attributes);
1637 for (unsigned i = 0; i != 1; ++i)
1638 (void)odsState.addRegion();
1639 assert(resultTypes.size() == 0u && "mismatched number of return types");
1640 odsState.addTypes(resultTypes);
1641
1642 if (!attributes.empty()) {
1643 ::mlir::OpaqueProperties properties =
1644 &odsState.getOrAddProperties<StructDefOp::Properties>();
1645 std::optional<::mlir::RegisteredOperationName> info =
1646 odsState.name.getRegisteredInfo();
1647 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1648 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
1649 ::llvm::report_fatal_error("Property conversion failed.");
1650 }
1651}
1652
1653::llvm::LogicalResult StructDefOp::verifyInvariantsImpl() {
1654 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1655 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
1656
1657 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_sym_name, "sym_name")))
1658 return ::mlir::failure();
1659 {
1660 unsigned index = 0; (void)index;
1661
1662 for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1663 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*this, region, "bodyRegion", index++)))
1664 return ::mlir::failure();
1665 }
1666 return ::mlir::success();
1667}
1668
1669::llvm::LogicalResult StructDefOp::verifyInvariants() {
1670 return verifyInvariantsImpl();
1671}
1672
1673::mlir::ParseResult StructDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1674 ::mlir::StringAttr sym_nameAttr;
1675 std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
1676
1677 if (parser.parseSymbolName(sym_nameAttr))
1678 return ::mlir::failure();
1679 if (sym_nameAttr) result.getOrAddProperties<StructDefOp::Properties>().sym_name = sym_nameAttr;
1680
1681 if (parser.parseRegion(*bodyRegionRegion))
1682 return ::mlir::failure();
1683
1684 if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
1685 {
1686 auto loc = parser.getCurrentLocation();(void)loc;
1687 if (parser.parseOptionalAttrDict(result.attributes))
1688 return ::mlir::failure();
1689 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1690 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1691 })))
1692 return ::mlir::failure();
1693 }
1694 result.addRegion(std::move(bodyRegionRegion));
1695 return ::mlir::success();
1696}
1697
1698void StructDefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1699 _odsPrinter << ' ';
1700 _odsPrinter.printSymbolName(getSymNameAttr().getValue());
1701 _odsPrinter << ' ';
1702 _odsPrinter.printRegion(getBodyRegion());
1703 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1704 elidedAttrs.push_back("sym_name");
1705 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1706}
1707
1708} // namespace component
1709} // namespace llzk
1710MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::StructDefOp)
1711
1712
1713#endif // GET_OP_CLASSES
1714
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:580
::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:688
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:712
::std::optional<::mlir::Attribute > getTableOffset()
Definition Ops.cpp.inc:979
::mlir::OperandRangeRange getMapOperands()
Definition Ops.h.inc:692
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1199
::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:725
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:989
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:645
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:706
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1070
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:984
::llvm::StringRef getMemberName()
Definition Ops.cpp.inc:974
::mlir::StringAttr getTableOffsetAttrName()
Definition Ops.h.inc:669
::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:784
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:682
::mlir::Attribute getTableOffsetAttr()
Definition Ops.h.inc:730
void setMemberName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:994
::mlir::StringAttr getMemberNameAttrName()
Definition Ops.h.inc:653
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:740
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:639
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.h.inc:735
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:661
MemberWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:873
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1224
::mlir::TypedValue<::llzk::component::StructType > getComponent()
Definition Ops.h.inc:952
void setMemberName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1320
FoldAdaptor::Properties Properties
Definition Ops.h.inc:924
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1290
::mlir::FlatSymbolRefAttr getMemberNameAttr()
Definition Ops.h.inc:989
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1496
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1394
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1463
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1283
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1303
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val)
Definition Ops.cpp.inc:1324
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1310
::llvm::StringRef getMemberName()
Definition Ops.cpp.inc:1315
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1256
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:946
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1370
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1277
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1233
::mlir::TypedValue<::mlir::Type > getVal()
Definition Ops.h.inc:956
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1294
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1398
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1272
::mlir::StringAttr getMemberNameAttrName()
Definition Ops.h.inc:930
StructDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1108
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1521
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1569
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1574
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name)
Definition Ops.cpp.inc:1609
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1580
::mlir::Region & getBodyRegion()
Definition Ops.h.inc:1189
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1587
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1669
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1553
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:1600
FoldAdaptor::Properties Properties
Definition Ops.h.inc:1151
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1591
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1673
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1530
::mlir::StringAttr getSymNameAttr()
Definition Ops.h.inc:1202
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1605
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1653
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:1157
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1698
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:538
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:534
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:842
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:838
StructDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1069
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:1065
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:140
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
Definition OpHelpers.h:132