32static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
33 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
34 unsigned valueIndex) {
35 if (!((::llvm::isa<::llzk::array::ArrayType>(type)))) {
36 return op->emitOpError(valueKind) <<
" #" << valueIndex
37 <<
" must be n-dimensional array, but got " << type;
39 return ::mlir::success();
42static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
43 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
44 unsigned valueIndex) {
45 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
46 return op->emitOpError(valueKind) <<
" #" << valueIndex
47 <<
" must be index, but got " << type;
49 return ::mlir::success();
52static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
53 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
54 unsigned valueIndex) {
56 return op->emitOpError(valueKind) <<
" #" << valueIndex
57 <<
" must be variadic of a valid array element type, but got " << type;
59 return ::mlir::success();
62static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops4(
63 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
64 unsigned valueIndex) {
65 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
66 return op->emitOpError(valueKind) <<
" #" << valueIndex
67 <<
" must be variadic of index, but got " << type;
69 return ::mlir::success();
72static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops5(
73 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
74 unsigned valueIndex) {
76 return op->emitOpError(valueKind) <<
" #" << valueIndex
77 <<
" must be a valid array element type, but got " << type;
79 return ::mlir::success();
82static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
83 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
84 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
85 return emitError() <<
"attribute '" << attrName
86 <<
"' failed to satisfy constraint: i32 dense array attribute";
87 return ::mlir::success();
89static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
90 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
91 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
92 return op->emitOpError();
109 return ::mlir::success();
112void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value arr_ref, ::mlir::Value dim) {
113 odsState.addOperands(arr_ref);
114 odsState.addOperands(dim);
115 odsState.addTypes(length);
118void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::Value dim) {
119 odsState.addOperands(arr_ref);
120 odsState.addOperands(dim);
122 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
124 odsState.location, odsState.operands,
125 odsState.attributes.getDictionary(odsState.getContext()),
126 odsState.getRawProperties(),
127 odsState.regions, inferredReturnTypes)))
128 odsState.addTypes(inferredReturnTypes);
130 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
134void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::Value dim) {
135 odsState.addOperands(arr_ref);
136 odsState.addOperands(dim);
137 assert(resultTypes.size() == 1u &&
"mismatched number of results");
138 odsState.addTypes(resultTypes);
141void ArrayLengthOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
142 assert(operands.size() == 2u &&
"mismatched number of parameters");
143 odsState.addOperands(operands);
144 odsState.addAttributes(attributes);
145 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
146 odsState.addTypes(resultTypes);
149void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
150 assert(operands.size() == 2u &&
"mismatched number of parameters");
151 odsState.addOperands(operands);
152 odsState.addAttributes(attributes);
154 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
156 odsState.location, operands,
157 odsState.attributes.getDictionary(odsState.getContext()),
158 odsState.getRawProperties(),
159 odsState.regions, inferredReturnTypes))) {
160 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
161 odsState.addTypes(inferredReturnTypes);
163 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
169 unsigned index = 0; (void)index;
172 for (
auto v : valueGroup0) {
173 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
174 return ::mlir::failure();
178 for (
auto v : valueGroup1) {
179 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
180 return ::mlir::failure();
184 unsigned index = 0; (void)index;
187 for (
auto v : valueGroup0) {
188 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"result", index++)))
189 return ::mlir::failure();
192 return ::mlir::success();
199::llvm::LogicalResult
ArrayLengthOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
200 inferredReturnTypes.resize(1);
201 ::mlir::Builder odsBuilder(context);
202 ::mlir::Type odsInferredType0 = odsBuilder.getIndexType();
203 inferredReturnTypes[0] = odsInferredType0;
204 return ::mlir::success();
208 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
209 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
210 (void)arr_refOperandsLoc;
211 ::mlir::OpAsmParser::UnresolvedOperand dimRawOperand{};
212 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dimOperands(&dimRawOperand, 1); ::llvm::SMLoc dimOperandsLoc;
213 (void)dimOperandsLoc;
214 ::mlir::Type arr_refRawType{};
215 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
217 arr_refOperandsLoc = parser.getCurrentLocation();
218 if (parser.parseOperand(arr_refRawOperand))
219 return ::mlir::failure();
220 if (parser.parseComma())
221 return ::mlir::failure();
223 dimOperandsLoc = parser.getCurrentLocation();
224 if (parser.parseOperand(dimRawOperand))
225 return ::mlir::failure();
226 if (parser.parseColon())
227 return ::mlir::failure();
231 if (parser.parseCustomTypeWithFallback(type))
232 return ::mlir::failure();
233 arr_refRawType = type;
236 auto loc = parser.getCurrentLocation();(void)loc;
237 if (parser.parseOptionalAttrDict(result.attributes))
238 return ::mlir::failure();
240 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
241 result.addTypes(odsBuildableType0);
242 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
243 return ::mlir::failure();
244 if (parser.resolveOperands(dimOperands, odsBuildableType0, dimOperandsLoc, result.operands))
245 return ::mlir::failure();
246 return ::mlir::success();
255 _odsPrinter <<
' ' <<
":";
259 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
260 _odsPrinter.printStrippedAttrOrType(validType);
264 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
265 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
289 for (
unsigned i = 0; i < index; ++i)
290 start += sizeAttr[i];
291 return {start, sizeAttr[index]};
295 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
314 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'array.new' op ""requires attribute 'mapOpGroupSizes'");
317 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
318 return emitError(loc,
"'array.new' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
320 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
321 return emitError(loc,
"'array.new' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
322 return ::mlir::success();
326 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
329 for (
unsigned i = 0; i < index; ++i)
330 start += sizeAttr[i];
331 return {start, sizeAttr[index]};
336 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
342 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
347 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
349 emitError() <<
"expected DictionaryAttr to set properties";
350 return ::mlir::failure();
355 auto attr = dict.get(
"mapOpGroupSizes");
357 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
359 propStorage = convertedAttr;
361 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
362 return ::mlir::failure();
369 auto attr = dict.get(
"numDimsPerMap");
371 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
373 propStorage = convertedAttr;
375 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
376 return ::mlir::failure();
382 auto setFromAttr = [] (
auto &propStorage, ::mlir::Attribute propAttr,
383 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
384 return convertFromAttribute(propStorage, propAttr, emitError);
386 auto attr = dict.get(
"operandSegmentSizes");
if (!attr) attr = dict.get(
"operand_segment_sizes");;
389 return ::mlir::failure();
391 return ::mlir::success();
395 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
396 ::mlir::Builder odsBuilder{ctx};
401 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
408 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
414 auto attr = [&]() -> ::mlir::Attribute {
415 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
417 attrs.push_back(odsBuilder.getNamedAttr(
"operandSegmentSizes", attr));
421 return odsBuilder.getDictionaryAttr(attrs);
426 auto hash_operandSegmentSizes = [] (
const auto &propStorage) -> llvm::hash_code {
427 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
429 return llvm::hash_combine(
436 if (name ==
"mapOpGroupSizes")
439 if (name ==
"numDimsPerMap")
441 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes")
return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }();
446 if (name ==
"mapOpGroupSizes") {
451 if (name ==
"numDimsPerMap") {
455 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes") {
456 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
457 if (!arrAttr)
return;
469 attrs.append(
"operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes); }());
475 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"mapOpGroupSizes", emitError)))
476 return ::mlir::failure();
481 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"numDimsPerMap", emitError)))
482 return ::mlir::failure();
484 return ::mlir::success();
488 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
490 return ::mlir::failure();
492 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
493 return ::mlir::failure();
495 if (reader.getBytecodeVersion() < 6) {
497 ::mlir::DenseI32ArrayAttr attr;
498 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
499 if (attr.size() >
static_cast<int64_t
>(
sizeof(propStorage) /
sizeof(int32_t))) {
500 reader.emitError(
"size mismatch for operand/result_segment_size");
501 return ::mlir::failure();
503 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
508 auto readProp = [&]() {
510 if (reader.getBytecodeVersion() >= 6)
511 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
513 return ::mlir::success();
515 if (::mlir::failed(readProp()))
516 return ::mlir::failure();
518 return ::mlir::success();
522 auto &prop = getProperties(); (void)prop;
527if (writer.getBytecodeVersion() < 6) {
529 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
535 if (writer.getBytecodeVersion() >= 6)
536 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
552 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
556 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
560 build(odsBuilder, odsState, result, mapOperands, odsBuilder.getDenseI32ArrayAttr(numDimsPerMap));
565 ::mlir::Builder odsBuilder(opName.getContext());
567 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
571 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
572 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
573 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
575 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
576 return ::mlir::failure();
578 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
579 return ::mlir::failure();
581 unsigned index = 0; (void)index;
584 for (
auto v : valueGroup0) {
585 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
586 return ::mlir::failure();
589 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
590 return ::mlir::failure();
592 for (
auto v : valueGroup1) {
593 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
594 return ::mlir::failure();
598 unsigned index = 0; (void)index;
601 for (
auto v : valueGroup0) {
602 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
603 return ::mlir::failure();
607 return emitOpError(
"failed to verify that operand types match result type");
608 return ::mlir::success();
613 return ::mlir::success();
614 return ::mlir::failure();
618 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
619 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
620 ::llvm::SMLoc mapOperandsOperandsLoc;
621 (void)mapOperandsOperandsLoc;
622 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
623 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> elementsOperands;
624 ::llvm::SMLoc elementsOperandsLoc;
625 (void)elementsOperandsLoc;
626 ::mlir::Type resultRawType{};
627 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
628 ::llvm::SmallVector<::mlir::Type, 1> elementsTypes;
629 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
631 mapOperandsOperandsLoc = parser.getCurrentLocation();
632 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
634 if (odsResult) return ::mlir::failure();
635 for (
const auto &subRange : mapOperandsOperandGroups) {
636 mapOperandsOperands.append(subRange.begin(), subRange.end());
637 mapOperandsOperandGroupSizes.push_back(subRange.size());
639 if (numDimsPerMapAttr)
642 if (parser.parseRBrace())
643 return ::mlir::failure();
646 elementsOperandsLoc = parser.getCurrentLocation();
647 if (parser.parseOperandList(elementsOperands))
648 return ::mlir::failure();
650 if (parser.parseColon())
651 return ::mlir::failure();
655 if (parser.parseCustomTypeWithFallback(type))
656 return ::mlir::failure();
657 resultRawType = type;
660 auto odsResult = parseInferredArrayType(parser, elementsTypes, elementsOperands, resultRawType);
661 if (odsResult) return ::mlir::failure();
665 if (odsResult) return ::mlir::failure();
667::llvm::copy(::llvm::ArrayRef<int32_t>({
static_cast<int32_t
>(elementsOperands.size()),
static_cast<int32_t
>(mapOperandsOperands.size())}), result.getOrAddProperties<
CreateArrayOp::Properties>().operandSegmentSizes.begin());
668 result.getOrAddProperties<
CreateArrayOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
669 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
670 result.addTypes(resultTypes);
671 if (parser.resolveOperands(elementsOperands, elementsTypes, elementsOperandsLoc, result.operands))
672 return ::mlir::failure();
673 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
674 return ::mlir::failure();
675 return ::mlir::success();
679 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
681 emitError() <<
"expected DictionaryAttr to set properties";
682 return ::mlir::failure();
687 auto attr = dict.get(
"mapOpGroupSizes");
690 emitError() <<
"expected key entry for mapOpGroupSizes in DictionaryAttr to set "
692 return ::mlir::failure();
694 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
696 propStorage = convertedAttr;
698 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
699 return ::mlir::failure();
703 return ::mlir::success();
715 _odsPrinter <<
' ' <<
":";
719 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
720 _odsPrinter.printStrippedAttrOrType(validType);
730 effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), 0,
false, ::llzk::DiscardableAllocationResource::get());
746 bool isVariadic[] = {
false,
true};
747 int prevVariadicCount = 0;
748 for (
unsigned i = 0; i < index; ++i)
749 if (isVariadic[i]) ++prevVariadicCount;
753 int variadicSize = (odsOperandsSize - 1) / 1;
758 int start = index + (variadicSize - 1) * prevVariadicCount;
759 int size = isVariadic[index] ? variadicSize : 1;
760 return {start, size};
767 return ::mlir::success();
771 bool isVariadic[] = {
false,
true};
772 int prevVariadicCount = 0;
773 for (
unsigned i = 0; i < index; ++i)
774 if (isVariadic[i]) ++prevVariadicCount;
778 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
783 int start = index + (variadicSize - 1) * prevVariadicCount;
784 int size = isVariadic[index] ? variadicSize : 1;
785 return {start, size};
790 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
794void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
795 odsState.addOperands(arr_ref);
796 odsState.addOperands(indices);
797 odsState.addTypes(result);
800void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
801 odsState.addOperands(arr_ref);
802 odsState.addOperands(indices);
804 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
806 odsState.location, odsState.operands,
807 odsState.attributes.getDictionary(odsState.getContext()),
808 odsState.getRawProperties(),
809 odsState.regions, inferredReturnTypes)))
810 odsState.addTypes(inferredReturnTypes);
812 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
816void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
817 odsState.addOperands(arr_ref);
818 odsState.addOperands(indices);
819 assert(resultTypes.size() == 1u &&
"mismatched number of results");
820 odsState.addTypes(resultTypes);
823void ExtractArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
824 assert(operands.size() >= 1u &&
"mismatched number of parameters");
825 odsState.addOperands(operands);
826 odsState.addAttributes(attributes);
827 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
828 odsState.addTypes(resultTypes);
831void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
832 assert(operands.size() >= 1u &&
"mismatched number of parameters");
833 odsState.addOperands(operands);
834 odsState.addAttributes(attributes);
836 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
838 odsState.location, operands,
839 odsState.attributes.getDictionary(odsState.getContext()),
840 odsState.getRawProperties(),
841 odsState.regions, inferredReturnTypes))) {
842 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
843 odsState.addTypes(inferredReturnTypes);
845 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
851 unsigned index = 0; (void)index;
854 for (
auto v : valueGroup0) {
855 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
856 return ::mlir::failure();
860 for (
auto v : valueGroup1) {
861 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
862 return ::mlir::failure();
866 unsigned index = 0; (void)index;
869 for (
auto v : valueGroup0) {
870 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
871 return ::mlir::failure();
874 return ::mlir::success();
882 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
883 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
884 (void)arr_refOperandsLoc;
885 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
886 ::llvm::SMLoc indicesOperandsLoc;
887 (void)indicesOperandsLoc;
888 ::mlir::Type arr_refRawType{};
889 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
891 arr_refOperandsLoc = parser.getCurrentLocation();
892 if (parser.parseOperand(arr_refRawOperand))
893 return ::mlir::failure();
894 if (parser.parseLSquare())
895 return ::mlir::failure();
897 indicesOperandsLoc = parser.getCurrentLocation();
898 if (parser.parseOperandList(indicesOperands))
899 return ::mlir::failure();
900 if (parser.parseRSquare())
901 return ::mlir::failure();
902 if (parser.parseColon())
903 return ::mlir::failure();
907 if (parser.parseCustomTypeWithFallback(type))
908 return ::mlir::failure();
909 arr_refRawType = type;
912 auto loc = parser.getCurrentLocation();(void)loc;
913 if (parser.parseOptionalAttrDict(result.attributes))
914 return ::mlir::failure();
916 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
917 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
918 return ::mlir::failure();
919 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
920 return ::mlir::failure();
922 ::llvm::SmallVector<::mlir::Type> inferredReturnTypes;
924 result.location, result.operands,
925 result.attributes.getDictionary(parser.getContext()),
926 result.getRawProperties(),
927 result.regions, inferredReturnTypes)))
928 return ::mlir::failure();
929 result.addTypes(inferredReturnTypes);
930 return ::mlir::success();
939 _odsPrinter <<
' ' <<
":";
943 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
944 _odsPrinter.printStrippedAttrOrType(validType);
948 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
949 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
952 ::llvm::LogicalResult
954 std::optional<::mlir::Location> location,
955 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
956 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
957 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
960 location, adaptor, inferredReturnTypes);
981 bool isVariadic[] = {
false,
true,
false};
982 int prevVariadicCount = 0;
983 for (
unsigned i = 0; i < index; ++i)
984 if (isVariadic[i]) ++prevVariadicCount;
988 int variadicSize = (odsOperandsSize - 2) / 1;
993 int start = index + (variadicSize - 1) * prevVariadicCount;
994 int size = isVariadic[index] ? variadicSize : 1;
995 return {start, size};
1002 return ::mlir::success();
1006 bool isVariadic[] = {
false,
true,
false};
1007 int prevVariadicCount = 0;
1008 for (
unsigned i = 0; i < index; ++i)
1009 if (isVariadic[i]) ++prevVariadicCount;
1013 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1018 int start = index + (variadicSize - 1) * prevVariadicCount;
1019 int size = isVariadic[index] ? variadicSize : 1;
1020 return {start, size};
1025 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1026 return mutableRange;
1029void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1030 odsState.addOperands(arr_ref);
1031 odsState.addOperands(indices);
1032 odsState.addOperands(rvalue);
1035void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1036 odsState.addOperands(arr_ref);
1037 odsState.addOperands(indices);
1038 odsState.addOperands(rvalue);
1039 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1040 odsState.addTypes(resultTypes);
1043void InsertArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1044 assert(operands.size() >= 2u &&
"mismatched number of parameters");
1045 odsState.addOperands(operands);
1046 odsState.addAttributes(attributes);
1047 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1048 odsState.addTypes(resultTypes);
1053 unsigned index = 0; (void)index;
1056 for (
auto v : valueGroup0) {
1057 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1058 return ::mlir::failure();
1062 for (
auto v : valueGroup1) {
1063 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1064 return ::mlir::failure();
1068 for (
auto v : valueGroup2) {
1069 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1070 return ::mlir::failure();
1073 return ::mlir::success();
1078 return ::mlir::success();
1079 return ::mlir::failure();
1083 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1084 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1085 (void)arr_refOperandsLoc;
1086 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1087 ::llvm::SMLoc indicesOperandsLoc;
1088 (void)indicesOperandsLoc;
1089 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperand{};
1090 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(&rvalueRawOperand, 1); ::llvm::SMLoc rvalueOperandsLoc;
1091 (void)rvalueOperandsLoc;
1092 ::mlir::Type arr_refRawType{};
1093 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1094 ::mlir::Type rvalueRawType{};
1095 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(&rvalueRawType, 1);
1097 arr_refOperandsLoc = parser.getCurrentLocation();
1098 if (parser.parseOperand(arr_refRawOperand))
1099 return ::mlir::failure();
1100 if (parser.parseLSquare())
1101 return ::mlir::failure();
1103 indicesOperandsLoc = parser.getCurrentLocation();
1104 if (parser.parseOperandList(indicesOperands))
1105 return ::mlir::failure();
1106 if (parser.parseRSquare())
1107 return ::mlir::failure();
1108 if (parser.parseEqual())
1109 return ::mlir::failure();
1111 rvalueOperandsLoc = parser.getCurrentLocation();
1112 if (parser.parseOperand(rvalueRawOperand))
1113 return ::mlir::failure();
1114 if (parser.parseColon())
1115 return ::mlir::failure();
1119 if (parser.parseCustomTypeWithFallback(type))
1120 return ::mlir::failure();
1121 arr_refRawType = type;
1123 if (parser.parseComma())
1124 return ::mlir::failure();
1128 if (parser.parseCustomTypeWithFallback(type))
1129 return ::mlir::failure();
1130 rvalueRawType = type;
1133 auto loc = parser.getCurrentLocation();(void)loc;
1134 if (parser.parseOptionalAttrDict(result.attributes))
1135 return ::mlir::failure();
1137 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1138 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1139 return ::mlir::failure();
1140 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1141 return ::mlir::failure();
1142 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1143 return ::mlir::failure();
1144 return ::mlir::success();
1153 _odsPrinter <<
' ' <<
"=";
1156 _odsPrinter <<
' ' <<
":";
1160 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1161 _odsPrinter.printStrippedAttrOrType(validType);
1163 _odsPrinter << type;
1169 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1170 _odsPrinter.printStrippedAttrOrType(validType);
1172 _odsPrinter << type;
1174 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1175 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1195 bool isVariadic[] = {
false,
true};
1196 int prevVariadicCount = 0;
1197 for (
unsigned i = 0; i < index; ++i)
1198 if (isVariadic[i]) ++prevVariadicCount;
1202 int variadicSize = (odsOperandsSize - 1) / 1;
1207 int start = index + (variadicSize - 1) * prevVariadicCount;
1208 int size = isVariadic[index] ? variadicSize : 1;
1209 return {start, size};
1216 return ::mlir::success();
1220 bool isVariadic[] = {
false,
true};
1221 int prevVariadicCount = 0;
1222 for (
unsigned i = 0; i < index; ++i)
1223 if (isVariadic[i]) ++prevVariadicCount;
1227 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1232 int start = index + (variadicSize - 1) * prevVariadicCount;
1233 int size = isVariadic[index] ? variadicSize : 1;
1234 return {start, size};
1239 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1240 return mutableRange;
1243void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1244 odsState.addOperands(arr_ref);
1245 odsState.addOperands(indices);
1246 odsState.addTypes(result);
1249void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1250 odsState.addOperands(arr_ref);
1251 odsState.addOperands(indices);
1253 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1255 odsState.location, odsState.operands,
1256 odsState.attributes.getDictionary(odsState.getContext()),
1257 odsState.getRawProperties(),
1258 odsState.regions, inferredReturnTypes)))
1259 odsState.addTypes(inferredReturnTypes);
1261 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
1265void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1266 odsState.addOperands(arr_ref);
1267 odsState.addOperands(indices);
1268 assert(resultTypes.size() == 1u &&
"mismatched number of results");
1269 odsState.addTypes(resultTypes);
1272void ReadArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1273 assert(operands.size() >= 1u &&
"mismatched number of parameters");
1274 odsState.addOperands(operands);
1275 odsState.addAttributes(attributes);
1276 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
1277 odsState.addTypes(resultTypes);
1280void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1281 assert(operands.size() >= 1u &&
"mismatched number of parameters");
1282 odsState.addOperands(operands);
1283 odsState.addAttributes(attributes);
1285 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1287 odsState.location, operands,
1288 odsState.attributes.getDictionary(odsState.getContext()),
1289 odsState.getRawProperties(),
1290 odsState.regions, inferredReturnTypes))) {
1291 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
1292 odsState.addTypes(inferredReturnTypes);
1294 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
1300 unsigned index = 0; (void)index;
1303 for (
auto v : valueGroup0) {
1304 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1305 return ::mlir::failure();
1309 for (
auto v : valueGroup1) {
1310 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1311 return ::mlir::failure();
1315 unsigned index = 0; (void)index;
1318 for (
auto v : valueGroup0) {
1319 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*
this, v.getType(),
"result", index++)))
1320 return ::mlir::failure();
1324 return emitOpError(
"failed to verify that result type matches with arr_ref element type");
1325 return ::mlir::success();
1330 return ::mlir::success();
1331 return ::mlir::failure();
1335 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1336 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1337 (void)arr_refOperandsLoc;
1338 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1339 ::llvm::SMLoc indicesOperandsLoc;
1340 (void)indicesOperandsLoc;
1341 ::mlir::Type arr_refRawType{};
1342 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1343 ::mlir::Type resultRawType{};
1344 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
1346 arr_refOperandsLoc = parser.getCurrentLocation();
1347 if (parser.parseOperand(arr_refRawOperand))
1348 return ::mlir::failure();
1349 if (parser.parseLSquare())
1350 return ::mlir::failure();
1352 indicesOperandsLoc = parser.getCurrentLocation();
1353 if (parser.parseOperandList(indicesOperands))
1354 return ::mlir::failure();
1355 if (parser.parseRSquare())
1356 return ::mlir::failure();
1357 if (parser.parseColon())
1358 return ::mlir::failure();
1362 if (parser.parseCustomTypeWithFallback(type))
1363 return ::mlir::failure();
1364 arr_refRawType = type;
1366 if (parser.parseComma())
1367 return ::mlir::failure();
1371 if (parser.parseCustomTypeWithFallback(type))
1372 return ::mlir::failure();
1373 resultRawType = type;
1376 auto loc = parser.getCurrentLocation();(void)loc;
1377 if (parser.parseOptionalAttrDict(result.attributes))
1378 return ::mlir::failure();
1380 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1381 result.addTypes(resultTypes);
1382 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1383 return ::mlir::failure();
1384 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1385 return ::mlir::failure();
1386 return ::mlir::success();
1395 _odsPrinter <<
' ' <<
":";
1399 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1400 _odsPrinter.printStrippedAttrOrType(validType);
1402 _odsPrinter << type;
1408 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1409 _odsPrinter.printStrippedAttrOrType(validType);
1411 _odsPrinter << type;
1413 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1414 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1417 ::llvm::LogicalResult
1419 std::optional<::mlir::Location> location,
1420 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
1421 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
1422 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
1425 location, adaptor, inferredReturnTypes);
1431 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1432 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1433 const ::mlir::DataLayout &dataLayout) {
1434 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1435 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1440 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1441 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1442 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1443 .rewire(slot, subslots, builder, dataLayout);
1458 ::mlir::Value, const ::mlir::DataLayout &) {
1459 llvm_unreachable(
"getStored() should not be called on ReadArrayOp");
1494 bool isVariadic[] = {
false,
true,
false};
1495 int prevVariadicCount = 0;
1496 for (
unsigned i = 0; i < index; ++i)
1497 if (isVariadic[i]) ++prevVariadicCount;
1501 int variadicSize = (odsOperandsSize - 2) / 1;
1506 int start = index + (variadicSize - 1) * prevVariadicCount;
1507 int size = isVariadic[index] ? variadicSize : 1;
1508 return {start, size};
1515 return ::mlir::success();
1519 bool isVariadic[] = {
false,
true,
false};
1520 int prevVariadicCount = 0;
1521 for (
unsigned i = 0; i < index; ++i)
1522 if (isVariadic[i]) ++prevVariadicCount;
1526 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1531 int start = index + (variadicSize - 1) * prevVariadicCount;
1532 int size = isVariadic[index] ? variadicSize : 1;
1533 return {start, size};
1538 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1539 return mutableRange;
1542void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1543 odsState.addOperands(arr_ref);
1544 odsState.addOperands(indices);
1545 odsState.addOperands(rvalue);
1548void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1549 odsState.addOperands(arr_ref);
1550 odsState.addOperands(indices);
1551 odsState.addOperands(rvalue);
1552 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1553 odsState.addTypes(resultTypes);
1556void WriteArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1557 assert(operands.size() >= 2u &&
"mismatched number of parameters");
1558 odsState.addOperands(operands);
1559 odsState.addAttributes(attributes);
1560 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1561 odsState.addTypes(resultTypes);
1566 unsigned index = 0; (void)index;
1569 for (
auto v : valueGroup0) {
1570 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1571 return ::mlir::failure();
1575 for (
auto v : valueGroup1) {
1576 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1577 return ::mlir::failure();
1581 for (
auto v : valueGroup2) {
1582 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*
this, v.getType(),
"operand", index++)))
1583 return ::mlir::failure();
1587 return emitOpError(
"failed to verify that rvalue type matches with arr_ref element type");
1588 return ::mlir::success();
1593 return ::mlir::success();
1594 return ::mlir::failure();
1598 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1599 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1600 (void)arr_refOperandsLoc;
1601 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1602 ::llvm::SMLoc indicesOperandsLoc;
1603 (void)indicesOperandsLoc;
1604 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperand{};
1605 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(&rvalueRawOperand, 1); ::llvm::SMLoc rvalueOperandsLoc;
1606 (void)rvalueOperandsLoc;
1607 ::mlir::Type arr_refRawType{};
1608 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1609 ::mlir::Type rvalueRawType{};
1610 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(&rvalueRawType, 1);
1612 arr_refOperandsLoc = parser.getCurrentLocation();
1613 if (parser.parseOperand(arr_refRawOperand))
1614 return ::mlir::failure();
1615 if (parser.parseLSquare())
1616 return ::mlir::failure();
1618 indicesOperandsLoc = parser.getCurrentLocation();
1619 if (parser.parseOperandList(indicesOperands))
1620 return ::mlir::failure();
1621 if (parser.parseRSquare())
1622 return ::mlir::failure();
1623 if (parser.parseEqual())
1624 return ::mlir::failure();
1626 rvalueOperandsLoc = parser.getCurrentLocation();
1627 if (parser.parseOperand(rvalueRawOperand))
1628 return ::mlir::failure();
1629 if (parser.parseColon())
1630 return ::mlir::failure();
1634 if (parser.parseCustomTypeWithFallback(type))
1635 return ::mlir::failure();
1636 arr_refRawType = type;
1638 if (parser.parseComma())
1639 return ::mlir::failure();
1643 if (parser.parseCustomTypeWithFallback(type))
1644 return ::mlir::failure();
1645 rvalueRawType = type;
1648 auto loc = parser.getCurrentLocation();(void)loc;
1649 if (parser.parseOptionalAttrDict(result.attributes))
1650 return ::mlir::failure();
1652 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1653 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1654 return ::mlir::failure();
1655 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1656 return ::mlir::failure();
1657 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1658 return ::mlir::failure();
1659 return ::mlir::success();
1668 _odsPrinter <<
' ' <<
"=";
1671 _odsPrinter <<
' ' <<
":";
1675 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1676 _odsPrinter.printStrippedAttrOrType(validType);
1678 _odsPrinter << type;
1684 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1685 _odsPrinter.printStrippedAttrOrType(validType);
1687 _odsPrinter << type;
1689 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1690 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1695 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1696 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1697 const ::mlir::DataLayout &dataLayout) {
1698 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1699 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1704 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1705 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1706 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1707 .rewire(slot, subslots, builder, dataLayout);
1722 ::mlir::Value, const ::mlir::DataLayout &) {
::llvm::LogicalResult verify(::mlir::Location loc)
ArrayLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
ArrayLengthOpAdaptor(ArrayLengthOp op)
::mlir::ValueRange getOperands()
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location > location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type > &inferredReturnTypes)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::Operation::operand_range getODSOperands(unsigned index)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value arr_ref, ::mlir::Value dim)
::llvm::LogicalResult verifyInvariants()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::TypedValue<::mlir::IndexType > getDim()
CreateArrayOpAdaptor(CreateArrayOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
CreateArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
void print(::mlir::OpAsmPrinter &_odsPrinter)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::array::ArrayType result, ::mlir::ValueRange elements={})
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::TypedValue<::llzk::array::ArrayType > getResult()
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::MutableOperandRangeRange getMapOperandsMutable()
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::StringAttr getNumDimsPerMapAttrName()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::Operation::result_range getODSResults(unsigned index)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::llvm::LogicalResult verify()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::OperandRangeRange getMapOperands()
::llvm::LogicalResult verifyInvariants()
FoldAdaptor::Properties Properties
::mlir::StringAttr getMapOpGroupSizesAttrName()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::mlir::MutableOperandRange getElementsMutable()
::mlir::Operation::operand_range getElements()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
::llvm::LogicalResult verify(::mlir::Location loc)
InsertArrayOpAdaptor(InsertArrayOp op)
InsertArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::Operation::operand_range getIndices()
::llvm::LogicalResult verifyInvariantsImpl()
bool isRead()
Return true if the op is a read, false if it's a write.
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify()
::mlir::TypedValue<::llzk::array::ArrayType > getRvalue()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
::mlir::MutableOperandRange getIndicesMutable()
ReadArrayOpAdaptor(ReadArrayOp op)
ReadArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::OpBuilder &builder, ::mlir::Value reachingDef, const ::mlir::DataLayout &dataLayout)
Required by PromotableAllocationOpInterface / mem2reg pass.
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::llvm::LogicalResult verifyInvariantsImpl()
::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.
::mlir::TypedValue<::mlir::Type > getResult()
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
::mlir::Operation::operand_range getIndices()
::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location > location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type > &inferredReturnTypes)
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
bool isRead()
Return true if the op is a read, false if it's a write.
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::llvm::LogicalResult verify()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::Operation::operand_range getODSOperands(unsigned index)
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.
ReadArrayOpAdaptor Adaptor
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::llvm::LogicalResult verifyInvariants()
::mlir::MutableOperandRange getIndicesMutable()
::llvm::LogicalResult verify(::mlir::Location loc)
WriteArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
WriteArrayOpAdaptor(WriteArrayOp op)
::mlir::ValueRange getOperands()
::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 loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify()
::mlir::Operation::operand_range getIndices()
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::OpBuilder &builder, ::mlir::Value reachingDef, const ::mlir::DataLayout &dataLayout)
Required by PromotableAllocationOpInterface / mem2reg pass.
void print(::mlir::OpAsmPrinter &_odsPrinter)
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.
::llvm::LogicalResult verifyInvariantsImpl()
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
::mlir::MutableOperandRange getIndicesMutable()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::TypedValue<::mlir::Type > getRvalue()
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::DictionaryAttr odsAttrs
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
const Properties & getProperties()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::RegionRange odsRegions
CreateArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::std::optional<::mlir::OperationName > odsOpName
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
bool isValidArrayElemType(Type type)
mlir::ParseResult parseAttrDictWithWarnings(mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
void printAttrDictWithWarnings(mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
mapOpGroupSizesTy mapOpGroupSizes
numDimsPerMapTy numDimsPerMap
operandSegmentSizesTy operandSegmentSizes