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;
294 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(
getProperties().signal);
296 attr = ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr);
303 return ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr) !=
nullptr;
304 return attr !=
nullptr;
314 if (!tblgen_sym_name)
return emitError(loc,
"'struct.member' op ""requires attribute 'sym_name'");
316 if (!tblgen_type)
return emitError(loc,
"'struct.member' op ""requires attribute 'type'");
318 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
319 return emitError(loc,
"'struct.member' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
321 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())))))
322 return emitError(loc,
"'struct.member' op ""attribute 'type' failed to satisfy constraint: type attribute of a valid LLZK type");
324 if (tblgen_column && !((::llvm::isa<::mlir::UnitAttr>(tblgen_column))))
325 return emitError(loc,
"'struct.member' op ""attribute 'column' failed to satisfy constraint: unit attribute");
327 if (tblgen_signal && !((::llvm::isa<::mlir::UnitAttr>(tblgen_signal))))
328 return emitError(loc,
"'struct.member' op ""attribute 'signal' failed to satisfy constraint: unit attribute");
329 return ::mlir::success();
333 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
335 emitError() <<
"expected DictionaryAttr to set properties";
336 return ::mlir::failure();
340 auto &propStorage = prop.
column;
341 auto attr = dict.get(
"column");
343 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
345 propStorage = convertedAttr;
347 emitError() <<
"Invalid attribute `column` in property conversion: " << attr;
348 return ::mlir::failure();
354 auto &propStorage = prop.
signal;
355 auto attr = dict.get(
"signal");
357 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
359 propStorage = convertedAttr;
361 emitError() <<
"Invalid attribute `signal` in property conversion: " << attr;
362 return ::mlir::failure();
369 auto attr = dict.get(
"sym_name");
371 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
373 propStorage = convertedAttr;
375 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
376 return ::mlir::failure();
382 auto &propStorage = prop.
type;
383 auto attr = dict.get(
"type");
385 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
387 propStorage = convertedAttr;
389 emitError() <<
"Invalid attribute `type` in property conversion: " << attr;
390 return ::mlir::failure();
394 return ::mlir::success();
398 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
399 ::mlir::Builder odsBuilder{ctx};
402 const auto &propStorage = prop.
column;
404 attrs.push_back(odsBuilder.getNamedAttr(
"column",
409 const auto &propStorage = prop.
signal;
411 attrs.push_back(odsBuilder.getNamedAttr(
"signal",
416 const auto &propStorage = prop.
sym_name;
418 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
423 const auto &propStorage = prop.
type;
425 attrs.push_back(odsBuilder.getNamedAttr(
"type",
430 return odsBuilder.getDictionaryAttr(attrs);
435 return llvm::hash_combine(
436 llvm::hash_value(prop.
column.getAsOpaquePointer()),
437 llvm::hash_value(prop.
signal.getAsOpaquePointer()),
438 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()),
439 llvm::hash_value(prop.
type.getAsOpaquePointer()));
443 if (name ==
"column")
446 if (name ==
"signal")
449 if (name ==
"sym_name")
458 if (name ==
"column") {
459 prop.
column = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
column)>>(value);
463 if (name ==
"signal") {
464 prop.
signal = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
signal)>>(value);
468 if (name ==
"sym_name") {
469 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
473 if (name ==
"type") {
474 prop.
type = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
type)>>(value);
486 if (prop.
type) attrs.append(
"type", prop.
type);
489::llvm::LogicalResult
MemberDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
492 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"column", emitError)))
493 return ::mlir::failure();
498 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"signal", emitError)))
499 return ::mlir::failure();
504 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
505 return ::mlir::failure();
510 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"type", emitError)))
511 return ::mlir::failure();
513 return ::mlir::success();
517 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
518 if (::mlir::failed(reader.readOptionalAttribute(prop.
column)))
519 return ::mlir::failure();
521 if (::mlir::failed(reader.readOptionalAttribute(prop.
signal)))
522 return ::mlir::failure();
524 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
525 return ::mlir::failure();
527 if (::mlir::failed(reader.readAttribute(prop.
type)))
528 return ::mlir::failure();
529 return ::mlir::success();
533 auto &prop = getProperties(); (void)prop;
535 writer.writeOptionalAttribute(prop.
column);
537 writer.writeOptionalAttribute(prop.
signal);
538 writer.writeAttribute(prop.
sym_name);
539 writer.writeAttribute(prop.
type);
544 return attr.getValue();
549 return ::llvm::cast<::mlir::Type>(attr.getValue());
555 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
556 return attr !=
nullptr;
562 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
563 return attr !=
nullptr;
567 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
571 getProperties().type = ::mlir::TypeAttr::get(attrValue);
575 auto &odsProp = getProperties().column;
577 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
583 auto &odsProp = getProperties().signal;
585 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
590void MemberDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes,
bool isSignal,
bool isColumn) {
591 build(odsBuilder, odsState, {}, {}, attributes, isSignal, isColumn);
595 auto tblgen_column = getProperties().column; (void)tblgen_column;
596 auto tblgen_signal = getProperties().signal; (void)tblgen_signal;
597 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
598 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
599 auto tblgen_type = getProperties().type; (void)tblgen_type;
600 if (!tblgen_type)
return emitOpError(
"requires attribute 'type'");
602 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
603 return ::mlir::failure();
605 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_type,
"type")))
606 return ::mlir::failure();
608 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_column,
"column")))
609 return ::mlir::failure();
611 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_signal,
"signal")))
612 return ::mlir::failure();
613 return ::mlir::success();
621 ::mlir::StringAttr sym_nameAttr;
622 ::mlir::TypeAttr typeAttr;
624 if (parser.parseSymbolName(sym_nameAttr))
625 return ::mlir::failure();
627 if (parser.parseColon())
628 return ::mlir::failure();
630 if (parser.parseCustomAttributeWithFallback(typeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
631 return ::mlir::failure();
635 auto loc = parser.getCurrentLocation();(void)loc;
636 if (parser.parseOptionalAttrDict(result.attributes))
637 return ::mlir::failure();
639 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
641 return ::mlir::failure();
643 return ::mlir::success();
649 _odsPrinter <<
' ' <<
":";
651 _odsPrinter.printAttributeWithoutType(
getTypeAttr());
652 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
653 elidedAttrs.push_back(
"sym_name");
654 elidedAttrs.push_back(
"type");
656 ::mlir::Builder odsBuilder(getContext());
658 if(attr && (attr == ((
false) ? odsBuilder.getUnitAttr() :
nullptr)))
659 elidedAttrs.push_back(
"column");
662 ::mlir::Builder odsBuilder(getContext());
664 if(attr && (attr == ((
false) ? odsBuilder.getUnitAttr() :
nullptr)))
665 elidedAttrs.push_back(
"signal");
667 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
685 bool isVariadic[] = {
false,
true};
686 int prevVariadicCount = 0;
687 for (
unsigned i = 0; i < index; ++i)
688 if (isVariadic[i]) ++prevVariadicCount;
692 int variadicSize = (odsOperandsSize - 1) / 1;
697 int start = index + (variadicSize - 1) * prevVariadicCount;
698 int size = isVariadic[index] ? variadicSize : 1;
699 return {start, size};
704 return attr.getValue();
709 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
713 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
732 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'struct.readm' op ""requires attribute 'mapOpGroupSizes'");
734 if (!tblgen_member_name)
return emitError(loc,
"'struct.readm' op ""requires attribute 'member_name'");
738 if (tblgen_member_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_member_name))))
739 return emitError(loc,
"'struct.readm' op ""attribute 'member_name' failed to satisfy constraint: flat symbol reference attribute");
741 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)))))
742 return emitError(loc,
"'struct.readm' op ""attribute 'tableOffset' failed to satisfy constraint: symbol reference attribute or index attribute or AffineMap attribute");
744 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
745 return emitError(loc,
"'struct.readm' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
747 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
748 return emitError(loc,
"'struct.readm' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
749 return ::mlir::success();
753 bool isVariadic[] = {
false,
true};
754 int prevVariadicCount = 0;
755 for (
unsigned i = 0; i < index; ++i)
756 if (isVariadic[i]) ++prevVariadicCount;
760 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
765 int start = index + (variadicSize - 1) * prevVariadicCount;
766 int size = isVariadic[index] ? variadicSize : 1;
767 return {start, size};
772 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
777 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
779 emitError() <<
"expected DictionaryAttr to set properties";
780 return ::mlir::failure();
785 auto attr = dict.get(
"mapOpGroupSizes");
787 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
789 propStorage = convertedAttr;
791 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
792 return ::mlir::failure();
799 auto attr = dict.get(
"member_name");
801 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
803 propStorage = convertedAttr;
805 emitError() <<
"Invalid attribute `member_name` in property conversion: " << attr;
806 return ::mlir::failure();
813 auto attr = dict.get(
"numDimsPerMap");
815 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
817 propStorage = convertedAttr;
819 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
820 return ::mlir::failure();
827 auto attr = dict.get(
"tableOffset");
829 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
831 propStorage = convertedAttr;
833 emitError() <<
"Invalid attribute `tableOffset` in property conversion: " << attr;
834 return ::mlir::failure();
838 return ::mlir::success();
842 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
843 ::mlir::Builder odsBuilder{ctx};
848 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
855 attrs.push_back(odsBuilder.getNamedAttr(
"member_name",
862 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
869 attrs.push_back(odsBuilder.getNamedAttr(
"tableOffset",
874 return odsBuilder.getDictionaryAttr(attrs);
879 return llvm::hash_combine(
881 llvm::hash_value(prop.
member_name.getAsOpaquePointer()),
883 llvm::hash_value(prop.
tableOffset.getAsOpaquePointer()));
887 if (name ==
"mapOpGroupSizes")
890 if (name ==
"member_name")
893 if (name ==
"numDimsPerMap")
896 if (name ==
"tableOffset")
902 if (name ==
"mapOpGroupSizes") {
907 if (name ==
"member_name") {
912 if (name ==
"numDimsPerMap") {
917 if (name ==
"tableOffset") {
933::llvm::LogicalResult
MemberReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
936 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr,
"mapOpGroupSizes", emitError)))
937 return ::mlir::failure();
942 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"member_name", emitError)))
943 return ::mlir::failure();
948 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr,
"numDimsPerMap", emitError)))
949 return ::mlir::failure();
954 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"tableOffset", emitError)))
955 return ::mlir::failure();
957 return ::mlir::success();
961 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
963 return ::mlir::failure();
965 if (::mlir::failed(reader.readAttribute(prop.
member_name)))
966 return ::mlir::failure();
968 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
969 return ::mlir::failure();
971 if (::mlir::failed(reader.readOptionalAttribute(prop.
tableOffset)))
972 return ::mlir::failure();
973 return ::mlir::success();
977 auto &prop = getProperties(); (void)prop;
988 return attr.getValue();
993 return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
1007 getProperties().member_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
1011 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1015 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1018void MemberReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value
component, ::mlir::StringAttr member, ::mlir::SymbolRefAttr dist) {
1019 build(odsBuilder, odsState, resultType,
component, member, dist, ::mlir::ValueRange(), std::nullopt);
1023void MemberReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value
component, ::mlir::StringAttr member, ::mlir::IntegerAttr dist) {
1024 build(odsBuilder, odsState, resultType,
component, member, dist, ::mlir::ValueRange(), std::nullopt);
1029 ::mlir::Builder odsBuilder(opName.getContext());
1031 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
1035 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
1036 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
1037 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1038 if (!tblgen_member_name)
return emitOpError(
"requires attribute 'member_name'");
1039 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
1040 auto tblgen_tableOffset = getProperties().tableOffset; (void)tblgen_tableOffset;
1042 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_member_name,
"member_name")))
1043 return ::mlir::failure();
1045 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_tableOffset,
"tableOffset")))
1046 return ::mlir::failure();
1048 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
1049 return ::mlir::failure();
1051 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
1052 return ::mlir::failure();
1054 unsigned index = 0; (void)index;
1057 for (
auto v : valueGroup0) {
1058 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1059 return ::mlir::failure();
1062 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
1063 return ::mlir::failure();
1065 for (
auto v : valueGroup1) {
1066 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
1067 return ::mlir::failure();
1071 unsigned index = 0; (void)index;
1074 for (
auto v : valueGroup0) {
1075 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"result", index++)))
1076 return ::mlir::failure();
1079 return ::mlir::success();
1084 return ::mlir::success();
1085 return ::mlir::failure();
1089 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1090 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1091 (void)componentOperandsLoc;
1092 ::mlir::FlatSymbolRefAttr member_nameAttr;
1093 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
1094 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
1095 ::llvm::SMLoc mapOperandsOperandsLoc;
1096 (void)mapOperandsOperandsLoc;
1097 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
1098 ::mlir::Type componentRawType{};
1099 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1100 ::mlir::Type valRawType{};
1101 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1103 componentOperandsLoc = parser.getCurrentLocation();
1104 if (parser.parseOperand(componentRawOperand))
1105 return ::mlir::failure();
1106 if (parser.parseLSquare())
1107 return ::mlir::failure();
1109 if (parser.parseCustomAttributeWithFallback(member_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1110 return ::mlir::failure();
1113 if (parser.parseRSquare())
1114 return ::mlir::failure();
1115 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
1117 mapOperandsOperandsLoc = parser.getCurrentLocation();
1118 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
1120 if (odsResult) return ::mlir::failure();
1121 for (
const auto &subRange : mapOperandsOperandGroups) {
1122 mapOperandsOperands.append(subRange.begin(), subRange.end());
1123 mapOperandsOperandGroupSizes.push_back(subRange.size());
1125 if (numDimsPerMapAttr)
1128 if (parser.parseRBrace())
1129 return ::mlir::failure();
1131 if (parser.parseColon())
1132 return ::mlir::failure();
1136 if (parser.parseCustomTypeWithFallback(type))
1137 return ::mlir::failure();
1138 componentRawType = type;
1140 if (parser.parseComma())
1141 return ::mlir::failure();
1145 if (parser.parseCustomTypeWithFallback(type))
1146 return ::mlir::failure();
1150 auto loc = parser.getCurrentLocation();(void)loc;
1151 if (parser.parseOptionalAttrDict(result.attributes))
1152 return ::mlir::failure();
1154 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1156 return ::mlir::failure();
1158 result.getOrAddProperties<
MemberReadOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
1159 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1160 result.addTypes(valTypes);
1161 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1162 return ::mlir::failure();
1163 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
1164 return ::mlir::failure();
1165 return ::mlir::success();
1175 _odsPrinter <<
' ' <<
"{";
1179 _odsPrinter <<
' ' <<
":";
1183 if (
auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1184 _odsPrinter.printStrippedAttrOrType(validType);
1186 _odsPrinter << type;
1191 auto type =
getVal().getType();
1192 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1193 _odsPrinter.printStrippedAttrOrType(validType);
1195 _odsPrinter << type;
1197 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1198 elidedAttrs.push_back(
"mapOpGroupSizes");
1199 elidedAttrs.push_back(
"member_name");
1200 elidedAttrs.push_back(
"numDimsPerMap");
1202 ::mlir::Builder odsBuilder(getContext());
1204 if(attr && (attr == odsBuilder.getDenseI32ArrayAttr({})))
1205 elidedAttrs.push_back(
"numDimsPerMap");
1207 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1219namespace component {
1230 return attr.getValue();
1238 if (!tblgen_member_name)
return emitError(loc,
"'struct.writem' op ""requires attribute 'member_name'");
1240 if (tblgen_member_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_member_name))))
1241 return emitError(loc,
"'struct.writem' op ""attribute 'member_name' failed to satisfy constraint: flat symbol reference attribute");
1242 return ::mlir::success();
1246 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1248 emitError() <<
"expected DictionaryAttr to set properties";
1249 return ::mlir::failure();
1254 auto attr = dict.get(
"member_name");
1256 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1257 if (convertedAttr) {
1258 propStorage = convertedAttr;
1260 emitError() <<
"Invalid attribute `member_name` in property conversion: " << attr;
1261 return ::mlir::failure();
1265 return ::mlir::success();
1269 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1270 ::mlir::Builder odsBuilder{ctx};
1275 attrs.push_back(odsBuilder.getNamedAttr(
"member_name",
1280 return odsBuilder.getDictionaryAttr(attrs);
1285 return llvm::hash_combine(
1286 llvm::hash_value(prop.
member_name.getAsOpaquePointer()));
1290 if (name ==
"member_name")
1292 return std::nullopt;
1296 if (name ==
"member_name") {
1309 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"member_name", emitError)))
1310 return ::mlir::failure();
1312 return ::mlir::success();
1316 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1317 if (::mlir::failed(reader.readAttribute(prop.
member_name)))
1318 return ::mlir::failure();
1319 return ::mlir::success();
1323 auto &prop = getProperties(); (void)prop;
1329 return attr.getValue();
1333 getProperties().member_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
1336void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value
component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1338 odsState.addOperands(val);
1339 odsState.getOrAddProperties<
Properties>().member_name = member_name;
1342void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value
component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val) {
1344 odsState.addOperands(val);
1345 odsState.getOrAddProperties<
Properties>().member_name = member_name;
1346 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1347 odsState.addTypes(resultTypes);
1350void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value
component, ::llvm::StringRef member_name, ::mlir::Value val) {
1352 odsState.addOperands(val);
1353 odsState.getOrAddProperties<
Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1356void MemberWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value
component, ::llvm::StringRef member_name, ::mlir::Value val) {
1358 odsState.addOperands(val);
1359 odsState.getOrAddProperties<
Properties>().member_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), member_name);
1360 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1361 odsState.addTypes(resultTypes);
1364void MemberWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1365 assert(operands.size() == 2u &&
"mismatched number of parameters");
1366 odsState.addOperands(operands);
1367 odsState.addAttributes(attributes);
1368 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1369 odsState.addTypes(resultTypes);
1371 if (!attributes.empty()) {
1372 ::mlir::OpaqueProperties properties =
1374 std::optional<::mlir::RegisteredOperationName> info =
1375 odsState.name.getRegisteredInfo();
1376 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1377 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1378 ::llvm::report_fatal_error(
"Property conversion failed.");
1383 auto tblgen_member_name = getProperties().member_name; (void)tblgen_member_name;
1384 if (!tblgen_member_name)
return emitOpError(
"requires attribute 'member_name'");
1386 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_member_name,
"member_name")))
1387 return ::mlir::failure();
1389 unsigned index = 0; (void)index;
1392 for (
auto v : valueGroup0) {
1393 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1394 return ::mlir::failure();
1398 for (
auto v : valueGroup1) {
1399 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1400 return ::mlir::failure();
1403 return ::mlir::success();
1411 ::mlir::OpAsmParser::UnresolvedOperand componentRawOperand{};
1412 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> componentOperands(&componentRawOperand, 1); ::llvm::SMLoc componentOperandsLoc;
1413 (void)componentOperandsLoc;
1414 ::mlir::FlatSymbolRefAttr member_nameAttr;
1415 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1416 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1417 (void)valOperandsLoc;
1418 ::mlir::Type componentRawType{};
1419 ::llvm::ArrayRef<::mlir::Type> componentTypes(&componentRawType, 1);
1420 ::mlir::Type valRawType{};
1421 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1423 componentOperandsLoc = parser.getCurrentLocation();
1424 if (parser.parseOperand(componentRawOperand))
1425 return ::mlir::failure();
1426 if (parser.parseLSquare())
1427 return ::mlir::failure();
1429 if (parser.parseCustomAttributeWithFallback(member_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1430 return ::mlir::failure();
1433 if (parser.parseRSquare())
1434 return ::mlir::failure();
1435 if (parser.parseEqual())
1436 return ::mlir::failure();
1438 valOperandsLoc = parser.getCurrentLocation();
1439 if (parser.parseOperand(valRawOperand))
1440 return ::mlir::failure();
1441 if (parser.parseColon())
1442 return ::mlir::failure();
1446 if (parser.parseCustomTypeWithFallback(type))
1447 return ::mlir::failure();
1448 componentRawType = type;
1450 if (parser.parseComma())
1451 return ::mlir::failure();
1455 if (parser.parseCustomTypeWithFallback(type))
1456 return ::mlir::failure();
1460 auto loc = parser.getCurrentLocation();(void)loc;
1461 if (parser.parseOptionalAttrDict(result.attributes))
1462 return ::mlir::failure();
1464 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1466 return ::mlir::failure();
1468 if (parser.resolveOperands(componentOperands, componentTypes, componentOperandsLoc, result.operands))
1469 return ::mlir::failure();
1470 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1471 return ::mlir::failure();
1472 return ::mlir::success();
1481 _odsPrinter <<
' ' <<
"=";
1484 _odsPrinter <<
' ' <<
":";
1488 if (
auto validType = ::llvm::dyn_cast<::llzk::component::StructType>(type))
1489 _odsPrinter.printStrippedAttrOrType(validType);
1491 _odsPrinter << type;
1496 auto type =
getVal().getType();
1497 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1498 _odsPrinter.printStrippedAttrOrType(validType);
1500 _odsPrinter << type;
1502 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1503 elidedAttrs.push_back(
"member_name");
1504 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1516namespace component {
1527 return attr.getValue();
1532 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1541 if (!tblgen_sym_name)
return emitError(loc,
"'struct.def' op ""requires attribute 'sym_name'");
1543 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1544 return emitError(loc,
"'struct.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1546 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))); }))))
1547 return emitError(loc,
"'struct.def' op ""attribute 'const_params' failed to satisfy constraint: flat symbol ref array attribute");
1548 return ::mlir::success();
1552 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1554 emitError() <<
"expected DictionaryAttr to set properties";
1555 return ::mlir::failure();
1560 auto attr = dict.get(
"const_params");
1562 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1563 if (convertedAttr) {
1564 propStorage = convertedAttr;
1566 emitError() <<
"Invalid attribute `const_params` in property conversion: " << attr;
1567 return ::mlir::failure();
1574 auto attr = dict.get(
"sym_name");
1576 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1577 if (convertedAttr) {
1578 propStorage = convertedAttr;
1580 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
1581 return ::mlir::failure();
1585 return ::mlir::success();
1589 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1590 ::mlir::Builder odsBuilder{ctx};
1595 attrs.push_back(odsBuilder.getNamedAttr(
"const_params",
1600 const auto &propStorage = prop.
sym_name;
1602 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
1607 return odsBuilder.getDictionaryAttr(attrs);
1612 return llvm::hash_combine(
1613 llvm::hash_value(prop.
const_params.getAsOpaquePointer()),
1614 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
1618 if (name ==
"const_params")
1621 if (name ==
"sym_name")
1623 return std::nullopt;
1627 if (name ==
"const_params") {
1632 if (name ==
"sym_name") {
1633 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
1644::llvm::LogicalResult
StructDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1647 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops7(attr,
"const_params", emitError)))
1648 return ::mlir::failure();
1653 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
1654 return ::mlir::failure();
1656 return ::mlir::success();
1660 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1661 if (::mlir::failed(reader.readOptionalAttribute(prop.
const_params)))
1662 return ::mlir::failure();
1664 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
1665 return ::mlir::failure();
1666 return ::mlir::success();
1670 auto &prop = getProperties(); (void)prop;
1673 writer.writeAttribute(prop.
sym_name);
1678 return attr.getValue();
1683 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1687 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1690void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params) {
1691 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1693 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1695 (void)odsState.addRegion();
1698void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr const_params) {
1699 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1701 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1703 (void)odsState.addRegion();
1704 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1705 odsState.addTypes(resultTypes);
1708void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::ArrayAttr const_params) {
1709 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1711 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1713 (void)odsState.addRegion();
1716void StructDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr const_params) {
1717 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1719 odsState.getOrAddProperties<
Properties>().const_params = const_params;
1721 (void)odsState.addRegion();
1722 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1723 odsState.addTypes(resultTypes);
1726void StructDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1727 assert(operands.size() == 0u &&
"mismatched number of parameters");
1728 odsState.addOperands(operands);
1729 odsState.addAttributes(attributes);
1730 for (
unsigned i = 0; i != 1; ++i)
1731 (
void)odsState.addRegion();
1732 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1733 odsState.addTypes(resultTypes);
1735 if (!attributes.empty()) {
1736 ::mlir::OpaqueProperties properties =
1738 std::optional<::mlir::RegisteredOperationName> info =
1739 odsState.name.getRegisteredInfo();
1740 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1741 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1742 ::llvm::report_fatal_error(
"Property conversion failed.");
1747 auto tblgen_const_params = getProperties().const_params; (void)tblgen_const_params;
1748 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1749 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
1751 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
1752 return ::mlir::failure();
1754 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops7(*
this, tblgen_const_params,
"const_params")))
1755 return ::mlir::failure();
1757 unsigned index = 0; (void)index;
1759 for (
auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1760 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*
this, region,
"bodyRegion", index++)))
1761 return ::mlir::failure();
1763 return ::mlir::success();
1771 ::mlir::StringAttr sym_nameAttr;
1772 ::mlir::ArrayAttr const_paramsAttr;
1773 std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
1775 if (parser.parseSymbolName(sym_nameAttr))
1776 return ::mlir::failure();
1778 if (::mlir::succeeded(parser.parseOptionalLess())) {
1780 if (parser.parseCustomAttributeWithFallback(const_paramsAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1781 return ::mlir::failure();
1784 if (parser.parseGreater())
1785 return ::mlir::failure();
1788 if (parser.parseRegion(*bodyRegionRegion))
1789 return ::mlir::failure();
1791 if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
1793 auto loc = parser.getCurrentLocation();(void)loc;
1794 if (parser.parseOptionalAttrDict(result.attributes))
1795 return ::mlir::failure();
1797 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1799 return ::mlir::failure();
1801 result.addRegion(std::move(bodyRegionRegion));
1802 return ::mlir::success();
1815 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1816 elidedAttrs.push_back(
"sym_name");
1817 elidedAttrs.push_back(
"const_params");
1818 _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)
MemberDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
MemberDefOpAdaptor(MemberDefOp op)
::mlir::ValueRange getOperands()
::llvm::StringRef getSymName()
void setSignal(bool attrValue)
::mlir::StringAttr getTypeAttrName()
::mlir::StringAttr getColumnAttrName()
::llvm::LogicalResult verifyInvariants()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::UnitAttr getSignalAttr()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, bool isSignal=false, bool isColumn=false)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
void setColumn(bool attrValue)
::mlir::TypeAttr getTypeAttr()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::StringAttr getSignalAttrName()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::StringAttr getSymNameAttr()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
void setType(::mlir::Type attrValue)
FoldAdaptor::Properties Properties
void setSymName(::llvm::StringRef attrValue)
::mlir::UnitAttr getColumnAttr()
::mlir::StringAttr getSymNameAttrName()
MemberReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
MemberReadOpAdaptor(MemberReadOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::mlir::MutableOperandRangeRange getMapOperandsMutable()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::TypedValue<::llzk::component::StructType > getComponent()
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
::mlir::TypedValue<::mlir::Type > getVal()
::std::optional<::mlir::Attribute > getTableOffset()
::mlir::OperandRangeRange getMapOperands()
bool isRead()
Return true if the op is a read, false if it's a write.
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType, ::mlir::Value component, ::mlir::StringAttr member)
::llvm::LogicalResult verifyInvariantsImpl()
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
::mlir::FlatSymbolRefAttr getMemberNameAttr()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::StringAttr getMapOpGroupSizesAttrName()
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult verifyInvariants()
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::llvm::StringRef getMemberName()
::mlir::StringAttr getTableOffsetAttrName()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verify()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::Attribute getTableOffsetAttr()
void setMemberName(::llvm::StringRef attrValue)
::mlir::StringAttr getMemberNameAttrName()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
FoldAdaptor::Properties Properties
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::mlir::StringAttr getNumDimsPerMapAttrName()
MemberWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
MemberWriteOpAdaptor(MemberWriteOp op)
::mlir::ValueRange getOperands()
::mlir::TypedValue<::llzk::component::StructType > getComponent()
void setMemberName(::llvm::StringRef attrValue)
FoldAdaptor::Properties Properties
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::FlatSymbolRefAttr getMemberNameAttr()
bool isRead()
Return true if the op is a read, false if it's a write.
::llvm::LogicalResult verifyInvariants()
void print(::mlir::OpAsmPrinter &_odsPrinter)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value component, ::mlir::FlatSymbolRefAttr member_name, ::mlir::Value val)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::StringRef getMemberName()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::Operation::operand_range getODSOperands(unsigned index)
::llvm::LogicalResult verifyInvariantsImpl()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getVal()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::StringAttr getMemberNameAttrName()
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)
::mlir::RegionRange odsRegions
::mlir::StringAttr getSymNameAttr()
::llvm::StringRef getSymName()
const Properties & getProperties()
::mlir::UnitAttr getColumnAttr()
::mlir::DictionaryAttr odsAttrs
::mlir::UnitAttr getSignalAttr()
MemberDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::TypeAttr getTypeAttr()
::mlir::DictionaryAttr odsAttrs
const Properties & getProperties()
::mlir::RegionRange odsRegions
::std::optional<::mlir::Attribute > getTableOffset()
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::mlir::Attribute getTableOffsetAttr()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
MemberReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::llvm::StringRef getMemberName()
::mlir::FlatSymbolRefAttr getMemberNameAttr()
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
MemberWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::StringRef getMemberName()
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
const Properties & getProperties()
::mlir::FlatSymbolRefAttr getMemberNameAttr()
::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)
mapOpGroupSizesTy mapOpGroupSizes
numDimsPerMapTy numDimsPerMap
tableOffsetTy tableOffset
member_nameTy member_name
member_nameTy member_name
const_paramsTy const_params