LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#ifdef GET_OP_LIST
11#undef GET_OP_LIST
12
19#endif // GET_OP_LIST
20
21#ifdef GET_OP_CLASSES
22#undef GET_OP_CLASSES
23
24
25//===----------------------------------------------------------------------===//
26// Local Utility Method Definitions
27//===----------------------------------------------------------------------===//
28
29namespace llzk {
30namespace array {
31
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;
38 }
39 return ::mlir::success();
40}
41
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;
48 }
49 return ::mlir::success();
50}
51
52static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
53 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
54 unsigned valueIndex) {
55 if (!((::llzk::isValidArrayElemType(type)))) {
56 return op->emitOpError(valueKind) << " #" << valueIndex
57 << " must be variadic of a valid array element type, but got " << type;
58 }
59 return ::mlir::success();
60}
61
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;
68 }
69 return ::mlir::success();
70}
71
72static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops5(
73 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
74 unsigned valueIndex) {
75 if (!((::llzk::isValidArrayElemType(type)))) {
76 return op->emitOpError(valueKind) << " #" << valueIndex
77 << " must be a valid array element type, but got " << type;
78 }
79 return ::mlir::success();
80}
81
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();
88}
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();
93 });
94}
95} // namespace array
96} // namespace llzk
97namespace llzk {
98namespace array {
99
100//===----------------------------------------------------------------------===//
101// ::llzk::array::ArrayLengthOp definitions
102//===----------------------------------------------------------------------===//
103
104namespace detail {
105} // namespace detail
107
108::llvm::LogicalResult ArrayLengthOpAdaptor::verify(::mlir::Location loc) {
109 return ::mlir::success();
110}
111
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);
116}
117
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);
121
122 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
123 if (::mlir::succeeded(ArrayLengthOp::inferReturnTypes(odsBuilder.getContext(),
124 odsState.location, odsState.operands,
125 odsState.attributes.getDictionary(odsState.getContext()),
126 odsState.getRawProperties(),
127 odsState.regions, inferredReturnTypes)))
128 odsState.addTypes(inferredReturnTypes);
129 else
130 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
131
132}
133
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);
139}
140
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);
147}
148
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);
153
154 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
155 if (::mlir::succeeded(ArrayLengthOp::inferReturnTypes(odsBuilder.getContext(),
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);
162 } else {
163 ::llvm::report_fatal_error("Failed to infer result type(s).");
164 }
165}
166
167::llvm::LogicalResult ArrayLengthOp::verifyInvariantsImpl() {
168 {
169 unsigned index = 0; (void)index;
170 auto valueGroup0 = getODSOperands(0);
171
172 for (auto v : valueGroup0) {
173 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
174 return ::mlir::failure();
175 }
176 auto valueGroup1 = getODSOperands(1);
177
178 for (auto v : valueGroup1) {
179 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
180 return ::mlir::failure();
181 }
182 }
183 {
184 unsigned index = 0; (void)index;
185 auto valueGroup0 = getODSResults(0);
186
187 for (auto v : valueGroup0) {
188 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "result", index++)))
189 return ::mlir::failure();
190 }
191 }
192 return ::mlir::success();
193}
194
195::llvm::LogicalResult ArrayLengthOp::verifyInvariants() {
196 return verifyInvariantsImpl();
197}
198
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();
205}
206
207::mlir::ParseResult ArrayLengthOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
216
217 arr_refOperandsLoc = parser.getCurrentLocation();
218 if (parser.parseOperand(arr_refRawOperand))
219 return ::mlir::failure();
220 if (parser.parseComma())
221 return ::mlir::failure();
222
223 dimOperandsLoc = parser.getCurrentLocation();
224 if (parser.parseOperand(dimRawOperand))
225 return ::mlir::failure();
226 if (parser.parseColon())
227 return ::mlir::failure();
228
229 {
231 if (parser.parseCustomTypeWithFallback(type))
232 return ::mlir::failure();
233 arr_refRawType = type;
234 }
235 {
236 auto loc = parser.getCurrentLocation();(void)loc;
237 if (parser.parseOptionalAttrDict(result.attributes))
238 return ::mlir::failure();
239 }
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();
247}
248
249void ArrayLengthOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
250 _odsPrinter << ' ';
251 _odsPrinter << getArrRef();
252 _odsPrinter << ",";
253 _odsPrinter << ' ';
254 _odsPrinter << getDim();
255 _odsPrinter << ' ' << ":";
256 _odsPrinter << ' ';
257 {
258 auto type = getArrRef().getType();
259 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
260 _odsPrinter.printStrippedAttrOrType(validType);
261 else
262 _odsPrinter << type;
263 }
264 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
265 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
266}
267
268void ArrayLengthOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
269}
270
271} // namespace array
272} // namespace llzk
273MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::ArrayLengthOp)
274
275namespace llzk {
276namespace array {
277
278//===----------------------------------------------------------------------===//
279// ::llzk::array::CreateArrayOp definitions
280//===----------------------------------------------------------------------===//
281
282namespace detail {
284
285std::pair<unsigned, unsigned> CreateArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
286 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
287
288 unsigned start = 0;
289 for (unsigned i = 0; i < index; ++i)
290 start += sizeAttr[i];
291 return {start, sizeAttr[index]};
292}
293
295 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
296 return attr;
297}
298
300 auto attr = getNumDimsPerMapAttr();
301 return attr;
302}
303
305 auto attr = getMapOpGroupSizesAttr();
306 return attr;
307}
308
309} // namespace detail
311
312::llvm::LogicalResult CreateArrayOpAdaptor::verify(::mlir::Location loc) {
313 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
314 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'array.new' op ""requires attribute 'mapOpGroupSizes'");
315 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
316
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");
319
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();
323}
324
325std::pair<unsigned, unsigned> CreateArrayOp::getODSOperandIndexAndLength(unsigned index) {
326 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
327
328 unsigned start = 0;
329 for (unsigned i = 0; i < index; ++i)
330 start += sizeAttr[i];
331 return {start, sizeAttr[index]};
332}
333
334::mlir::MutableOperandRange CreateArrayOp::getElementsMutable() {
335 auto range = getODSOperandIndexAndLength(0);
336 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
337 return mutableRange;
338}
339
340::mlir::MutableOperandRangeRange CreateArrayOp::getMapOperandsMutable() {
341 auto range = getODSOperandIndexAndLength(1);
342 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
343 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
344}
345
346::llvm::LogicalResult CreateArrayOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
347 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
348 if (!dict) {
349 emitError() << "expected DictionaryAttr to set properties";
350 return ::mlir::failure();
351 }
352
353 {
354 auto &propStorage = prop.mapOpGroupSizes;
355 auto attr = dict.get("mapOpGroupSizes");
356 if (attr) {
357 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
358 if (convertedAttr) {
359 propStorage = convertedAttr;
360 } else {
361 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
362 return ::mlir::failure();
363 }
364 }
365 }
366
367 {
368 auto &propStorage = prop.numDimsPerMap;
369 auto attr = dict.get("numDimsPerMap");
370 if (attr) {
371 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
372 if (convertedAttr) {
373 propStorage = convertedAttr;
374 } else {
375 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
376 return ::mlir::failure();
377 }
378 }
379 }
380{
381
382 auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
383 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
384 return convertFromAttribute(propStorage, propAttr, emitError);
385 };
386 auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
387;
388 if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError)))
389 return ::mlir::failure();
390 }
391 return ::mlir::success();
392}
393
394::mlir::Attribute CreateArrayOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
395 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
396 ::mlir::Builder odsBuilder{ctx};
397
398 {
399 const auto &propStorage = prop.mapOpGroupSizes;
400 if (propStorage)
401 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
402 propStorage));
403 }
404
405 {
406 const auto &propStorage = prop.numDimsPerMap;
407 if (propStorage)
408 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
409 propStorage));
410 }
411
412 {
413 const auto &propStorage = prop.operandSegmentSizes;
414 auto attr = [&]() -> ::mlir::Attribute {
415 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
416 }();
417 attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
418 }
419
420 if (!attrs.empty())
421 return odsBuilder.getDictionaryAttr(attrs);
422 return {};
423}
424
426 auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
427 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
428 };
429 return llvm::hash_combine(
430 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
431 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
432 hash_operandSegmentSizes(prop.operandSegmentSizes));
433}
434
435std::optional<mlir::Attribute> CreateArrayOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
436 if (name == "mapOpGroupSizes")
437 return prop.mapOpGroupSizes;
438
439 if (name == "numDimsPerMap")
440 return prop.numDimsPerMap;
441 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
442 return std::nullopt;
443}
444
445void CreateArrayOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
446 if (name == "mapOpGroupSizes") {
447 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
448 return;
449 }
450
451 if (name == "numDimsPerMap") {
452 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
453 return;
454 }
455 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
456 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
457 if (!arrAttr) return;
458 if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
459 return;
460 llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
461 return;
462 }
463}
464
465void CreateArrayOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
466 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
467
468 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
469 attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
470}
471
472::llvm::LogicalResult CreateArrayOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
473 {
474 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
475 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "mapOpGroupSizes", emitError)))
476 return ::mlir::failure();
477 }
478
479 {
480 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
481 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "numDimsPerMap", emitError)))
482 return ::mlir::failure();
483 }
484 return ::mlir::success();
485}
486
487::llvm::LogicalResult CreateArrayOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
488 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
489 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
490 return ::mlir::failure();
491
492 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
493 return ::mlir::failure();
494
495 if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
496 auto &propStorage = prop.operandSegmentSizes;
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();
502 }
503 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
504 }
505
506 {
507 auto &propStorage = prop.operandSegmentSizes;
508 auto readProp = [&]() {
509
510 if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
511 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
512;
513 return ::mlir::success();
514 };
515 if (::mlir::failed(readProp()))
516 return ::mlir::failure();
517 }
518 return ::mlir::success();
519}
520
521void CreateArrayOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
522 auto &prop = getProperties(); (void)prop;
523 writer.writeAttribute(prop.mapOpGroupSizes);
524
525 writer.writeOptionalAttribute(prop.numDimsPerMap);
526
527if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
528 auto &propStorage = prop.operandSegmentSizes;
529 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
530}
531
532 {
533 auto &propStorage = prop.operandSegmentSizes;
534
535 if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
536 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
537;
538 }
539}
540
541::llvm::ArrayRef<int32_t> CreateArrayOp::getNumDimsPerMap() {
542 auto attr = getNumDimsPerMapAttr();
543 return attr;
544}
545
546::llvm::ArrayRef<int32_t> CreateArrayOp::getMapOpGroupSizes() {
547 auto attr = getMapOpGroupSizesAttr();
548 return attr;
549}
550
551void CreateArrayOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
552 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
553}
554
555void CreateArrayOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
556 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
557}
558
559void CreateArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::array::ArrayType result, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap) {
560 build(odsBuilder, odsState, result, mapOperands, odsBuilder.getDenseI32ArrayAttr(numDimsPerMap));
561
562}
563
564void CreateArrayOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
565 ::mlir::Builder odsBuilder(opName.getContext());
566 if (!properties.numDimsPerMap)
567 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
568}
569
570::llvm::LogicalResult CreateArrayOp::verifyInvariantsImpl() {
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;
574
575 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
576 return ::mlir::failure();
577
578 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
579 return ::mlir::failure();
580 {
581 unsigned index = 0; (void)index;
582 auto valueGroup0 = getODSOperands(0);
583
584 for (auto v : valueGroup0) {
585 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
586 return ::mlir::failure();
587 }
588 auto valueGroup1 = getODSOperands(1);
589 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
590 return ::mlir::failure();
591
592 for (auto v : valueGroup1) {
593 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
594 return ::mlir::failure();
595 }
596 }
597 {
598 unsigned index = 0; (void)index;
599 auto valueGroup0 = getODSResults(0);
600
601 for (auto v : valueGroup0) {
602 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
603 return ::mlir::failure();
604 }
605 }
606 if (!((getElements().empty() || std::equal_to<>()(resultTypeToElementsTypes((*this->getODSResults(0).begin()).getType()), this->getODSOperands(0).getType()))))
607 return emitOpError("failed to verify that operand types match result type");
608 return ::mlir::success();
609}
610
611::llvm::LogicalResult CreateArrayOp::verifyInvariants() {
612 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
613 return ::mlir::success();
614 return ::mlir::failure();
615}
616
617::mlir::ParseResult CreateArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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())) {
630 {
631 mapOperandsOperandsLoc = parser.getCurrentLocation();
632 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
633 auto odsResult = parseMultiDimAndSymbolList(parser, mapOperandsOperandGroups, numDimsPerMapAttr);
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());
638 }
639 if (numDimsPerMapAttr)
640 result.getOrAddProperties<CreateArrayOp::Properties>().numDimsPerMap = numDimsPerMapAttr;
641 }
642 if (parser.parseRBrace())
643 return ::mlir::failure();
644 } else {
645
646 elementsOperandsLoc = parser.getCurrentLocation();
647 if (parser.parseOperandList(elementsOperands))
648 return ::mlir::failure();
649 }
650 if (parser.parseColon())
651 return ::mlir::failure();
652
653 {
655 if (parser.parseCustomTypeWithFallback(type))
656 return ::mlir::failure();
657 resultRawType = type;
658 }
659 {
660 auto odsResult = parseInferredArrayType(parser, elementsTypes, elementsOperands, resultRawType);
661 if (odsResult) return ::mlir::failure();
662 }
663 {
664 auto odsResult = parseAttrDictWithWarnings(parser, result.attributes, result);
665 if (odsResult) return ::mlir::failure();
666 }
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();
676}
677
678::llvm::LogicalResult CreateArrayOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
679 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
680 if (!dict) {
681 emitError() << "expected DictionaryAttr to set properties";
682 return ::mlir::failure();
683 }
684 {
685
686 auto &propStorage = prop.mapOpGroupSizes;
687 auto attr = dict.get("mapOpGroupSizes");
688 if (attr || /*isRequired=*/true) {
689 if (!attr) {
690 emitError() << "expected key entry for mapOpGroupSizes in DictionaryAttr to set "
691 "Properties.";
692 return ::mlir::failure();
693 }
694 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
695 if (convertedAttr) {
696 propStorage = convertedAttr;
697 } else {
698 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
699 return ::mlir::failure();
700 }
701 }
702 }
703 return ::mlir::success();
704}
705
706void CreateArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
707 if (((!getMapOperands().empty()) || (getNumDimsPerMapAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI32ArrayAttr({})))) {
708 _odsPrinter << "{";
710 _odsPrinter << "}";
711 } else {
712 _odsPrinter << ' ';
713 _odsPrinter << getElements();
714 }
715 _odsPrinter << ' ' << ":";
716 _odsPrinter << ' ';
717 {
718 auto type = getResult().getType();
719 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
720 _odsPrinter.printStrippedAttrOrType(validType);
721 else
722 _odsPrinter << type;
723 }
724 printInferredArrayType(_odsPrinter, *this, getElements().getTypes(), getElements(), getResult().getType());
725 _odsPrinter << ' ';
726 printAttrDictWithWarnings(_odsPrinter, *this, getOperation()->getAttrDictionary(), getProperties());
727}
728
729void CreateArrayOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
730 effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), 0, false, ::llzk::DiscardableAllocationResource::get());
731}
732
733} // namespace array
734} // namespace llzk
735MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::CreateArrayOp)
736
737namespace llzk {
738namespace array {
739
740//===----------------------------------------------------------------------===//
741// ::llzk::array::ExtractArrayOp definitions
742//===----------------------------------------------------------------------===//
743
744namespace detail {
745std::pair<unsigned, unsigned> ExtractArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
746 bool isVariadic[] = {false, true};
747 int prevVariadicCount = 0;
748 for (unsigned i = 0; i < index; ++i)
749 if (isVariadic[i]) ++prevVariadicCount;
750
751 // Calculate how many dynamic values a static variadic operand corresponds to.
752 // This assumes all static variadic operands have the same dynamic value count.
753 int variadicSize = (odsOperandsSize - 1) / 1;
754 // `index` passed in as the parameter is the static index which counts each
755 // operand (variadic or not) as size 1. So here for each previous static variadic
756 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
757 // value pack for this static operand starts.
758 int start = index + (variadicSize - 1) * prevVariadicCount;
759 int size = isVariadic[index] ? variadicSize : 1;
760 return {start, size};
761}
762
763} // namespace detail
765
766::llvm::LogicalResult ExtractArrayOpAdaptor::verify(::mlir::Location loc) {
767 return ::mlir::success();
768}
769
770std::pair<unsigned, unsigned> ExtractArrayOp::getODSOperandIndexAndLength(unsigned index) {
771 bool isVariadic[] = {false, true};
772 int prevVariadicCount = 0;
773 for (unsigned i = 0; i < index; ++i)
774 if (isVariadic[i]) ++prevVariadicCount;
775
776 // Calculate how many dynamic values a static variadic operand corresponds to.
777 // This assumes all static variadic operands have the same dynamic value count.
778 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
779 // `index` passed in as the parameter is the static index which counts each
780 // operand (variadic or not) as size 1. So here for each previous static variadic
781 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
782 // value pack for this static operand starts.
783 int start = index + (variadicSize - 1) * prevVariadicCount;
784 int size = isVariadic[index] ? variadicSize : 1;
785 return {start, size};
786}
787
788::mlir::MutableOperandRange ExtractArrayOp::getIndicesMutable() {
789 auto range = getODSOperandIndexAndLength(1);
790 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
791 return mutableRange;
792}
793
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);
798}
799
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);
803
804 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
805 if (::mlir::succeeded(ExtractArrayOp::inferReturnTypes(odsBuilder.getContext(),
806 odsState.location, odsState.operands,
807 odsState.attributes.getDictionary(odsState.getContext()),
808 odsState.getRawProperties(),
809 odsState.regions, inferredReturnTypes)))
810 odsState.addTypes(inferredReturnTypes);
811 else
812 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
813
814}
815
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);
821}
822
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);
829}
830
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);
835
836 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
837 if (::mlir::succeeded(ExtractArrayOp::inferReturnTypes(odsBuilder.getContext(),
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);
844 } else {
845 ::llvm::report_fatal_error("Failed to infer result type(s).");
846 }
847}
848
850 {
851 unsigned index = 0; (void)index;
852 auto valueGroup0 = getODSOperands(0);
853
854 for (auto v : valueGroup0) {
855 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
856 return ::mlir::failure();
857 }
858 auto valueGroup1 = getODSOperands(1);
859
860 for (auto v : valueGroup1) {
861 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
862 return ::mlir::failure();
863 }
864 }
865 {
866 unsigned index = 0; (void)index;
867 auto valueGroup0 = getODSResults(0);
868
869 for (auto v : valueGroup0) {
870 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
871 return ::mlir::failure();
872 }
873 }
874 return ::mlir::success();
875}
876
877::llvm::LogicalResult ExtractArrayOp::verifyInvariants() {
878 return verifyInvariantsImpl();
879}
880
881::mlir::ParseResult ExtractArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
890
891 arr_refOperandsLoc = parser.getCurrentLocation();
892 if (parser.parseOperand(arr_refRawOperand))
893 return ::mlir::failure();
894 if (parser.parseLSquare())
895 return ::mlir::failure();
896
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();
904
905 {
907 if (parser.parseCustomTypeWithFallback(type))
908 return ::mlir::failure();
909 arr_refRawType = type;
910 }
911 {
912 auto loc = parser.getCurrentLocation();(void)loc;
913 if (parser.parseOptionalAttrDict(result.attributes))
914 return ::mlir::failure();
915 }
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();
921
922 ::llvm::SmallVector<::mlir::Type> inferredReturnTypes;
923 if (::mlir::failed(ExtractArrayOp::inferReturnTypes(parser.getContext(),
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();
931}
932
933void ExtractArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
934 _odsPrinter << ' ';
935 _odsPrinter << getArrRef();
936 _odsPrinter << "[";
937 _odsPrinter << getIndices();
938 _odsPrinter << "]";
939 _odsPrinter << ' ' << ":";
940 _odsPrinter << ' ';
941 {
942 auto type = getArrRef().getType();
943 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
944 _odsPrinter.printStrippedAttrOrType(validType);
945 else
946 _odsPrinter << type;
947 }
948 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
949 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
950}
951
952 ::llvm::LogicalResult
953 ExtractArrayOp::inferReturnTypes(::mlir::MLIRContext *context,
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) {
958 ExtractArrayOp::Adaptor adaptor(operands, attributes, properties, regions);
960 location, adaptor, inferredReturnTypes);
961 }
962
963
966 return true;
967}
968} // namespace array
969} // namespace llzk
970MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::ExtractArrayOp)
971
972namespace llzk {
973namespace array {
974
975//===----------------------------------------------------------------------===//
976// ::llzk::array::InsertArrayOp definitions
977//===----------------------------------------------------------------------===//
978
979namespace detail {
980std::pair<unsigned, unsigned> InsertArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
981 bool isVariadic[] = {false, true, false};
982 int prevVariadicCount = 0;
983 for (unsigned i = 0; i < index; ++i)
984 if (isVariadic[i]) ++prevVariadicCount;
985
986 // Calculate how many dynamic values a static variadic operand corresponds to.
987 // This assumes all static variadic operands have the same dynamic value count.
988 int variadicSize = (odsOperandsSize - 2) / 1;
989 // `index` passed in as the parameter is the static index which counts each
990 // operand (variadic or not) as size 1. So here for each previous static variadic
991 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
992 // value pack for this static operand starts.
993 int start = index + (variadicSize - 1) * prevVariadicCount;
994 int size = isVariadic[index] ? variadicSize : 1;
995 return {start, size};
996}
997
998} // namespace detail
1000
1001::llvm::LogicalResult InsertArrayOpAdaptor::verify(::mlir::Location loc) {
1002 return ::mlir::success();
1003}
1004
1005std::pair<unsigned, unsigned> InsertArrayOp::getODSOperandIndexAndLength(unsigned index) {
1006 bool isVariadic[] = {false, true, false};
1007 int prevVariadicCount = 0;
1008 for (unsigned i = 0; i < index; ++i)
1009 if (isVariadic[i]) ++prevVariadicCount;
1010
1011 // Calculate how many dynamic values a static variadic operand corresponds to.
1012 // This assumes all static variadic operands have the same dynamic value count.
1013 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1014 // `index` passed in as the parameter is the static index which counts each
1015 // operand (variadic or not) as size 1. So here for each previous static variadic
1016 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1017 // value pack for this static operand starts.
1018 int start = index + (variadicSize - 1) * prevVariadicCount;
1019 int size = isVariadic[index] ? variadicSize : 1;
1020 return {start, size};
1021}
1022
1023::mlir::MutableOperandRange InsertArrayOp::getIndicesMutable() {
1024 auto range = getODSOperandIndexAndLength(1);
1025 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1026 return mutableRange;
1027}
1028
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);
1033}
1034
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);
1041}
1042
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);
1049}
1050
1052 {
1053 unsigned index = 0; (void)index;
1054 auto valueGroup0 = getODSOperands(0);
1055
1056 for (auto v : valueGroup0) {
1057 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1058 return ::mlir::failure();
1059 }
1060 auto valueGroup1 = getODSOperands(1);
1061
1062 for (auto v : valueGroup1) {
1063 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1064 return ::mlir::failure();
1065 }
1066 auto valueGroup2 = getODSOperands(2);
1067
1068 for (auto v : valueGroup2) {
1069 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1070 return ::mlir::failure();
1071 }
1072 }
1073 return ::mlir::success();
1074}
1075
1076::llvm::LogicalResult InsertArrayOp::verifyInvariants() {
1077 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1078 return ::mlir::success();
1079 return ::mlir::failure();
1080}
1081
1082::mlir::ParseResult InsertArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
1096
1097 arr_refOperandsLoc = parser.getCurrentLocation();
1098 if (parser.parseOperand(arr_refRawOperand))
1099 return ::mlir::failure();
1100 if (parser.parseLSquare())
1101 return ::mlir::failure();
1102
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();
1110
1111 rvalueOperandsLoc = parser.getCurrentLocation();
1112 if (parser.parseOperand(rvalueRawOperand))
1113 return ::mlir::failure();
1114 if (parser.parseColon())
1115 return ::mlir::failure();
1116
1117 {
1119 if (parser.parseCustomTypeWithFallback(type))
1120 return ::mlir::failure();
1121 arr_refRawType = type;
1122 }
1123 if (parser.parseComma())
1124 return ::mlir::failure();
1125
1126 {
1128 if (parser.parseCustomTypeWithFallback(type))
1129 return ::mlir::failure();
1130 rvalueRawType = type;
1131 }
1132 {
1133 auto loc = parser.getCurrentLocation();(void)loc;
1134 if (parser.parseOptionalAttrDict(result.attributes))
1135 return ::mlir::failure();
1136 }
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();
1145}
1146
1147void InsertArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1148 _odsPrinter << ' ';
1149 _odsPrinter << getArrRef();
1150 _odsPrinter << "[";
1151 _odsPrinter << getIndices();
1152 _odsPrinter << "]";
1153 _odsPrinter << ' ' << "=";
1154 _odsPrinter << ' ';
1155 _odsPrinter << getRvalue();
1156 _odsPrinter << ' ' << ":";
1157 _odsPrinter << ' ';
1158 {
1159 auto type = getArrRef().getType();
1160 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1161 _odsPrinter.printStrippedAttrOrType(validType);
1162 else
1163 _odsPrinter << type;
1164 }
1165 _odsPrinter << ",";
1166 _odsPrinter << ' ';
1167 {
1168 auto type = getRvalue().getType();
1169 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1170 _odsPrinter.printStrippedAttrOrType(validType);
1171 else
1172 _odsPrinter << type;
1173 }
1174 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1175 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1176}
1177
1180 return false;
1181}
1182} // namespace array
1183} // namespace llzk
1184MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::InsertArrayOp)
1185
1186namespace llzk {
1187namespace array {
1188
1189//===----------------------------------------------------------------------===//
1190// ::llzk::array::ReadArrayOp definitions
1191//===----------------------------------------------------------------------===//
1192
1193namespace detail {
1194std::pair<unsigned, unsigned> ReadArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1195 bool isVariadic[] = {false, true};
1196 int prevVariadicCount = 0;
1197 for (unsigned i = 0; i < index; ++i)
1198 if (isVariadic[i]) ++prevVariadicCount;
1199
1200 // Calculate how many dynamic values a static variadic operand corresponds to.
1201 // This assumes all static variadic operands have the same dynamic value count.
1202 int variadicSize = (odsOperandsSize - 1) / 1;
1203 // `index` passed in as the parameter is the static index which counts each
1204 // operand (variadic or not) as size 1. So here for each previous static variadic
1205 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1206 // value pack for this static operand starts.
1207 int start = index + (variadicSize - 1) * prevVariadicCount;
1208 int size = isVariadic[index] ? variadicSize : 1;
1209 return {start, size};
1210}
1211
1212} // namespace detail
1214
1215::llvm::LogicalResult ReadArrayOpAdaptor::verify(::mlir::Location loc) {
1216 return ::mlir::success();
1217}
1218
1219std::pair<unsigned, unsigned> ReadArrayOp::getODSOperandIndexAndLength(unsigned index) {
1220 bool isVariadic[] = {false, true};
1221 int prevVariadicCount = 0;
1222 for (unsigned i = 0; i < index; ++i)
1223 if (isVariadic[i]) ++prevVariadicCount;
1224
1225 // Calculate how many dynamic values a static variadic operand corresponds to.
1226 // This assumes all static variadic operands have the same dynamic value count.
1227 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1228 // `index` passed in as the parameter is the static index which counts each
1229 // operand (variadic or not) as size 1. So here for each previous static variadic
1230 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1231 // value pack for this static operand starts.
1232 int start = index + (variadicSize - 1) * prevVariadicCount;
1233 int size = isVariadic[index] ? variadicSize : 1;
1234 return {start, size};
1235}
1236
1237::mlir::MutableOperandRange ReadArrayOp::getIndicesMutable() {
1238 auto range = getODSOperandIndexAndLength(1);
1239 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1240 return mutableRange;
1241}
1242
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);
1247}
1248
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);
1252
1253 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1254 if (::mlir::succeeded(ReadArrayOp::inferReturnTypes(odsBuilder.getContext(),
1255 odsState.location, odsState.operands,
1256 odsState.attributes.getDictionary(odsState.getContext()),
1257 odsState.getRawProperties(),
1258 odsState.regions, inferredReturnTypes)))
1259 odsState.addTypes(inferredReturnTypes);
1260 else
1261 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
1262
1263}
1264
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);
1270}
1271
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);
1278}
1279
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);
1284
1285 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1286 if (::mlir::succeeded(ReadArrayOp::inferReturnTypes(odsBuilder.getContext(),
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);
1293 } else {
1294 ::llvm::report_fatal_error("Failed to infer result type(s).");
1295 }
1296}
1297
1298::llvm::LogicalResult ReadArrayOp::verifyInvariantsImpl() {
1299 {
1300 unsigned index = 0; (void)index;
1301 auto valueGroup0 = getODSOperands(0);
1302
1303 for (auto v : valueGroup0) {
1304 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1305 return ::mlir::failure();
1306 }
1307 auto valueGroup1 = getODSOperands(1);
1308
1309 for (auto v : valueGroup1) {
1310 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1311 return ::mlir::failure();
1312 }
1313 }
1314 {
1315 unsigned index = 0; (void)index;
1316 auto valueGroup0 = getODSResults(0);
1317
1318 for (auto v : valueGroup0) {
1319 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*this, v.getType(), "result", index++)))
1320 return ::mlir::failure();
1321 }
1322 }
1323 if (!((::llzk::typesUnify(::llvm::cast<::llzk::array::ArrayType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType()))))
1324 return emitOpError("failed to verify that result type matches with arr_ref element type");
1325 return ::mlir::success();
1326}
1327
1328::llvm::LogicalResult ReadArrayOp::verifyInvariants() {
1329 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1330 return ::mlir::success();
1331 return ::mlir::failure();
1332}
1333
1334::mlir::ParseResult ReadArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
1345
1346 arr_refOperandsLoc = parser.getCurrentLocation();
1347 if (parser.parseOperand(arr_refRawOperand))
1348 return ::mlir::failure();
1349 if (parser.parseLSquare())
1350 return ::mlir::failure();
1351
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();
1359
1360 {
1362 if (parser.parseCustomTypeWithFallback(type))
1363 return ::mlir::failure();
1364 arr_refRawType = type;
1365 }
1366 if (parser.parseComma())
1367 return ::mlir::failure();
1368
1369 {
1370 ::mlir::Type type;
1371 if (parser.parseCustomTypeWithFallback(type))
1372 return ::mlir::failure();
1373 resultRawType = type;
1374 }
1375 {
1376 auto loc = parser.getCurrentLocation();(void)loc;
1377 if (parser.parseOptionalAttrDict(result.attributes))
1378 return ::mlir::failure();
1379 }
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();
1387}
1388
1389void ReadArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1390 _odsPrinter << ' ';
1391 _odsPrinter << getArrRef();
1392 _odsPrinter << "[";
1393 _odsPrinter << getIndices();
1394 _odsPrinter << "]";
1395 _odsPrinter << ' ' << ":";
1396 _odsPrinter << ' ';
1397 {
1398 auto type = getArrRef().getType();
1399 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1400 _odsPrinter.printStrippedAttrOrType(validType);
1401 else
1402 _odsPrinter << type;
1403 }
1404 _odsPrinter << ",";
1405 _odsPrinter << ' ';
1406 {
1407 auto type = getResult().getType();
1408 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1409 _odsPrinter.printStrippedAttrOrType(validType);
1410 else
1411 _odsPrinter << type;
1412 }
1413 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1414 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1415}
1416
1417 ::llvm::LogicalResult
1418 ReadArrayOp::inferReturnTypes(::mlir::MLIRContext *context,
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) {
1423 ReadArrayOp::Adaptor adaptor(operands, attributes, properties, regions);
1424 return ReadArrayOp::inferReturnTypes(context,
1425 location, adaptor, inferredReturnTypes);
1426 }
1427
1428
1430bool ReadArrayOp::canRewire(const ::mlir::DestructurableMemorySlot &slot,
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);
1436}
1437
1439::mlir::DeletionKind ReadArrayOp::rewire(const ::mlir::DestructurableMemorySlot &slot,
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);
1444}
1445
1447bool ReadArrayOp::loadsFrom(const ::mlir::MemorySlot &slot) {
1448 return getArrRef() == slot.ptr;
1449}
1450
1452bool ReadArrayOp::storesTo(const ::mlir::MemorySlot &slot) {
1453 return false;
1454}
1455
1457::mlir::Value ReadArrayOp::getStored(const ::mlir::MemorySlot &, ::mlir::OpBuilder &,
1458 ::mlir::Value, const ::mlir::DataLayout &) {
1459 llvm_unreachable("getStored() should not be called on ReadArrayOp");
1460}
1461
1464 return true;
1465}
1466
1469 return getArrRef() == ptr;
1470}
1471
1474 return false;
1475}
1476
1478bool ReadArrayOp::canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &) {
1479 return false;
1480}
1481} // namespace array
1482} // namespace llzk
1483MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::ReadArrayOp)
1484
1485namespace llzk {
1486namespace array {
1487
1488//===----------------------------------------------------------------------===//
1489// ::llzk::array::WriteArrayOp definitions
1490//===----------------------------------------------------------------------===//
1491
1492namespace detail {
1493std::pair<unsigned, unsigned> WriteArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1494 bool isVariadic[] = {false, true, false};
1495 int prevVariadicCount = 0;
1496 for (unsigned i = 0; i < index; ++i)
1497 if (isVariadic[i]) ++prevVariadicCount;
1498
1499 // Calculate how many dynamic values a static variadic operand corresponds to.
1500 // This assumes all static variadic operands have the same dynamic value count.
1501 int variadicSize = (odsOperandsSize - 2) / 1;
1502 // `index` passed in as the parameter is the static index which counts each
1503 // operand (variadic or not) as size 1. So here for each previous static variadic
1504 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1505 // value pack for this static operand starts.
1506 int start = index + (variadicSize - 1) * prevVariadicCount;
1507 int size = isVariadic[index] ? variadicSize : 1;
1508 return {start, size};
1509}
1510
1511} // namespace detail
1513
1514::llvm::LogicalResult WriteArrayOpAdaptor::verify(::mlir::Location loc) {
1515 return ::mlir::success();
1516}
1517
1518std::pair<unsigned, unsigned> WriteArrayOp::getODSOperandIndexAndLength(unsigned index) {
1519 bool isVariadic[] = {false, true, false};
1520 int prevVariadicCount = 0;
1521 for (unsigned i = 0; i < index; ++i)
1522 if (isVariadic[i]) ++prevVariadicCount;
1523
1524 // Calculate how many dynamic values a static variadic operand corresponds to.
1525 // This assumes all static variadic operands have the same dynamic value count.
1526 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1527 // `index` passed in as the parameter is the static index which counts each
1528 // operand (variadic or not) as size 1. So here for each previous static variadic
1529 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1530 // value pack for this static operand starts.
1531 int start = index + (variadicSize - 1) * prevVariadicCount;
1532 int size = isVariadic[index] ? variadicSize : 1;
1533 return {start, size};
1534}
1535
1536::mlir::MutableOperandRange WriteArrayOp::getIndicesMutable() {
1537 auto range = getODSOperandIndexAndLength(1);
1538 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1539 return mutableRange;
1540}
1541
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);
1546}
1547
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);
1554}
1555
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);
1562}
1563
1564::llvm::LogicalResult WriteArrayOp::verifyInvariantsImpl() {
1565 {
1566 unsigned index = 0; (void)index;
1567 auto valueGroup0 = getODSOperands(0);
1568
1569 for (auto v : valueGroup0) {
1570 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1571 return ::mlir::failure();
1572 }
1573 auto valueGroup1 = getODSOperands(1);
1574
1575 for (auto v : valueGroup1) {
1576 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1577 return ::mlir::failure();
1578 }
1579 auto valueGroup2 = getODSOperands(2);
1580
1581 for (auto v : valueGroup2) {
1582 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*this, v.getType(), "operand", index++)))
1583 return ::mlir::failure();
1584 }
1585 }
1586 if (!((::llzk::typesUnify(::llvm::cast<::llzk::array::ArrayType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSOperands(2).begin()).getType()))))
1587 return emitOpError("failed to verify that rvalue type matches with arr_ref element type");
1588 return ::mlir::success();
1589}
1590
1591::llvm::LogicalResult WriteArrayOp::verifyInvariants() {
1592 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1593 return ::mlir::success();
1594 return ::mlir::failure();
1595}
1596
1597::mlir::ParseResult WriteArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
1611
1612 arr_refOperandsLoc = parser.getCurrentLocation();
1613 if (parser.parseOperand(arr_refRawOperand))
1614 return ::mlir::failure();
1615 if (parser.parseLSquare())
1616 return ::mlir::failure();
1617
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();
1625
1626 rvalueOperandsLoc = parser.getCurrentLocation();
1627 if (parser.parseOperand(rvalueRawOperand))
1628 return ::mlir::failure();
1629 if (parser.parseColon())
1630 return ::mlir::failure();
1631
1632 {
1634 if (parser.parseCustomTypeWithFallback(type))
1635 return ::mlir::failure();
1636 arr_refRawType = type;
1637 }
1638 if (parser.parseComma())
1639 return ::mlir::failure();
1640
1641 {
1642 ::mlir::Type type;
1643 if (parser.parseCustomTypeWithFallback(type))
1644 return ::mlir::failure();
1645 rvalueRawType = type;
1646 }
1647 {
1648 auto loc = parser.getCurrentLocation();(void)loc;
1649 if (parser.parseOptionalAttrDict(result.attributes))
1650 return ::mlir::failure();
1651 }
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();
1660}
1661
1662void WriteArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1663 _odsPrinter << ' ';
1664 _odsPrinter << getArrRef();
1665 _odsPrinter << "[";
1666 _odsPrinter << getIndices();
1667 _odsPrinter << "]";
1668 _odsPrinter << ' ' << "=";
1669 _odsPrinter << ' ';
1670 _odsPrinter << getRvalue();
1671 _odsPrinter << ' ' << ":";
1672 _odsPrinter << ' ';
1673 {
1674 auto type = getArrRef().getType();
1675 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1676 _odsPrinter.printStrippedAttrOrType(validType);
1677 else
1678 _odsPrinter << type;
1679 }
1680 _odsPrinter << ",";
1681 _odsPrinter << ' ';
1682 {
1683 auto type = getRvalue().getType();
1684 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1685 _odsPrinter.printStrippedAttrOrType(validType);
1686 else
1687 _odsPrinter << type;
1688 }
1689 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1690 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1691}
1692
1694bool WriteArrayOp::canRewire(const ::mlir::DestructurableMemorySlot &slot,
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);
1700}
1701
1703::mlir::DeletionKind WriteArrayOp::rewire(const ::mlir::DestructurableMemorySlot &slot,
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);
1708}
1709
1711bool WriteArrayOp::loadsFrom(const ::mlir::MemorySlot &slot) {
1712 return false;
1713}
1714
1716bool WriteArrayOp::storesTo(const ::mlir::MemorySlot &slot) {
1717 return getArrRef() == slot.ptr;
1718}
1719
1721::mlir::Value WriteArrayOp::getStored(const ::mlir::MemorySlot &, ::mlir::OpBuilder &,
1722 ::mlir::Value, const ::mlir::DataLayout &) {
1723 return getRvalue();
1724}
1725
1728 return false;
1729}
1730
1733 return false;
1734}
1735
1738 return getArrRef() == ptr && getRvalue() != ptr;
1739}
1740
1742bool WriteArrayOp::canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &) {
1743 return getArrRef() == ptr && getRvalue() != ptr;
1744}
1745} // namespace array
1746} // namespace llzk
1747MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::WriteArrayOp)
1748
1749
1750#endif // GET_OP_CLASSES
1751
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:108
ArrayLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:79
ArrayLengthOpAdaptor(ArrayLengthOp op)
Definition Ops.cpp.inc:106
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:146
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:168
::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)
Definition Ops.cpp.inc:199
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:268
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:249
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:140
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value arr_ref, ::mlir::Value dim)
Definition Ops.cpp.inc:112
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:195
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:207
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:167
::mlir::TypedValue<::mlir::IndexType > getDim()
Definition Ops.h.inc:150
CreateArrayOpAdaptor(CreateArrayOp op)
Definition Ops.cpp.inc:310
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:312
CreateArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:288
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:521
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:325
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:465
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:706
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)
Definition Ops.cpp.inc:729
::mlir::TypedValue<::llzk::array::ArrayType > getResult()
Definition Ops.h.inc:408
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:678
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:472
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:340
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:551
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:435
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:570
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:361
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:346
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:402
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:425
::llvm::LogicalResult verify()
Definition Ops.cpp:105
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:382
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.h.inc:421
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:487
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:541
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:546
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:394
::mlir::OperandRangeRange getMapOperands()
Definition Ops.h.inc:392
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:611
FoldAdaptor::Properties Properties
Definition Ops.h.inc:347
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:353
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:426
::mlir::MutableOperandRange getElementsMutable()
Definition Ops.cpp.inc:334
::mlir::Operation::operand_range getElements()
Definition Ops.h.inc:388
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:617
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:445
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:564
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:555
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:766
ExtractArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:525
ExtractArrayOpAdaptor(ExtractArrayOp op)
Definition Ops.cpp.inc:764
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:607
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
Definition Ops.cpp.inc:794
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:881
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:788
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:965
ExtractArrayOpAdaptor Adaptor
Definition Ops.h.inc:570
::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)
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:849
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:877
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:933
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:770
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:593
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:589
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:583
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1001
InsertArrayOpAdaptor(InsertArrayOp op)
Definition Ops.cpp.inc:999
InsertArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:681
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:753
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1051
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1179
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1076
::llvm::LogicalResult verify()
Definition Ops.cpp:438
::mlir::TypedValue<::llzk::array::ArrayType > getRvalue()
Definition Ops.h.inc:757
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:743
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1082
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1147
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:749
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1005
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
Definition Ops.cpp.inc:1029
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1023
ReadArrayOpAdaptor(ReadArrayOp op)
Definition Ops.cpp.inc:1213
ReadArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:835
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1215
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::OpBuilder &builder, ::mlir::Value reachingDef, const ::mlir::DataLayout &dataLayout)
Required by PromotableAllocationOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1457
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1473
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1298
::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.
Definition Ops.cpp.inc:1439
::mlir::TypedValue<::mlir::Type > getResult()
Definition Ops.h.inc:923
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:899
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1452
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:903
::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.
Definition Ops.cpp.inc:1447
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1478
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1334
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1463
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1468
::llvm::LogicalResult verify()
Definition Ops.cpp:318
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
Definition Ops.cpp.inc:1243
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1389
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:917
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:893
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.
Definition Ops.cpp.inc:1430
ReadArrayOpAdaptor Adaptor
Definition Ops.h.inc:880
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1219
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1328
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1237
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1514
WriteArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1002
WriteArrayOpAdaptor(WriteArrayOp op)
Definition Ops.cpp.inc:1512
::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.
Definition Ops.cpp.inc:1703
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1727
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1711
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1591
::llvm::LogicalResult verify()
Definition Ops.cpp:357
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:1074
::mlir::Value getStored(const ::mlir::MemorySlot &slot, ::mlir::OpBuilder &builder, ::mlir::Value reachingDef, const ::mlir::DataLayout &dataLayout)
Required by PromotableAllocationOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1721
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1662
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.
Definition Ops.cpp.inc:1694
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1564
bool canEraseAsDeadStoreTo(::mlir::Value ptr, const ::mlir::DataLayout &dataLayout)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1742
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1597
bool loadsFromDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1732
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1716
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
Definition Ops.cpp.inc:1542
bool storesToDiscardableAllocation(::mlir::Value ptr)
Required by DiscardableAllocationAccessorOpInterface / unused allocation cleanup.
Definition Ops.cpp.inc:1737
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1536
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:1064
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:1070
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1518
::mlir::TypedValue<::mlir::Type > getRvalue()
Definition Ops.h.inc:1078
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:275
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:304
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:299
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:285
CreateArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:258
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:254
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:745
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:980
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1194
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1493
bool isValidArrayElemType(Type type)
mlir::ParseResult parseAttrDictWithWarnings(mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
Definition OpHelpers.h:195
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:188
void printAttrDictWithWarnings(mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
Definition OpHelpers.h:202
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)
Definition OpHelpers.h:180