LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#ifdef GET_OP_LIST
11#undef GET_OP_LIST
12
14#endif // GET_OP_LIST
15
16#ifdef GET_OP_CLASSES
17#undef GET_OP_CLASSES
18
19
20//===----------------------------------------------------------------------===//
21// Local Utility Method Definitions
22//===----------------------------------------------------------------------===//
23
24
25static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
26 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
27 unsigned valueIndex) {
28 if (!((::llzk::isValidType(type)))) {
29 return op->emitOpError(valueKind) << " #" << valueIndex
30 << " must be a valid LLZK type, but got " << type;
31 }
32 return ::mlir::success();
33}
34namespace llzk {
35
36
37//===----------------------------------------------------------------------===//
38// ::llzk::NonDetOp definitions
39//===----------------------------------------------------------------------===//
40
41namespace detail {
42
43NonDetOpGenericAdaptorBase::NonDetOpGenericAdaptorBase(NonDetOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
44
45
46} // namespace detail
48
49::llvm::LogicalResult NonDetOpAdaptor::verify(::mlir::Location loc) {
50 return ::mlir::success();
51}
52
53::llvm::LogicalResult NonDetOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
54 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
55 if (!dict) {
56 emitError() << "expected DictionaryAttr to set properties";
57 return ::mlir::failure();
58 }
59 return ::mlir::success();
60}
61
62::mlir::Attribute NonDetOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
63 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
64 ::mlir::Builder odsBuilder{ctx};
65
66 if (!attrs.empty())
67 return odsBuilder.getDictionaryAttr(attrs);
68 return {};
69}
70
71llvm::hash_code NonDetOp::computePropertiesHash(const Properties &prop) {
72 using llvm::hash_value;
73 return llvm::hash_combine();
74}
75
76std::optional<mlir::Attribute> NonDetOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
77 return std::nullopt;
78}
79
80void NonDetOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
81}
82
83void NonDetOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
84}
85
86::llvm::LogicalResult NonDetOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
87 return ::mlir::success();
88}
89
90void NonDetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
91 odsState.addTypes(res);
92}
93
94NonDetOp NonDetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res) {
95 ::mlir::OperationState __state__(location, getOperationName());
96 build(builder, __state__, std::forward<decltype(res)>(res));
97 auto __res__ = ::llvm::dyn_cast<NonDetOp>(builder.create(__state__));
98 assert(__res__ && "builder didn't return the right type");
99 return __res__;
100}
101
102NonDetOp NonDetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type res) {
103 return create(builder, builder.getLoc(), std::forward<decltype(res)>(res));
104}
105
106void NonDetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
107 assert(resultTypes.size() == 1u && "mismatched number of results");
108 odsState.addTypes(resultTypes);
109}
110
111NonDetOp NonDetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
112 ::mlir::OperationState __state__(location, getOperationName());
113 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
114 auto __res__ = ::llvm::dyn_cast<NonDetOp>(builder.create(__state__));
115 assert(__res__ && "builder didn't return the right type");
116 return __res__;
117}
118
119NonDetOp NonDetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
120 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
121}
122
123void NonDetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
124 assert(operands.size() == 0u && "mismatched number of parameters");
125 odsState.addOperands(operands);
126 odsState.addAttributes(attributes);
127 assert(resultTypes.size() == 1u && "mismatched number of return types");
128 odsState.addTypes(resultTypes);
129}
130
131NonDetOp NonDetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
132 ::mlir::OperationState __state__(location, getOperationName());
133 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
134 auto __res__ = ::llvm::dyn_cast<NonDetOp>(builder.create(__state__));
135 assert(__res__ && "builder didn't return the right type");
136 return __res__;
137}
138
139NonDetOp NonDetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
140 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
141}
142
143void NonDetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
144 assert(operands.size() == 0u && "mismatched number of parameters");
145 odsState.addOperands(operands);
146 odsState.useProperties(const_cast<Properties&>(properties));
147 odsState.addAttributes(discardableAttributes);
148 assert(resultTypes.size() == 1u && "mismatched number of return types");
149 odsState.addTypes(resultTypes);
150}
151
152NonDetOp NonDetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
153 ::mlir::OperationState __state__(location, getOperationName());
154 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
155 auto __res__ = ::llvm::dyn_cast<NonDetOp>(builder.create(__state__));
156 assert(__res__ && "builder didn't return the right type");
157 return __res__;
158}
159
160NonDetOp NonDetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
161 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));
162}
163
164::llvm::LogicalResult NonDetOp::verifyInvariantsImpl() {
165 {
166 unsigned index = 0; (void)index;
167 auto valueGroup0 = getODSResults(0);
168
169 for (auto v : valueGroup0) {
170 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
171 return ::mlir::failure();
172 }
173 }
174 return ::mlir::success();
175}
176
177::llvm::LogicalResult NonDetOp::verifyInvariants() {
178 return verifyInvariantsImpl();
179}
180
181::mlir::ParseResult NonDetOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
182 ::mlir::Type resRawType{};
183 ::llvm::ArrayRef<::mlir::Type> resTypes(&resRawType, 1);
184 if (parser.parseColon())
185 return ::mlir::failure();
186
187 {
188 ::mlir::Type type;
189 if (parser.parseCustomTypeWithFallback(type))
190 return ::mlir::failure();
191 resRawType = type;
192 }
193 {
194 auto loc = parser.getCurrentLocation();(void)loc;
195 if (parser.parseOptionalAttrDict(result.attributes))
196 return ::mlir::failure();
197 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
198 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
199 })))
200 return ::mlir::failure();
201 }
202 result.addTypes(resTypes);
203 return ::mlir::success();
204}
205
206void NonDetOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
207 _odsPrinter << ' ' << ":";
208 _odsPrinter << ' ';
209 {
210 auto type = getRes().getType();
211 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
212 _odsPrinter.printStrippedAttrOrType(validType);
213 else
214 _odsPrinter << type;
215 }
216 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
217 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
218}
219
220
221} // namespace llzk
222MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::NonDetOp)
223
224
225#endif // GET_OP_CLASSES
226
NonDetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:111
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:49
NonDetOpAdaptor(NonDetOp op)
Definition Ops.cpp.inc:47
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:53
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:180
::mlir::TypedValue<::mlir::Type > getRes()
Definition Ops.h.inc:186
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:86
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:164
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:71
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:62
static NonDetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type res)
Definition Ops.cpp.inc:94
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:206
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:83
FoldAdaptor::Properties Properties
Definition Ops.h.inc:154
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:76
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:162
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res)
Definition Ops.cpp.inc:90
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:177
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:80
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:181
::mlir::DictionaryAttr odsAttrs
Definition Ops.h.inc:80
NonDetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:85
const Properties & getProperties()
Definition Ops.h.inc:95
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:81
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
bool isValidType(Type type)