26static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
27 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
28 unsigned valueIndex) {
29 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
30 return op->emitOpError(valueKind) <<
" #" << valueIndex
31 <<
" must be index, but got " << type;
33 return ::mlir::success();
36static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
37 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
38 unsigned valueIndex) {
39 if (!((::llvm::isa<::llzk::felt::FeltType>(type)))) {
40 return op->emitOpError(valueKind) <<
" #" << valueIndex
41 <<
" must be finite field element, but got " << type;
43 return ::mlir::success();
61 return ::mlir::success();
65 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
67 emitError() <<
"expected DictionaryAttr to set properties";
68 return ::mlir::failure();
70 return ::mlir::success();
74 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
75 ::mlir::Builder odsBuilder{ctx};
78 return odsBuilder.getDictionaryAttr(attrs);
83 using llvm::hash_value;
84 return llvm::hash_combine();
97::llvm::LogicalResult
LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
98 return ::mlir::success();
101void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value addr) {
102 odsState.addOperands(addr);
103 odsState.addTypes(val);
106LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, ::mlir::Value addr) {
108 build(builder, __state__, std::forward<
decltype(val)>(val), std::forward<
decltype(addr)>(addr));
109 auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
110 assert(__res__ &&
"builder didn't return the right type");
115 return create(builder, builder.getLoc(), std::forward<
decltype(val)>(val), std::forward<
decltype(addr)>(addr));
118void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr) {
119 odsState.addOperands(addr);
120 assert(resultTypes.size() == 1u &&
"mismatched number of results");
121 odsState.addTypes(resultTypes);
124LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value addr) {
126 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(addr)>(addr));
127 auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
128 assert(__res__ &&
"builder didn't return the right type");
132LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value addr) {
133 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(addr)>(addr));
136void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
137 assert(operands.size() == 1u &&
"mismatched number of parameters");
138 odsState.addOperands(operands);
139 odsState.addAttributes(attributes);
140 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
141 odsState.addTypes(resultTypes);
144LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
146 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
147 auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
148 assert(__res__ &&
"builder didn't return the right type");
152LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
153 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
156void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
157 assert(operands.size() == 1u &&
"mismatched number of parameters");
158 odsState.addOperands(operands);
159 odsState.useProperties(
const_cast<Properties&
>(properties));
160 odsState.addAttributes(discardableAttributes);
161 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
162 odsState.addTypes(resultTypes);
165LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
167 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
168 auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
169 assert(__res__ &&
"builder didn't return the right type");
173LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
174 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
179 unsigned index = 0; (void)index;
182 for (
auto v : valueGroup0) {
183 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
184 return ::mlir::failure();
188 unsigned index = 0; (void)index;
191 for (
auto v : valueGroup0) {
192 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"result", index++)))
193 return ::mlir::failure();
196 return ::mlir::success();
203::mlir::ParseResult
LoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
204 ::mlir::OpAsmParser::UnresolvedOperand addrRawOperand{};
205 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(&addrRawOperand, 1); ::llvm::SMLoc addrOperandsLoc;
206 (void)addrOperandsLoc;
207 ::mlir::Type valRawType{};
208 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
210 addrOperandsLoc = parser.getCurrentLocation();
211 if (parser.parseOperand(addrRawOperand))
212 return ::mlir::failure();
213 if (parser.parseColon())
214 return ::mlir::failure();
218 if (parser.parseCustomTypeWithFallback(type))
219 return ::mlir::failure();
223 auto loc = parser.getCurrentLocation();(void)loc;
224 if (parser.parseOptionalAttrDict(result.attributes))
225 return ::mlir::failure();
227 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
229 return ::mlir::failure();
231 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
232 result.addTypes(valTypes);
233 if (parser.resolveOperands(addrOperands, odsBuildableType0, addrOperandsLoc, result.operands))
234 return ::mlir::failure();
235 return ::mlir::success();
241 _odsPrinter <<
' ' <<
":";
244 auto type =
getVal().getType();
245 if (
auto validType = ::llvm::dyn_cast<::llzk::felt::FeltType>(type))
246 _odsPrinter.printStrippedAttrOrType(validType);
250 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
251 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
254void LoadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
255 effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0,
false, ::mlir::SideEffects::DefaultResource::get());
278 return ::mlir::success();
282 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
284 emitError() <<
"expected DictionaryAttr to set properties";
285 return ::mlir::failure();
287 return ::mlir::success();
291 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
292 ::mlir::Builder odsBuilder{ctx};
295 return odsBuilder.getDictionaryAttr(attrs);
300 using llvm::hash_value;
301 return llvm::hash_combine();
314::llvm::LogicalResult
StoreOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
315 return ::mlir::success();
318void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value val) {
319 odsState.addOperands(addr);
320 odsState.addOperands(val);
325 build(builder, __state__, std::forward<
decltype(addr)>(addr), std::forward<
decltype(val)>(val));
326 auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
327 assert(__res__ &&
"builder didn't return the right type");
332 return create(builder, builder.getLoc(), std::forward<
decltype(addr)>(addr), std::forward<
decltype(val)>(val));
335void StoreOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value val) {
336 odsState.addOperands(addr);
337 odsState.addOperands(val);
338 assert(resultTypes.size() == 0u &&
"mismatched number of results");
339 odsState.addTypes(resultTypes);
342StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value val) {
344 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(addr)>(addr), std::forward<
decltype(val)>(val));
345 auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
346 assert(__res__ &&
"builder didn't return the right type");
350StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value val) {
351 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(addr)>(addr), std::forward<
decltype(val)>(val));
354void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
355 assert(operands.size() == 2u &&
"mismatched number of parameters");
356 odsState.addOperands(operands);
357 odsState.addAttributes(attributes);
358 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
359 odsState.addTypes(resultTypes);
362StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
364 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
365 auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
366 assert(__res__ &&
"builder didn't return the right type");
370StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
371 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
374void StoreOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
375 assert(operands.size() == 2u &&
"mismatched number of parameters");
376 odsState.addOperands(operands);
377 odsState.useProperties(
const_cast<Properties&
>(properties));
378 odsState.addAttributes(discardableAttributes);
379 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
380 odsState.addTypes(resultTypes);
383StoreOp StoreOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
385 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
386 auto __res__ = ::llvm::dyn_cast<StoreOp>(builder.create(__state__));
387 assert(__res__ &&
"builder didn't return the right type");
391StoreOp StoreOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
392 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
397 unsigned index = 0; (void)index;
400 for (
auto v : valueGroup0) {
401 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
402 return ::mlir::failure();
406 for (
auto v : valueGroup1) {
407 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
408 return ::mlir::failure();
411 return ::mlir::success();
418::mlir::ParseResult
StoreOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
419 ::mlir::OpAsmParser::UnresolvedOperand addrRawOperand{};
420 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> addrOperands(&addrRawOperand, 1); ::llvm::SMLoc addrOperandsLoc;
421 (void)addrOperandsLoc;
422 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
423 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
424 (void)valOperandsLoc;
425 ::mlir::Type valRawType{};
426 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
428 addrOperandsLoc = parser.getCurrentLocation();
429 if (parser.parseOperand(addrRawOperand))
430 return ::mlir::failure();
431 if (parser.parseComma())
432 return ::mlir::failure();
434 valOperandsLoc = parser.getCurrentLocation();
435 if (parser.parseOperand(valRawOperand))
436 return ::mlir::failure();
437 if (parser.parseColon())
438 return ::mlir::failure();
442 if (parser.parseCustomTypeWithFallback(type))
443 return ::mlir::failure();
447 auto loc = parser.getCurrentLocation();(void)loc;
448 if (parser.parseOptionalAttrDict(result.attributes))
449 return ::mlir::failure();
451 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
453 return ::mlir::failure();
455 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
456 if (parser.resolveOperands(addrOperands, odsBuildableType0, addrOperandsLoc, result.operands))
457 return ::mlir::failure();
458 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
459 return ::mlir::failure();
460 return ::mlir::success();
469 _odsPrinter <<
' ' <<
":";
472 auto type =
getVal().getType();
473 if (
auto validType = ::llvm::dyn_cast<::llzk::felt::FeltType>(type))
474 _odsPrinter.printStrippedAttrOrType(validType);
478 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
479 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
482void StoreOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
483 effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0,
false, ::mlir::SideEffects::DefaultResource::get());
LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
static llvm::hash_code computePropertiesHash(const Properties &prop)
static LoadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, ::mlir::Value addr)
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verifyInvariantsImpl()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
void print(::mlir::OpAsmPrinter &_odsPrinter)
static constexpr ::llvm::StringLiteral getOperationName()
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
FoldAdaptor::Properties Properties
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::llzk::felt::FeltType > getVal()
::mlir::TypedValue<::mlir::IndexType > getAddr()
::mlir::Operation::operand_range getODSOperands(unsigned index)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value addr)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult verify(::mlir::Location loc)
StoreOpAdaptor(StoreOp op)
StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value val)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::llzk::felt::FeltType > getVal()
static constexpr ::llvm::StringLiteral getOperationName()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Operation::operand_range getODSOperands(unsigned index)
static StoreOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value addr, ::mlir::Value val)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::TypedValue<::mlir::IndexType > getAddr()
::llvm::LogicalResult verifyInvariants()
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
FoldAdaptor::Properties Properties
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult verifyInvariantsImpl()
LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
const Properties & getProperties()
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
const Properties & getProperties()
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...