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
15#endif // GET_OP_LIST
16
17#ifdef GET_OP_CLASSES
18#undef GET_OP_CLASSES
19
20
21//===----------------------------------------------------------------------===//
22// Local Utility Method Definitions
23//===----------------------------------------------------------------------===//
24
25namespace llzk {
26namespace constrain {
27
28static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
29 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
30 unsigned valueIndex) {
31 if (!((::llvm::isa<::llzk::array::ArrayType>(type)))) {
32 return op->emitOpError(valueKind) << " #" << valueIndex
33 << " must be n-dimensional array, but got " << type;
34 }
35 return ::mlir::success();
36}
37
38static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
39 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
40 unsigned valueIndex) {
41 if (!((::llzk::isValidType(type)))) {
42 return op->emitOpError(valueKind) << " #" << valueIndex
43 << " must be a valid LLZK type, but got " << type;
44 }
45 return ::mlir::success();
46}
47
48static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
49 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
50 unsigned valueIndex) {
51 if (!((::llzk::isValidEmitEqType(type)))) {
52 return op->emitOpError(valueKind) << " #" << valueIndex
53 << " must be any LLZK type, excluding non-Signal struct and string types, but got " << type;
54 }
55 return ::mlir::success();
56}
57} // namespace constrain
58} // namespace llzk
59namespace llzk {
60namespace constrain {
61
62//===----------------------------------------------------------------------===//
63// ::llzk::constrain::EmitContainmentOp definitions
64//===----------------------------------------------------------------------===//
65
66namespace detail {
67} // namespace detail
69
70::llvm::LogicalResult EmitContainmentOpAdaptor::verify(::mlir::Location loc) {
71 return ::mlir::success();
72}
73
74void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
75 odsState.addOperands(lhs);
76 odsState.addOperands(rhs);
77}
78
79void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
80 odsState.addOperands(lhs);
81 odsState.addOperands(rhs);
82 assert(resultTypes.size() == 0u && "mismatched number of results");
83 odsState.addTypes(resultTypes);
84}
85
86void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
87 assert(operands.size() == 2u && "mismatched number of parameters");
88 odsState.addOperands(operands);
89 odsState.addAttributes(attributes);
90 assert(resultTypes.size() == 0u && "mismatched number of return types");
91 odsState.addTypes(resultTypes);
92}
93
95 {
96 unsigned index = 0; (void)index;
97 auto valueGroup0 = getODSOperands(0);
98
99 for (auto v : valueGroup0) {
100 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
101 return ::mlir::failure();
102 }
103 auto valueGroup1 = getODSOperands(1);
104
105 for (auto v : valueGroup1) {
106 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
107 return ::mlir::failure();
108 }
109 }
110 return ::mlir::success();
111}
112
113::llvm::LogicalResult EmitContainmentOp::verifyInvariants() {
114 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
115 return ::mlir::success();
116 return ::mlir::failure();
117}
118
119::mlir::ParseResult EmitContainmentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
120 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
121 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
122 (void)lhsOperandsLoc;
123 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
124 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
125 (void)rhsOperandsLoc;
126 ::mlir::Type lhsRawType{};
127 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
128 ::mlir::Type rhsRawType{};
129 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
130
131 lhsOperandsLoc = parser.getCurrentLocation();
132 if (parser.parseOperand(lhsRawOperand))
133 return ::mlir::failure();
134 if (parser.parseComma())
135 return ::mlir::failure();
136
137 rhsOperandsLoc = parser.getCurrentLocation();
138 if (parser.parseOperand(rhsRawOperand))
139 return ::mlir::failure();
140 if (parser.parseColon())
141 return ::mlir::failure();
142
143 {
145 if (parser.parseCustomTypeWithFallback(type))
146 return ::mlir::failure();
147 lhsRawType = type;
148 }
149 if (parser.parseComma())
150 return ::mlir::failure();
151
152 {
153 ::mlir::Type type;
154 if (parser.parseCustomTypeWithFallback(type))
155 return ::mlir::failure();
156 rhsRawType = type;
157 }
158 {
159 auto loc = parser.getCurrentLocation();(void)loc;
160 if (parser.parseOptionalAttrDict(result.attributes))
161 return ::mlir::failure();
162 }
163 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
164 return ::mlir::failure();
165 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
166 return ::mlir::failure();
167 return ::mlir::success();
168}
169
170void EmitContainmentOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
171 _odsPrinter << ' ';
172 _odsPrinter << getLhs();
173 _odsPrinter << ",";
174 _odsPrinter << ' ';
175 _odsPrinter << getRhs();
176 _odsPrinter << ' ' << ":";
177 _odsPrinter << ' ';
178 {
179 auto type = getLhs().getType();
180 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
181 _odsPrinter.printStrippedAttrOrType(validType);
182 else
183 _odsPrinter << type;
184 }
185 _odsPrinter << ",";
186 _odsPrinter << ' ';
187 {
188 auto type = getRhs().getType();
189 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
190 _odsPrinter.printStrippedAttrOrType(validType);
191 else
192 _odsPrinter << type;
193 }
194 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
195 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
196}
197
198} // namespace constrain
199} // namespace llzk
200MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitContainmentOp)
201
202namespace llzk {
203namespace constrain {
204
205//===----------------------------------------------------------------------===//
206// ::llzk::constrain::EmitEqualityOp definitions
207//===----------------------------------------------------------------------===//
208
209namespace detail {
210} // namespace detail
212
213::llvm::LogicalResult EmitEqualityOpAdaptor::verify(::mlir::Location loc) {
214 return ::mlir::success();
215}
216
217void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
218 odsState.addOperands(lhs);
219 odsState.addOperands(rhs);
220}
221
222void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
223 odsState.addOperands(lhs);
224 odsState.addOperands(rhs);
225 assert(resultTypes.size() == 0u && "mismatched number of results");
226 odsState.addTypes(resultTypes);
227}
228
229void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
230 assert(operands.size() == 2u && "mismatched number of parameters");
231 odsState.addOperands(operands);
232 odsState.addAttributes(attributes);
233 assert(resultTypes.size() == 0u && "mismatched number of return types");
234 odsState.addTypes(resultTypes);
235}
236
238 {
239 unsigned index = 0; (void)index;
240 auto valueGroup0 = getODSOperands(0);
241
242 for (auto v : valueGroup0) {
243 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
244 return ::mlir::failure();
245 }
246 auto valueGroup1 = getODSOperands(1);
247
248 for (auto v : valueGroup1) {
249 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
250 return ::mlir::failure();
251 }
252 }
253 if (!((::llzk::typesUnify((*this->getODSOperands(0).begin()).getType(), (*this->getODSOperands(1).begin()).getType()))))
254 return emitOpError("failed to verify that rhs type matches with lhs type");
255 return ::mlir::success();
256}
257
258::llvm::LogicalResult EmitEqualityOp::verifyInvariants() {
259 return verifyInvariantsImpl();
260}
261
262::mlir::ParseResult EmitEqualityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
263 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
264 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
265 (void)lhsOperandsLoc;
266 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
267 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
268 (void)rhsOperandsLoc;
269 ::mlir::Type lhsRawType{};
270 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
271 ::mlir::Type rhsRawType{};
272 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
273
274 lhsOperandsLoc = parser.getCurrentLocation();
275 if (parser.parseOperand(lhsRawOperand))
276 return ::mlir::failure();
277 if (parser.parseComma())
278 return ::mlir::failure();
279
280 rhsOperandsLoc = parser.getCurrentLocation();
281 if (parser.parseOperand(rhsRawOperand))
282 return ::mlir::failure();
283 if (parser.parseColon())
284 return ::mlir::failure();
285
286 {
287 ::mlir::Type type;
288 if (parser.parseCustomTypeWithFallback(type))
289 return ::mlir::failure();
290 lhsRawType = type;
291 }
292 {
293 auto odsResult = parseInferredOrParsedType(parser, rhsRawType, lhsRawType);
294 if (odsResult) return ::mlir::failure();
295 }
296 {
297 auto loc = parser.getCurrentLocation();(void)loc;
298 if (parser.parseOptionalAttrDict(result.attributes))
299 return ::mlir::failure();
300 }
301 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
302 return ::mlir::failure();
303 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
304 return ::mlir::failure();
305 return ::mlir::success();
306}
307
308void EmitEqualityOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
309 _odsPrinter << ' ';
310 _odsPrinter << getLhs();
311 _odsPrinter << ",";
312 _odsPrinter << ' ';
313 _odsPrinter << getRhs();
314 _odsPrinter << ' ' << ":";
315 _odsPrinter << ' ';
316 {
317 auto type = getLhs().getType();
318 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
319 _odsPrinter.printStrippedAttrOrType(validType);
320 else
321 _odsPrinter << type;
322 }
323 printInferredOrParsedType(_odsPrinter, *this, getRhs().getType(), getLhs().getType());
324 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
325 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
326}
327
328} // namespace constrain
329} // namespace llzk
330MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitEqualityOp)
331
332
333#endif // GET_OP_CLASSES
334
EmitContainmentOpAdaptor(EmitContainmentOp op)
Definition Ops.cpp.inc:68
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:70
EmitContainmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:94
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:113
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:74
::llvm::LogicalResult verify()
Definition Ops.cpp:50
::mlir::TypedValue<::mlir::Type > getRhs()
Definition Ops.h.inc:130
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:120
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:170
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
Definition Ops.h.inc:126
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:119
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:213
EmitEqualityOpAdaptor(EmitEqualityOp op)
Definition Ops.cpp.inc:211
EmitEqualityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:205
static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer, ::mlir::Operation *op, ::mlir::Type rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:328
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:262
::mlir::TypedValue<::mlir::Type > getLhs()
Definition Ops.h.inc:272
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:266
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:308
::mlir::ParseResult parseInferredOrParsedType(::mlir::OpAsmParser &parser, ::mlir::Type &rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:311
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:258
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:217
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:237
::mlir::TypedValue<::mlir::Type > getRhs()
Definition Ops.h.inc:276
bool isValidEmitEqType(Type type)
bool isValidType(Type type)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)