LLZK 0.1.0
Veridise's ZK Language IR
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops0(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops1(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops2(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
69 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
70 return __mlir_ods_local_attr_constraint_Ops0(attr, attrName, [op]() {
71 return op->emitOpError();
72 });
73}
74
75static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
83 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
84 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
85 return op->emitOpError();
86 });
87}
88
89static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
97 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
98 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
99 return op->emitOpError();
100 });
101}
102
103static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
111 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
112 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
113 return op->emitOpError();
114 });
115}
116
117static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
125 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
126 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
127 return op->emitOpError();
128 });
129}
130
131static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
139 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
140 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
141 return op->emitOpError();
142 });
143}
144
145static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
146 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
147 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); }))))
148 return emitError() << "attribute '" << attrName
149 << "' failed to satisfy constraint: flat symbol ref array attribute";
150 return ::mlir::success();
151}
152static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
153 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
154 return __mlir_ods_local_attr_constraint_Ops6(attr, attrName, [op]() {
155 return op->emitOpError();
156 });
157}
158
159static ::mlir::LogicalResult __mlir_ods_local_region_constraint_Ops0(
160 ::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
161 unsigned regionIndex) {
162 if (!((::llvm::hasNItems(region, 1)))) {
163 return op->emitOpError("region #") << regionIndex
164 << (regionName.empty() ? " " : " ('" + regionName + "') ")
165 << "failed to verify constraint: region with 1 blocks";
166 }
167 return ::mlir::success();
168}
169} // namespace component
170} // namespace llzk
171namespace llzk {
172namespace component {
173
174//===----------------------------------------------------------------------===//
175// ::llzk::component::CreateStructOp definitions
176//===----------------------------------------------------------------------===//
177
178namespace detail {
179CreateStructOpGenericAdaptorBase::CreateStructOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
180 odsOpName.emplace("struct.new", odsAttrs.getContext());
181}
182
184
185std::pair<unsigned, unsigned> CreateStructOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
186 return {index, 1};
187}
188
190 return odsAttrs;
191}
192
193} // namespace detail
195
196::mlir::LogicalResult CreateStructOpAdaptor::verify(::mlir::Location loc) {
197 return ::mlir::success();
198}
199
200std::pair<unsigned, unsigned> CreateStructOp::getODSOperandIndexAndLength(unsigned index) {
201 return {index, 1};
202}
203
204::mlir::Operation::operand_range CreateStructOp::getODSOperands(unsigned index) {
205 auto valueRange = getODSOperandIndexAndLength(index);
206 return {std::next(getOperation()->operand_begin(), valueRange.first),
207 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
208}
209
210std::pair<unsigned, unsigned> CreateStructOp::getODSResultIndexAndLength(unsigned index) {
211 return {index, 1};
212}
213
214::mlir::Operation::result_range CreateStructOp::getODSResults(unsigned index) {
215 auto valueRange = getODSResultIndexAndLength(index);
216 return {std::next(getOperation()->result_begin(), valueRange.first),
217 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
218}
219
220::mlir::TypedValue<::llzk::component::StructType> CreateStructOp::getResult() {
221 return ::llvm::cast<::mlir::TypedValue<::llzk::component::StructType>>(*getODSResults(0).begin());
222}
223
224void CreateStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) {
225 odsState.addTypes(result);
226}
227
228void CreateStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
229 assert(resultTypes.size() == 1u && "mismatched number of results");
230 odsState.addTypes(resultTypes);
231}
232
233void CreateStructOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
234 assert(operands.size() == 0u && "mismatched number of parameters");
235 odsState.addOperands(operands);
236 odsState.addAttributes(attributes);
237 assert(resultTypes.size() == 1u && "mismatched number of return types");
238 odsState.addTypes(resultTypes);
239}
240
242 {
243 unsigned index = 0; (void)index;
244 auto valueGroup0 = getODSResults(0);
245
246 for (auto v : valueGroup0) {
247 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "result", index++)))
248 return ::mlir::failure();
249 }
250 }
251 return ::mlir::success();
252}
253
254::mlir::LogicalResult CreateStructOp::verifyInvariants() {
255 return verifyInvariantsImpl();
256}
257
258::mlir::ParseResult CreateStructOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
259 ::mlir::Type resultRawTypes[1];
260 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
261 if (parser.parseColon())
262 return ::mlir::failure();
263
264 {
266 if (parser.parseCustomTypeWithFallback(type))
267 return ::mlir::failure();
268 resultRawTypes[0] = type;
269 }
270 {
271 auto loc = parser.getCurrentLocation();(void)loc;
272 if (parser.parseOptionalAttrDict(result.attributes))
273 return ::mlir::failure();
274 }
275 result.addTypes(resultTypes);
276 return ::mlir::success();
277}
278
279void CreateStructOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
280 _odsPrinter << ' ' << ":";
281 _odsPrinter << ' ';
282 {
283 auto type = getResult().getType();
284 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
285 _odsPrinter.printStrippedAttrOrType(validType);
286 else
287 _odsPrinter << type;
288 }
289 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
290 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
291}
292
293} // namespace component
294} // namespace llzk
295MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::CreateStructOp)
296
297namespace llzk {
298namespace component {
299
300//===----------------------------------------------------------------------===//
301// ::llzk::component::FieldDefOp definitions
302//===----------------------------------------------------------------------===//
303
304namespace detail {
305FieldDefOpGenericAdaptorBase::FieldDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
306 odsOpName.emplace("struct.field", odsAttrs.getContext());
307}
308
310
311std::pair<unsigned, unsigned> FieldDefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
312 return {index, 1};
313}
314
316 return odsAttrs;
317}
318
320 auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
321 return attr;
322}
323
325 auto attr = getSymNameAttr();
326 return attr.getValue();
327}
328
330 auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type);
331 return attr;
332}
333
335 auto attr = getTypeAttr();
336 return ::llvm::cast<::mlir::Type>(attr.getValue());
337}
338
340 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().column);
341 if (!attr)
342 attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
343 return attr;
344}
345
347 auto attr = getColumnAttr();
348 if (!attr)
349 return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
350 return attr != nullptr;
351}
352
353} // namespace detail
355
356::mlir::LogicalResult FieldDefOpAdaptor::verify(::mlir::Location loc) {
357 auto tblgen_column = getProperties().column; (void)tblgen_column;
358 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
359 if (!tblgen_sym_name) return emitError(loc, "'struct.field' op ""requires attribute 'sym_name'");
360 auto tblgen_type = getProperties().type; (void)tblgen_type;
361 if (!tblgen_type) return emitError(loc, "'struct.field' op ""requires attribute 'type'");
362
363 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
364 return emitError(loc, "'struct.field' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
365
366 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())))))
367 return emitError(loc, "'struct.field' op ""attribute 'type' failed to satisfy constraint: type attribute of a valid LLZK type");
368
369 if (tblgen_column && !((::llvm::isa<::mlir::UnitAttr>(tblgen_column))))
370 return emitError(loc, "'struct.field' op ""attribute 'column' failed to satisfy constraint: unit attribute");
371 return ::mlir::success();
372}
373
374std::pair<unsigned, unsigned> FieldDefOp::getODSOperandIndexAndLength(unsigned index) {
375 return {index, 1};
376}
377
378::mlir::Operation::operand_range FieldDefOp::getODSOperands(unsigned index) {
379 auto valueRange = getODSOperandIndexAndLength(index);
380 return {std::next(getOperation()->operand_begin(), valueRange.first),
381 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
382}
383
384std::pair<unsigned, unsigned> FieldDefOp::getODSResultIndexAndLength(unsigned index) {
385 return {index, 1};
386}
387
388::mlir::Operation::result_range FieldDefOp::getODSResults(unsigned index) {
389 auto valueRange = getODSResultIndexAndLength(index);
390 return {std::next(getOperation()->result_begin(), valueRange.first),
391 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
392}
393
394::mlir::LogicalResult FieldDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
395 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
396 if (!dict) {
397 emitError() << "expected DictionaryAttr to set properties";
398 return ::mlir::failure();
399 }
400
401 {
402 auto &propStorage = prop.column;
403 auto attr = dict.get("column");
404 if (attr || /*isRequired=*/false) {
405 if (!attr) {
406 emitError() << "expected key entry for column in DictionaryAttr to set "
407 "Properties.";
408 return ::mlir::failure();
409 }
410 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
411 if (convertedAttr) {
412 propStorage = convertedAttr;
413 } else {
414 emitError() << "Invalid attribute `column` in property conversion: " << attr;
415 return ::mlir::failure();
416 }
417 }
418 }
419
420 {
421 auto &propStorage = prop.sym_name;
422 auto attr = dict.get("sym_name");
423 if (attr || /*isRequired=*/true) {
424 if (!attr) {
425 emitError() << "expected key entry for sym_name in DictionaryAttr to set "
426 "Properties.";
427 return ::mlir::failure();
428 }
429 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
430 if (convertedAttr) {
431 propStorage = convertedAttr;
432 } else {
433 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
434 return ::mlir::failure();
435 }
436 }
437 }
438
439 {
440 auto &propStorage = prop.type;
441 auto attr = dict.get("type");
442 if (attr || /*isRequired=*/true) {
443 if (!attr) {
444 emitError() << "expected key entry for type in DictionaryAttr to set "
445 "Properties.";
446 return ::mlir::failure();
447 }
448 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
449 if (convertedAttr) {
450 propStorage = convertedAttr;
451 } else {
452 emitError() << "Invalid attribute `type` in property conversion: " << attr;
453 return ::mlir::failure();
454 }
455 }
456 }
457 return ::mlir::success();
458}
459
460::mlir::Attribute FieldDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
461 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
462 ::mlir::Builder odsBuilder{ctx};
463
464 {
465 const auto &propStorage = prop.column;
466 if (propStorage)
467 attrs.push_back(odsBuilder.getNamedAttr("column",
468 propStorage));
469 }
470
471 {
472 const auto &propStorage = prop.sym_name;
473 if (propStorage)
474 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
475 propStorage));
476 }
477
478 {
479 const auto &propStorage = prop.type;
480 if (propStorage)
481 attrs.push_back(odsBuilder.getNamedAttr("type",
482 propStorage));
483 }
484
485 if (!attrs.empty())
486 return odsBuilder.getDictionaryAttr(attrs);
487 return {};
488}
489
490llvm::hash_code FieldDefOp::computePropertiesHash(const Properties &prop) {
491 return llvm::hash_combine(
492 llvm::hash_value(prop.column.getAsOpaquePointer()),
493 llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
494 llvm::hash_value(prop.type.getAsOpaquePointer()));
495}
496
497std::optional<mlir::Attribute> FieldDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
498 if (name == "column")
499 return prop.column;
500
501 if (name == "sym_name")
502 return prop.sym_name;
503
504 if (name == "type")
505 return prop.type;
506 return std::nullopt;
507}
508
509void FieldDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
510 if (name == "column") {
511 prop.column = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.column)>>(value);
512 return;
513 }
514
515 if (name == "sym_name") {
516 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
517 return;
518 }
519
520 if (name == "type") {
521 prop.type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.type)>>(value);
522 return;
523 }
524}
525
526void FieldDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
527 if (prop.column) attrs.append("column", prop.column);
528
529 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
530
531 if (prop.type) attrs.append("type", prop.type);
532}
533
534::mlir::LogicalResult FieldDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
535 {
536 ::mlir::Attribute attr = attrs.get(getColumnAttrName(opName));
537 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "column", emitError)))
538 return ::mlir::failure();
539 }
540
541 {
542 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
543 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr, "sym_name", emitError)))
544 return ::mlir::failure();
545 }
546
547 {
548 ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName));
549 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "type", emitError)))
550 return ::mlir::failure();
551 }
552 return ::mlir::success();
553}
554
555::mlir::LogicalResult FieldDefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
556 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
557 if (::mlir::failed(reader.readOptionalAttribute(prop.column)))
558 return ::mlir::failure();
559
560 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
561 return ::mlir::failure();
562
563 if (::mlir::failed(reader.readAttribute(prop.type)))
564 return ::mlir::failure();
565 return ::mlir::success();
566}
567
568void FieldDefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
569 auto &prop = getProperties(); (void)prop;
570
571 writer.writeOptionalAttribute(prop.column);
572 writer.writeAttribute(prop.sym_name);
573 writer.writeAttribute(prop.type);
574}
575
576::mlir::StringAttr FieldDefOp::getSymNameAttr() {
577 return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
578}
579
580::llvm::StringRef FieldDefOp::getSymName() {
581 auto attr = getSymNameAttr();
582 return attr.getValue();
583}
584
585::mlir::TypeAttr FieldDefOp::getTypeAttr() {
586 return ::llvm::cast<::mlir::TypeAttr>(getProperties().type);
587}
588
589::mlir::Type FieldDefOp::getType() {
590 auto attr = getTypeAttr();
591 return ::llvm::cast<::mlir::Type>(attr.getValue());
592}
593
594::mlir::UnitAttr FieldDefOp::getColumnAttr() {
595 return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().column);
596}
597
599 auto attr = getColumnAttr();
600 if (!attr)
601 return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
602 return attr != nullptr;
603}
604
605void FieldDefOp::setSymNameAttr(::mlir::StringAttr attr) {
606 (*this)->setAttr(getSymNameAttrName(), attr);
607}
608
609void FieldDefOp::setSymName(::llvm::StringRef attrValue) {
610 (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue));
611}
612
613void FieldDefOp::setTypeAttr(::mlir::TypeAttr attr) {
614 (*this)->setAttr(getTypeAttrName(), attr);
615}
616
617void FieldDefOp::setType(::mlir::Type attrValue) {
618 (*this)->setAttr(getTypeAttrName(), ::mlir::TypeAttr::get(attrValue));
619}
620
621void FieldDefOp::setColumnAttr(::mlir::UnitAttr attr) {
622 (*this)->setAttr(getColumnAttrName(), attr);
623}
624
625void FieldDefOp::setColumn(bool attrValue) {
626 if (attrValue)
627 return (*this)->setAttr(getColumnAttrName(), ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr));
628 (*this)->removeAttr(getColumnAttrName());
629}
630
631::mlir::Attribute FieldDefOp::removeColumnAttr() {
632 auto &attr = getProperties().column;
633 attr = {};
634 return attr;
635}
636
637void FieldDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, bool isColumn) {
638 build(odsBuilder, odsState, {}, {}, attributes, isColumn);
639}
640
641::mlir::LogicalResult FieldDefOp::verifyInvariantsImpl() {
642 auto tblgen_column = getProperties().column; (void)tblgen_column;
643 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
644 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
645 auto tblgen_type = getProperties().type; (void)tblgen_type;
646 if (!tblgen_type) return emitOpError("requires attribute 'type'");
647
648 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*this, tblgen_sym_name, "sym_name")))
649 return ::mlir::failure();
650
651 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_type, "type")))
652 return ::mlir::failure();
653
654 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_column, "column")))
655 return ::mlir::failure();
656 return ::mlir::success();
657}
658
659::mlir::LogicalResult FieldDefOp::verifyInvariants() {
660 return verifyInvariantsImpl();
661}
662
663::mlir::ParseResult FieldDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
664 ::mlir::StringAttr sym_nameAttr;
665 ::mlir::TypeAttr typeAttr;
666
667 if (parser.parseSymbolName(sym_nameAttr))
668 return ::mlir::failure();
669 if (sym_nameAttr) result.getOrAddProperties<FieldDefOp::Properties>().sym_name = sym_nameAttr;
670 if (parser.parseColon())
671 return ::mlir::failure();
672
673 if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
674 return ::mlir::failure();
675 }
676 if (typeAttr) result.getOrAddProperties<FieldDefOp::Properties>().type = typeAttr;
677 {
678 auto loc = parser.getCurrentLocation();(void)loc;
679 if (parser.parseOptionalAttrDict(result.attributes))
680 return ::mlir::failure();
681 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
682 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
683 })))
684 return ::mlir::failure();
685 }
686 return ::mlir::success();
687}
688
689void FieldDefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
690 _odsPrinter << ' ';
691 _odsPrinter.printSymbolName(getSymNameAttr().getValue());
692 _odsPrinter << ' ' << ":";
693 _odsPrinter << ' ';
694 _odsPrinter.printAttributeWithoutType(getTypeAttr());
695 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
696 elidedAttrs.push_back("sym_name");
697 elidedAttrs.push_back("type");
698 {
699 ::mlir::Builder odsBuilder(getContext());
700 ::mlir::Attribute attr = getColumnAttr();
701 if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
702 elidedAttrs.push_back("column");
703 }
704 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
705}
706
707} // namespace component
708} // namespace llzk
709MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::FieldDefOp)
710
711namespace llzk {
712namespace component {
713
714//===----------------------------------------------------------------------===//
715// ::llzk::component::FieldReadOp definitions
716//===----------------------------------------------------------------------===//
717
718namespace detail {
719FieldReadOpGenericAdaptorBase::FieldReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
720 odsOpName.emplace("struct.readf", odsAttrs.getContext());
721}
722
724
725std::pair<unsigned, unsigned> FieldReadOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
726 bool isVariadic[] = {false, true};
727 int prevVariadicCount = 0;
728 for (unsigned i = 0; i < index; ++i)
729 if (isVariadic[i]) ++prevVariadicCount;
730
731 // Calculate how many dynamic values a static variadic operand corresponds to.
732 // This assumes all static variadic operands have the same dynamic value count.
733 int variadicSize = (odsOperandsSize - 1) / 1;
734 // `index` passed in as the parameter is the static index which counts each
735 // operand (variadic or not) as size 1. So here for each previous static variadic
736 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
737 // value pack for this static operand starts.
738 int start = index + (variadicSize - 1) * prevVariadicCount;
739 int size = isVariadic[index] ? variadicSize : 1;
740 return {start, size};
741}
742
744 return odsAttrs;
745}
746
748 auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name);
749 return attr;
750}
751
753 auto attr = getFieldNameAttr();
754 return attr.getValue();
755}
756
758 auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().tableOffset);
759 return attr;
760}
761
762::std::optional<::mlir::Attribute> FieldReadOpGenericAdaptorBase::getTableOffset() {
763 auto attr = getTableOffsetAttr();
764 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
765}
766
768 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
769 return attr;
770}
771
773 auto attr = getNumDimsPerMapAttr();
774 return attr;
775}
776
778 auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mapOpGroupSizes);
779 return attr;
780}
781
783 auto attr = getMapOpGroupSizesAttr();
784 return attr;
785}
786
787} // namespace detail
789
790::mlir::LogicalResult FieldReadOpAdaptor::verify(::mlir::Location loc) {
791 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
792 if (!tblgen_field_name) return emitError(loc, "'struct.readf' op ""requires attribute 'field_name'");
793 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
794 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'struct.readf' op ""requires attribute 'mapOpGroupSizes'");
795 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
796 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
797
798 if (tblgen_field_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_field_name))))
799 return emitError(loc, "'struct.readf' op ""attribute 'field_name' failed to satisfy constraint: flat symbol reference attribute");
800
801 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)))))
802 return emitError(loc, "'struct.readf' op ""attribute 'tableOffset' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute");
803
804 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
805 return emitError(loc, "'struct.readf' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
806
807 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
808 return emitError(loc, "'struct.readf' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
809 return ::mlir::success();
810}
811
812std::pair<unsigned, unsigned> FieldReadOp::getODSOperandIndexAndLength(unsigned index) {
813 bool isVariadic[] = {false, true};
814 int prevVariadicCount = 0;
815 for (unsigned i = 0; i < index; ++i)
816 if (isVariadic[i]) ++prevVariadicCount;
817
818 // Calculate how many dynamic values a static variadic operand corresponds to.
819 // This assumes all static variadic operands have the same dynamic value count.
820 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
821 // `index` passed in as the parameter is the static index which counts each
822 // operand (variadic or not) as size 1. So here for each previous static variadic
823 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
824 // value pack for this static operand starts.
825 int start = index + (variadicSize - 1) * prevVariadicCount;
826 int size = isVariadic[index] ? variadicSize : 1;
827 return {start, size};
828}
829
830::mlir::Operation::operand_range FieldReadOp::getODSOperands(unsigned index) {
831 auto valueRange = getODSOperandIndexAndLength(index);
832 return {std::next(getOperation()->operand_begin(), valueRange.first),
833 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
834}
835
836::mlir::TypedValue<::llzk::component::StructType> FieldReadOp::getComponent() {
837 return ::llvm::cast<::mlir::TypedValue<::llzk::component::StructType>>(*getODSOperands(0).begin());
838}
839
840::mlir::OperandRangeRange FieldReadOp::getMapOperands() {
841 return getODSOperands(1).split(getMapOpGroupSizesAttr());
842}
843
845 auto range = getODSOperandIndexAndLength(0);
846 return getOperation()->getOpOperand(range.first);
847}
848
849::mlir::MutableOperandRangeRange FieldReadOp::getMapOperandsMutable() {
850 auto range = getODSOperandIndexAndLength(1);
851 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
852 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
853}
854
855std::pair<unsigned, unsigned> FieldReadOp::getODSResultIndexAndLength(unsigned index) {
856 return {index, 1};
857}
858
859::mlir::Operation::result_range FieldReadOp::getODSResults(unsigned index) {
860 auto valueRange = getODSResultIndexAndLength(index);
861 return {std::next(getOperation()->result_begin(), valueRange.first),
862 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
863}
864
865::mlir::Value FieldReadOp::getVal() {
866 return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin());
867}
868
869::mlir::LogicalResult FieldReadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
870 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
871 if (!dict) {
872 emitError() << "expected DictionaryAttr to set properties";
873 return ::mlir::failure();
874 }
875
876 {
877 auto &propStorage = prop.field_name;
878 auto attr = dict.get("field_name");
879 if (attr || /*isRequired=*/true) {
880 if (!attr) {
881 emitError() << "expected key entry for field_name in DictionaryAttr to set "
882 "Properties.";
883 return ::mlir::failure();
884 }
885 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
886 if (convertedAttr) {
887 propStorage = convertedAttr;
888 } else {
889 emitError() << "Invalid attribute `field_name` in property conversion: " << attr;
890 return ::mlir::failure();
891 }
892 }
893 }
894
895 {
896 auto &propStorage = prop.mapOpGroupSizes;
897 auto attr = dict.get("mapOpGroupSizes");
898 if (attr || /*isRequired=*/true) {
899 if (!attr) {
900 emitError() << "expected key entry for mapOpGroupSizes in DictionaryAttr to set "
901 "Properties.";
902 return ::mlir::failure();
903 }
904 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
905 if (convertedAttr) {
906 propStorage = convertedAttr;
907 } else {
908 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
909 return ::mlir::failure();
910 }
911 }
912 }
913
914 {
915 auto &propStorage = prop.numDimsPerMap;
916 auto attr = dict.get("numDimsPerMap");
917 if (attr || /*isRequired=*/false) {
918 if (!attr) {
919 emitError() << "expected key entry for numDimsPerMap in DictionaryAttr to set "
920 "Properties.";
921 return ::mlir::failure();
922 }
923 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
924 if (convertedAttr) {
925 propStorage = convertedAttr;
926 } else {
927 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
928 return ::mlir::failure();
929 }
930 }
931 }
932
933 {
934 auto &propStorage = prop.tableOffset;
935 auto attr = dict.get("tableOffset");
936 if (attr || /*isRequired=*/false) {
937 if (!attr) {
938 emitError() << "expected key entry for tableOffset in DictionaryAttr to set "
939 "Properties.";
940 return ::mlir::failure();
941 }
942 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
943 if (convertedAttr) {
944 propStorage = convertedAttr;
945 } else {
946 emitError() << "Invalid attribute `tableOffset` in property conversion: " << attr;
947 return ::mlir::failure();
948 }
949 }
950 }
951 return ::mlir::success();
952}
953
954::mlir::Attribute FieldReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
955 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
956 ::mlir::Builder odsBuilder{ctx};
957
958 {
959 const auto &propStorage = prop.field_name;
960 if (propStorage)
961 attrs.push_back(odsBuilder.getNamedAttr("field_name",
962 propStorage));
963 }
964
965 {
966 const auto &propStorage = prop.mapOpGroupSizes;
967 if (propStorage)
968 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
969 propStorage));
970 }
971
972 {
973 const auto &propStorage = prop.numDimsPerMap;
974 if (propStorage)
975 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
976 propStorage));
977 }
978
979 {
980 const auto &propStorage = prop.tableOffset;
981 if (propStorage)
982 attrs.push_back(odsBuilder.getNamedAttr("tableOffset",
983 propStorage));
984 }
985
986 if (!attrs.empty())
987 return odsBuilder.getDictionaryAttr(attrs);
988 return {};
989}
990
991llvm::hash_code FieldReadOp::computePropertiesHash(const Properties &prop) {
992 return llvm::hash_combine(
993 llvm::hash_value(prop.field_name.getAsOpaquePointer()),
994 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
995 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
996 llvm::hash_value(prop.tableOffset.getAsOpaquePointer()));
997}
998
999std::optional<mlir::Attribute> FieldReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1000 if (name == "field_name")
1001 return prop.field_name;
1002
1003 if (name == "mapOpGroupSizes")
1004 return prop.mapOpGroupSizes;
1005
1006 if (name == "numDimsPerMap")
1007 return prop.numDimsPerMap;
1008
1009 if (name == "tableOffset")
1010 return prop.tableOffset;
1011 return std::nullopt;
1012}
1013
1014void FieldReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1015 if (name == "field_name") {
1016 prop.field_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field_name)>>(value);
1017 return;
1018 }
1019
1020 if (name == "mapOpGroupSizes") {
1021 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
1022 return;
1023 }
1024
1025 if (name == "numDimsPerMap") {
1026 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
1027 return;
1028 }
1029
1030 if (name == "tableOffset") {
1031 prop.tableOffset = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tableOffset)>>(value);
1032 return;
1033 }
1034}
1035
1036void FieldReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1037 if (prop.field_name) attrs.append("field_name", prop.field_name);
1038
1039 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
1040
1041 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
1042
1043 if (prop.tableOffset) attrs.append("tableOffset", prop.tableOffset);
1044}
1045
1046::mlir::LogicalResult FieldReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1047 {
1048 ::mlir::Attribute attr = attrs.get(getFieldNameAttrName(opName));
1049 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "field_name", emitError)))
1050 return ::mlir::failure();
1051 }
1052
1053 {
1054 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
1055 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "mapOpGroupSizes", emitError)))
1056 return ::mlir::failure();
1057 }
1058
1059 {
1060 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
1061 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "numDimsPerMap", emitError)))
1062 return ::mlir::failure();
1063 }
1064
1065 {
1066 ::mlir::Attribute attr = attrs.get(getTableOffsetAttrName(opName));
1067 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "tableOffset", emitError)))
1068 return ::mlir::failure();
1069 }
1070 return ::mlir::success();
1071}
1072
1073::mlir::LogicalResult FieldReadOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1074 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1075 if (::mlir::failed(reader.readAttribute(prop.field_name)))
1076 return ::mlir::failure();
1077
1078 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
1079 return ::mlir::failure();
1080
1081 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
1082 return ::mlir::failure();
1083
1084 if (::mlir::failed(reader.readOptionalAttribute(prop.tableOffset)))
1085 return ::mlir::failure();
1086 return ::mlir::success();
1087}
1088
1089void FieldReadOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1090 auto &prop = getProperties(); (void)prop;
1091 writer.writeAttribute(prop.field_name);
1092 writer.writeAttribute(prop.mapOpGroupSizes);
1093
1094 writer.writeOptionalAttribute(prop.numDimsPerMap);
1095
1096 writer.writeOptionalAttribute(prop.tableOffset);
1097}
1098
1099::mlir::FlatSymbolRefAttr FieldReadOp::getFieldNameAttr() {
1100 return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name);
1101}
1102
1103::llvm::StringRef FieldReadOp::getFieldName() {
1104 auto attr = getFieldNameAttr();
1105 return attr.getValue();
1106}
1107
1109 return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().tableOffset);
1110}
1111
1112::std::optional<::mlir::Attribute> FieldReadOp::getTableOffset() {
1113 auto attr = getTableOffsetAttr();
1114 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
1115}
1116
1117::mlir::DenseI32ArrayAttr FieldReadOp::getNumDimsPerMapAttr() {
1118 return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
1119}
1120
1121::llvm::ArrayRef<int32_t> FieldReadOp::getNumDimsPerMap() {
1122 auto attr = getNumDimsPerMapAttr();
1123 return attr;
1124}
1125
1126::mlir::DenseI32ArrayAttr FieldReadOp::getMapOpGroupSizesAttr() {
1127 return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mapOpGroupSizes);
1128}
1129
1130::llvm::ArrayRef<int32_t> FieldReadOp::getMapOpGroupSizes() {
1131 auto attr = getMapOpGroupSizesAttr();
1132 return attr;
1133}
1134
1135void FieldReadOp::setFieldNameAttr(::mlir::FlatSymbolRefAttr attr) {
1136 (*this)->setAttr(getFieldNameAttrName(), attr);
1137}
1138
1139void FieldReadOp::setFieldName(::llvm::StringRef attrValue) {
1140 (*this)->setAttr(getFieldNameAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue));
1141}
1142
1143void FieldReadOp::setTableOffsetAttr(::mlir::Attribute attr) {
1144 (*this)->setAttr(getTableOffsetAttrName(), attr);
1145}
1146
1147void FieldReadOp::setNumDimsPerMapAttr(::mlir::DenseI32ArrayAttr attr) {
1148 (*this)->setAttr(getNumDimsPerMapAttrName(), attr);
1149}
1150
1151void FieldReadOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
1152 (*this)->setAttr(getNumDimsPerMapAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue));
1153}
1154
1155void FieldReadOp::setMapOpGroupSizesAttr(::mlir::DenseI32ArrayAttr attr) {
1156 (*this)->setAttr(getMapOpGroupSizesAttrName(), attr);
1157}
1158
1159void FieldReadOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
1160 (*this)->setAttr(getMapOpGroupSizesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue));
1161}
1162
1164 auto &attr = getProperties().tableOffset;
1165 attr = {};
1166 return attr;
1167}
1168
1169void FieldReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr field, ::mlir::SymbolRefAttr dist) {
1170 build(odsBuilder, odsState, resultType, component, field, dist, ::mlir::ValueRange(), std::nullopt);
1171
1172}
1173
1174void FieldReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr field, ::mlir::IntegerAttr dist) {
1175 build(odsBuilder, odsState, resultType, component, field, dist, ::mlir::ValueRange(), std::nullopt);
1176
1177}
1178
1179void FieldReadOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
1180 ::mlir::Builder odsBuilder(opName.getContext());
1181 if (!properties.numDimsPerMap)
1182 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
1183}
1184
1185::mlir::LogicalResult FieldReadOp::verifyInvariantsImpl() {
1186 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
1187 if (!tblgen_field_name) return emitOpError("requires attribute 'field_name'");
1188 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
1189 if (!tblgen_mapOpGroupSizes) return emitOpError("requires attribute 'mapOpGroupSizes'");
1190 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
1191 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
1192
1193 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_field_name, "field_name")))
1194 return ::mlir::failure();
1195
1196 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_tableOffset, "tableOffset")))
1197 return ::mlir::failure();
1198
1199 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
1200 return ::mlir::failure();
1201
1202 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
1203 return ::mlir::failure();
1204 {
1205 unsigned index = 0; (void)index;
1206 auto valueGroup0 = getODSOperands(0);
1207
1208 for (auto v : valueGroup0) {
1209 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "operand", index++)))
1210 return ::mlir::failure();
1211 }
1212 auto valueGroup1 = getODSOperands(1);
1213 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
1214 return ::mlir::failure();
1215
1216 for (auto v : valueGroup1) {
1217 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1218 return ::mlir::failure();
1219 }
1220 }
1221 {
1222 unsigned index = 0; (void)index;
1223 auto valueGroup0 = getODSResults(0);
1224
1225 for (auto v : valueGroup0) {
1226 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "result", index++)))
1227 return ::mlir::failure();
1228 }
1229 }
1230 return ::mlir::success();
1231}
1232
1233::mlir::LogicalResult FieldReadOp::verifyInvariants() {
1234 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1235 return ::mlir::success();
1236 return ::mlir::failure();
1237}
1238
1239::mlir::ParseResult FieldReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1240 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperands[1];
1241 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(componentRawOperands); ::llvm::SMLoc componentOperandsLoc;
1242 (void)componentOperandsLoc;
1243 ::mlir::FlatSymbolRefAttr field_nameAttr;
1244 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
1245 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
1246 ::llvm::SMLoc mapOperandsOperandsLoc;
1247 (void)mapOperandsOperandsLoc;
1248 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
1249 ::mlir::Type componentRawTypes[1];
1250 ::llvm::ArrayRef<::mlir::Type> componentTypes(componentRawTypes);
1251 ::mlir::Type valRawTypes[1];
1252 ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes);
1253
1254 componentOperandsLoc = parser.getCurrentLocation();
1255 if (parser.parseOperand(componentRawOperands[0]))
1256 return ::mlir::failure();
1257 if (parser.parseLSquare())
1258 return ::mlir::failure();
1259
1260 if (parser.parseCustomAttributeWithFallback(field_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1261 return ::mlir::failure();
1262 }
1263 if (field_nameAttr) result.getOrAddProperties<FieldReadOp::Properties>().field_name = field_nameAttr;
1264 if (parser.parseRSquare())
1265 return ::mlir::failure();
1266 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
1267 {
1268 mapOperandsOperandsLoc = parser.getCurrentLocation();
1269 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
1270 auto odsResult = parseMultiDimAndSymbolList(parser, mapOperandsOperandGroups, numDimsPerMapAttr);
1271 if (odsResult) return ::mlir::failure();
1272 for (const auto &subRange : mapOperandsOperandGroups) {
1273 mapOperandsOperands.append(subRange.begin(), subRange.end());
1274 mapOperandsOperandGroupSizes.push_back(subRange.size());
1275 }
1276 if (numDimsPerMapAttr)
1277 result.getOrAddProperties<FieldReadOp::Properties>().numDimsPerMap = numDimsPerMapAttr;
1278 }
1279 if (parser.parseRBrace())
1280 return ::mlir::failure();
1281 }
1282 if (parser.parseColon())
1283 return ::mlir::failure();
1284
1285 {
1287 if (parser.parseCustomTypeWithFallback(type))
1288 return ::mlir::failure();
1289 componentRawTypes[0] = type;
1290 }
1291 if (parser.parseComma())
1292 return ::mlir::failure();
1293
1294 {
1295 ::mlir::Type type;
1296 if (parser.parseCustomTypeWithFallback(type))
1297 return ::mlir::failure();
1298 valRawTypes[0] = type;
1299 }
1300 {
1301 auto loc = parser.getCurrentLocation();(void)loc;
1302 if (parser.parseOptionalAttrDict(result.attributes))
1303 return ::mlir::failure();
1304 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1305 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1306 })))
1307 return ::mlir::failure();
1308 }
1309 result.getOrAddProperties<FieldReadOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
1310 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1311 result.addTypes(valTypes);
1312 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1313 return ::mlir::failure();
1314 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
1315 return ::mlir::failure();
1316 return ::mlir::success();
1317}
1318
1319void FieldReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1320 _odsPrinter << ' ';
1321 _odsPrinter << getComponent();
1322 _odsPrinter << "[";
1323 _odsPrinter.printAttributeWithoutType(getFieldNameAttr());
1324 _odsPrinter << "]";
1325 if (((!getMapOperands().empty()) || (getNumDimsPerMapAttr() && getNumDimsPerMapAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI32ArrayAttr({})))) {
1326 _odsPrinter << ' ' << "{";
1328 _odsPrinter << "}";
1329 }
1330 _odsPrinter << ' ' << ":";
1331 _odsPrinter << ' ';
1332 {
1333 auto type = getComponent().getType();
1334 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1335 _odsPrinter.printStrippedAttrOrType(validType);
1336 else
1337 _odsPrinter << type;
1338 }
1339 _odsPrinter << ",";
1340 _odsPrinter << ' ';
1341 {
1342 auto type = getVal().getType();
1343 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1344 _odsPrinter.printStrippedAttrOrType(validType);
1345 else
1346 _odsPrinter << type;
1347 }
1348 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1349 elidedAttrs.push_back("mapOpGroupSizes");
1350 elidedAttrs.push_back("field_name");
1351 elidedAttrs.push_back("numDimsPerMap");
1352 {
1353 ::mlir::Builder odsBuilder(getContext());
1354 ::mlir::Attribute attr = getNumDimsPerMapAttr();
1355 if(attr && (attr == odsBuilder.getDenseI32ArrayAttr({})))
1356 elidedAttrs.push_back("numDimsPerMap");
1357 }
1358 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1359}
1360
1363 return true;
1364}
1365} // namespace component
1366} // namespace llzk
1367MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::FieldReadOp)
1368
1369namespace llzk {
1370namespace component {
1371
1372//===----------------------------------------------------------------------===//
1373// ::llzk::component::FieldWriteOp definitions
1374//===----------------------------------------------------------------------===//
1375
1376namespace detail {
1377FieldWriteOpGenericAdaptorBase::FieldWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1378 odsOpName.emplace("struct.writef", odsAttrs.getContext());
1379}
1380
1382
1383std::pair<unsigned, unsigned> FieldWriteOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1384 return {index, 1};
1385}
1386
1388 return odsAttrs;
1389}
1390
1392 auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name);
1393 return attr;
1394}
1395
1397 auto attr = getFieldNameAttr();
1398 return attr.getValue();
1399}
1400
1401} // namespace detail
1403
1404::mlir::LogicalResult FieldWriteOpAdaptor::verify(::mlir::Location loc) {
1405 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
1406 if (!tblgen_field_name) return emitError(loc, "'struct.writef' op ""requires attribute 'field_name'");
1407
1408 if (tblgen_field_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_field_name))))
1409 return emitError(loc, "'struct.writef' op ""attribute 'field_name' failed to satisfy constraint: flat symbol reference attribute");
1410 return ::mlir::success();
1411}
1412
1413std::pair<unsigned, unsigned> FieldWriteOp::getODSOperandIndexAndLength(unsigned index) {
1414 return {index, 1};
1415}
1416
1417::mlir::Operation::operand_range FieldWriteOp::getODSOperands(unsigned index) {
1418 auto valueRange = getODSOperandIndexAndLength(index);
1419 return {std::next(getOperation()->operand_begin(), valueRange.first),
1420 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1421}
1422
1423::mlir::TypedValue<::llzk::component::StructType> FieldWriteOp::getComponent() {
1424 return ::llvm::cast<::mlir::TypedValue<::llzk::component::StructType>>(*getODSOperands(0).begin());
1425}
1426
1427::mlir::Value FieldWriteOp::getVal() {
1428 return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin());
1429}
1430
1432 auto range = getODSOperandIndexAndLength(0);
1433 return getOperation()->getOpOperand(range.first);
1434}
1435
1436::mlir::OpOperand &FieldWriteOp::getValMutable() {
1437 auto range = getODSOperandIndexAndLength(1);
1438 return getOperation()->getOpOperand(range.first);
1439}
1440
1441std::pair<unsigned, unsigned> FieldWriteOp::getODSResultIndexAndLength(unsigned index) {
1442 return {index, 1};
1443}
1444
1445::mlir::Operation::result_range FieldWriteOp::getODSResults(unsigned index) {
1446 auto valueRange = getODSResultIndexAndLength(index);
1447 return {std::next(getOperation()->result_begin(), valueRange.first),
1448 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1449}
1450
1451::mlir::LogicalResult FieldWriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1452 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1453 if (!dict) {
1454 emitError() << "expected DictionaryAttr to set properties";
1455 return ::mlir::failure();
1456 }
1457
1458 {
1459 auto &propStorage = prop.field_name;
1460 auto attr = dict.get("field_name");
1461 if (attr || /*isRequired=*/true) {
1462 if (!attr) {
1463 emitError() << "expected key entry for field_name in DictionaryAttr to set "
1464 "Properties.";
1465 return ::mlir::failure();
1466 }
1467 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1468 if (convertedAttr) {
1469 propStorage = convertedAttr;
1470 } else {
1471 emitError() << "Invalid attribute `field_name` in property conversion: " << attr;
1472 return ::mlir::failure();
1473 }
1474 }
1475 }
1476 return ::mlir::success();
1477}
1478
1479::mlir::Attribute FieldWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1480 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1481 ::mlir::Builder odsBuilder{ctx};
1482
1483 {
1484 const auto &propStorage = prop.field_name;
1485 if (propStorage)
1486 attrs.push_back(odsBuilder.getNamedAttr("field_name",
1487 propStorage));
1488 }
1489
1490 if (!attrs.empty())
1491 return odsBuilder.getDictionaryAttr(attrs);
1492 return {};
1493}
1494
1496 return llvm::hash_combine(
1497 llvm::hash_value(prop.field_name.getAsOpaquePointer()));
1498}
1499
1500std::optional<mlir::Attribute> FieldWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1501 if (name == "field_name")
1502 return prop.field_name;
1503 return std::nullopt;
1504}
1505
1506void FieldWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1507 if (name == "field_name") {
1508 prop.field_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field_name)>>(value);
1509 return;
1510 }
1511}
1512
1513void FieldWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1514 if (prop.field_name) attrs.append("field_name", prop.field_name);
1515}
1516
1517::mlir::LogicalResult FieldWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1518 {
1519 ::mlir::Attribute attr = attrs.get(getFieldNameAttrName(opName));
1520 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "field_name", emitError)))
1521 return ::mlir::failure();
1522 }
1523 return ::mlir::success();
1524}
1525
1526::mlir::LogicalResult FieldWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1527 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1528 if (::mlir::failed(reader.readAttribute(prop.field_name)))
1529 return ::mlir::failure();
1530 return ::mlir::success();
1531}
1532
1533void FieldWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1534 auto &prop = getProperties(); (void)prop;
1535 writer.writeAttribute(prop.field_name);
1536}
1537
1538::mlir::FlatSymbolRefAttr FieldWriteOp::getFieldNameAttr() {
1539 return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name);
1540}
1541
1542::llvm::StringRef FieldWriteOp::getFieldName() {
1543 auto attr = getFieldNameAttr();
1544 return attr.getValue();
1545}
1546
1547void FieldWriteOp::setFieldNameAttr(::mlir::FlatSymbolRefAttr attr) {
1548 (*this)->setAttr(getFieldNameAttrName(), attr);
1549}
1550
1551void FieldWriteOp::setFieldName(::llvm::StringRef attrValue) {
1552 (*this)->setAttr(getFieldNameAttrName(), ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue));
1553}
1554
1555void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val) {
1556 odsState.addOperands(component);
1557 odsState.addOperands(val);
1558 odsState.getOrAddProperties<Properties>().field_name = field_name;
1559}
1560
1561void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val) {
1562 odsState.addOperands(component);
1563 odsState.addOperands(val);
1564 odsState.getOrAddProperties<Properties>().field_name = field_name;
1565 assert(resultTypes.size() == 0u && "mismatched number of results");
1566 odsState.addTypes(resultTypes);
1567}
1568
1569void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::llvm::StringRef field_name, ::mlir::Value val) {
1570 odsState.addOperands(component);
1571 odsState.addOperands(val);
1572 odsState.getOrAddProperties<Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
1573}
1574
1575void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value component, ::llvm::StringRef field_name, ::mlir::Value val) {
1576 odsState.addOperands(component);
1577 odsState.addOperands(val);
1578 odsState.getOrAddProperties<Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
1579 assert(resultTypes.size() == 0u && "mismatched number of results");
1580 odsState.addTypes(resultTypes);
1581}
1582
1583void FieldWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1584 assert(operands.size() == 2u && "mismatched number of parameters");
1585 odsState.addOperands(operands);
1586 odsState.addAttributes(attributes);
1587 assert(resultTypes.size() == 0u && "mismatched number of return types");
1588 odsState.addTypes(resultTypes);
1589}
1590
1591::mlir::LogicalResult FieldWriteOp::verifyInvariantsImpl() {
1592 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
1593 if (!tblgen_field_name) return emitOpError("requires attribute 'field_name'");
1594
1595 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_field_name, "field_name")))
1596 return ::mlir::failure();
1597 {
1598 unsigned index = 0; (void)index;
1599 auto valueGroup0 = getODSOperands(0);
1600
1601 for (auto v : valueGroup0) {
1602 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "operand", index++)))
1603 return ::mlir::failure();
1604 }
1605 auto valueGroup1 = getODSOperands(1);
1606
1607 for (auto v : valueGroup1) {
1608 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
1609 return ::mlir::failure();
1610 }
1611 }
1612 return ::mlir::success();
1613}
1614
1615::mlir::LogicalResult FieldWriteOp::verifyInvariants() {
1616 return verifyInvariantsImpl();
1617}
1618
1619::mlir::ParseResult FieldWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1620 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperands[1];
1621 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(componentRawOperands); ::llvm::SMLoc componentOperandsLoc;
1622 (void)componentOperandsLoc;
1623 ::mlir::FlatSymbolRefAttr field_nameAttr;
1624 ::mlir::OpAsmParser::UnresolvedOperand valRawOperands[1];
1625 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(valRawOperands); ::llvm::SMLoc valOperandsLoc;
1626 (void)valOperandsLoc;
1627 ::mlir::Type componentRawTypes[1];
1628 ::llvm::ArrayRef<::mlir::Type> componentTypes(componentRawTypes);
1629 ::mlir::Type valRawTypes[1];
1630 ::llvm::ArrayRef<::mlir::Type> valTypes(valRawTypes);
1631
1632 componentOperandsLoc = parser.getCurrentLocation();
1633 if (parser.parseOperand(componentRawOperands[0]))
1634 return ::mlir::failure();
1635 if (parser.parseLSquare())
1636 return ::mlir::failure();
1637
1638 if (parser.parseCustomAttributeWithFallback(field_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1639 return ::mlir::failure();
1640 }
1641 if (field_nameAttr) result.getOrAddProperties<FieldWriteOp::Properties>().field_name = field_nameAttr;
1642 if (parser.parseRSquare())
1643 return ::mlir::failure();
1644 if (parser.parseEqual())
1645 return ::mlir::failure();
1646
1647 valOperandsLoc = parser.getCurrentLocation();
1648 if (parser.parseOperand(valRawOperands[0]))
1649 return ::mlir::failure();
1650 if (parser.parseColon())
1651 return ::mlir::failure();
1652
1653 {
1655 if (parser.parseCustomTypeWithFallback(type))
1656 return ::mlir::failure();
1657 componentRawTypes[0] = type;
1658 }
1659 if (parser.parseComma())
1660 return ::mlir::failure();
1661
1662 {
1663 ::mlir::Type type;
1664 if (parser.parseCustomTypeWithFallback(type))
1665 return ::mlir::failure();
1666 valRawTypes[0] = type;
1667 }
1668 {
1669 auto loc = parser.getCurrentLocation();(void)loc;
1670 if (parser.parseOptionalAttrDict(result.attributes))
1671 return ::mlir::failure();
1672 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1673 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1674 })))
1675 return ::mlir::failure();
1676 }
1677 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1678 return ::mlir::failure();
1679 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1680 return ::mlir::failure();
1681 return ::mlir::success();
1682}
1683
1684void FieldWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1685 _odsPrinter << ' ';
1686 _odsPrinter << getComponent();
1687 _odsPrinter << "[";
1688 _odsPrinter.printAttributeWithoutType(getFieldNameAttr());
1689 _odsPrinter << "]";
1690 _odsPrinter << ' ' << "=";
1691 _odsPrinter << ' ';
1692 _odsPrinter << getVal();
1693 _odsPrinter << ' ' << ":";
1694 _odsPrinter << ' ';
1695 {
1696 auto type = getComponent().getType();
1697 if (auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1698 _odsPrinter.printStrippedAttrOrType(validType);
1699 else
1700 _odsPrinter << type;
1701 }
1702 _odsPrinter << ",";
1703 _odsPrinter << ' ';
1704 {
1705 auto type = getVal().getType();
1706 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1707 _odsPrinter.printStrippedAttrOrType(validType);
1708 else
1709 _odsPrinter << type;
1710 }
1711 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1712 elidedAttrs.push_back("field_name");
1713 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1714}
1715
1718 return true;
1719}
1720} // namespace component
1721} // namespace llzk
1722MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::FieldWriteOp)
1723
1724namespace llzk {
1725namespace component {
1726
1727//===----------------------------------------------------------------------===//
1728// ::llzk::component::StructDefOp definitions
1729//===----------------------------------------------------------------------===//
1730
1731namespace detail {
1732StructDefOpGenericAdaptorBase::StructDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
1733 odsOpName.emplace("struct.def", odsAttrs.getContext());
1734}
1735
1737
1738std::pair<unsigned, unsigned> StructDefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1739 return {index, 1};
1740}
1741
1743 return odsAttrs;
1744}
1745
1747 auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
1748 return attr;
1749}
1750
1752 auto attr = getSymNameAttr();
1753 return attr.getValue();
1754}
1755
1757 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().const_params);
1758 return attr;
1759}
1760
1761::std::optional< ::mlir::ArrayAttr > StructDefOpGenericAdaptorBase::getConstParams() {
1762 auto attr = getConstParamsAttr();
1763 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1764}
1765
1767 return *odsRegions[0];
1768}
1769
1771 return odsRegions;
1772}
1773
1774} // namespace detail
1776
1777::mlir::LogicalResult StructDefOpAdaptor::verify(::mlir::Location loc) {
1778 auto tblgen_const_params = getProperties().const_params; (void)tblgen_const_params;
1779 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1780 if (!tblgen_sym_name) return emitError(loc, "'struct.def' op ""requires attribute 'sym_name'");
1781
1782 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1783 return emitError(loc, "'struct.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1784
1785 if (tblgen_const_params && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_const_params))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_const_params), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))); }))))
1786 return emitError(loc, "'struct.def' op ""attribute 'const_params' failed to satisfy constraint: flat symbol ref array attribute");
1787 return ::mlir::success();
1788}
1789
1790std::pair<unsigned, unsigned> StructDefOp::getODSOperandIndexAndLength(unsigned index) {
1791 return {index, 1};
1792}
1793
1794::mlir::Operation::operand_range StructDefOp::getODSOperands(unsigned index) {
1795 auto valueRange = getODSOperandIndexAndLength(index);
1796 return {std::next(getOperation()->operand_begin(), valueRange.first),
1797 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1798}
1799
1800std::pair<unsigned, unsigned> StructDefOp::getODSResultIndexAndLength(unsigned index) {
1801 return {index, 1};
1802}
1803
1804::mlir::Operation::result_range StructDefOp::getODSResults(unsigned index) {
1805 auto valueRange = getODSResultIndexAndLength(index);
1806 return {std::next(getOperation()->result_begin(), valueRange.first),
1807 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1808}
1809
1810::mlir::Region &StructDefOp::getBody() {
1811 return (*this)->getRegion(0);
1812}
1813
1814::mlir::LogicalResult StructDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1815 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1816 if (!dict) {
1817 emitError() << "expected DictionaryAttr to set properties";
1818 return ::mlir::failure();
1819 }
1820
1821 {
1822 auto &propStorage = prop.const_params;
1823 auto attr = dict.get("const_params");
1824 if (attr || /*isRequired=*/false) {
1825 if (!attr) {
1826 emitError() << "expected key entry for const_params in DictionaryAttr to set "
1827 "Properties.";
1828 return ::mlir::failure();
1829 }
1830 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1831 if (convertedAttr) {
1832 propStorage = convertedAttr;
1833 } else {
1834 emitError() << "Invalid attribute `const_params` in property conversion: " << attr;
1835 return ::mlir::failure();
1836 }
1837 }
1838 }
1839
1840 {
1841 auto &propStorage = prop.sym_name;
1842 auto attr = dict.get("sym_name");
1843 if (attr || /*isRequired=*/true) {
1844 if (!attr) {
1845 emitError() << "expected key entry for sym_name in DictionaryAttr to set "
1846 "Properties.";
1847 return ::mlir::failure();
1848 }
1849 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1850 if (convertedAttr) {
1851 propStorage = convertedAttr;
1852 } else {
1853 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
1854 return ::mlir::failure();
1855 }
1856 }
1857 }
1858 return ::mlir::success();
1859}
1860
1861::mlir::Attribute StructDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1862 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1863 ::mlir::Builder odsBuilder{ctx};
1864
1865 {
1866 const auto &propStorage = prop.const_params;
1867 if (propStorage)
1868 attrs.push_back(odsBuilder.getNamedAttr("const_params",
1869 propStorage));
1870 }
1871
1872 {
1873 const auto &propStorage = prop.sym_name;
1874 if (propStorage)
1875 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
1876 propStorage));
1877 }
1878
1879 if (!attrs.empty())
1880 return odsBuilder.getDictionaryAttr(attrs);
1881 return {};
1882}
1883
1885 return llvm::hash_combine(
1886 llvm::hash_value(prop.const_params.getAsOpaquePointer()),
1887 llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
1888}
1889
1890std::optional<mlir::Attribute> StructDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1891 if (name == "const_params")
1892 return prop.const_params;
1893
1894 if (name == "sym_name")
1895 return prop.sym_name;
1896 return std::nullopt;
1897}
1898
1899void StructDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1900 if (name == "const_params") {
1901 prop.const_params = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.const_params)>>(value);
1902 return;
1903 }
1904
1905 if (name == "sym_name") {
1906 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
1907 return;
1908 }
1909}
1910
1911void StructDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1912 if (prop.const_params) attrs.append("const_params", prop.const_params);
1913
1914 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
1915}
1916
1917::mlir::LogicalResult StructDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1918 {
1919 ::mlir::Attribute attr = attrs.get(getConstParamsAttrName(opName));
1920 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr, "const_params", emitError)))
1921 return ::mlir::failure();
1922 }
1923
1924 {
1925 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
1926 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr, "sym_name", emitError)))
1927 return ::mlir::failure();
1928 }
1929 return ::mlir::success();
1930}
1931
1932::mlir::LogicalResult StructDefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1933 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1934 if (::mlir::failed(reader.readOptionalAttribute(prop.const_params)))
1935 return ::mlir::failure();
1936
1937 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
1938 return ::mlir::failure();
1939 return ::mlir::success();
1940}
1941
1942void StructDefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1943 auto &prop = getProperties(); (void)prop;
1944
1945 writer.writeOptionalAttribute(prop.const_params);
1946 writer.writeAttribute(prop.sym_name);
1947}
1948
1949::mlir::StringAttr StructDefOp::getSymNameAttr() {
1950 return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
1951}
1952
1953::llvm::StringRef StructDefOp::getSymName() {
1954 auto attr = getSymNameAttr();
1955 return attr.getValue();
1956}
1957
1959 return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().const_params);
1960}
1961
1962::std::optional< ::mlir::ArrayAttr > StructDefOp::getConstParams() {
1963 auto attr = getConstParamsAttr();
1964 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1965}
1966
1967void StructDefOp::setSymNameAttr(::mlir::StringAttr attr) {
1968 (*this)->setAttr(getSymNameAttrName(), attr);
1969}
1970
1971void StructDefOp::setSymName(::llvm::StringRef attrValue) {
1972 (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue));
1973}
1974
1975void StructDefOp::setConstParamsAttr(::mlir::ArrayAttr attr) {
1976 (*this)->setAttr(getConstParamsAttrName(), attr);
1977}
1978
1980 auto &attr = getProperties().const_params;
1981 attr = {};
1982 return attr;
1983}
1984
1985void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::ArrayAttr const_params) {
1986 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1987 if (const_params) {
1988 odsState.getOrAddProperties<Properties>().const_params = const_params;
1989 }
1990 (void)odsState.addRegion();
1991}
1992
1993void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::ArrayAttr const_params) {
1994 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1995 if (const_params) {
1996 odsState.getOrAddProperties<Properties>().const_params = const_params;
1997 }
1998 (void)odsState.addRegion();
1999 assert(resultTypes.size() == 0u && "mismatched number of results");
2000 odsState.addTypes(resultTypes);
2001}
2002
2003void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/::mlir::ArrayAttr const_params) {
2004 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
2005 if (const_params) {
2006 odsState.getOrAddProperties<Properties>().const_params = const_params;
2007 }
2008 (void)odsState.addRegion();
2009}
2010
2011void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::ArrayAttr const_params) {
2012 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
2013 if (const_params) {
2014 odsState.getOrAddProperties<Properties>().const_params = const_params;
2015 }
2016 (void)odsState.addRegion();
2017 assert(resultTypes.size() == 0u && "mismatched number of results");
2018 odsState.addTypes(resultTypes);
2019}
2020
2021void StructDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2022 assert(operands.size() == 0u && "mismatched number of parameters");
2023 odsState.addOperands(operands);
2024 odsState.addAttributes(attributes);
2025 for (unsigned i = 0; i != 1; ++i)
2026 (void)odsState.addRegion();
2027 assert(resultTypes.size() == 0u && "mismatched number of return types");
2028 odsState.addTypes(resultTypes);
2029}
2030
2031::mlir::LogicalResult StructDefOp::verifyInvariantsImpl() {
2032 auto tblgen_const_params = getProperties().const_params; (void)tblgen_const_params;
2033 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
2034 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
2035
2036 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*this, tblgen_sym_name, "sym_name")))
2037 return ::mlir::failure();
2038
2039 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*this, tblgen_const_params, "const_params")))
2040 return ::mlir::failure();
2041 {
2042 unsigned index = 0; (void)index;
2043
2044 for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
2045 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops0(*this, region, "body", index++)))
2046 return ::mlir::failure();
2047 }
2048 return ::mlir::success();
2049}
2050
2051::mlir::LogicalResult StructDefOp::verifyInvariants() {
2052 return verifyInvariantsImpl();
2053}
2054
2055::mlir::ParseResult StructDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2056 ::mlir::StringAttr sym_nameAttr;
2057 ::mlir::ArrayAttr const_paramsAttr;
2058 std::unique_ptr<::mlir::Region> bodyRegion = std::make_unique<::mlir::Region>();
2059
2060 if (parser.parseSymbolName(sym_nameAttr))
2061 return ::mlir::failure();
2062 if (sym_nameAttr) result.getOrAddProperties<StructDefOp::Properties>().sym_name = sym_nameAttr;
2063 if (::mlir::succeeded(parser.parseOptionalLess())) {
2064
2065 if (parser.parseCustomAttributeWithFallback(const_paramsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
2066 return ::mlir::failure();
2067 }
2068 if (const_paramsAttr) result.getOrAddProperties<StructDefOp::Properties>().const_params = const_paramsAttr;
2069 if (parser.parseGreater())
2070 return ::mlir::failure();
2071 }
2072
2073 if (parser.parseRegion(*bodyRegion))
2074 return ::mlir::failure();
2075
2076 if (bodyRegion->empty()) bodyRegion->emplaceBlock();
2077 {
2078 auto loc = parser.getCurrentLocation();(void)loc;
2079 if (parser.parseOptionalAttrDict(result.attributes))
2080 return ::mlir::failure();
2081 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
2082 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
2083 })))
2084 return ::mlir::failure();
2085 }
2086 result.addRegion(std::move(bodyRegion));
2087 return ::mlir::success();
2088}
2089
2090void StructDefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2091 _odsPrinter << ' ';
2092 _odsPrinter.printSymbolName(getSymNameAttr().getValue());
2093 if (getConstParamsAttr()) {
2094 _odsPrinter << "<";
2095 _odsPrinter.printAttributeWithoutType(getConstParamsAttr());
2096 _odsPrinter << ">";
2097 }
2098 _odsPrinter << ' ';
2099 _odsPrinter.printRegion(getBody());
2100 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
2101 elidedAttrs.push_back("sym_name");
2102 elidedAttrs.push_back("const_params");
2103 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
2104}
2105
2106} // namespace component
2107} // namespace llzk
2108MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::component::StructDefOp)
2109
2110
2111#endif // GET_OP_CLASSES
2112
CreateStructOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:75
CreateStructOpAdaptor(CreateStructOp op)
Definition Ops.cpp.inc:194
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:196
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:210
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result)
Definition Ops.cpp.inc:224
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:200
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:214
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:204
::mlir::TypedValue<::llzk::component::StructType > getResult()
Definition Ops.cpp.inc:220
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:241
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:254
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:258
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:279
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:356
FieldDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:223
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:526
void setColumnAttr(::mlir::UnitAttr attr)
Definition Ops.cpp.inc:621
FoldAdaptor::Properties Properties
Definition Ops.h.inc:262
::mlir::StringAttr getColumnAttrName()
Definition Ops.h.inc:268
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:388
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:641
void setColumn(bool attrValue)
Definition Ops.cpp.inc:625
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:276
void setSymNameAttr(::mlir::StringAttr attr)
Definition Ops.cpp.inc:605
::mlir::Attribute removeColumnAttr()
Definition Ops.cpp.inc:631
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:490
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, bool isColumn=false)
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:689
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:378
::mlir::StringAttr getTypeAttrName()
Definition Ops.h.inc:284
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:555
::mlir::UnitAttr getColumnAttr()
Definition Ops.cpp.inc:594
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:509
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:659
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:497
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:384
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:568
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:534
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:394
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:374
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:609
void setType(::mlir::Type attrValue)
Definition Ops.cpp.inc:617
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:460
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:580
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:663
::mlir::StringAttr getSymNameAttr()
Definition Ops.cpp.inc:576
::mlir::TypeAttr getTypeAttr()
Definition Ops.cpp.inc:585
void setTypeAttr(::mlir::TypeAttr attr)
Definition Ops.cpp.inc:613
FieldReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:446
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:790
FoldAdaptor::Properties Properties
Definition Ops.h.inc:501
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:523
::mlir::OpOperand & getComponentMutable()
Definition Ops.cpp.inc:844
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:849
::mlir::StringAttr getFieldNameAttrName()
Definition Ops.h.inc:507
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:1151
::mlir::StringAttr getTableOffsetAttrName()
Definition Ops.h.inc:531
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.cpp.inc:1117
::llvm::StringRef getFieldName()
Definition Ops.cpp.inc:1103
::mlir::Attribute getTableOffsetAttr()
Definition Ops.cpp.inc:1108
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:859
::mlir::LogicalResult verify()
Definition Ops.cpp:586
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr field)
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:1179
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1362
::mlir::OperandRangeRange getMapOperands()
Definition Ops.cpp.inc:840
::mlir::TypedValue<::llzk::component::StructType > getComponent()
Definition Ops.cpp.inc:836
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:1121
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:999
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1073
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:515
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1233
void setNumDimsPerMapAttr(::mlir::DenseI32ArrayAttr attr)
Definition Ops.cpp.inc:1147
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.cpp.inc:1126
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:830
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:1159
::mlir::FlatSymbolRefAttr getFieldNameAttr()
Definition Ops.cpp.inc:1099
::std::optional<::mlir::Attribute > getTableOffset()
Definition Ops.cpp.inc:1112
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1046
::mlir::Attribute removeTableOffsetAttr()
Definition Ops.cpp.inc:1163
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1036
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1239
void setMapOpGroupSizesAttr(::mlir::DenseI32ArrayAttr attr)
Definition Ops.cpp.inc:1155
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1014
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:954
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:869
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:991
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:1130
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1185
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:855
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:812
void setFieldName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1139
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1089
void setFieldNameAttr(::mlir::FlatSymbolRefAttr attr)
Definition Ops.cpp.inc:1135
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1319
void setTableOffsetAttr(::mlir::Attribute attr)
Definition Ops.cpp.inc:1143
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1404
FieldWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:668
::mlir::OpOperand & getComponentMutable()
Definition Ops.cpp.inc:1431
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1451
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1533
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1717
::llvm::StringRef getFieldName()
Definition Ops.cpp.inc:1542
::mlir::OpOperand & getValMutable()
Definition Ops.cpp.inc:1436
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1441
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1591
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1526
void setFieldName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1551
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1619
::mlir::StringAttr getFieldNameAttrName()
Definition Ops.h.inc:721
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1513
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:1445
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:1417
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1413
::mlir::FlatSymbolRefAttr getFieldNameAttr()
Definition Ops.cpp.inc:1538
::mlir::TypedValue<::llzk::component::StructType > getComponent()
Definition Ops.cpp.inc:1423
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1479
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1615
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1517
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val)
Definition Ops.cpp.inc:1555
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1506
FoldAdaptor::Properties Properties
Definition Ops.h.inc:715
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1495
void setFieldNameAttr(::mlir::FlatSymbolRefAttr attr)
Definition Ops.cpp.inc:1547
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1684
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1500
StructDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:858
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1777
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1884
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1890
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:1794
::mlir::StringAttr getSymNameAttr()
Definition Ops.cpp.inc:1949
::mlir::Region & getBody()
Definition Ops.cpp.inc:1810
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1899
::mlir::ArrayAttr getConstParamsAttr()
Definition Ops.cpp.inc:1958
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1911
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1861
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:1953
void setSymNameAttr(::mlir::StringAttr attr)
Definition Ops.cpp.inc:1967
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1790
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1814
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:1804
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1932
FoldAdaptor::Properties Properties
Definition Ops.h.inc:897
::mlir::StringAttr getConstParamsAttrName()
Definition Ops.h.inc:903
::mlir::Attribute removeConstParamsAttr()
Definition Ops.cpp.inc:1979
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:2055
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1942
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1800
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params)
Definition Ops.cpp.inc:1985
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:2031
::std::optional< ::mlir::ArrayAttr > getConstParams()
Definition Ops.cpp.inc:1962
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1971
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1917
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:911
void setConstParamsAttr(::mlir::ArrayAttr attr)
Definition Ops.cpp.inc:1975
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:2090
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:2051
CreateStructOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:179
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:59
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:185
FieldDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:305
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:196
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:311
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:725
::std::optional<::mlir::Attribute > getTableOffset()
Definition Ops.cpp.inc:762
FieldReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:719
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:417
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:645
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1383
FieldWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:1377
StructDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:1732
::std::optional< ::mlir::ArrayAttr > getConstParams()
Definition Ops.cpp.inc:1761
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:831
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1738
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:102
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
Definition OpHelpers.h:94