32static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops0(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops1(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops2(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops3(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops4(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
90 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
91 return __mlir_ods_local_attr_constraint_Ops0(attr, attrName, [op]() {
92 return op->emitOpError();
123 return ::mlir::success();
132 return {std::next(getOperation()->operand_begin(), valueRange.first),
133 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
137 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(0).begin());
141 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*
getODSOperands(1).begin());
146 return getOperation()->getOpOperand(range.first);
151 return getOperation()->getOpOperand(range.first);
160 return {std::next(getOperation()->result_begin(), valueRange.first),
161 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
165 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*
getODSResults(0).begin());
168void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value arr_ref, ::mlir::Value dim) {
169 odsState.addOperands(arr_ref);
170 odsState.addOperands(dim);
171 odsState.addTypes(length);
174void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::Value dim) {
175 odsState.addOperands(arr_ref);
176 odsState.addOperands(dim);
178 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
180 odsState.location, odsState.operands,
181 odsState.attributes.getDictionary(odsState.getContext()),
182 odsState.getRawProperties(),
183 odsState.regions, inferredReturnTypes)))
184 odsState.addTypes(inferredReturnTypes);
186 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
189void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::Value dim) {
190 odsState.addOperands(arr_ref);
191 odsState.addOperands(dim);
192 assert(resultTypes.size() == 1u &&
"mismatched number of results");
193 odsState.addTypes(resultTypes);
196void ArrayLengthOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
197 assert(operands.size() == 2u &&
"mismatched number of parameters");
198 odsState.addOperands(operands);
199 odsState.addAttributes(attributes);
200 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
201 odsState.addTypes(resultTypes);
204void ArrayLengthOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
205 assert(operands.size() == 2u &&
"mismatched number of parameters");
206 odsState.addOperands(operands);
207 odsState.addAttributes(attributes);
209 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
211 odsState.location, operands,
212 odsState.attributes.getDictionary(odsState.getContext()),
213 odsState.getRawProperties(),
214 odsState.regions, inferredReturnTypes))) {
215 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
216 odsState.addTypes(inferredReturnTypes);
218 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
224 unsigned index = 0; (void)index;
227 for (
auto v : valueGroup0) {
228 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
229 return ::mlir::failure();
233 for (
auto v : valueGroup1) {
234 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
235 return ::mlir::failure();
239 unsigned index = 0; (void)index;
242 for (
auto v : valueGroup0) {
243 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
244 return ::mlir::failure();
247 return ::mlir::success();
254::mlir::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) {
255 inferredReturnTypes.resize(1);
256 ::mlir::Builder odsBuilder(context);
257 ::mlir::Type odsInferredType0 = odsBuilder.getIndexType();
258 inferredReturnTypes[0] = odsInferredType0;
259 return ::mlir::success();
263 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperands[1];
264 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(arr_refRawOperands); ::llvm::SMLoc arr_refOperandsLoc;
265 (void)arr_refOperandsLoc;
266 ::mlir::OpAsmParser::UnresolvedOperand dimRawOperands[1];
267 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> dimOperands(dimRawOperands); ::llvm::SMLoc dimOperandsLoc;
268 (void)dimOperandsLoc;
269 ::mlir::Type arr_refRawTypes[1];
270 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(arr_refRawTypes);
272 arr_refOperandsLoc = parser.getCurrentLocation();
273 if (parser.parseOperand(arr_refRawOperands[0]))
274 return ::mlir::failure();
275 if (parser.parseComma())
276 return ::mlir::failure();
278 dimOperandsLoc = parser.getCurrentLocation();
279 if (parser.parseOperand(dimRawOperands[0]))
280 return ::mlir::failure();
281 if (parser.parseColon())
282 return ::mlir::failure();
286 if (parser.parseCustomTypeWithFallback(type))
287 return ::mlir::failure();
288 arr_refRawTypes[0] = type;
291 auto loc = parser.getCurrentLocation();(void)loc;
292 if (parser.parseOptionalAttrDict(result.attributes))
293 return ::mlir::failure();
295 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
296 result.addTypes(odsBuildableType0);
297 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
298 return ::mlir::failure();
299 if (parser.resolveOperands(dimOperands, odsBuildableType0, dimOperandsLoc, result.operands))
300 return ::mlir::failure();
301 return ::mlir::success();
310 _odsPrinter <<
' ' <<
":";
314 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
315 _odsPrinter.printStrippedAttrOrType(validType);
319 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
320 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
348 for (
unsigned i = 0; i < index; ++i)
349 start += sizeAttr[i];
350 return {start, sizeAttr[index]};
358 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(
getProperties().numDimsPerMap);
368 auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(
getProperties().mapOpGroupSizes);
382 if (!tblgen_mapOpGroupSizes)
return emitError(loc,
"'array.new' op ""requires attribute 'mapOpGroupSizes'");
385 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
386 return emitError(loc,
"'array.new' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
388 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
389 return emitError(loc,
"'array.new' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
390 return ::mlir::success();
394 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
397 for (
unsigned i = 0; i < index; ++i)
398 start += sizeAttr[i];
399 return {start, sizeAttr[index]};
404 return {std::next(getOperation()->operand_begin(), valueRange.first),
405 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
418 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
424 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
434 return {std::next(getOperation()->result_begin(), valueRange.first),
435 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
439 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSResults(0).begin());
443 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
445 emitError() <<
"expected DictionaryAttr to set properties";
446 return ::mlir::failure();
451 auto attr = dict.get(
"mapOpGroupSizes");
454 emitError() <<
"expected key entry for mapOpGroupSizes in DictionaryAttr to set "
456 return ::mlir::failure();
458 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
460 propStorage = convertedAttr;
462 emitError() <<
"Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
463 return ::mlir::failure();
470 auto attr = dict.get(
"numDimsPerMap");
473 emitError() <<
"expected key entry for numDimsPerMap in DictionaryAttr to set "
475 return ::mlir::failure();
477 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
479 propStorage = convertedAttr;
481 emitError() <<
"Invalid attribute `numDimsPerMap` in property conversion: " << attr;
482 return ::mlir::failure();
488 auto setFromAttr = [] (
auto &propStorage, ::mlir::Attribute propAttr,
489 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
490 return convertFromAttribute(propStorage, propAttr, emitError);;
492 auto attr = dict.get(
"operandSegmentSizes");
if (!attr) attr = dict.get(
"operand_segment_sizes");;
494 emitError() <<
"expected key entry for operandSegmentSizes in DictionaryAttr to set "
496 return ::mlir::failure();
499 return ::mlir::failure();
501 return ::mlir::success();
505 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
506 ::mlir::Builder odsBuilder{ctx};
511 attrs.push_back(odsBuilder.getNamedAttr(
"mapOpGroupSizes",
518 attrs.push_back(odsBuilder.getNamedAttr(
"numDimsPerMap",
524 attrs.push_back(odsBuilder.getNamedAttr(
"operandSegmentSizes",
525 ::mlir::DenseI32ArrayAttr::get(ctx, propStorage)));
529 return odsBuilder.getDictionaryAttr(attrs);
534 auto hash_operandSegmentSizes = [] (
const auto &propStorage) -> llvm::hash_code {
535 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
537 return llvm::hash_combine(
544 if (name ==
"mapOpGroupSizes")
547 if (name ==
"numDimsPerMap")
549 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes);
554 if (name ==
"mapOpGroupSizes") {
559 if (name ==
"numDimsPerMap") {
563 if (name ==
"operand_segment_sizes" || name ==
"operandSegmentSizes") {
564 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
565 if (!arrAttr)
return;
577 attrs.append(
"operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.
operandSegmentSizes));
583 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr,
"mapOpGroupSizes", emitError)))
584 return ::mlir::failure();
589 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr,
"numDimsPerMap", emitError)))
590 return ::mlir::failure();
592 return ::mlir::success();
596 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
598 return ::mlir::failure();
600 if (::mlir::failed(reader.readOptionalAttribute(prop.
numDimsPerMap)))
601 return ::mlir::failure();
603 if (reader.getBytecodeVersion() < 6) {
605 ::mlir::DenseI32ArrayAttr attr;
606 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
607 if (attr.size() >
static_cast<int64_t
>(
sizeof(propStorage) /
sizeof(int32_t))) {
608 reader.emitError(
"size mismatch for operand/result_segment_size");
609 return ::mlir::failure();
611 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
616 auto readProp = [&]() {
618 if (reader.getBytecodeVersion() >= 6)
619 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
621 return ::mlir::success();
623 if (::mlir::failed(readProp()))
624 return ::mlir::failure();
626 return ::mlir::success();
630 auto &prop = getProperties(); (void)prop;
635if (writer.getBytecodeVersion() < 6) {
637 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
643 if (writer.getBytecodeVersion() >= 6)
644 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
650 return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
659 return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mapOpGroupSizes);
672 (*this)->setAttr(
getNumDimsPerMapAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue));
684 build(odsBuilder, odsState, result, mapOperands, odsBuilder.getDenseI32ArrayAttr(numDimsPerMap));
689 ::mlir::Builder odsBuilder(opName.getContext());
691 properties.
numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
695 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
696 if (!tblgen_mapOpGroupSizes)
return emitOpError(
"requires attribute 'mapOpGroupSizes'");
697 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
699 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*
this, tblgen_numDimsPerMap,
"numDimsPerMap")))
700 return ::mlir::failure();
702 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*
this, tblgen_mapOpGroupSizes,
"mapOpGroupSizes")))
703 return ::mlir::failure();
705 unsigned index = 0; (void)index;
708 for (
auto v : valueGroup0) {
709 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
710 return ::mlir::failure();
713 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*
this,
"mapOpGroupSizes",
"mapOperands", valueGroup1.size())))
714 return ::mlir::failure();
716 for (
auto v : valueGroup1) {
717 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
718 return ::mlir::failure();
722 unsigned index = 0; (void)index;
725 for (
auto v : valueGroup0) {
726 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"result", index++)))
727 return ::mlir::failure();
731 return emitOpError(
"failed to verify that operand types match result type");
732 return ::mlir::success();
737 return ::mlir::success();
738 return ::mlir::failure();
742 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
743 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
744 ::llvm::SMLoc mapOperandsOperandsLoc;
745 (void)mapOperandsOperandsLoc;
746 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
747 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> elementsOperands;
748 ::llvm::SMLoc elementsOperandsLoc;
749 (void)elementsOperandsLoc;
750 ::mlir::Type resultRawTypes[1];
751 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
752 ::llvm::SmallVector<::mlir::Type, 1> elementsTypes;
753 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
755 mapOperandsOperandsLoc = parser.getCurrentLocation();
756 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
758 if (odsResult) return ::mlir::failure();
759 for (
const auto &subRange : mapOperandsOperandGroups) {
760 mapOperandsOperands.append(subRange.begin(), subRange.end());
761 mapOperandsOperandGroupSizes.push_back(subRange.size());
763 if (numDimsPerMapAttr)
766 if (parser.parseRBrace())
767 return ::mlir::failure();
770 elementsOperandsLoc = parser.getCurrentLocation();
771 if (parser.parseOperandList(elementsOperands))
772 return ::mlir::failure();
774 if (parser.parseColon())
775 return ::mlir::failure();
779 if (parser.parseCustomTypeWithFallback(type))
780 return ::mlir::failure();
781 resultRawTypes[0] = type;
785 if (odsResult) return ::mlir::failure();
789 if (odsResult) return ::mlir::failure();
791::llvm::copy(::llvm::ArrayRef<int32_t>({
static_cast<int32_t
>(elementsOperands.size()),
static_cast<int32_t
>(mapOperandsOperands.size())}), result.getOrAddProperties<
CreateArrayOp::Properties>().operandSegmentSizes.begin());
792 result.getOrAddProperties<
CreateArrayOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
793 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
794 result.addTypes(resultTypes);
795 if (parser.resolveOperands(elementsOperands, elementsTypes, elementsOperandsLoc, result.operands))
796 return ::mlir::failure();
797 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
798 return ::mlir::failure();
799 return ::mlir::success();
811 _odsPrinter <<
' ' <<
":";
815 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
816 _odsPrinter.printStrippedAttrOrType(validType);
847 bool isVariadic[] = {
false,
true};
848 int prevVariadicCount = 0;
849 for (
unsigned i = 0; i < index; ++i)
850 if (isVariadic[i]) ++prevVariadicCount;
854 int variadicSize = (odsOperandsSize - 1) / 1;
859 int start = index + (variadicSize - 1) * prevVariadicCount;
860 int size = isVariadic[index] ? variadicSize : 1;
861 return {start, size};
872 return ::mlir::success();
876 bool isVariadic[] = {
false,
true};
877 int prevVariadicCount = 0;
878 for (
unsigned i = 0; i < index; ++i)
879 if (isVariadic[i]) ++prevVariadicCount;
883 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
888 int start = index + (variadicSize - 1) * prevVariadicCount;
889 int size = isVariadic[index] ? variadicSize : 1;
890 return {start, size};
895 return {std::next(getOperation()->operand_begin(), valueRange.first),
896 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
900 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(0).begin());
909 return getOperation()->getOpOperand(range.first);
914 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
924 return {std::next(getOperation()->result_begin(), valueRange.first),
925 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
929 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSResults(0).begin());
932void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
933 odsState.addOperands(arr_ref);
934 odsState.addOperands(indices);
935 odsState.addTypes(result);
938void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
939 odsState.addOperands(arr_ref);
940 odsState.addOperands(indices);
942 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
944 odsState.location, odsState.operands,
945 odsState.attributes.getDictionary(odsState.getContext()),
946 odsState.getRawProperties(),
947 odsState.regions, inferredReturnTypes)))
948 odsState.addTypes(inferredReturnTypes);
950 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
953void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
954 odsState.addOperands(arr_ref);
955 odsState.addOperands(indices);
956 assert(resultTypes.size() == 1u &&
"mismatched number of results");
957 odsState.addTypes(resultTypes);
960void ExtractArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
961 assert(operands.size() >= 1u &&
"mismatched number of parameters");
962 odsState.addOperands(operands);
963 odsState.addAttributes(attributes);
964 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
965 odsState.addTypes(resultTypes);
968void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
969 assert(operands.size() >= 1u &&
"mismatched number of parameters");
970 odsState.addOperands(operands);
971 odsState.addAttributes(attributes);
973 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
975 odsState.location, operands,
976 odsState.attributes.getDictionary(odsState.getContext()),
977 odsState.getRawProperties(),
978 odsState.regions, inferredReturnTypes))) {
979 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
980 odsState.addTypes(inferredReturnTypes);
982 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
988 unsigned index = 0; (void)index;
991 for (
auto v : valueGroup0) {
992 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
993 return ::mlir::failure();
997 for (
auto v : valueGroup1) {
998 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
999 return ::mlir::failure();
1003 unsigned index = 0; (void)index;
1006 for (
auto v : valueGroup0) {
1007 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"result", index++)))
1008 return ::mlir::failure();
1011 return ::mlir::success();
1019 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperands[1];
1020 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(arr_refRawOperands); ::llvm::SMLoc arr_refOperandsLoc;
1021 (void)arr_refOperandsLoc;
1022 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1023 ::llvm::SMLoc indicesOperandsLoc;
1024 (void)indicesOperandsLoc;
1025 ::mlir::Type arr_refRawTypes[1];
1026 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(arr_refRawTypes);
1028 arr_refOperandsLoc = parser.getCurrentLocation();
1029 if (parser.parseOperand(arr_refRawOperands[0]))
1030 return ::mlir::failure();
1031 if (parser.parseLSquare())
1032 return ::mlir::failure();
1034 indicesOperandsLoc = parser.getCurrentLocation();
1035 if (parser.parseOperandList(indicesOperands))
1036 return ::mlir::failure();
1037 if (parser.parseRSquare())
1038 return ::mlir::failure();
1039 if (parser.parseColon())
1040 return ::mlir::failure();
1044 if (parser.parseCustomTypeWithFallback(type))
1045 return ::mlir::failure();
1046 arr_refRawTypes[0] = type;
1049 auto loc = parser.getCurrentLocation();(void)loc;
1050 if (parser.parseOptionalAttrDict(result.attributes))
1051 return ::mlir::failure();
1053 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1054 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1055 return ::mlir::failure();
1056 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1057 return ::mlir::failure();
1059 ::llvm::SmallVector<::mlir::Type> inferredReturnTypes;
1061 result.location, result.operands,
1062 result.attributes.getDictionary(parser.getContext()),
1063 result.getRawProperties(),
1064 result.regions, inferredReturnTypes)))
1065 return ::mlir::failure();
1066 result.addTypes(inferredReturnTypes);
1067 return ::mlir::success();
1076 _odsPrinter <<
' ' <<
":";
1080 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1081 _odsPrinter.printStrippedAttrOrType(validType);
1083 _odsPrinter << type;
1085 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1086 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1089 ::mlir::LogicalResult
1091 std::optional<::mlir::Location> location,
1092 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
1093 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
1094 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
1097 location, adaptor, inferredReturnTypes);
1124 bool isVariadic[] = {
false,
true,
false};
1125 int prevVariadicCount = 0;
1126 for (
unsigned i = 0; i < index; ++i)
1127 if (isVariadic[i]) ++prevVariadicCount;
1131 int variadicSize = (odsOperandsSize - 2) / 1;
1136 int start = index + (variadicSize - 1) * prevVariadicCount;
1137 int size = isVariadic[index] ? variadicSize : 1;
1138 return {start, size};
1149 return ::mlir::success();
1153 bool isVariadic[] = {
false,
true,
false};
1154 int prevVariadicCount = 0;
1155 for (
unsigned i = 0; i < index; ++i)
1156 if (isVariadic[i]) ++prevVariadicCount;
1160 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1165 int start = index + (variadicSize - 1) * prevVariadicCount;
1166 int size = isVariadic[index] ? variadicSize : 1;
1167 return {start, size};
1172 return {std::next(getOperation()->operand_begin(), valueRange.first),
1173 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1177 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(0).begin());
1185 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(2).begin());
1190 return getOperation()->getOpOperand(range.first);
1195 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1196 return mutableRange;
1201 return getOperation()->getOpOperand(range.first);
1210 return {std::next(getOperation()->result_begin(), valueRange.first),
1211 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1214void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1215 odsState.addOperands(arr_ref);
1216 odsState.addOperands(indices);
1217 odsState.addOperands(rvalue);
1220void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1221 odsState.addOperands(arr_ref);
1222 odsState.addOperands(indices);
1223 odsState.addOperands(rvalue);
1224 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1225 odsState.addTypes(resultTypes);
1228void InsertArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1229 assert(operands.size() >= 2u &&
"mismatched number of parameters");
1230 odsState.addOperands(operands);
1231 odsState.addAttributes(attributes);
1232 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1233 odsState.addTypes(resultTypes);
1238 unsigned index = 0; (void)index;
1241 for (
auto v : valueGroup0) {
1242 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
1243 return ::mlir::failure();
1247 for (
auto v : valueGroup1) {
1248 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1249 return ::mlir::failure();
1253 for (
auto v : valueGroup2) {
1254 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
1255 return ::mlir::failure();
1258 return ::mlir::success();
1263 return ::mlir::success();
1264 return ::mlir::failure();
1268 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperands[1];
1269 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(arr_refRawOperands); ::llvm::SMLoc arr_refOperandsLoc;
1270 (void)arr_refOperandsLoc;
1271 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1272 ::llvm::SMLoc indicesOperandsLoc;
1273 (void)indicesOperandsLoc;
1274 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperands[1];
1275 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(rvalueRawOperands); ::llvm::SMLoc rvalueOperandsLoc;
1276 (void)rvalueOperandsLoc;
1277 ::mlir::Type arr_refRawTypes[1];
1278 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(arr_refRawTypes);
1279 ::mlir::Type rvalueRawTypes[1];
1280 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(rvalueRawTypes);
1282 arr_refOperandsLoc = parser.getCurrentLocation();
1283 if (parser.parseOperand(arr_refRawOperands[0]))
1284 return ::mlir::failure();
1285 if (parser.parseLSquare())
1286 return ::mlir::failure();
1288 indicesOperandsLoc = parser.getCurrentLocation();
1289 if (parser.parseOperandList(indicesOperands))
1290 return ::mlir::failure();
1291 if (parser.parseRSquare())
1292 return ::mlir::failure();
1293 if (parser.parseEqual())
1294 return ::mlir::failure();
1296 rvalueOperandsLoc = parser.getCurrentLocation();
1297 if (parser.parseOperand(rvalueRawOperands[0]))
1298 return ::mlir::failure();
1299 if (parser.parseColon())
1300 return ::mlir::failure();
1304 if (parser.parseCustomTypeWithFallback(type))
1305 return ::mlir::failure();
1306 arr_refRawTypes[0] = type;
1308 if (parser.parseComma())
1309 return ::mlir::failure();
1313 if (parser.parseCustomTypeWithFallback(type))
1314 return ::mlir::failure();
1315 rvalueRawTypes[0] = type;
1318 auto loc = parser.getCurrentLocation();(void)loc;
1319 if (parser.parseOptionalAttrDict(result.attributes))
1320 return ::mlir::failure();
1322 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1323 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1324 return ::mlir::failure();
1325 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1326 return ::mlir::failure();
1327 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1328 return ::mlir::failure();
1329 return ::mlir::success();
1338 _odsPrinter <<
' ' <<
"=";
1341 _odsPrinter <<
' ' <<
":";
1345 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1346 _odsPrinter.printStrippedAttrOrType(validType);
1348 _odsPrinter << type;
1354 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1355 _odsPrinter.printStrippedAttrOrType(validType);
1357 _odsPrinter << type;
1359 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1360 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1386 bool isVariadic[] = {
false,
true};
1387 int prevVariadicCount = 0;
1388 for (
unsigned i = 0; i < index; ++i)
1389 if (isVariadic[i]) ++prevVariadicCount;
1393 int variadicSize = (odsOperandsSize - 1) / 1;
1398 int start = index + (variadicSize - 1) * prevVariadicCount;
1399 int size = isVariadic[index] ? variadicSize : 1;
1400 return {start, size};
1411 return ::mlir::success();
1415 bool isVariadic[] = {
false,
true};
1416 int prevVariadicCount = 0;
1417 for (
unsigned i = 0; i < index; ++i)
1418 if (isVariadic[i]) ++prevVariadicCount;
1422 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1427 int start = index + (variadicSize - 1) * prevVariadicCount;
1428 int size = isVariadic[index] ? variadicSize : 1;
1429 return {start, size};
1434 return {std::next(getOperation()->operand_begin(), valueRange.first),
1435 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1439 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(0).begin());
1448 return getOperation()->getOpOperand(range.first);
1453 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1454 return mutableRange;
1463 return {std::next(getOperation()->result_begin(), valueRange.first),
1464 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1468 return ::llvm::cast<::mlir::Value>(*
getODSResults(0).begin());
1471void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1472 odsState.addOperands(arr_ref);
1473 odsState.addOperands(indices);
1474 odsState.addTypes(result);
1477void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1478 odsState.addOperands(arr_ref);
1479 odsState.addOperands(indices);
1481 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1483 odsState.location, odsState.operands,
1484 odsState.attributes.getDictionary(odsState.getContext()),
1485 odsState.getRawProperties(),
1486 odsState.regions, inferredReturnTypes)))
1487 odsState.addTypes(inferredReturnTypes);
1489 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
1492void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1493 odsState.addOperands(arr_ref);
1494 odsState.addOperands(indices);
1495 assert(resultTypes.size() == 1u &&
"mismatched number of results");
1496 odsState.addTypes(resultTypes);
1499void ReadArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1500 assert(operands.size() >= 1u &&
"mismatched number of parameters");
1501 odsState.addOperands(operands);
1502 odsState.addAttributes(attributes);
1503 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
1504 odsState.addTypes(resultTypes);
1507void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1508 assert(operands.size() >= 1u &&
"mismatched number of parameters");
1509 odsState.addOperands(operands);
1510 odsState.addAttributes(attributes);
1512 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1514 odsState.location, operands,
1515 odsState.attributes.getDictionary(odsState.getContext()),
1516 odsState.getRawProperties(),
1517 odsState.regions, inferredReturnTypes))) {
1518 assert(inferredReturnTypes.size() == 1u &&
"mismatched number of return types");
1519 odsState.addTypes(inferredReturnTypes);
1521 ::llvm::report_fatal_error(
"Failed to infer result type(s).");
1527 unsigned index = 0; (void)index;
1530 for (
auto v : valueGroup0) {
1531 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
1532 return ::mlir::failure();
1536 for (
auto v : valueGroup1) {
1537 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1538 return ::mlir::failure();
1542 unsigned index = 0; (void)index;
1545 for (
auto v : valueGroup0) {
1546 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"result", index++)))
1547 return ::mlir::failure();
1551 return emitOpError(
"failed to verify that result type matches with arr_ref element type");
1552 return ::mlir::success();
1557 return ::mlir::success();
1558 return ::mlir::failure();
1562 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperands[1];
1563 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(arr_refRawOperands); ::llvm::SMLoc arr_refOperandsLoc;
1564 (void)arr_refOperandsLoc;
1565 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1566 ::llvm::SMLoc indicesOperandsLoc;
1567 (void)indicesOperandsLoc;
1568 ::mlir::Type arr_refRawTypes[1];
1569 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(arr_refRawTypes);
1570 ::mlir::Type resultRawTypes[1];
1571 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
1573 arr_refOperandsLoc = parser.getCurrentLocation();
1574 if (parser.parseOperand(arr_refRawOperands[0]))
1575 return ::mlir::failure();
1576 if (parser.parseLSquare())
1577 return ::mlir::failure();
1579 indicesOperandsLoc = parser.getCurrentLocation();
1580 if (parser.parseOperandList(indicesOperands))
1581 return ::mlir::failure();
1582 if (parser.parseRSquare())
1583 return ::mlir::failure();
1584 if (parser.parseColon())
1585 return ::mlir::failure();
1589 if (parser.parseCustomTypeWithFallback(type))
1590 return ::mlir::failure();
1591 arr_refRawTypes[0] = type;
1593 if (parser.parseComma())
1594 return ::mlir::failure();
1598 if (parser.parseCustomTypeWithFallback(type))
1599 return ::mlir::failure();
1600 resultRawTypes[0] = type;
1603 auto loc = parser.getCurrentLocation();(void)loc;
1604 if (parser.parseOptionalAttrDict(result.attributes))
1605 return ::mlir::failure();
1607 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1608 result.addTypes(resultTypes);
1609 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1610 return ::mlir::failure();
1611 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1612 return ::mlir::failure();
1613 return ::mlir::success();
1622 _odsPrinter <<
' ' <<
":";
1626 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1627 _odsPrinter.printStrippedAttrOrType(validType);
1629 _odsPrinter << type;
1635 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1636 _odsPrinter.printStrippedAttrOrType(validType);
1638 _odsPrinter << type;
1640 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1641 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1644 ::mlir::LogicalResult
1646 std::optional<::mlir::Location> location,
1647 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
1648 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
1649 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
1652 location, adaptor, inferredReturnTypes);
1658 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1659 ::mlir::SmallVectorImpl<::mlir::MemorySlot>
1660 &mustBeSafelyUsed) {
1661 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1662 .canRewire(slot, usedIndices, mustBeSafelyUsed);
1667::mlir::DestructurableMemorySlot &slot,
1668 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1669 ::mlir::RewriterBase &rewriter) {
1670 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1671 .rewire(slot, subslots, rewriter);
1686 llvm_unreachable(
"getStored() should not be called on ReadArrayOp");
1712 bool isVariadic[] = {
false,
true,
false};
1713 int prevVariadicCount = 0;
1714 for (
unsigned i = 0; i < index; ++i)
1715 if (isVariadic[i]) ++prevVariadicCount;
1719 int variadicSize = (odsOperandsSize - 2) / 1;
1724 int start = index + (variadicSize - 1) * prevVariadicCount;
1725 int size = isVariadic[index] ? variadicSize : 1;
1726 return {start, size};
1737 return ::mlir::success();
1741 bool isVariadic[] = {
false,
true,
false};
1742 int prevVariadicCount = 0;
1743 for (
unsigned i = 0; i < index; ++i)
1744 if (isVariadic[i]) ++prevVariadicCount;
1748 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1753 int start = index + (variadicSize - 1) * prevVariadicCount;
1754 int size = isVariadic[index] ? variadicSize : 1;
1755 return {start, size};
1760 return {std::next(getOperation()->operand_begin(), valueRange.first),
1761 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1765 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*
getODSOperands(0).begin());
1778 return getOperation()->getOpOperand(range.first);
1783 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1784 return mutableRange;
1789 return getOperation()->getOpOperand(range.first);
1798 return {std::next(getOperation()->result_begin(), valueRange.first),
1799 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1802void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1803 odsState.addOperands(arr_ref);
1804 odsState.addOperands(indices);
1805 odsState.addOperands(rvalue);
1808void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1809 odsState.addOperands(arr_ref);
1810 odsState.addOperands(indices);
1811 odsState.addOperands(rvalue);
1812 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1813 odsState.addTypes(resultTypes);
1816void WriteArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1817 assert(operands.size() >= 2u &&
"mismatched number of parameters");
1818 odsState.addOperands(operands);
1819 odsState.addAttributes(attributes);
1820 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1821 odsState.addTypes(resultTypes);
1826 unsigned index = 0; (void)index;
1829 for (
auto v : valueGroup0) {
1830 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*
this, v.getType(),
"operand", index++)))
1831 return ::mlir::failure();
1835 for (
auto v : valueGroup1) {
1836 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1837 return ::mlir::failure();
1841 for (
auto v : valueGroup2) {
1842 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1843 return ::mlir::failure();
1847 return emitOpError(
"failed to verify that rvalue type matches with arr_ref element type");
1848 return ::mlir::success();
1853 return ::mlir::success();
1854 return ::mlir::failure();
1858 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperands[1];
1859 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(arr_refRawOperands); ::llvm::SMLoc arr_refOperandsLoc;
1860 (void)arr_refOperandsLoc;
1861 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1862 ::llvm::SMLoc indicesOperandsLoc;
1863 (void)indicesOperandsLoc;
1864 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperands[1];
1865 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(rvalueRawOperands); ::llvm::SMLoc rvalueOperandsLoc;
1866 (void)rvalueOperandsLoc;
1867 ::mlir::Type arr_refRawTypes[1];
1868 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(arr_refRawTypes);
1869 ::mlir::Type rvalueRawTypes[1];
1870 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(rvalueRawTypes);
1872 arr_refOperandsLoc = parser.getCurrentLocation();
1873 if (parser.parseOperand(arr_refRawOperands[0]))
1874 return ::mlir::failure();
1875 if (parser.parseLSquare())
1876 return ::mlir::failure();
1878 indicesOperandsLoc = parser.getCurrentLocation();
1879 if (parser.parseOperandList(indicesOperands))
1880 return ::mlir::failure();
1881 if (parser.parseRSquare())
1882 return ::mlir::failure();
1883 if (parser.parseEqual())
1884 return ::mlir::failure();
1886 rvalueOperandsLoc = parser.getCurrentLocation();
1887 if (parser.parseOperand(rvalueRawOperands[0]))
1888 return ::mlir::failure();
1889 if (parser.parseColon())
1890 return ::mlir::failure();
1894 if (parser.parseCustomTypeWithFallback(type))
1895 return ::mlir::failure();
1896 arr_refRawTypes[0] = type;
1898 if (parser.parseComma())
1899 return ::mlir::failure();
1903 if (parser.parseCustomTypeWithFallback(type))
1904 return ::mlir::failure();
1905 rvalueRawTypes[0] = type;
1908 auto loc = parser.getCurrentLocation();(void)loc;
1909 if (parser.parseOptionalAttrDict(result.attributes))
1910 return ::mlir::failure();
1912 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1913 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1914 return ::mlir::failure();
1915 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1916 return ::mlir::failure();
1917 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1918 return ::mlir::failure();
1919 return ::mlir::success();
1928 _odsPrinter <<
' ' <<
"=";
1931 _odsPrinter <<
' ' <<
":";
1935 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1936 _odsPrinter.printStrippedAttrOrType(validType);
1938 _odsPrinter << type;
1944 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1945 _odsPrinter.printStrippedAttrOrType(validType);
1947 _odsPrinter << type;
1949 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1950 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1955 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1956 ::mlir::SmallVectorImpl<::mlir::MemorySlot>
1957 &mustBeSafelyUsed) {
1958 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1959 .canRewire(slot, usedIndices, mustBeSafelyUsed);
1964::mlir::DestructurableMemorySlot &slot,
1965 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1966 ::mlir::RewriterBase &rewriter) {
1967 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1968 .rewire(slot, subslots, rewriter);
::mlir::LogicalResult verify(::mlir::Location loc)
ArrayLengthOpAdaptor(ArrayLengthOp op)
ArrayLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::TypedValue<::mlir::IndexType > getDim()
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
::mlir::OpOperand & getDimMutable()
::mlir::OpOperand & getArrRefMutable()
::mlir::LogicalResult verifyInvariantsImpl()
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::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 print(::mlir::OpAsmPrinter &_odsPrinter)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value arr_ref, ::mlir::Value dim)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::TypedValue<::mlir::IndexType > getLength()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::LogicalResult verifyInvariants()
CreateArrayOpAdaptor(CreateArrayOp op)
::mlir::LogicalResult verify(::mlir::Location loc)
CreateArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::Operation::result_range getODSResults(unsigned index)
static void printInferredArrayType(::mlir::OpAsmPrinter &printer, CreateArrayOp, ::mlir::TypeRange, ::mlir::OperandRange, ::mlir::Type)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void setNumDimsPerMapAttr(::mlir::DenseI32ArrayAttr attr)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::array::ArrayType result, ::mlir::ValueRange elements={})
void setMapOpGroupSizesAttr(::mlir::DenseI32ArrayAttr attr)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::ParseResult parseInferredArrayType(::mlir::OpAsmParser &parser, ::llvm::SmallVector<::mlir::Type, 1 > &elementsTypes, ::mlir::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand > elements, ::mlir::Type resultType)
::mlir::MutableOperandRangeRange getMapOperandsMutable()
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::StringAttr getNumDimsPerMapAttrName()
::mlir::LogicalResult verifyInvariants()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::LogicalResult verify()
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
::mlir::LogicalResult verifyInvariantsImpl()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
FoldAdaptor::Properties Properties
::mlir::StringAttr getMapOpGroupSizesAttrName()
::mlir::MutableOperandRange getElementsMutable()
::mlir::OperandRangeRange getMapOperands()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::Operation::operand_range getElements()
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)
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
::mlir::TypedValue<::llzk::array::ArrayType > getResult()
::mlir::LogicalResult verify(::mlir::Location loc)
InsertArrayOpAdaptor(InsertArrayOp op)
InsertArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::TypedValue<::llzk::array::ArrayType > getRvalue()
::mlir::Operation::operand_range getIndices()
bool isRead()
Return true if the op is a read, false if it's a write.
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::LogicalResult verify()
::mlir::LogicalResult verifyInvariants()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::OpOperand & getRvalueMutable()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::LogicalResult verifyInvariantsImpl()
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
::mlir::OpOperand & getArrRefMutable()
::mlir::MutableOperandRange getIndicesMutable()
ReadArrayOpAdaptor(ReadArrayOp op)
::mlir::LogicalResult verify(::mlir::Location loc)
ReadArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::Operation::operand_range getIndices()
::mlir::OpOperand & getArrRefMutable()
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot > &subslots, ::mlir::RewriterBase &rewriter)
Required by DestructurableAllocationOpInterface / SROA pass.
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
::mlir::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)
::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.
::mlir::LogicalResult verify()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::LogicalResult verifyInvariants()
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter)
Required by PromotableAllocationOpInterface / mem2reg pass.
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::LogicalResult verifyInvariantsImpl()
bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute > &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot > &mustBeSafelyUsed)
Required by DestructurableAllocationOpInterface / SROA pass.
ReadArrayOpAdaptor Adaptor
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::Value getResult()
::mlir::MutableOperandRange getIndicesMutable()
WriteArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::LogicalResult verify(::mlir::Location loc)
WriteArrayOpAdaptor(WriteArrayOp op)
::mlir::ValueRange getOperands()
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.
::mlir::LogicalResult verifyInvariantsImpl()
::mlir::OpOperand & getRvalueMutable()
::mlir::OpOperand & getArrRefMutable()
::mlir::Operation::operand_range getIndices()
::mlir::LogicalResult verify()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::Value getRvalue()
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
::mlir::LogicalResult verifyInvariants()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot > &subslots, ::mlir::RewriterBase &rewriter)
Required by DestructurableAllocationOpInterface / SROA pass.
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
::mlir::MutableOperandRange getIndicesMutable()
::mlir::Operation::operand_range getODSOperands(unsigned index)
bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute > &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot > &mustBeSafelyUsed)
Required by DestructurableAllocationOpInterface / SROA pass.
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::RewriterBase &rewriter)
Required by PromotableAllocationOpInterface / mem2reg pass.
::mlir::Operation::result_range getODSResults(unsigned index)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::RegionRange odsRegions
::mlir::DictionaryAttr getAttributes()
ArrayLengthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
::mlir::DictionaryAttr getAttributes()
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
::mlir::DictionaryAttr odsAttrs
CreateArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties={}, ::mlir::RegionRange regions={})
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
const Properties & getProperties()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::RegionRange odsRegions
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
::std::optional<::mlir::OperationName > odsOpName
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr getAttributes()
InsertArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::mlir::DictionaryAttr getAttributes()
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
::mlir::RegionRange odsRegions
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
ReadArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
WriteArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr getAttributes()
::mlir::DictionaryAttr odsAttrs
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
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