31static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
32 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
33 unsigned valueIndex) {
34 if (!((::llvm::isa<::llzk::component::StructType>(type)))) {
35 return op->emitOpError(valueKind) <<
" #" << valueIndex
36 <<
" must be circuit component, but got " << type;
38 return ::mlir::success();
41static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
42 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
43 unsigned valueIndex) {
44 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
45 return op->emitOpError(valueKind) <<
" #" << valueIndex
46 <<
" must be variadic of index, but got " << type;
48 return ::mlir::success();
51static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
52 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
53 unsigned valueIndex) {
55 return op->emitOpError(valueKind) <<
" #" << valueIndex
56 <<
" must be a valid LLZK type, but got " << type;
58 return ::mlir::success();
61static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
62 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
63 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
64 return emitError() <<
"attribute '" << attrName
65 <<
"' failed to satisfy constraint: string attribute";
66 return ::mlir::success();
68static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
69 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
70 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
71 return op->emitOpError();
75static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
76 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
77 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((
::llzk::isValidType(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
78 return emitError() <<
"attribute '" << attrName
79 <<
"' failed to satisfy constraint: type attribute of a valid LLZK type";
80 return ::mlir::success();
82static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
83 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
84 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
85 return op->emitOpError();
89static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
90 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
91 if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
92 return emitError() <<
"attribute '" << attrName
93 <<
"' failed to satisfy constraint: unit attribute";
94 return ::mlir::success();
96static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
97 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
98 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
99 return op->emitOpError();
103static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
104 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
105 if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
106 return emitError() <<
"attribute '" << attrName
107 <<
"' failed to satisfy constraint: flat symbol reference attribute";
108 return ::mlir::success();
110static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
111 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
112 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
113 return op->emitOpError();
117static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
118 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
119 if (attr && !(((::llvm::isa<::mlir::SymbolRefAttr>(attr))) || (((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType())))) || ((::llvm::isa<::mlir::AffineMapAttr>(attr)))))
120 return emitError() <<
"attribute '" << attrName
121 <<
"' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute";
122 return ::mlir::success();
124static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
125 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
126 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
127 return op->emitOpError();
131static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
132 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
133 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
134 return emitError() <<
"attribute '" << attrName
135 <<
"' failed to satisfy constraint: i32 dense array attribute";
136 return ::mlir::success();
138static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
139 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
140 return __mlir_ods_local_attr_constraint_Ops6(attr, attrName, [op]() {
141 return op->emitOpError();
145static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops7(
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();
152static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops7(
153 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
154 return __mlir_ods_local_attr_constraint_Ops7(attr, attrName, [op]() {
155 return op->emitOpError();
159static ::llvm::LogicalResult __mlir_ods_local_region_constraint_Ops1(
160 ::mlir::Operation *op, ::mlir::Region ®ion, ::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";
167 return ::mlir::success();
183 return ::mlir::success();
187 odsState.addTypes(result);
190void CreateStructOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
191 assert(resultTypes.size() == 1u &&
"mismatched number of results");
192 odsState.addTypes(resultTypes);
195void CreateStructOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
196 assert(operands.size() == 0u &&
"mismatched number of parameters");
197 odsState.addOperands(operands);
198 odsState.addAttributes(attributes);
199 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
200 odsState.addTypes(resultTypes);
205 unsigned index = 0; (void)index;
208 for (
auto v : valueGroup0) {
209 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
210 return ::mlir::failure();
213 return ::mlir::success();
221 ::mlir::Type resultRawType{};
222 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
223 if (parser.parseColon())
224 return ::mlir::failure();
228 if (parser.parseCustomTypeWithFallback(type))
229 return ::mlir::failure();
230 resultRawType = type;
233 auto loc = parser.getCurrentLocation();(void)loc;
234 if (parser.parseOptionalAttrDict(result.attributes))
235 return ::mlir::failure();
237 result.addTypes(resultTypes);
238 return ::mlir::success();
242 _odsPrinter <<
' ' <<
":";
246 if (
auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
247 _odsPrinter.printStrippedAttrOrType(validType);
251 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
252 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
271 return attr.getValue();
276 return ::llvm::cast<::mlir::Type>(attr.getValue());
280 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(
getProperties().column);
282 attr = ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr);
289 return ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr) !=
nullptr;
290 return attr !=
nullptr;
299 if (!tblgen_sym_name)
return emitError(loc,
"'struct.field' op ""requires attribute 'sym_name'");
301 if (!tblgen_type)
return emitError(loc,
"'struct.field' op ""requires attribute 'type'");
303 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
304 return emitError(loc,
"'struct.field' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
306 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())))))
307 return emitError(loc,
"'struct.field' op ""attribute 'type' failed to satisfy constraint: type attribute of a valid LLZK type");
309 if (tblgen_column && !((::llvm::isa<::mlir::UnitAttr>(tblgen_column))))
310 return emitError(loc,
"'struct.field' op ""attribute 'column' failed to satisfy constraint: unit attribute");
311 return ::mlir::success();
315 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
317 emitError() <<
"expected DictionaryAttr to set properties";
318 return ::mlir::failure();
322 auto &propStorage = prop.
column;
323 auto attr = dict.get(
"column");
325 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
327 propStorage = convertedAttr;
329 emitError() <<
"Invalid attribute `column` in property conversion: " << attr;
330 return ::mlir::failure();
337 auto attr = dict.get(
"sym_name");
339 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
341 propStorage = convertedAttr;
343 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
344 return ::mlir::failure();
350 auto &propStorage = prop.
type;
351 auto attr = dict.get(
"type");
353 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
355 propStorage = convertedAttr;
357 emitError() <<
"Invalid attribute `type` in property conversion: " << attr;
358 return ::mlir::failure();
362 return ::mlir::success();
366 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
367 ::mlir::Builder odsBuilder{ctx};
370 const auto &propStorage = prop.
column;
372 attrs.push_back(odsBuilder.getNamedAttr(
"column",
377 const auto &propStorage = prop.
sym_name;
379 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
384 const auto &propStorage = prop.
type;
386 attrs.push_back(odsBuilder.getNamedAttr(
"type",
391 return odsBuilder.getDictionaryAttr(attrs);
396 return llvm::hash_combine(
397 llvm::hash_value(prop.
column.getAsOpaquePointer()),
398 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()),
399 llvm::hash_value(prop.
type.getAsOpaquePointer()));
403 if (
name ==
"column")
406 if (
name ==
"sym_name")
415 if (
name ==
"column") {
416 prop.
column = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
column)>>(value);
420 if (
name ==
"sym_name") {
421 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
425 if (
name ==
"type") {
426 prop.
type = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
type)>>(value);
436 if (prop.
type) attrs.append(
"type", prop.
type);
439::llvm::LogicalResult
FieldDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
442 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"column", emitError)))
443 return ::mlir::failure();
448 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
449 return ::mlir::failure();
454 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"type", emitError)))
455 return ::mlir::failure();
457 return ::mlir::success();
461 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
462 if (::mlir::failed(reader.readOptionalAttribute(prop.
column)))
463 return ::mlir::failure();
465 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
466 return ::mlir::failure();
468 if (::mlir::failed(reader.readAttribute(prop.
type)))
469 return ::mlir::failure();
470 return ::mlir::success();
474 auto &prop = getProperties(); (void)prop;
476 writer.writeOptionalAttribute(prop.
column);
477 writer.writeAttribute(prop.
sym_name);
478 writer.writeAttribute(prop.
type);
483 return attr.getValue();
488 return ::llvm::cast<::mlir::Type>(attr.getValue());
494 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
495 return attr !=
nullptr;
499 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
503 getProperties().type = ::mlir::TypeAttr::get(attrValue);
507 auto &odsProp = getProperties().column;
509 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
514void FieldDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes,
bool isColumn) {
515 build(odsBuilder, odsState, {}, {}, attributes, isColumn);
519 auto tblgen_column = getProperties().column; (void)tblgen_column;
520 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
521 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
522 auto tblgen_type = getProperties().type; (void)tblgen_type;
523 if (!tblgen_type)
return emitOpError(
"requires attribute 'type'");
525 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
526 return ::mlir::failure();
528 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_type,
"type")))
529 return ::mlir::failure();
531 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_column,
"column")))
532 return ::mlir::failure();
533 return ::mlir::success();
540::mlir::ParseResult
FieldDefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
541 ::mlir::StringAttr sym_nameAttr;
542 ::mlir::TypeAttr typeAttr;
544 if (parser.parseSymbolName(sym_nameAttr))
545 return ::mlir::failure();
547 if (parser.parseColon())
548 return ::mlir::failure();
550 if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
551 return ::mlir::failure();
555 auto loc = parser.getCurrentLocation();(void)loc;
556 if (parser.parseOptionalAttrDict(result.attributes))
557 return ::mlir::failure();
559 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
561 return ::mlir::failure();
563 return ::mlir::success();
569 _odsPrinter <<
' ' <<
":";
571 _odsPrinter.printAttributeWithoutType(
getTypeAttr());
572 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
573 elidedAttrs.push_back(
"sym_name");
574 elidedAttrs.push_back(
"type");
576 ::mlir::Builder odsBuilder(getContext());
578 if(attr && (attr == ((
false) ? odsBuilder.getUnitAttr() :
nullptr)))
579 elidedAttrs.push_back(
"column");
581 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
599 bool isVariadic[] = {
false,
true};
600 int prevVariadicCount = 0;
601 for (
unsigned i = 0; i < index; ++i)
602 if (isVariadic[i]) ++prevVariadicCount;
606 int variadicSize = (odsOperandsSize - 1) / 1;
611 int start = index + (variadicSize - 1) * prevVariadicCount;
612 int size = isVariadic[index] ? variadicSize : 1;
613 return {start, size};
618 return attr.getValue();
623 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
627 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
646 if (!tblgen_field_name)
return emitError(loc,
"'struct.readf' op ""requires attribute 'field_name'");
648 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'struct.readf' op ""requires attribute 'mapOpGroupSizes'");
652 if (tblgen_field_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_field_name))))
653 return emitError(loc,
"'struct.readf' op ""attribute 'field_name' failed to satisfy constraint: flat symbol reference attribute");
655 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)))))
656 return emitError(loc,
"'struct.readf' op ""attribute 'tableOffset' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute");
658 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
659 return emitError(loc,
"'struct.readf' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
661 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
662 return emitError(loc,
"'struct.readf' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
663 return ::mlir::success();
667 bool isVariadic[] = {
false,
true};
668 int prevVariadicCount = 0;
669 for (
unsigned i = 0; i < index; ++i)
670 if (isVariadic[i]) ++prevVariadicCount;
674 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
679 int start = index + (variadicSize - 1) * prevVariadicCount;
680 int size = isVariadic[index] ? variadicSize : 1;
681 return {start, size};
686 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
691 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
693 emitError() <<
"expected DictionaryAttr to set properties";
694 return ::mlir::failure();
699 auto attr = dict.get(
"field_name");
701 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
703 propStorage = convertedAttr;
705 emitError() <<
"Invalid attribute `field_name` in property conversion: " << attr;
706 return ::mlir::failure();
713 auto attr = dict.get(
"mapOpGroupSizes");
715 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
717 propStorage = convertedAttr;
719 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
720 return ::mlir::failure();
727 auto attr = dict.get(
"numDimsPerMap");
729 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
731 propStorage = convertedAttr;
733 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
734 return ::mlir::failure();
741 auto attr = dict.get(
"tableOffset");
743 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
745 propStorage = convertedAttr;
747 emitError() <<
"Invalid attribute `tableOffset` in property conversion: " << attr;
748 return ::mlir::failure();
752 return ::mlir::success();
756 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
757 ::mlir::Builder odsBuilder{ctx};
762 attrs.push_back(odsBuilder.getNamedAttr(
"field_name",
769 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
776 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
783 attrs.push_back(odsBuilder.getNamedAttr(
"tableOffset",
788 return odsBuilder.getDictionaryAttr(attrs);
793 return llvm::hash_combine(
794 llvm::hash_value(prop.
field_name.getAsOpaquePointer()),
797 llvm::hash_value(prop.
tableOffset.getAsOpaquePointer()));
801 if (
name ==
"field_name")
804 if (
name ==
"mapOpGroupSizes")
807 if (
name ==
"numDimsPerMap")
810 if (
name ==
"tableOffset")
816 if (
name ==
"field_name") {
817 prop.
field_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
field_name)>>(value);
821 if (
name ==
"mapOpGroupSizes") {
826 if (
name ==
"numDimsPerMap") {
831 if (
name ==
"tableOffset") {
847::llvm::LogicalResult
FieldReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
850 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"field_name", emitError)))
851 return ::mlir::failure();
856 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr,
"mapOpGroupSizes", emitError)))
857 return ::mlir::failure();
862 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr,
"numDimsPerMap", emitError)))
863 return ::mlir::failure();
868 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"tableOffset", emitError)))
869 return ::mlir::failure();
871 return ::mlir::success();
875 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
876 if (::mlir::failed(reader.readAttribute(prop.
field_name)))
877 return ::mlir::failure();
880 return ::mlir::failure();
882 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
883 return ::mlir::failure();
885 if (::mlir::failed(reader.readOptionalAttribute(prop.
tableOffset)))
886 return ::mlir::failure();
887 return ::mlir::success();
891 auto &prop = getProperties(); (void)prop;
902 return attr.getValue();
907 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
921 getProperties().field_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
925 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
929 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
932void FieldReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value
component, ::mlir::StringAttr field, ::mlir::SymbolRefAttr dist) {
933 build(odsBuilder, odsState, resultType,
component, field, dist, ::mlir::ValueRange(), std::nullopt);
937void FieldReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value
component, ::mlir::StringAttr field, ::mlir::IntegerAttr dist) {
938 build(odsBuilder, odsState, resultType,
component, field, dist, ::mlir::ValueRange(), std::nullopt);
943 ::mlir::Builder odsBuilder(opName.getContext());
945 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
949 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
950 if (!tblgen_field_name)
return emitOpError(
"requires attribute 'field_name'");
951 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
952 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
953 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
954 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
956 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_field_name,
"field_name")))
957 return ::mlir::failure();
959 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_tableOffset,
"tableOffset")))
960 return ::mlir::failure();
962 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
963 return ::mlir::failure();
965 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
966 return ::mlir::failure();
968 unsigned index = 0; (void)index;
971 for (
auto v : valueGroup0) {
972 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
973 return ::mlir::failure();
976 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
977 return ::mlir::failure();
979 for (
auto v : valueGroup1) {
980 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
981 return ::mlir::failure();
985 unsigned index = 0; (void)index;
988 for (
auto v : valueGroup0) {
989 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"result", index++)))
990 return ::mlir::failure();
993 return ::mlir::success();
998 return ::mlir::success();
999 return ::mlir::failure();
1003 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1004 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1005 (void)componentOperandsLoc;
1006 ::mlir::FlatSymbolRefAttr field_nameAttr;
1007 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
1008 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
1009 ::llvm::SMLoc mapOperandsOperandsLoc;
1010 (void)mapOperandsOperandsLoc;
1011 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
1012 ::mlir::Type componentRawType{};
1013 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1014 ::mlir::Type valRawType{};
1015 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1017 componentOperandsLoc = parser.getCurrentLocation();
1018 if (parser.parseOperand(componentRawOperand))
1019 return ::mlir::failure();
1020 if (parser.parseLSquare())
1021 return ::mlir::failure();
1023 if (parser.parseCustomAttributeWithFallback(field_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1024 return ::mlir::failure();
1027 if (parser.parseRSquare())
1028 return ::mlir::failure();
1029 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
1031 mapOperandsOperandsLoc = parser.getCurrentLocation();
1032 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
1034 if (odsResult) return ::mlir::failure();
1035 for (
const auto &subRange : mapOperandsOperandGroups) {
1036 mapOperandsOperands.append(subRange.begin(), subRange.end());
1037 mapOperandsOperandGroupSizes.push_back(subRange.size());
1039 if (numDimsPerMapAttr)
1042 if (parser.parseRBrace())
1043 return ::mlir::failure();
1045 if (parser.parseColon())
1046 return ::mlir::failure();
1050 if (parser.parseCustomTypeWithFallback(type))
1051 return ::mlir::failure();
1052 componentRawType = type;
1054 if (parser.parseComma())
1055 return ::mlir::failure();
1059 if (parser.parseCustomTypeWithFallback(type))
1060 return ::mlir::failure();
1064 auto loc = parser.getCurrentLocation();(void)loc;
1065 if (parser.parseOptionalAttrDict(result.attributes))
1066 return ::mlir::failure();
1068 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1070 return ::mlir::failure();
1072 result.getOrAddProperties<
FieldReadOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
1073 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1074 result.addTypes(valTypes);
1075 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1076 return ::mlir::failure();
1077 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
1078 return ::mlir::failure();
1079 return ::mlir::success();
1089 _odsPrinter <<
' ' <<
"{";
1093 _odsPrinter <<
' ' <<
":";
1097 if (
auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1098 _odsPrinter.printStrippedAttrOrType(validType);
1100 _odsPrinter << type;
1105 auto type =
getVal().getType();
1106 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1107 _odsPrinter.printStrippedAttrOrType(validType);
1109 _odsPrinter << type;
1111 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1112 elidedAttrs.push_back(
"mapOpGroupSizes");
1113 elidedAttrs.push_back(
"field_name");
1114 elidedAttrs.push_back(
"numDimsPerMap");
1116 ::mlir::Builder odsBuilder(getContext());
1118 if(attr && (attr == odsBuilder.getDenseI32ArrayAttr({})))
1119 elidedAttrs.push_back(
"numDimsPerMap");
1121 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1133namespace component {
1144 return attr.getValue();
1152 if (!tblgen_field_name)
return emitError(loc,
"'struct.writef' op ""requires attribute 'field_name'");
1154 if (tblgen_field_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_field_name))))
1155 return emitError(loc,
"'struct.writef' op ""attribute 'field_name' failed to satisfy constraint: flat symbol reference attribute");
1156 return ::mlir::success();
1160 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1162 emitError() <<
"expected DictionaryAttr to set properties";
1163 return ::mlir::failure();
1168 auto attr = dict.get(
"field_name");
1170 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1171 if (convertedAttr) {
1172 propStorage = convertedAttr;
1174 emitError() <<
"Invalid attribute `field_name` in property conversion: " << attr;
1175 return ::mlir::failure();
1179 return ::mlir::success();
1183 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1184 ::mlir::Builder odsBuilder{ctx};
1189 attrs.push_back(odsBuilder.getNamedAttr(
"field_name",
1194 return odsBuilder.getDictionaryAttr(attrs);
1199 return llvm::hash_combine(
1200 llvm::hash_value(prop.
field_name.getAsOpaquePointer()));
1204 if (
name ==
"field_name")
1206 return std::nullopt;
1210 if (
name ==
"field_name") {
1211 prop.
field_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
field_name)>>(value);
1223 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"field_name", emitError)))
1224 return ::mlir::failure();
1226 return ::mlir::success();
1230 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1231 if (::mlir::failed(reader.readAttribute(prop.
field_name)))
1232 return ::mlir::failure();
1233 return ::mlir::success();
1237 auto &prop = getProperties(); (void)prop;
1243 return attr.getValue();
1247 getProperties().field_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
1250void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value
component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val) {
1252 odsState.addOperands(val);
1253 odsState.getOrAddProperties<
Properties>().field_name = field_name;
1256void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value
component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val) {
1258 odsState.addOperands(val);
1259 odsState.getOrAddProperties<
Properties>().field_name = field_name;
1260 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1261 odsState.addTypes(resultTypes);
1264void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value
component, ::llvm::StringRef field_name, ::mlir::Value val) {
1266 odsState.addOperands(val);
1267 odsState.getOrAddProperties<
Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
1270void FieldWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value
component, ::llvm::StringRef field_name, ::mlir::Value val) {
1272 odsState.addOperands(val);
1273 odsState.getOrAddProperties<
Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
1274 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1275 odsState.addTypes(resultTypes);
1278void FieldWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1279 assert(operands.size() == 2u &&
"mismatched number of parameters");
1280 odsState.addOperands(operands);
1281 odsState.addAttributes(attributes);
1282 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1283 odsState.addTypes(resultTypes);
1285 if (!attributes.empty()) {
1286 ::mlir::OpaqueProperties properties =
1288 std::optional<::mlir::RegisteredOperationName> info =
1289 odsState.name.getRegisteredInfo();
1290 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1291 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1292 ::llvm::report_fatal_error(
"Property conversion failed.");
1297 auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
1298 if (!tblgen_field_name)
return emitOpError(
"requires attribute 'field_name'");
1300 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_field_name,
"field_name")))
1301 return ::mlir::failure();
1303 unsigned index = 0; (void)index;
1306 for (
auto v : valueGroup0) {
1307 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1308 return ::mlir::failure();
1312 for (
auto v : valueGroup1) {
1313 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1314 return ::mlir::failure();
1317 return ::mlir::success();
1325 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1326 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1327 (void)componentOperandsLoc;
1328 ::mlir::FlatSymbolRefAttr field_nameAttr;
1329 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1330 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1331 (void)valOperandsLoc;
1332 ::mlir::Type componentRawType{};
1333 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1334 ::mlir::Type valRawType{};
1335 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1337 componentOperandsLoc = parser.getCurrentLocation();
1338 if (parser.parseOperand(componentRawOperand))
1339 return ::mlir::failure();
1340 if (parser.parseLSquare())
1341 return ::mlir::failure();
1343 if (parser.parseCustomAttributeWithFallback(field_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1344 return ::mlir::failure();
1347 if (parser.parseRSquare())
1348 return ::mlir::failure();
1349 if (parser.parseEqual())
1350 return ::mlir::failure();
1352 valOperandsLoc = parser.getCurrentLocation();
1353 if (parser.parseOperand(valRawOperand))
1354 return ::mlir::failure();
1355 if (parser.parseColon())
1356 return ::mlir::failure();
1360 if (parser.parseCustomTypeWithFallback(type))
1361 return ::mlir::failure();
1362 componentRawType = type;
1364 if (parser.parseComma())
1365 return ::mlir::failure();
1369 if (parser.parseCustomTypeWithFallback(type))
1370 return ::mlir::failure();
1374 auto loc = parser.getCurrentLocation();(void)loc;
1375 if (parser.parseOptionalAttrDict(result.attributes))
1376 return ::mlir::failure();
1378 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1380 return ::mlir::failure();
1382 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1383 return ::mlir::failure();
1384 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1385 return ::mlir::failure();
1386 return ::mlir::success();
1395 _odsPrinter <<
' ' <<
"=";
1398 _odsPrinter <<
' ' <<
":";
1402 if (
auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1403 _odsPrinter.printStrippedAttrOrType(validType);
1405 _odsPrinter << type;
1410 auto type =
getVal().getType();
1411 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1412 _odsPrinter.printStrippedAttrOrType(validType);
1414 _odsPrinter << type;
1416 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1417 elidedAttrs.push_back(
"field_name");
1418 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1430namespace component {
1441 return attr.getValue();
1446 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1455 if (!tblgen_sym_name)
return emitError(loc,
"'struct.def' op ""requires attribute 'sym_name'");
1457 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1458 return emitError(loc,
"'struct.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1460 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))); }))))
1461 return emitError(loc,
"'struct.def' op ""attribute 'const_params' failed to satisfy constraint: flat symbol ref array attribute");
1462 return ::mlir::success();
1466 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1468 emitError() <<
"expected DictionaryAttr to set properties";
1469 return ::mlir::failure();
1474 auto attr = dict.get(
"const_params");
1476 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1477 if (convertedAttr) {
1478 propStorage = convertedAttr;
1480 emitError() <<
"Invalid attribute `const_params` in property conversion: " << attr;
1481 return ::mlir::failure();
1488 auto attr = dict.get(
"sym_name");
1490 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1491 if (convertedAttr) {
1492 propStorage = convertedAttr;
1494 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
1495 return ::mlir::failure();
1499 return ::mlir::success();
1503 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1504 ::mlir::Builder odsBuilder{ctx};
1509 attrs.push_back(odsBuilder.getNamedAttr(
"const_params",
1514 const auto &propStorage = prop.
sym_name;
1516 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
1521 return odsBuilder.getDictionaryAttr(attrs);
1526 return llvm::hash_combine(
1527 llvm::hash_value(prop.
const_params.getAsOpaquePointer()),
1528 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
1532 if (
name ==
"const_params")
1535 if (
name ==
"sym_name")
1537 return std::nullopt;
1541 if (
name ==
"const_params") {
1546 if (
name ==
"sym_name") {
1547 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
1558::llvm::LogicalResult
StructDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1561 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops7(attr,
"const_params", emitError)))
1562 return ::mlir::failure();
1567 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
1568 return ::mlir::failure();
1570 return ::mlir::success();
1574 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1575 if (::mlir::failed(reader.readOptionalAttribute(prop.
const_params)))
1576 return ::mlir::failure();
1578 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
1579 return ::mlir::failure();
1580 return ::mlir::success();
1584 auto &prop = getProperties(); (void)prop;
1587 writer.writeAttribute(prop.
sym_name);
1592 return attr.getValue();
1597 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1601 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1604void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params) {
1605 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1607 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1609 (void)odsState.addRegion();
1612void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params) {
1613 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1615 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1617 (void)odsState.addRegion();
1618 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1619 odsState.addTypes(resultTypes);
1622void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::ArrayAttr const_params) {
1623 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1625 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1627 (void)odsState.addRegion();
1630void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr const_params) {
1631 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1633 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1635 (void)odsState.addRegion();
1636 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1637 odsState.addTypes(resultTypes);
1640void StructDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1641 assert(operands.size() == 0u &&
"mismatched number of parameters");
1642 odsState.addOperands(operands);
1643 odsState.addAttributes(attributes);
1644 for (
unsigned i = 0; i != 1; ++i)
1645 (
void)odsState.addRegion();
1646 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1647 odsState.addTypes(resultTypes);
1649 if (!attributes.empty()) {
1650 ::mlir::OpaqueProperties properties =
1652 std::optional<::mlir::RegisteredOperationName> info =
1653 odsState.name.getRegisteredInfo();
1654 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1655 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1656 ::llvm::report_fatal_error(
"Property conversion failed.");
1661 auto tblgen_const_params = getProperties().const_params; (void)tblgen_const_params;
1662 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1663 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
1665 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
1666 return ::mlir::failure();
1668 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops7(*
this, tblgen_const_params,
"const_params")))
1669 return ::mlir::failure();
1671 unsigned index = 0; (void)index;
1673 for (
auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1674 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*
this, region,
"bodyRegion", index++)))
1675 return ::mlir::failure();
1677 return ::mlir::success();
1685 ::mlir::StringAttr sym_nameAttr;
1686 ::mlir::ArrayAttr const_paramsAttr;
1687 std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
1689 if (parser.parseSymbolName(sym_nameAttr))
1690 return ::mlir::failure();
1692 if (::mlir::succeeded(parser.parseOptionalLess())) {
1694 if (parser.parseCustomAttributeWithFallback(const_paramsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1695 return ::mlir::failure();
1698 if (parser.parseGreater())
1699 return ::mlir::failure();
1702 if (parser.parseRegion(*bodyRegionRegion))
1703 return ::mlir::failure();
1705 if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
1707 auto loc = parser.getCurrentLocation();(void)loc;
1708 if (parser.parseOptionalAttrDict(result.attributes))
1709 return ::mlir::failure();
1711 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1713 return ::mlir::failure();
1715 result.addRegion(std::move(bodyRegionRegion));
1716 return ::mlir::success();
1729 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1730 elidedAttrs.push_back(
"sym_name");
1731 elidedAttrs.push_back(
"const_params");
1732 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
CreateStructOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
CreateStructOpAdaptor(CreateStructOp op)
::mlir::ValueRange getOperands()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verifyInvariants()
::mlir::TypedValue<::llzk::component::StructType > getResult()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void print(::mlir::OpAsmPrinter &_odsPrinter)
FieldDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
FieldDefOpAdaptor(FieldDefOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
FoldAdaptor::Properties Properties
::mlir::StringAttr getColumnAttrName()
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
void setColumn(bool attrValue)
::mlir::StringAttr getSymNameAttrName()
::mlir::TypeAttr getTypeAttr()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, bool isColumn=false)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult verifyInvariants()
::mlir::StringAttr getTypeAttrName()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
void setSymName(::llvm::StringRef attrValue)
void setType(::mlir::Type attrValue)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::StringRef getSymName()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::StringAttr getSymNameAttr()
::mlir::UnitAttr getColumnAttr()
::llvm::LogicalResult verify(::mlir::Location loc)
FieldReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
FieldReadOpAdaptor(FieldReadOp op)
::mlir::ValueRange getOperands()
FoldAdaptor::Properties Properties
::mlir::StringAttr getNumDimsPerMapAttrName()
::mlir::OperandRangeRange getMapOperands()
::mlir::MutableOperandRangeRange getMapOperandsMutable()
::mlir::TypedValue<::mlir::Type > getVal()
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::mlir::StringAttr getFieldNameAttrName()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
::mlir::StringAttr getTableOffsetAttrName()
::llvm::StringRef getFieldName()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::llvm::LogicalResult verify()
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)
bool isRead()
Return true if the op is a read, false if it's a write.
::mlir::TypedValue<::llzk::component::StructType > getComponent()
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::FlatSymbolRefAttr getFieldNameAttr()
::llvm::LogicalResult verifyInvariants()
::mlir::StringAttr getMapOpGroupSizesAttrName()
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::Operation::operand_range getODSOperands(unsigned index)
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
::std::optional<::mlir::Attribute > getTableOffset()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
void setFieldName(::llvm::StringRef attrValue)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::mlir::Attribute getTableOffsetAttr()
void print(::mlir::OpAsmPrinter &_odsPrinter)
FieldWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
FieldWriteOpAdaptor(FieldWriteOp op)
::mlir::ValueRange getOperands()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
bool isRead()
Return true if the op is a read, false if it's a write.
::llvm::StringRef getFieldName()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void setFieldName(::llvm::StringRef attrValue)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::StringAttr getFieldNameAttrName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::TypedValue<::llzk::component::StructType > getComponent()
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::Operation::operand_range getODSOperands(unsigned index)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getVal()
::mlir::FlatSymbolRefAttr getFieldNameAttr()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr field_name, ::mlir::Value val)
::llvm::LogicalResult verifyInvariants()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
FoldAdaptor::Properties Properties
static llvm::hash_code computePropertiesHash(const Properties &prop)
void print(::mlir::OpAsmPrinter &_odsPrinter)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
StructDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
StructDefOpAdaptor(StructDefOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
static llvm::hash_code computePropertiesHash(const Properties &prop)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::Region & getBodyRegion()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult verifyInvariants()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::StringRef getSymName()
FoldAdaptor::Properties Properties
::mlir::StringAttr getConstParamsAttrName()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params)
::mlir::StringAttr getSymNameAttr()
::std::optional< ::mlir::ArrayAttr > getConstParams()
void setSymName(::llvm::StringRef attrValue)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::ArrayAttr getConstParamsAttr()
::mlir::StringAttr getSymNameAttrName()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::StringRef getSymName()
::mlir::UnitAttr getColumnAttr()
FieldDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::RegionRange odsRegions
::mlir::TypeAttr getTypeAttr()
const Properties & getProperties()
::mlir::DictionaryAttr odsAttrs
::mlir::StringAttr getSymNameAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
FieldReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::Attribute > getTableOffset()
::mlir::FlatSymbolRefAttr getFieldNameAttr()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
const Properties & getProperties()
::mlir::RegionRange odsRegions
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::mlir::Attribute getTableOffsetAttr()
::std::optional<::mlir::OperationName > odsOpName
::llvm::StringRef getFieldName()
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
FieldWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::FlatSymbolRefAttr getFieldNameAttr()
::llvm::StringRef getFieldName()
::mlir::DictionaryAttr odsAttrs
const Properties & getProperties()
::mlir::RegionRange odsRegions
::mlir::RegionRange getRegions()
::std::optional< ::mlir::ArrayAttr > getConstParams()
::mlir::RegionRange odsRegions
::mlir::DictionaryAttr odsAttrs
StructDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ArrayAttr getConstParamsAttr()
::mlir::StringAttr getSymNameAttr()
::std::optional<::mlir::OperationName > odsOpName
::llvm::StringRef getSymName()
const Properties & getProperties()
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
tableOffsetTy tableOffset
numDimsPerMapTy numDimsPerMap
mapOpGroupSizesTy mapOpGroupSizes
const_paramsTy const_params