LLZK 0.1.0
Veridise's ZK Language IR
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}
731
732} // namespace array
733} // namespace llzk
734MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::CreateArrayOp)
735
736namespace llzk {
737namespace array {
738
739//===----------------------------------------------------------------------===//
740// ::llzk::array::ExtractArrayOp definitions
741//===----------------------------------------------------------------------===//
742
743namespace detail {
744std::pair<unsigned, unsigned> ExtractArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
745 bool isVariadic[] = {false, true};
746 int prevVariadicCount = 0;
747 for (unsigned i = 0; i < index; ++i)
748 if (isVariadic[i]) ++prevVariadicCount;
749
750 // Calculate how many dynamic values a static variadic operand corresponds to.
751 // This assumes all static variadic operands have the same dynamic value count.
752 int variadicSize = (odsOperandsSize - 1) / 1;
753 // `index` passed in as the parameter is the static index which counts each
754 // operand (variadic or not) as size 1. So here for each previous static variadic
755 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
756 // value pack for this static operand starts.
757 int start = index + (variadicSize - 1) * prevVariadicCount;
758 int size = isVariadic[index] ? variadicSize : 1;
759 return {start, size};
760}
761
762} // namespace detail
764
765::llvm::LogicalResult ExtractArrayOpAdaptor::verify(::mlir::Location loc) {
766 return ::mlir::success();
767}
768
769std::pair<unsigned, unsigned> ExtractArrayOp::getODSOperandIndexAndLength(unsigned index) {
770 bool isVariadic[] = {false, true};
771 int prevVariadicCount = 0;
772 for (unsigned i = 0; i < index; ++i)
773 if (isVariadic[i]) ++prevVariadicCount;
774
775 // Calculate how many dynamic values a static variadic operand corresponds to.
776 // This assumes all static variadic operands have the same dynamic value count.
777 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
778 // `index` passed in as the parameter is the static index which counts each
779 // operand (variadic or not) as size 1. So here for each previous static variadic
780 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
781 // value pack for this static operand starts.
782 int start = index + (variadicSize - 1) * prevVariadicCount;
783 int size = isVariadic[index] ? variadicSize : 1;
784 return {start, size};
785}
786
787::mlir::MutableOperandRange ExtractArrayOp::getIndicesMutable() {
788 auto range = getODSOperandIndexAndLength(1);
789 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
790 return mutableRange;
791}
792
793void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
794 odsState.addOperands(arr_ref);
795 odsState.addOperands(indices);
796 odsState.addTypes(result);
797}
798
799void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
800 odsState.addOperands(arr_ref);
801 odsState.addOperands(indices);
802
803 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
804 if (::mlir::succeeded(ExtractArrayOp::inferReturnTypes(odsBuilder.getContext(),
805 odsState.location, odsState.operands,
806 odsState.attributes.getDictionary(odsState.getContext()),
807 odsState.getRawProperties(),
808 odsState.regions, inferredReturnTypes)))
809 odsState.addTypes(inferredReturnTypes);
810 else
811 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
812
813}
814
815void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
816 odsState.addOperands(arr_ref);
817 odsState.addOperands(indices);
818 assert(resultTypes.size() == 1u && "mismatched number of results");
819 odsState.addTypes(resultTypes);
820}
821
822void ExtractArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
823 assert(operands.size() >= 1u && "mismatched number of parameters");
824 odsState.addOperands(operands);
825 odsState.addAttributes(attributes);
826 assert(resultTypes.size() == 1u && "mismatched number of return types");
827 odsState.addTypes(resultTypes);
828}
829
830void ExtractArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
831 assert(operands.size() >= 1u && "mismatched number of parameters");
832 odsState.addOperands(operands);
833 odsState.addAttributes(attributes);
834
835 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
836 if (::mlir::succeeded(ExtractArrayOp::inferReturnTypes(odsBuilder.getContext(),
837 odsState.location, operands,
838 odsState.attributes.getDictionary(odsState.getContext()),
839 odsState.getRawProperties(),
840 odsState.regions, inferredReturnTypes))) {
841 assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
842 odsState.addTypes(inferredReturnTypes);
843 } else {
844 ::llvm::report_fatal_error("Failed to infer result type(s).");
845 }
846}
847
849 {
850 unsigned index = 0; (void)index;
851 auto valueGroup0 = getODSOperands(0);
852
853 for (auto v : valueGroup0) {
854 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
855 return ::mlir::failure();
856 }
857 auto valueGroup1 = getODSOperands(1);
858
859 for (auto v : valueGroup1) {
860 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
861 return ::mlir::failure();
862 }
863 }
864 {
865 unsigned index = 0; (void)index;
866 auto valueGroup0 = getODSResults(0);
867
868 for (auto v : valueGroup0) {
869 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
870 return ::mlir::failure();
871 }
872 }
873 return ::mlir::success();
874}
875
876::llvm::LogicalResult ExtractArrayOp::verifyInvariants() {
877 return verifyInvariantsImpl();
878}
879
880::mlir::ParseResult ExtractArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
881 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
882 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
883 (void)arr_refOperandsLoc;
884 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
885 ::llvm::SMLoc indicesOperandsLoc;
886 (void)indicesOperandsLoc;
887 ::mlir::Type arr_refRawType{};
888 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
889
890 arr_refOperandsLoc = parser.getCurrentLocation();
891 if (parser.parseOperand(arr_refRawOperand))
892 return ::mlir::failure();
893 if (parser.parseLSquare())
894 return ::mlir::failure();
895
896 indicesOperandsLoc = parser.getCurrentLocation();
897 if (parser.parseOperandList(indicesOperands))
898 return ::mlir::failure();
899 if (parser.parseRSquare())
900 return ::mlir::failure();
901 if (parser.parseColon())
902 return ::mlir::failure();
903
904 {
906 if (parser.parseCustomTypeWithFallback(type))
907 return ::mlir::failure();
908 arr_refRawType = type;
909 }
910 {
911 auto loc = parser.getCurrentLocation();(void)loc;
912 if (parser.parseOptionalAttrDict(result.attributes))
913 return ::mlir::failure();
914 }
915 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
916 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
917 return ::mlir::failure();
918 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
919 return ::mlir::failure();
920
921 ::llvm::SmallVector<::mlir::Type> inferredReturnTypes;
922 if (::mlir::failed(ExtractArrayOp::inferReturnTypes(parser.getContext(),
923 result.location, result.operands,
924 result.attributes.getDictionary(parser.getContext()),
925 result.getRawProperties(),
926 result.regions, inferredReturnTypes)))
927 return ::mlir::failure();
928 result.addTypes(inferredReturnTypes);
929 return ::mlir::success();
930}
931
932void ExtractArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
933 _odsPrinter << ' ';
934 _odsPrinter << getArrRef();
935 _odsPrinter << "[";
936 _odsPrinter << getIndices();
937 _odsPrinter << "]";
938 _odsPrinter << ' ' << ":";
939 _odsPrinter << ' ';
940 {
941 auto type = getArrRef().getType();
942 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
943 _odsPrinter.printStrippedAttrOrType(validType);
944 else
945 _odsPrinter << type;
946 }
947 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
948 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
949}
950
951 ::llvm::LogicalResult
952 ExtractArrayOp::inferReturnTypes(::mlir::MLIRContext *context,
953 std::optional<::mlir::Location> location,
954 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
955 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
956 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
957 ExtractArrayOp::Adaptor adaptor(operands, attributes, properties, regions);
959 location, adaptor, inferredReturnTypes);
960 }
961
962
965 return true;
966}
967} // namespace array
968} // namespace llzk
969MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::ExtractArrayOp)
970
971namespace llzk {
972namespace array {
973
974//===----------------------------------------------------------------------===//
975// ::llzk::array::InsertArrayOp definitions
976//===----------------------------------------------------------------------===//
977
978namespace detail {
979std::pair<unsigned, unsigned> InsertArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
980 bool isVariadic[] = {false, true, false};
981 int prevVariadicCount = 0;
982 for (unsigned i = 0; i < index; ++i)
983 if (isVariadic[i]) ++prevVariadicCount;
984
985 // Calculate how many dynamic values a static variadic operand corresponds to.
986 // This assumes all static variadic operands have the same dynamic value count.
987 int variadicSize = (odsOperandsSize - 2) / 1;
988 // `index` passed in as the parameter is the static index which counts each
989 // operand (variadic or not) as size 1. So here for each previous static variadic
990 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
991 // value pack for this static operand starts.
992 int start = index + (variadicSize - 1) * prevVariadicCount;
993 int size = isVariadic[index] ? variadicSize : 1;
994 return {start, size};
995}
996
997} // namespace detail
999
1000::llvm::LogicalResult InsertArrayOpAdaptor::verify(::mlir::Location loc) {
1001 return ::mlir::success();
1002}
1003
1004std::pair<unsigned, unsigned> InsertArrayOp::getODSOperandIndexAndLength(unsigned index) {
1005 bool isVariadic[] = {false, true, false};
1006 int prevVariadicCount = 0;
1007 for (unsigned i = 0; i < index; ++i)
1008 if (isVariadic[i]) ++prevVariadicCount;
1009
1010 // Calculate how many dynamic values a static variadic operand corresponds to.
1011 // This assumes all static variadic operands have the same dynamic value count.
1012 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1013 // `index` passed in as the parameter is the static index which counts each
1014 // operand (variadic or not) as size 1. So here for each previous static variadic
1015 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1016 // value pack for this static operand starts.
1017 int start = index + (variadicSize - 1) * prevVariadicCount;
1018 int size = isVariadic[index] ? variadicSize : 1;
1019 return {start, size};
1020}
1021
1022::mlir::MutableOperandRange InsertArrayOp::getIndicesMutable() {
1023 auto range = getODSOperandIndexAndLength(1);
1024 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1025 return mutableRange;
1026}
1027
1028void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1029 odsState.addOperands(arr_ref);
1030 odsState.addOperands(indices);
1031 odsState.addOperands(rvalue);
1032}
1033
1034void InsertArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1035 odsState.addOperands(arr_ref);
1036 odsState.addOperands(indices);
1037 odsState.addOperands(rvalue);
1038 assert(resultTypes.size() == 0u && "mismatched number of results");
1039 odsState.addTypes(resultTypes);
1040}
1041
1042void InsertArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1043 assert(operands.size() >= 2u && "mismatched number of parameters");
1044 odsState.addOperands(operands);
1045 odsState.addAttributes(attributes);
1046 assert(resultTypes.size() == 0u && "mismatched number of return types");
1047 odsState.addTypes(resultTypes);
1048}
1049
1051 {
1052 unsigned index = 0; (void)index;
1053 auto valueGroup0 = getODSOperands(0);
1054
1055 for (auto v : valueGroup0) {
1056 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1057 return ::mlir::failure();
1058 }
1059 auto valueGroup1 = getODSOperands(1);
1060
1061 for (auto v : valueGroup1) {
1062 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1063 return ::mlir::failure();
1064 }
1065 auto valueGroup2 = getODSOperands(2);
1066
1067 for (auto v : valueGroup2) {
1068 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1069 return ::mlir::failure();
1070 }
1071 }
1072 return ::mlir::success();
1073}
1074
1075::llvm::LogicalResult InsertArrayOp::verifyInvariants() {
1076 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1077 return ::mlir::success();
1078 return ::mlir::failure();
1079}
1080
1081::mlir::ParseResult InsertArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1082 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1083 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1084 (void)arr_refOperandsLoc;
1085 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1086 ::llvm::SMLoc indicesOperandsLoc;
1087 (void)indicesOperandsLoc;
1088 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperand{};
1089 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(&rvalueRawOperand, 1); ::llvm::SMLoc rvalueOperandsLoc;
1090 (void)rvalueOperandsLoc;
1091 ::mlir::Type arr_refRawType{};
1092 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1093 ::mlir::Type rvalueRawType{};
1094 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(&rvalueRawType, 1);
1095
1096 arr_refOperandsLoc = parser.getCurrentLocation();
1097 if (parser.parseOperand(arr_refRawOperand))
1098 return ::mlir::failure();
1099 if (parser.parseLSquare())
1100 return ::mlir::failure();
1101
1102 indicesOperandsLoc = parser.getCurrentLocation();
1103 if (parser.parseOperandList(indicesOperands))
1104 return ::mlir::failure();
1105 if (parser.parseRSquare())
1106 return ::mlir::failure();
1107 if (parser.parseEqual())
1108 return ::mlir::failure();
1109
1110 rvalueOperandsLoc = parser.getCurrentLocation();
1111 if (parser.parseOperand(rvalueRawOperand))
1112 return ::mlir::failure();
1113 if (parser.parseColon())
1114 return ::mlir::failure();
1115
1116 {
1118 if (parser.parseCustomTypeWithFallback(type))
1119 return ::mlir::failure();
1120 arr_refRawType = type;
1121 }
1122 if (parser.parseComma())
1123 return ::mlir::failure();
1124
1125 {
1127 if (parser.parseCustomTypeWithFallback(type))
1128 return ::mlir::failure();
1129 rvalueRawType = type;
1130 }
1131 {
1132 auto loc = parser.getCurrentLocation();(void)loc;
1133 if (parser.parseOptionalAttrDict(result.attributes))
1134 return ::mlir::failure();
1135 }
1136 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1137 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1138 return ::mlir::failure();
1139 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1140 return ::mlir::failure();
1141 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1142 return ::mlir::failure();
1143 return ::mlir::success();
1144}
1145
1146void InsertArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1147 _odsPrinter << ' ';
1148 _odsPrinter << getArrRef();
1149 _odsPrinter << "[";
1150 _odsPrinter << getIndices();
1151 _odsPrinter << "]";
1152 _odsPrinter << ' ' << "=";
1153 _odsPrinter << ' ';
1154 _odsPrinter << getRvalue();
1155 _odsPrinter << ' ' << ":";
1156 _odsPrinter << ' ';
1157 {
1158 auto type = getArrRef().getType();
1159 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1160 _odsPrinter.printStrippedAttrOrType(validType);
1161 else
1162 _odsPrinter << type;
1163 }
1164 _odsPrinter << ",";
1165 _odsPrinter << ' ';
1166 {
1167 auto type = getRvalue().getType();
1168 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1169 _odsPrinter.printStrippedAttrOrType(validType);
1170 else
1171 _odsPrinter << type;
1172 }
1173 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1174 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1175}
1176
1179 return false;
1180}
1181} // namespace array
1182} // namespace llzk
1183MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::InsertArrayOp)
1184
1185namespace llzk {
1186namespace array {
1187
1188//===----------------------------------------------------------------------===//
1189// ::llzk::array::ReadArrayOp definitions
1190//===----------------------------------------------------------------------===//
1191
1192namespace detail {
1193std::pair<unsigned, unsigned> ReadArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1194 bool isVariadic[] = {false, true};
1195 int prevVariadicCount = 0;
1196 for (unsigned i = 0; i < index; ++i)
1197 if (isVariadic[i]) ++prevVariadicCount;
1198
1199 // Calculate how many dynamic values a static variadic operand corresponds to.
1200 // This assumes all static variadic operands have the same dynamic value count.
1201 int variadicSize = (odsOperandsSize - 1) / 1;
1202 // `index` passed in as the parameter is the static index which counts each
1203 // operand (variadic or not) as size 1. So here for each previous static variadic
1204 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1205 // value pack for this static operand starts.
1206 int start = index + (variadicSize - 1) * prevVariadicCount;
1207 int size = isVariadic[index] ? variadicSize : 1;
1208 return {start, size};
1209}
1210
1211} // namespace detail
1213
1214::llvm::LogicalResult ReadArrayOpAdaptor::verify(::mlir::Location loc) {
1215 return ::mlir::success();
1216}
1217
1218std::pair<unsigned, unsigned> ReadArrayOp::getODSOperandIndexAndLength(unsigned index) {
1219 bool isVariadic[] = {false, true};
1220 int prevVariadicCount = 0;
1221 for (unsigned i = 0; i < index; ++i)
1222 if (isVariadic[i]) ++prevVariadicCount;
1223
1224 // Calculate how many dynamic values a static variadic operand corresponds to.
1225 // This assumes all static variadic operands have the same dynamic value count.
1226 int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1227 // `index` passed in as the parameter is the static index which counts each
1228 // operand (variadic or not) as size 1. So here for each previous static variadic
1229 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1230 // value pack for this static operand starts.
1231 int start = index + (variadicSize - 1) * prevVariadicCount;
1232 int size = isVariadic[index] ? variadicSize : 1;
1233 return {start, size};
1234}
1235
1236::mlir::MutableOperandRange ReadArrayOp::getIndicesMutable() {
1237 auto range = getODSOperandIndexAndLength(1);
1238 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1239 return mutableRange;
1240}
1241
1242void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1243 odsState.addOperands(arr_ref);
1244 odsState.addOperands(indices);
1245 odsState.addTypes(result);
1246}
1247
1248void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1249 odsState.addOperands(arr_ref);
1250 odsState.addOperands(indices);
1251
1252 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1253 if (::mlir::succeeded(ReadArrayOp::inferReturnTypes(odsBuilder.getContext(),
1254 odsState.location, odsState.operands,
1255 odsState.attributes.getDictionary(odsState.getContext()),
1256 odsState.getRawProperties(),
1257 odsState.regions, inferredReturnTypes)))
1258 odsState.addTypes(inferredReturnTypes);
1259 else
1260 ::mlir::detail::reportFatalInferReturnTypesError(odsState);
1261
1262}
1263
1264void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices) {
1265 odsState.addOperands(arr_ref);
1266 odsState.addOperands(indices);
1267 assert(resultTypes.size() == 1u && "mismatched number of results");
1268 odsState.addTypes(resultTypes);
1269}
1270
1271void ReadArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1272 assert(operands.size() >= 1u && "mismatched number of parameters");
1273 odsState.addOperands(operands);
1274 odsState.addAttributes(attributes);
1275 assert(resultTypes.size() == 1u && "mismatched number of return types");
1276 odsState.addTypes(resultTypes);
1277}
1278
1279void ReadArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1280 assert(operands.size() >= 1u && "mismatched number of parameters");
1281 odsState.addOperands(operands);
1282 odsState.addAttributes(attributes);
1283
1284 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
1285 if (::mlir::succeeded(ReadArrayOp::inferReturnTypes(odsBuilder.getContext(),
1286 odsState.location, operands,
1287 odsState.attributes.getDictionary(odsState.getContext()),
1288 odsState.getRawProperties(),
1289 odsState.regions, inferredReturnTypes))) {
1290 assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
1291 odsState.addTypes(inferredReturnTypes);
1292 } else {
1293 ::llvm::report_fatal_error("Failed to infer result type(s).");
1294 }
1295}
1296
1297::llvm::LogicalResult ReadArrayOp::verifyInvariantsImpl() {
1298 {
1299 unsigned index = 0; (void)index;
1300 auto valueGroup0 = getODSOperands(0);
1301
1302 for (auto v : valueGroup0) {
1303 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1304 return ::mlir::failure();
1305 }
1306 auto valueGroup1 = getODSOperands(1);
1307
1308 for (auto v : valueGroup1) {
1309 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1310 return ::mlir::failure();
1311 }
1312 }
1313 {
1314 unsigned index = 0; (void)index;
1315 auto valueGroup0 = getODSResults(0);
1316
1317 for (auto v : valueGroup0) {
1318 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*this, v.getType(), "result", index++)))
1319 return ::mlir::failure();
1320 }
1321 }
1322 if (!((::llzk::typesUnify(::llvm::cast<::llzk::array::ArrayType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSResults(0).begin()).getType()))))
1323 return emitOpError("failed to verify that result type matches with arr_ref element type");
1324 return ::mlir::success();
1325}
1326
1327::llvm::LogicalResult ReadArrayOp::verifyInvariants() {
1328 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1329 return ::mlir::success();
1330 return ::mlir::failure();
1331}
1332
1333::mlir::ParseResult ReadArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1334 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1335 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1336 (void)arr_refOperandsLoc;
1337 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1338 ::llvm::SMLoc indicesOperandsLoc;
1339 (void)indicesOperandsLoc;
1340 ::mlir::Type arr_refRawType{};
1341 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1342 ::mlir::Type resultRawType{};
1343 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
1344
1345 arr_refOperandsLoc = parser.getCurrentLocation();
1346 if (parser.parseOperand(arr_refRawOperand))
1347 return ::mlir::failure();
1348 if (parser.parseLSquare())
1349 return ::mlir::failure();
1350
1351 indicesOperandsLoc = parser.getCurrentLocation();
1352 if (parser.parseOperandList(indicesOperands))
1353 return ::mlir::failure();
1354 if (parser.parseRSquare())
1355 return ::mlir::failure();
1356 if (parser.parseColon())
1357 return ::mlir::failure();
1358
1359 {
1361 if (parser.parseCustomTypeWithFallback(type))
1362 return ::mlir::failure();
1363 arr_refRawType = type;
1364 }
1365 if (parser.parseComma())
1366 return ::mlir::failure();
1367
1368 {
1369 ::mlir::Type type;
1370 if (parser.parseCustomTypeWithFallback(type))
1371 return ::mlir::failure();
1372 resultRawType = type;
1373 }
1374 {
1375 auto loc = parser.getCurrentLocation();(void)loc;
1376 if (parser.parseOptionalAttrDict(result.attributes))
1377 return ::mlir::failure();
1378 }
1379 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1380 result.addTypes(resultTypes);
1381 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1382 return ::mlir::failure();
1383 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1384 return ::mlir::failure();
1385 return ::mlir::success();
1386}
1387
1388void ReadArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1389 _odsPrinter << ' ';
1390 _odsPrinter << getArrRef();
1391 _odsPrinter << "[";
1392 _odsPrinter << getIndices();
1393 _odsPrinter << "]";
1394 _odsPrinter << ' ' << ":";
1395 _odsPrinter << ' ';
1396 {
1397 auto type = getArrRef().getType();
1398 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1399 _odsPrinter.printStrippedAttrOrType(validType);
1400 else
1401 _odsPrinter << type;
1402 }
1403 _odsPrinter << ",";
1404 _odsPrinter << ' ';
1405 {
1406 auto type = getResult().getType();
1407 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1408 _odsPrinter.printStrippedAttrOrType(validType);
1409 else
1410 _odsPrinter << type;
1411 }
1412 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1413 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1414}
1415
1416 ::llvm::LogicalResult
1417 ReadArrayOp::inferReturnTypes(::mlir::MLIRContext *context,
1418 std::optional<::mlir::Location> location,
1419 ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
1420 ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
1421 ::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
1422 ReadArrayOp::Adaptor adaptor(operands, attributes, properties, regions);
1423 return ReadArrayOp::inferReturnTypes(context,
1424 location, adaptor, inferredReturnTypes);
1425 }
1426
1427
1429bool ReadArrayOp::canRewire(const ::mlir::DestructurableMemorySlot &slot,
1430 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1431 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1432 const ::mlir::DataLayout &dataLayout) {
1433 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1434 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1435}
1436
1438::mlir::DeletionKind ReadArrayOp::rewire(const ::mlir::DestructurableMemorySlot &slot,
1439 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1440 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1441 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1442 .rewire(slot, subslots, builder, dataLayout);
1443}
1444
1446bool ReadArrayOp::loadsFrom(const ::mlir::MemorySlot &slot) {
1447 return getArrRef() == slot.ptr;
1448}
1449
1451bool ReadArrayOp::storesTo(const ::mlir::MemorySlot &slot) {
1452 return false;
1453}
1454
1456::mlir::Value ReadArrayOp::getStored(const ::mlir::MemorySlot &, ::mlir::OpBuilder &,
1457 ::mlir::Value, const ::mlir::DataLayout &) {
1458 llvm_unreachable("getStored() should not be called on ReadArrayOp");
1459}
1460
1463 return true;
1464}
1465} // namespace array
1466} // namespace llzk
1467MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::ReadArrayOp)
1468
1469namespace llzk {
1470namespace array {
1471
1472//===----------------------------------------------------------------------===//
1473// ::llzk::array::WriteArrayOp definitions
1474//===----------------------------------------------------------------------===//
1475
1476namespace detail {
1477std::pair<unsigned, unsigned> WriteArrayOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1478 bool isVariadic[] = {false, true, false};
1479 int prevVariadicCount = 0;
1480 for (unsigned i = 0; i < index; ++i)
1481 if (isVariadic[i]) ++prevVariadicCount;
1482
1483 // Calculate how many dynamic values a static variadic operand corresponds to.
1484 // This assumes all static variadic operands have the same dynamic value count.
1485 int variadicSize = (odsOperandsSize - 2) / 1;
1486 // `index` passed in as the parameter is the static index which counts each
1487 // operand (variadic or not) as size 1. So here for each previous static variadic
1488 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1489 // value pack for this static operand starts.
1490 int start = index + (variadicSize - 1) * prevVariadicCount;
1491 int size = isVariadic[index] ? variadicSize : 1;
1492 return {start, size};
1493}
1494
1495} // namespace detail
1497
1498::llvm::LogicalResult WriteArrayOpAdaptor::verify(::mlir::Location loc) {
1499 return ::mlir::success();
1500}
1501
1502std::pair<unsigned, unsigned> WriteArrayOp::getODSOperandIndexAndLength(unsigned index) {
1503 bool isVariadic[] = {false, true, false};
1504 int prevVariadicCount = 0;
1505 for (unsigned i = 0; i < index; ++i)
1506 if (isVariadic[i]) ++prevVariadicCount;
1507
1508 // Calculate how many dynamic values a static variadic operand corresponds to.
1509 // This assumes all static variadic operands have the same dynamic value count.
1510 int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1511 // `index` passed in as the parameter is the static index which counts each
1512 // operand (variadic or not) as size 1. So here for each previous static variadic
1513 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1514 // value pack for this static operand starts.
1515 int start = index + (variadicSize - 1) * prevVariadicCount;
1516 int size = isVariadic[index] ? variadicSize : 1;
1517 return {start, size};
1518}
1519
1520::mlir::MutableOperandRange WriteArrayOp::getIndicesMutable() {
1521 auto range = getODSOperandIndexAndLength(1);
1522 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1523 return mutableRange;
1524}
1525
1526void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1527 odsState.addOperands(arr_ref);
1528 odsState.addOperands(indices);
1529 odsState.addOperands(rvalue);
1530}
1531
1532void WriteArrayOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue) {
1533 odsState.addOperands(arr_ref);
1534 odsState.addOperands(indices);
1535 odsState.addOperands(rvalue);
1536 assert(resultTypes.size() == 0u && "mismatched number of results");
1537 odsState.addTypes(resultTypes);
1538}
1539
1540void WriteArrayOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1541 assert(operands.size() >= 2u && "mismatched number of parameters");
1542 odsState.addOperands(operands);
1543 odsState.addAttributes(attributes);
1544 assert(resultTypes.size() == 0u && "mismatched number of return types");
1545 odsState.addTypes(resultTypes);
1546}
1547
1548::llvm::LogicalResult WriteArrayOp::verifyInvariantsImpl() {
1549 {
1550 unsigned index = 0; (void)index;
1551 auto valueGroup0 = getODSOperands(0);
1552
1553 for (auto v : valueGroup0) {
1554 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1555 return ::mlir::failure();
1556 }
1557 auto valueGroup1 = getODSOperands(1);
1558
1559 for (auto v : valueGroup1) {
1560 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
1561 return ::mlir::failure();
1562 }
1563 auto valueGroup2 = getODSOperands(2);
1564
1565 for (auto v : valueGroup2) {
1566 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops5(*this, v.getType(), "operand", index++)))
1567 return ::mlir::failure();
1568 }
1569 }
1570 if (!((::llzk::typesUnify(::llvm::cast<::llzk::array::ArrayType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSOperands(2).begin()).getType()))))
1571 return emitOpError("failed to verify that rvalue type matches with arr_ref element type");
1572 return ::mlir::success();
1573}
1574
1575::llvm::LogicalResult WriteArrayOp::verifyInvariants() {
1576 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1577 return ::mlir::success();
1578 return ::mlir::failure();
1579}
1580
1581::mlir::ParseResult WriteArrayOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1582 ::mlir::OpAsmParser::UnresolvedOperand arr_refRawOperand{};
1583 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> arr_refOperands(&arr_refRawOperand, 1); ::llvm::SMLoc arr_refOperandsLoc;
1584 (void)arr_refOperandsLoc;
1585 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
1586 ::llvm::SMLoc indicesOperandsLoc;
1587 (void)indicesOperandsLoc;
1588 ::mlir::OpAsmParser::UnresolvedOperand rvalueRawOperand{};
1589 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rvalueOperands(&rvalueRawOperand, 1); ::llvm::SMLoc rvalueOperandsLoc;
1590 (void)rvalueOperandsLoc;
1591 ::mlir::Type arr_refRawType{};
1592 ::llvm::ArrayRef<::mlir::Type> arr_refTypes(&arr_refRawType, 1);
1593 ::mlir::Type rvalueRawType{};
1594 ::llvm::ArrayRef<::mlir::Type> rvalueTypes(&rvalueRawType, 1);
1595
1596 arr_refOperandsLoc = parser.getCurrentLocation();
1597 if (parser.parseOperand(arr_refRawOperand))
1598 return ::mlir::failure();
1599 if (parser.parseLSquare())
1600 return ::mlir::failure();
1601
1602 indicesOperandsLoc = parser.getCurrentLocation();
1603 if (parser.parseOperandList(indicesOperands))
1604 return ::mlir::failure();
1605 if (parser.parseRSquare())
1606 return ::mlir::failure();
1607 if (parser.parseEqual())
1608 return ::mlir::failure();
1609
1610 rvalueOperandsLoc = parser.getCurrentLocation();
1611 if (parser.parseOperand(rvalueRawOperand))
1612 return ::mlir::failure();
1613 if (parser.parseColon())
1614 return ::mlir::failure();
1615
1616 {
1618 if (parser.parseCustomTypeWithFallback(type))
1619 return ::mlir::failure();
1620 arr_refRawType = type;
1621 }
1622 if (parser.parseComma())
1623 return ::mlir::failure();
1624
1625 {
1626 ::mlir::Type type;
1627 if (parser.parseCustomTypeWithFallback(type))
1628 return ::mlir::failure();
1629 rvalueRawType = type;
1630 }
1631 {
1632 auto loc = parser.getCurrentLocation();(void)loc;
1633 if (parser.parseOptionalAttrDict(result.attributes))
1634 return ::mlir::failure();
1635 }
1636 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1637 if (parser.resolveOperands(arr_refOperands, arr_refTypes, arr_refOperandsLoc, result.operands))
1638 return ::mlir::failure();
1639 if (parser.resolveOperands(indicesOperands, odsBuildableType0, indicesOperandsLoc, result.operands))
1640 return ::mlir::failure();
1641 if (parser.resolveOperands(rvalueOperands, rvalueTypes, rvalueOperandsLoc, result.operands))
1642 return ::mlir::failure();
1643 return ::mlir::success();
1644}
1645
1646void WriteArrayOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1647 _odsPrinter << ' ';
1648 _odsPrinter << getArrRef();
1649 _odsPrinter << "[";
1650 _odsPrinter << getIndices();
1651 _odsPrinter << "]";
1652 _odsPrinter << ' ' << "=";
1653 _odsPrinter << ' ';
1654 _odsPrinter << getRvalue();
1655 _odsPrinter << ' ' << ":";
1656 _odsPrinter << ' ';
1657 {
1658 auto type = getArrRef().getType();
1659 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
1660 _odsPrinter.printStrippedAttrOrType(validType);
1661 else
1662 _odsPrinter << type;
1663 }
1664 _odsPrinter << ",";
1665 _odsPrinter << ' ';
1666 {
1667 auto type = getRvalue().getType();
1668 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1669 _odsPrinter.printStrippedAttrOrType(validType);
1670 else
1671 _odsPrinter << type;
1672 }
1673 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1674 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1675}
1676
1678bool WriteArrayOp::canRewire(const ::mlir::DestructurableMemorySlot &slot,
1679 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
1680 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
1681 const ::mlir::DataLayout &dataLayout) {
1682 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1683 .canRewire(slot, usedIndices, mustBeSafelyUsed, dataLayout);
1684}
1685
1687::mlir::DeletionKind WriteArrayOp::rewire(const ::mlir::DestructurableMemorySlot &slot,
1688 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
1689 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout) {
1690 return ::llvm::cast<ArrayAccessOpInterface>(getOperation())
1691 .rewire(slot, subslots, builder, dataLayout);
1692}
1693
1695bool WriteArrayOp::loadsFrom(const ::mlir::MemorySlot &slot) {
1696 return false;
1697}
1698
1700bool WriteArrayOp::storesTo(const ::mlir::MemorySlot &slot) {
1701 return getArrRef() == slot.ptr;
1702}
1703
1705::mlir::Value WriteArrayOp::getStored(const ::mlir::MemorySlot &, ::mlir::OpBuilder &,
1706 ::mlir::Value, const ::mlir::DataLayout &) {
1707 return getRvalue();
1708}
1709
1712 return false;
1713}
1714} // namespace array
1715} // namespace llzk
1716MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::array::WriteArrayOp)
1717
1718
1719#endif // GET_OP_CLASSES
1720
MlirStringRef name
Definition Poly.cpp:48
::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
static void printInferredArrayType(::mlir::OpAsmPrinter &printer, CreateArrayOp, ::mlir::TypeRange, ::mlir::OperandRange, ::mlir::Type)
Definition Ops.cpp:94
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::ParseResult parseInferredArrayType(::mlir::OpAsmParser &parser, ::llvm::SmallVector<::mlir::Type, 1 > &elementsTypes, ::mlir::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand > elements, ::mlir::Type resultType)
Definition Ops.cpp:81
::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:100
::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:765
ExtractArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:523
ExtractArrayOpAdaptor(ExtractArrayOp op)
Definition Ops.cpp.inc:763
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:605
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
Definition Ops.cpp.inc:793
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:880
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:787
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:964
ExtractArrayOpAdaptor Adaptor
Definition Ops.h.inc:568
::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:848
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:876
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:932
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:769
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:591
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:587
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:581
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1000
InsertArrayOpAdaptor(InsertArrayOp op)
Definition Ops.cpp.inc:998
InsertArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:679
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:751
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1050
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1178
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1075
::llvm::LogicalResult verify()
Definition Ops.cpp:433
::mlir::TypedValue<::llzk::array::ArrayType > getRvalue()
Definition Ops.h.inc:755
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:741
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1081
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1146
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:747
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1004
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
Definition Ops.cpp.inc:1028
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1022
ReadArrayOpAdaptor(ReadArrayOp op)
Definition Ops.cpp.inc:1212
ReadArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:833
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1214
::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:1456
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1297
::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:1438
::mlir::TypedValue<::mlir::Type > getResult()
Definition Ops.h.inc:921
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:897
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1451
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:901
::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:1446
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1333
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1462
::llvm::LogicalResult verify()
Definition Ops.cpp:313
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arr_ref, ::mlir::ValueRange indices)
Definition Ops.cpp.inc:1242
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1388
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:915
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:891
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:1429
ReadArrayOpAdaptor Adaptor
Definition Ops.h.inc:878
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1218
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1327
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1236
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1498
WriteArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:997
WriteArrayOpAdaptor(WriteArrayOp op)
Definition Ops.cpp.inc:1496
::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:1687
bool isRead()
Return true if the op is a read, false if it's a write.
Definition Ops.cpp.inc:1711
bool loadsFrom(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1695
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1575
::llvm::LogicalResult verify()
Definition Ops.cpp:352
::mlir::Operation::operand_range getIndices()
Definition Ops.h.inc:1069
::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:1705
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1646
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:1678
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1548
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1581
bool storesTo(const ::mlir::MemorySlot &slot)
Required by PromotableMemOpInterface / mem2reg pass.
Definition Ops.cpp.inc:1700
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arr_ref, ::mlir::ValueRange indices, ::mlir::Value rvalue)
Definition Ops.cpp.inc:1526
::mlir::MutableOperandRange getIndicesMutable()
Definition Ops.cpp.inc:1520
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:1059
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Definition Ops.h.inc:1065
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1502
::mlir::TypedValue<::mlir::Type > getRvalue()
Definition Ops.h.inc:1073
::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:744
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:979
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1193
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1477
bool isValidArrayElemType(Type type)
mlir::ParseResult parseAttrDictWithWarnings(mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
Definition OpHelpers.h:122
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:115
void printAttrDictWithWarnings(mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
Definition OpHelpers.h:129
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:107