27static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
28 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
29 unsigned valueIndex) {
31 return op->emitOpError(valueKind) <<
" #" << valueIndex
32 <<
" must be variadic of a valid LLZK type, but got " << type;
34 return ::mlir::success();
37static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
38 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
39 unsigned valueIndex) {
40 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
41 return op->emitOpError(valueKind) <<
" #" << valueIndex
42 <<
" must be variadic of index, but got " << type;
44 return ::mlir::success();
47static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
48 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
49 unsigned valueIndex) {
50 if (!((::llvm::isa<::llzk::pod::PodType>(type)))) {
51 return op->emitOpError(valueKind) <<
" #" << valueIndex
52 <<
" must be plain-old-data struct, but got " << type;
54 return ::mlir::success();
57static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops4(
58 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
59 unsigned valueIndex) {
61 return op->emitOpError(valueKind) <<
" #" << valueIndex
62 <<
" must be a valid LLZK type, but got " << type;
64 return ::mlir::success();
67static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
68 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
69 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) {
return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
70 return emitError() <<
"attribute '" << attrName
71 <<
"' failed to satisfy constraint: string array attribute";
72 return ::mlir::success();
74static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
75 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
76 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
77 return op->emitOpError();
81static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
82 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
83 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
84 return emitError() <<
"attribute '" << attrName
85 <<
"' failed to satisfy constraint: i32 dense array attribute";
86 return ::mlir::success();
88static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
89 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
90 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
91 return op->emitOpError();
95static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
96 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
97 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
98 return emitError() <<
"attribute '" << attrName
99 <<
"' failed to satisfy constraint: string attribute";
100 return ::mlir::success();
102static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
103 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
104 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
105 return op->emitOpError();
123 for (
unsigned i = 0; i < index; ++i)
124 start += sizeAttr[i];
125 return {start, sizeAttr[index]};
129 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(
getProperties().initializedRecords);
139 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
160 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'pod.new' op requires attribute 'mapOpGroupSizes'");
163 if (tblgen_initializedRecords && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_initializedRecords))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_initializedRecords), [&](::mlir::Attribute attr) {
return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
164 return emitError(loc,
"'pod.new' op attribute 'initializedRecords' failed to satisfy constraint: string array attribute");
166 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
167 return emitError(loc,
"'pod.new' op attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
169 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
170 return emitError(loc,
"'pod.new' op attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
171 return ::mlir::success();
175 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
178 for (
unsigned i = 0; i < index; ++i)
179 start += sizeAttr[i];
180 return {start, sizeAttr[index]};
185 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
191 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
196 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
198 emitError() <<
"expected DictionaryAttr to set properties";
199 return ::mlir::failure();
204 auto attr = dict.get(
"initializedRecords");
206 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
208 propStorage = convertedAttr;
210 emitError() <<
"Invalid attribute `initializedRecords` in property conversion: " << attr;
211 return ::mlir::failure();
218 auto attr = dict.get(
"mapOpGroupSizes");
220 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
222 propStorage = convertedAttr;
224 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
225 return ::mlir::failure();
232 auto attr = dict.get(
"numDimsPerMap");
234 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
236 propStorage = convertedAttr;
238 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
239 return ::mlir::failure();
245 auto setFromAttr = [] (
auto &propStorage, ::mlir::Attribute propAttr,
246 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
247 return convertFromAttribute(propStorage, propAttr, emitError);
249 auto attr = dict.get(
"operandSegmentSizes");
if (!attr) attr = dict.get(
"operand_segment_sizes");;
252 return emitError() <<
"for `operandSegmentSizes`: ";
254 return ::mlir::failure();
256 return ::mlir::success();
260 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
261 ::mlir::Builder odsBuilder{ctx};
266 attrs.push_back(odsBuilder.getNamedAttr(
"initializedRecords",
273 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
280 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
286 auto attr = [&]() -> ::mlir::Attribute {
287 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
289 attrs.push_back(odsBuilder.getNamedAttr(
"operandSegmentSizes", attr));
293 return odsBuilder.getDictionaryAttr(attrs);
298 auto hash_operandSegmentSizes_ = [] (
const auto &propStorage) -> llvm::hash_code {
299 using ::llvm::hash_value;
300 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
302 using llvm::hash_value;
303 return llvm::hash_combine(
311 if (name ==
"initializedRecords")
314 if (name ==
"mapOpGroupSizes")
317 if (name ==
"numDimsPerMap")
319 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes")
return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }();
324 if (name ==
"initializedRecords") {
329 if (name ==
"mapOpGroupSizes") {
334 if (name ==
"numDimsPerMap") {
338 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes") {
339 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
340 if (!arrAttr)
return;
354 attrs.append(
"operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }());
357::llvm::LogicalResult
NewPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
360 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"initializedRecords", emitError)))
361 return ::mlir::failure();
366 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"mapOpGroupSizes", emitError)))
367 return ::mlir::failure();
372 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"numDimsPerMap", emitError)))
373 return ::mlir::failure();
375 return ::mlir::success();
379 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
381 return ::mlir::failure();
384 return ::mlir::failure();
386 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
387 return ::mlir::failure();
389 if (reader.getBytecodeVersion() < 6) {
391 ::mlir::DenseI32ArrayAttr attr;
392 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
393 if (attr.size() >
static_cast<int64_t
>(
sizeof(propStorage) /
sizeof(int32_t))) {
394 reader.emitError(
"size mismatch for operand/result_segment_size");
395 return ::mlir::failure();
397 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
402 auto readProp = [&]() {
404 if (reader.getBytecodeVersion() >= 6)
405 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
407 return ::mlir::success();
409 if (::mlir::failed(readProp()))
410 return ::mlir::failure();
412 return ::mlir::success();
416 auto &prop = getProperties(); (void)prop;
423if (writer.getBytecodeVersion() < 6) {
425 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
431 if (writer.getBytecodeVersion() >= 6)
432 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
453 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
457 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
462 build(odsBuilder, odsState, resultType, initialValues);
468 build(builder, __state__, std::forward<
decltype(initialValues)>(initialValues));
469 auto __res__ = ::llvm::dyn_cast<NewPodOp>(builder.create(__state__));
470 assert(__res__ &&
"builder didn't return the right type");
475 return create(builder, builder.getLoc(), std::forward<
decltype(initialValues)>(initialValues));
480 build(builder, __state__, std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(initialValues)>(initialValues));
481 auto __res__ = ::llvm::dyn_cast<NewPodOp>(builder.create(__state__));
482 assert(__res__ &&
"builder didn't return the right type");
487 return create(builder, builder.getLoc(), std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(initialValues)>(initialValues));
492 build(builder, __state__, std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(mapOperands)>(mapOperands), std::forward<
decltype(numDimsPerMap)>(numDimsPerMap), std::forward<
decltype(initialValues)>(initialValues));
493 auto __res__ = ::llvm::dyn_cast<NewPodOp>(builder.create(__state__));
494 assert(__res__ &&
"builder didn't return the right type");
499 return create(builder, builder.getLoc(), std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(mapOperands)>(mapOperands), std::forward<
decltype(numDimsPerMap)>(numDimsPerMap), std::forward<
decltype(initialValues)>(initialValues));
503 build(odsBuilder, odsState, resultType, mapOperands,
504 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap), initialValues);
510 build(builder, __state__, std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(mapOperands)>(mapOperands), std::forward<
decltype(numDimsPerMap)>(numDimsPerMap), std::forward<
decltype(initialValues)>(initialValues));
511 auto __res__ = ::llvm::dyn_cast<NewPodOp>(builder.create(__state__));
512 assert(__res__ &&
"builder didn't return the right type");
517 return create(builder, builder.getLoc(), std::forward<
decltype(resultType)>(resultType), std::forward<
decltype(mapOperands)>(mapOperands), std::forward<
decltype(numDimsPerMap)>(numDimsPerMap), std::forward<
decltype(initialValues)>(initialValues));
521 ::mlir::Builder odsBuilder(opName.getContext());
525 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
529 auto tblgen_initializedRecords = getProperties().initializedRecords; (void)tblgen_initializedRecords;
530 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
531 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
532 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
534 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_initializedRecords,
"initializedRecords")))
535 return ::mlir::failure();
537 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
538 return ::mlir::failure();
540 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
541 return ::mlir::failure();
543 unsigned index = 0; (void)index;
546 for (
auto v : valueGroup0) {
547 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
548 return ::mlir::failure();
551 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
552 return ::mlir::failure();
554 for (
auto v : valueGroup1) {
555 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
556 return ::mlir::failure();
560 unsigned index = 0; (void)index;
563 for (
auto v : valueGroup0) {
564 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"result", index++)))
565 return ::mlir::failure();
568 return ::mlir::success();
573 return ::mlir::success();
574 return ::mlir::failure();
578 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
580 emitError() <<
"expected DictionaryAttr to set properties";
581 return ::mlir::failure();
585 ::mlir::DenseSet<::mlir::StringAttr> usedKeys;
586 ::mlir::MLIRContext *ctx = dict.getContext();
591 auto initializedRecordsAttrName = ::mlir::StringAttr::get(ctx,
"initializedRecords");
592 auto attr = dict.get(initializedRecordsAttrName);
593 usedKeys.insert(initializedRecordsAttrName);
596 emitError() <<
"expected key entry for initializedRecords in DictionaryAttr to set "
598 return ::mlir::failure();
600 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
602 propStorage = convertedAttr;
604 emitError() <<
"Invalid attribute `initializedRecords` in property conversion: " << attr;
605 return ::mlir::failure();
612 auto numDimsPerMapAttrName = ::mlir::StringAttr::get(ctx,
"numDimsPerMap");
613 auto attr = dict.get(numDimsPerMapAttrName);
614 usedKeys.insert(numDimsPerMapAttrName);
617 emitError() <<
"expected key entry for numDimsPerMap in DictionaryAttr to set "
619 return ::mlir::failure();
621 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
623 propStorage = convertedAttr;
625 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
626 return ::mlir::failure();
633 auto mapOpGroupSizesAttrName = ::mlir::StringAttr::get(ctx,
"mapOpGroupSizes");
634 auto attr = dict.get(mapOpGroupSizesAttrName);
635 usedKeys.insert(mapOpGroupSizesAttrName);
638 emitError() <<
"expected key entry for mapOpGroupSizes in DictionaryAttr to set "
640 return ::mlir::failure();
642 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
644 propStorage = convertedAttr;
646 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
647 return ::mlir::failure();
652 for (::mlir::NamedAttribute attr : dict) {
653 if (!usedKeys.contains(attr.getName()))
654 return emitError() <<
"unknown key '" << attr.getName() <<
655 "' when parsing properties dictionary";
657 return ::mlir::success();
660void NewPodOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
661 effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), 0,
false, ::llzk::DiscardableAllocationResource::get());
682 return attr.getValue();
691 if (!tblgen_record_name)
return emitError(loc,
"'pod.read' op requires attribute 'record_name'");
693 if (tblgen_record_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_record_name))))
694 return emitError(loc,
"'pod.read' op attribute 'record_name' failed to satisfy constraint: string attribute");
695 return ::mlir::success();
699 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
701 emitError() <<
"expected DictionaryAttr to set properties";
702 return ::mlir::failure();
707 auto attr = dict.get(
"record_name");
709 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
711 propStorage = convertedAttr;
713 emitError() <<
"Invalid attribute `record_name` in property conversion: " << attr;
714 return ::mlir::failure();
718 return ::mlir::success();
722 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
723 ::mlir::Builder odsBuilder{ctx};
728 attrs.push_back(odsBuilder.getNamedAttr(
"record_name",
733 return odsBuilder.getDictionaryAttr(attrs);
738 using llvm::hash_value;
739 return llvm::hash_combine(
740 llvm::hash_value(prop.
record_name.getAsOpaquePointer()));
744 if (name ==
"record_name")
750 if (name ==
"record_name") {
760::llvm::LogicalResult
ReadPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
763 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"record_name", emitError)))
764 return ::mlir::failure();
766 return ::mlir::success();
771 return attr.getValue();
775 getProperties().record_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
778void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
779 odsState.addOperands(pod_ref);
780 odsState.getOrAddProperties<
Properties>().record_name = record_name;
781 odsState.addTypes(result);
784ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
786 build(builder, __state__, std::forward<
decltype(result)>(result), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
787 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
788 assert(__res__ &&
"builder didn't return the right type");
792ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
793 return create(builder, builder.getLoc(), std::forward<
decltype(result)>(result), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
796void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
797 odsState.addOperands(pod_ref);
798 odsState.getOrAddProperties<
Properties>().record_name = record_name;
799 assert(resultTypes.size() == 1u &&
"mismatched number of results");
800 odsState.addTypes(resultTypes);
803ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
805 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
806 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
807 assert(__res__ &&
"builder didn't return the right type");
811ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name) {
812 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
815void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
816 odsState.addOperands(pod_ref);
817 odsState.getOrAddProperties<
Properties>().record_name = odsBuilder.getStringAttr(record_name);
818 odsState.addTypes(result);
821ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
823 build(builder, __state__, std::forward<
decltype(result)>(result), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
824 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
825 assert(__res__ &&
"builder didn't return the right type");
829ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
830 return create(builder, builder.getLoc(), std::forward<
decltype(result)>(result), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
833void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
834 odsState.addOperands(pod_ref);
835 odsState.getOrAddProperties<
Properties>().record_name = odsBuilder.getStringAttr(record_name);
836 assert(resultTypes.size() == 1u &&
"mismatched number of results");
837 odsState.addTypes(resultTypes);
840ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
842 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
843 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
844 assert(__res__ &&
"builder didn't return the right type");
848ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
849 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name));
852void ReadPodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
853 assert(operands.size() == 1u &&
"mismatched number of parameters");
854 odsState.addOperands(operands);
855 odsState.addAttributes(attributes);
856 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
857 odsState.addTypes(resultTypes);
859 if (!attributes.empty()) {
861 ::mlir::PropertyRef properties = odsState.getRawProperties();
862 std::optional<::mlir::RegisteredOperationName> info =
863 odsState.name.getRegisteredInfo();
864 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
865 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
866 ::llvm::report_fatal_error(
"Property conversion failed.");
870ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
872 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
873 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
874 assert(__res__ &&
"builder didn't return the right type");
878ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
879 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
882void ReadPodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
883 assert(operands.size() == 1u &&
"mismatched number of parameters");
884 odsState.addOperands(operands);
885 odsState.useProperties(
const_cast<Properties&
>(properties));
886 odsState.addAttributes(discardableAttributes);
887 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
888 odsState.addTypes(resultTypes);
891ReadPodOp ReadPodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
893 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
894 auto __res__ = ::llvm::dyn_cast<ReadPodOp>(builder.create(__state__));
895 assert(__res__ &&
"builder didn't return the right type");
899ReadPodOp ReadPodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
900 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
904 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
905 if (!tblgen_record_name)
return emitOpError(
"requires attribute 'record_name'");
907 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_record_name,
"record_name")))
908 return ::mlir::failure();
910 unsigned index = 0; (void)index;
913 for (
auto v : valueGroup0) {
914 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
915 return ::mlir::failure();
919 unsigned index = 0; (void)index;
922 for (
auto v : valueGroup0) {
923 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"result", index++)))
924 return ::mlir::failure();
927 return ::mlir::success();
932 return ::mlir::success();
933 return ::mlir::failure();
936::mlir::ParseResult
ReadPodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
937 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
938 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
939 (void)pod_refOperandsLoc;
940 ::mlir::StringAttr record_nameAttr;
941 ::mlir::Type pod_refRawType{};
942 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
943 ::mlir::Type resultRawType{};
944 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
946 pod_refOperandsLoc = parser.getCurrentLocation();
947 if (parser.parseOperand(pod_refRawOperand))
948 return ::mlir::failure();
949 if (parser.parseLSquare())
950 return ::mlir::failure();
953 if (odsResult) return ::mlir::failure();
956 if (parser.parseRSquare())
957 return ::mlir::failure();
958 if (parser.parseColon())
959 return ::mlir::failure();
963 if (parser.parseCustomTypeWithFallback(type))
964 return ::mlir::failure();
965 pod_refRawType = type;
967 if (parser.parseComma())
968 return ::mlir::failure();
972 if (parser.parseCustomTypeWithFallback(type))
973 return ::mlir::failure();
974 resultRawType = type;
977 auto loc = parser.getCurrentLocation();(void)loc;
978 if (parser.parseOptionalAttrDict(result.attributes))
979 return ::mlir::failure();
981 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
983 return ::mlir::failure();
985 result.addTypes(resultTypes);
986 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
987 return ::mlir::failure();
988 return ::mlir::success();
997 _odsPrinter <<
' ' <<
":";
1001 if (
auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
1002 _odsPrinter.printStrippedAttrOrType(validType);
1004 _odsPrinter << type;
1010 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1011 _odsPrinter.printStrippedAttrOrType(validType);
1013 _odsPrinter << type;
1015 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1016 elidedAttrs.push_back(
"record_name");
1017 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1022 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1023 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1024 const ::mlir::DataLayout &dataLayout) {
1025 return ::llvm::cast<PodAccessOpInterface>(getOperation())
1026 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1031 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1032 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1033 return ::llvm::cast<PodAccessOpInterface>(getOperation())
1034 .rewire(slot, subslots, builder, dataLayout);
1084 return attr.getValue();
1093 if (!tblgen_record_name)
return emitError(loc,
"'pod.write' op requires attribute 'record_name'");
1095 if (tblgen_record_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_record_name))))
1096 return emitError(loc,
"'pod.write' op attribute 'record_name' failed to satisfy constraint: string attribute");
1097 return ::mlir::success();
1101 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1103 emitError() <<
"expected DictionaryAttr to set properties";
1104 return ::mlir::failure();
1109 auto attr = dict.get(
"record_name");
1111 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1112 if (convertedAttr) {
1113 propStorage = convertedAttr;
1115 emitError() <<
"Invalid attribute `record_name` in property conversion: " << attr;
1116 return ::mlir::failure();
1120 return ::mlir::success();
1124 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1125 ::mlir::Builder odsBuilder{ctx};
1130 attrs.push_back(odsBuilder.getNamedAttr(
"record_name",
1135 return odsBuilder.getDictionaryAttr(attrs);
1140 using llvm::hash_value;
1141 return llvm::hash_combine(
1142 llvm::hash_value(prop.
record_name.getAsOpaquePointer()));
1146 if (name ==
"record_name")
1148 return std::nullopt;
1152 if (name ==
"record_name") {
1162::llvm::LogicalResult
WritePodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1165 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"record_name", emitError)))
1166 return ::mlir::failure();
1168 return ::mlir::success();
1173 return attr.getValue();
1177 getProperties().record_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1180void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value) {
1181 odsState.addOperands(pod_ref);
1182 odsState.addOperands(value);
1183 odsState.getOrAddProperties<
Properties>().record_name = record_name;
1186WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value) {
1188 build(builder, __state__, std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1189 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1190 assert(__res__ &&
"builder didn't return the right type");
1195 return create(builder, builder.getLoc(), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1198void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value) {
1199 odsState.addOperands(pod_ref);
1200 odsState.addOperands(value);
1201 odsState.getOrAddProperties<
Properties>().record_name = record_name;
1202 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1203 odsState.addTypes(resultTypes);
1206WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value) {
1208 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1209 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1210 assert(__res__ &&
"builder didn't return the right type");
1214WritePodOp WritePodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value) {
1215 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1218void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
1219 odsState.addOperands(pod_ref);
1220 odsState.addOperands(value);
1221 odsState.getOrAddProperties<
Properties>().record_name = odsBuilder.getStringAttr(record_name);
1224WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
1226 build(builder, __state__, std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1227 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1228 assert(__res__ &&
"builder didn't return the right type");
1233 return create(builder, builder.getLoc(), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1236void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
1237 odsState.addOperands(pod_ref);
1238 odsState.addOperands(value);
1239 odsState.getOrAddProperties<
Properties>().record_name = odsBuilder.getStringAttr(record_name);
1240 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1241 odsState.addTypes(resultTypes);
1244WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
1246 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1247 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1248 assert(__res__ &&
"builder didn't return the right type");
1252WritePodOp WritePodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
1253 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(pod_ref)>(pod_ref), std::forward<
decltype(record_name)>(record_name), std::forward<
decltype(value)>(value));
1256void WritePodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1257 assert(operands.size() == 2u &&
"mismatched number of parameters");
1258 odsState.addOperands(operands);
1259 odsState.addAttributes(attributes);
1260 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1261 odsState.addTypes(resultTypes);
1263 if (!attributes.empty()) {
1265 ::mlir::PropertyRef properties = odsState.getRawProperties();
1266 std::optional<::mlir::RegisteredOperationName> info =
1267 odsState.name.getRegisteredInfo();
1268 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1269 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1270 ::llvm::report_fatal_error(
"Property conversion failed.");
1274WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1276 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
1277 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1278 assert(__res__ &&
"builder didn't return the right type");
1282WritePodOp WritePodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1283 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
1286void WritePodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1287 assert(operands.size() == 2u &&
"mismatched number of parameters");
1288 odsState.addOperands(operands);
1289 odsState.useProperties(
const_cast<Properties&
>(properties));
1290 odsState.addAttributes(discardableAttributes);
1291 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1292 odsState.addTypes(resultTypes);
1295WritePodOp WritePodOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1297 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1298 auto __res__ = ::llvm::dyn_cast<WritePodOp>(builder.create(__state__));
1299 assert(__res__ &&
"builder didn't return the right type");
1303WritePodOp WritePodOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1304 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1308 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
1309 if (!tblgen_record_name)
return emitOpError(
"requires attribute 'record_name'");
1311 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_record_name,
"record_name")))
1312 return ::mlir::failure();
1314 unsigned index = 0; (void)index;
1317 for (
auto v : valueGroup0) {
1318 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1319 return ::mlir::failure();
1323 for (
auto v : valueGroup1) {
1324 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1325 return ::mlir::failure();
1328 return ::mlir::success();
1333 return ::mlir::success();
1334 return ::mlir::failure();
1338 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
1339 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
1340 (void)pod_refOperandsLoc;
1341 ::mlir::StringAttr record_nameAttr;
1342 ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
1343 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
1344 (void)valueOperandsLoc;
1345 ::mlir::Type pod_refRawType{};
1346 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
1347 ::mlir::Type valueRawType{};
1348 ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
1350 pod_refOperandsLoc = parser.getCurrentLocation();
1351 if (parser.parseOperand(pod_refRawOperand))
1352 return ::mlir::failure();
1353 if (parser.parseLSquare())
1354 return ::mlir::failure();
1357 if (odsResult) return ::mlir::failure();
1360 if (parser.parseRSquare())
1361 return ::mlir::failure();
1362 if (parser.parseEqual())
1363 return ::mlir::failure();
1365 valueOperandsLoc = parser.getCurrentLocation();
1366 if (parser.parseOperand(valueRawOperand))
1367 return ::mlir::failure();
1368 if (parser.parseColon())
1369 return ::mlir::failure();
1373 if (parser.parseCustomTypeWithFallback(type))
1374 return ::mlir::failure();
1375 pod_refRawType = type;
1377 if (parser.parseComma())
1378 return ::mlir::failure();
1382 if (parser.parseCustomTypeWithFallback(type))
1383 return ::mlir::failure();
1384 valueRawType = type;
1387 auto loc = parser.getCurrentLocation();(void)loc;
1388 if (parser.parseOptionalAttrDict(result.attributes))
1389 return ::mlir::failure();
1391 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1393 return ::mlir::failure();
1395 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
1396 return ::mlir::failure();
1397 if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
1398 return ::mlir::failure();
1399 return ::mlir::success();
1408 _odsPrinter <<
' ' <<
"=";
1411 _odsPrinter <<
' ' <<
":";
1415 if (
auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
1416 _odsPrinter.printStrippedAttrOrType(validType);
1418 _odsPrinter << type;
1424 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1425 _odsPrinter.printStrippedAttrOrType(validType);
1427 _odsPrinter << type;
1429 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1430 elidedAttrs.push_back(
"record_name");
1431 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1436 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1437 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1438 const ::mlir::DataLayout &dataLayout) {
1439 return ::llvm::cast<PodAccessOpInterface>(getOperation())
1440 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1445 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1446 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1447 return ::llvm::cast<PodAccessOpInterface>(getOperation())
1448 .rewire(slot, subslots, builder, dataLayout);
::llvm::LogicalResult verify(::mlir::Location loc)
NewPodOpAdaptor(NewPodOp op)
NewPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static NewPodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llzk::pod::InitializedRecords initialValues={})
static llvm::hash_code computePropertiesHash(const Properties &prop)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::ArrayAttr getInitializedRecordsAttr()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInvariantsImpl()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::pod::InitializedRecords initialValues={})
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::StringAttr getInitializedRecordsAttrName()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::StringAttr getMapOpGroupSizesAttrName()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::mlir::MutableOperandRange getInitialValuesMutable()
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
FoldAdaptor::Properties Properties
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::MutableOperandRangeRange getMapOperandsMutable()
::llvm::LogicalResult verify()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::mlir::ArrayAttr getInitializedRecords()
::mlir::StringAttr getNumDimsPerMapAttrName()
static constexpr ::llvm::StringLiteral getOperationName()
static PodType fromInitialValues(::mlir::MLIRContext *ctx, InitializedRecords init)
Creates a new type from a set of initialized records.
ReadPodOpAdaptor(ReadPodOp op)
ReadPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInvariants()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::StringRef getRecordName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::TypedValue<::mlir::Type > getResult()
::mlir::Operation::operand_range getODSOperands(unsigned index)
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
bool isRead()
Return true if the op is a read, false if it's a write.
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verify()
FoldAdaptor::Properties Properties
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
void print(::mlir::OpAsmPrinter &_odsPrinter)
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static constexpr ::llvm::StringLiteral getOperationName()
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::StringAttr getRecordNameAttr()
::mlir::StringAttr getRecordNameAttrName()
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute > &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot > &mustBeSafelyUsed, const ::mlir::DataLayout &dataLayout)
Required by DestructurableAllocationOpInterface / SROA pass.
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
void setRecordName(::llvm::StringRef attrValue)
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static ReadPodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::StringAttr record_name)
::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot > &subslots, ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout)
Required by DestructurableAllocationOpInterface / SROA pass.
WritePodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
WritePodOpAdaptor(WritePodOp op)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verify()
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult verifyInvariants()
static constexpr ::llvm::StringLiteral getOperationName()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::mlir::StringAttr getRecordNameAttr()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getValue()
void setRecordName(::llvm::StringRef attrValue)
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
FoldAdaptor::Properties Properties
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot > &subslots, ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout)
Required by DestructurableAllocationOpInterface / SROA pass.
bool isRead()
Return true if the op is a read, false if it's a write.
bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute > &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot > &mustBeSafelyUsed, const ::mlir::DataLayout &dataLayout)
Required by DestructurableAllocationOpInterface / SROA pass.
::mlir::Operation::operand_range getODSOperands(unsigned index)
::llvm::LogicalResult verifyInvariantsImpl()
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
::llvm::StringRef getRecordName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static WritePodOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value pod_ref, ::mlir::StringAttr record_name, ::mlir::Value value)
::mlir::StringAttr getRecordNameAttrName()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::ArrayAttr getInitializedRecords()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
NewPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::mlir::RegionRange odsRegions
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::std::optional<::mlir::OperationName > odsOpName
::mlir::ArrayAttr getInitializedRecordsAttr()
const Properties & getProperties()
::mlir::DictionaryAttr odsAttrs
::mlir::StringAttr getRecordNameAttr()
::llvm::StringRef getRecordName()
const Properties & getProperties()
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
ReadPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
const Properties & getProperties()
::mlir::StringAttr getRecordNameAttr()
WritePodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
::llvm::StringRef getRecordName()
Common interface for operations that reference a plain-old-data struct value.
mlir::ArrayRef< RecordValue > InitializedRecords
void printRecordName(AsmPrinter &printer, Operation *, StringAttr name)
ParseResult parseRecordName(AsmParser &parser, StringAttr &name)
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
bool isValidType(Type type)
mapOpGroupSizesTy mapOpGroupSizes
operandSegmentSizesTy operandSegmentSizes
initializedRecordsTy initializedRecords
numDimsPerMapTy numDimsPerMap
record_nameTy record_name
record_nameTy record_name