/home/arjun/llvm-project/build/tools/mlir/include/mlir/Dialect/StandardOps/IR/Ops.cpp.inc
Line | Count | Source (jump to first uncovered line) |
1 | | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | | |* *| |
3 | | |* Op Definitions *| |
4 | | |* *| |
5 | | |* Automatically generated file, do not edit! *| |
6 | | |* *| |
7 | | \*===----------------------------------------------------------------------===*/ |
8 | | |
9 | | #ifdef GET_OP_LIST |
10 | | #undef GET_OP_LIST |
11 | | |
12 | | AbsFOp, |
13 | | AddCFOp, |
14 | | AddFOp, |
15 | | AddIOp, |
16 | | AllocOp, |
17 | | AllocaOp, |
18 | | AndOp, |
19 | | AssumeAlignmentOp, |
20 | | AtomicRMWOp, |
21 | | AtomicYieldOp, |
22 | | BranchOp, |
23 | | CallIndirectOp, |
24 | | CallOp, |
25 | | CeilFOp, |
26 | | CmpFOp, |
27 | | CmpIOp, |
28 | | CondBranchOp, |
29 | | ConstantOp, |
30 | | CopySignOp, |
31 | | CosOp, |
32 | | CreateComplexOp, |
33 | | DeallocOp, |
34 | | DimOp, |
35 | | DivFOp, |
36 | | Exp2Op, |
37 | | ExpOp, |
38 | | ExtractElementOp, |
39 | | FPExtOp, |
40 | | FPToSIOp, |
41 | | FPTruncOp, |
42 | | GenericAtomicRMWOp, |
43 | | ImOp, |
44 | | IndexCastOp, |
45 | | LoadOp, |
46 | | Log10Op, |
47 | | Log2Op, |
48 | | LogOp, |
49 | | MemRefCastOp, |
50 | | MulFOp, |
51 | | MulIOp, |
52 | | NegFOp, |
53 | | OrOp, |
54 | | PrefetchOp, |
55 | | RankOp, |
56 | | ReOp, |
57 | | RemFOp, |
58 | | ReturnOp, |
59 | | RsqrtOp, |
60 | | SIToFPOp, |
61 | | SelectOp, |
62 | | ShiftLeftOp, |
63 | | SignExtendIOp, |
64 | | SignedDivIOp, |
65 | | SignedRemIOp, |
66 | | SignedShiftRightOp, |
67 | | SinOp, |
68 | | SplatOp, |
69 | | SqrtOp, |
70 | | StoreOp, |
71 | | SubCFOp, |
72 | | SubFOp, |
73 | | SubIOp, |
74 | | SubViewOp, |
75 | | TanhOp, |
76 | | TensorCastOp, |
77 | | TensorFromElementsOp, |
78 | | TensorLoadOp, |
79 | | TensorStoreOp, |
80 | | TruncateIOp, |
81 | | UnsignedDivIOp, |
82 | | UnsignedRemIOp, |
83 | | UnsignedShiftRightOp, |
84 | | ViewOp, |
85 | | XOrOp, |
86 | | ZeroExtendIOp |
87 | | #endif // GET_OP_LIST |
88 | | |
89 | | #ifdef GET_OP_CLASSES |
90 | | #undef GET_OP_CLASSES |
91 | | |
92 | | |
93 | | //===----------------------------------------------------------------------===// |
94 | | // AbsFOp definitions |
95 | | //===----------------------------------------------------------------------===// |
96 | | |
97 | 0 | AbsFOpOperandAdaptor::AbsFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
98 | 0 |
|
99 | 0 | } |
100 | | |
101 | 0 | AbsFOpOperandAdaptor::AbsFOpOperandAdaptor(AbsFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
102 | 0 |
|
103 | 0 | } |
104 | | |
105 | 0 | std::pair<unsigned, unsigned> AbsFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
106 | 0 | return {index, 1}; |
107 | 0 | } |
108 | | |
109 | 0 | ValueRange AbsFOpOperandAdaptor::getODSOperands(unsigned index) { |
110 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
111 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
112 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
113 | 0 | } |
114 | | |
115 | 0 | Value AbsFOpOperandAdaptor::operand() { |
116 | 0 | return *getODSOperands(0).begin(); |
117 | 0 | } |
118 | | |
119 | 0 | StringRef AbsFOp::getOperationName() { |
120 | 0 | return "std.absf"; |
121 | 0 | } |
122 | | |
123 | 0 | std::pair<unsigned, unsigned> AbsFOp::getODSOperandIndexAndLength(unsigned index) { |
124 | 0 | return {index, 1}; |
125 | 0 | } |
126 | | |
127 | 0 | Operation::operand_range AbsFOp::getODSOperands(unsigned index) { |
128 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
129 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
130 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
131 | 0 | } |
132 | | |
133 | 0 | Value AbsFOp::operand() { |
134 | 0 | return *getODSOperands(0).begin(); |
135 | 0 | } |
136 | | |
137 | 0 | ::mlir::MutableOperandRange AbsFOp::operandMutable() { |
138 | 0 | auto range = getODSOperandIndexAndLength(0); |
139 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
140 | 0 | } |
141 | | |
142 | 0 | std::pair<unsigned, unsigned> AbsFOp::getODSResultIndexAndLength(unsigned index) { |
143 | 0 | return {index, 1}; |
144 | 0 | } |
145 | | |
146 | 0 | Operation::result_range AbsFOp::getODSResults(unsigned index) { |
147 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
148 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
149 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
150 | 0 | } |
151 | | |
152 | 0 | void AbsFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
153 | 0 | odsState.addOperands(operand); |
154 | 0 | odsState.addTypes(resultType0); |
155 | 0 | } |
156 | | |
157 | 0 | void AbsFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
158 | 0 | odsState.addOperands(operand); |
159 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
160 | 0 | odsState.addTypes(resultTypes); |
161 | 0 | } |
162 | | |
163 | 0 | void AbsFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
164 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
165 | 0 | odsState.addOperands(operands); |
166 | 0 | odsState.addAttributes(attributes); |
167 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
168 | 0 | odsState.addTypes(resultTypes); |
169 | 0 | } |
170 | | |
171 | 0 | void AbsFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
172 | 0 | odsState.addOperands(operand); |
173 | 0 | odsState.addTypes({operand.getType()}); |
174 | 0 |
|
175 | 0 | } |
176 | | |
177 | 0 | void AbsFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
178 | 0 | odsState.addOperands(operands); |
179 | 0 | odsState.addAttributes(attributes); |
180 | 0 | odsState.addTypes({operands[0].getType()}); |
181 | 0 |
|
182 | 0 | } |
183 | | |
184 | 0 | ParseResult AbsFOp::parse(OpAsmParser &parser, OperationState &result) { |
185 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
186 | 0 | } |
187 | | |
188 | 0 | void AbsFOp::print(OpAsmPrinter &p) { |
189 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
190 | 0 | } |
191 | | |
192 | 0 | LogicalResult AbsFOp::verify() { |
193 | 0 | { |
194 | 0 | unsigned index = 0; (void)index; |
195 | 0 | auto valueGroup0 = getODSOperands(0); |
196 | 0 | for (Value v : valueGroup0) { |
197 | 0 | (void)v; |
198 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
199 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
200 | 0 | } |
201 | 0 | ++index; |
202 | 0 | } |
203 | 0 | } |
204 | 0 | { |
205 | 0 | unsigned index = 0; (void)index; |
206 | 0 | auto valueGroup0 = getODSResults(0); |
207 | 0 | for (Value v : valueGroup0) { |
208 | 0 | (void)v; |
209 | 0 | if (!((true))) { |
210 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
211 | 0 | } |
212 | 0 | ++index; |
213 | 0 | } |
214 | 0 | } |
215 | 0 | return mlir::success(); |
216 | 0 | } |
217 | | |
218 | 0 | void AbsFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
219 | 0 |
|
220 | 0 | } |
221 | | |
222 | | |
223 | | //===----------------------------------------------------------------------===// |
224 | | // AddCFOp definitions |
225 | | //===----------------------------------------------------------------------===// |
226 | | |
227 | 0 | AddCFOpOperandAdaptor::AddCFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
228 | 0 |
|
229 | 0 | } |
230 | | |
231 | 0 | AddCFOpOperandAdaptor::AddCFOpOperandAdaptor(AddCFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
232 | 0 |
|
233 | 0 | } |
234 | | |
235 | 0 | std::pair<unsigned, unsigned> AddCFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
236 | 0 | return {index, 1}; |
237 | 0 | } |
238 | | |
239 | 0 | ValueRange AddCFOpOperandAdaptor::getODSOperands(unsigned index) { |
240 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
241 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
242 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
243 | 0 | } |
244 | | |
245 | 0 | Value AddCFOpOperandAdaptor::lhs() { |
246 | 0 | return *getODSOperands(0).begin(); |
247 | 0 | } |
248 | | |
249 | 0 | Value AddCFOpOperandAdaptor::rhs() { |
250 | 0 | return *getODSOperands(1).begin(); |
251 | 0 | } |
252 | | |
253 | 0 | StringRef AddCFOp::getOperationName() { |
254 | 0 | return "std.addcf"; |
255 | 0 | } |
256 | | |
257 | 0 | std::pair<unsigned, unsigned> AddCFOp::getODSOperandIndexAndLength(unsigned index) { |
258 | 0 | return {index, 1}; |
259 | 0 | } |
260 | | |
261 | 0 | Operation::operand_range AddCFOp::getODSOperands(unsigned index) { |
262 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
263 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
264 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
265 | 0 | } |
266 | | |
267 | 0 | Value AddCFOp::lhs() { |
268 | 0 | return *getODSOperands(0).begin(); |
269 | 0 | } |
270 | | |
271 | 0 | Value AddCFOp::rhs() { |
272 | 0 | return *getODSOperands(1).begin(); |
273 | 0 | } |
274 | | |
275 | 0 | ::mlir::MutableOperandRange AddCFOp::lhsMutable() { |
276 | 0 | auto range = getODSOperandIndexAndLength(0); |
277 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
278 | 0 | } |
279 | | |
280 | 0 | ::mlir::MutableOperandRange AddCFOp::rhsMutable() { |
281 | 0 | auto range = getODSOperandIndexAndLength(1); |
282 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
283 | 0 | } |
284 | | |
285 | 0 | std::pair<unsigned, unsigned> AddCFOp::getODSResultIndexAndLength(unsigned index) { |
286 | 0 | return {index, 1}; |
287 | 0 | } |
288 | | |
289 | 0 | Operation::result_range AddCFOp::getODSResults(unsigned index) { |
290 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
291 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
292 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
293 | 0 | } |
294 | | |
295 | 0 | void AddCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
296 | 0 | odsState.addOperands(lhs); |
297 | 0 | odsState.addOperands(rhs); |
298 | 0 | odsState.addTypes(resultType0); |
299 | 0 | } |
300 | | |
301 | 0 | void AddCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
302 | 0 | odsState.addOperands(lhs); |
303 | 0 | odsState.addOperands(rhs); |
304 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
305 | 0 | odsState.addTypes(resultTypes); |
306 | 0 | } |
307 | | |
308 | 0 | void AddCFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
309 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
310 | 0 | odsState.addOperands(operands); |
311 | 0 | odsState.addAttributes(attributes); |
312 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
313 | 0 | odsState.addTypes(resultTypes); |
314 | 0 | } |
315 | | |
316 | 0 | void AddCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
317 | 0 | odsState.addOperands(lhs); |
318 | 0 | odsState.addOperands(rhs); |
319 | 0 | odsState.addTypes({lhs.getType()}); |
320 | 0 |
|
321 | 0 | } |
322 | | |
323 | 0 | void AddCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
324 | 0 | odsState.addOperands(operands); |
325 | 0 | odsState.addAttributes(attributes); |
326 | 0 | odsState.addTypes({operands[0].getType()}); |
327 | 0 |
|
328 | 0 | } |
329 | | |
330 | 0 | ParseResult AddCFOp::parse(OpAsmParser &parser, OperationState &result) { |
331 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
332 | 0 | } |
333 | | |
334 | 0 | void AddCFOp::print(OpAsmPrinter &p) { |
335 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
336 | 0 | } |
337 | | |
338 | 0 | LogicalResult AddCFOp::verify() { |
339 | 0 | { |
340 | 0 | unsigned index = 0; (void)index; |
341 | 0 | auto valueGroup0 = getODSOperands(0); |
342 | 0 | for (Value v : valueGroup0) { |
343 | 0 | (void)v; |
344 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
345 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
346 | 0 | } |
347 | 0 | ++index; |
348 | 0 | } |
349 | 0 | auto valueGroup1 = getODSOperands(1); |
350 | 0 | for (Value v : valueGroup1) { |
351 | 0 | (void)v; |
352 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
353 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
354 | 0 | } |
355 | 0 | ++index; |
356 | 0 | } |
357 | 0 | } |
358 | 0 | { |
359 | 0 | unsigned index = 0; (void)index; |
360 | 0 | auto valueGroup0 = getODSResults(0); |
361 | 0 | for (Value v : valueGroup0) { |
362 | 0 | (void)v; |
363 | 0 | if (!((true))) { |
364 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
365 | 0 | } |
366 | 0 | ++index; |
367 | 0 | } |
368 | 0 | } |
369 | 0 | return mlir::success(); |
370 | 0 | } |
371 | | |
372 | 0 | void AddCFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
373 | 0 |
|
374 | 0 | } |
375 | | |
376 | | |
377 | | //===----------------------------------------------------------------------===// |
378 | | // AddFOp definitions |
379 | | //===----------------------------------------------------------------------===// |
380 | | |
381 | 0 | AddFOpOperandAdaptor::AddFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
382 | 0 |
|
383 | 0 | } |
384 | | |
385 | 0 | AddFOpOperandAdaptor::AddFOpOperandAdaptor(AddFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
386 | 0 |
|
387 | 0 | } |
388 | | |
389 | 0 | std::pair<unsigned, unsigned> AddFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
390 | 0 | return {index, 1}; |
391 | 0 | } |
392 | | |
393 | 0 | ValueRange AddFOpOperandAdaptor::getODSOperands(unsigned index) { |
394 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
395 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
396 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
397 | 0 | } |
398 | | |
399 | 0 | Value AddFOpOperandAdaptor::lhs() { |
400 | 0 | return *getODSOperands(0).begin(); |
401 | 0 | } |
402 | | |
403 | 0 | Value AddFOpOperandAdaptor::rhs() { |
404 | 0 | return *getODSOperands(1).begin(); |
405 | 0 | } |
406 | | |
407 | 0 | StringRef AddFOp::getOperationName() { |
408 | 0 | return "std.addf"; |
409 | 0 | } |
410 | | |
411 | 0 | std::pair<unsigned, unsigned> AddFOp::getODSOperandIndexAndLength(unsigned index) { |
412 | 0 | return {index, 1}; |
413 | 0 | } |
414 | | |
415 | 0 | Operation::operand_range AddFOp::getODSOperands(unsigned index) { |
416 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
417 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
418 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
419 | 0 | } |
420 | | |
421 | 0 | Value AddFOp::lhs() { |
422 | 0 | return *getODSOperands(0).begin(); |
423 | 0 | } |
424 | | |
425 | 0 | Value AddFOp::rhs() { |
426 | 0 | return *getODSOperands(1).begin(); |
427 | 0 | } |
428 | | |
429 | 0 | ::mlir::MutableOperandRange AddFOp::lhsMutable() { |
430 | 0 | auto range = getODSOperandIndexAndLength(0); |
431 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
432 | 0 | } |
433 | | |
434 | 0 | ::mlir::MutableOperandRange AddFOp::rhsMutable() { |
435 | 0 | auto range = getODSOperandIndexAndLength(1); |
436 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
437 | 0 | } |
438 | | |
439 | 0 | std::pair<unsigned, unsigned> AddFOp::getODSResultIndexAndLength(unsigned index) { |
440 | 0 | return {index, 1}; |
441 | 0 | } |
442 | | |
443 | 0 | Operation::result_range AddFOp::getODSResults(unsigned index) { |
444 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
445 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
446 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
447 | 0 | } |
448 | | |
449 | 0 | void AddFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
450 | 0 | odsState.addOperands(lhs); |
451 | 0 | odsState.addOperands(rhs); |
452 | 0 | odsState.addTypes(resultType0); |
453 | 0 | } |
454 | | |
455 | 0 | void AddFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
456 | 0 | odsState.addOperands(lhs); |
457 | 0 | odsState.addOperands(rhs); |
458 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
459 | 0 | odsState.addTypes(resultTypes); |
460 | 0 | } |
461 | | |
462 | 0 | void AddFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
463 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
464 | 0 | odsState.addOperands(operands); |
465 | 0 | odsState.addAttributes(attributes); |
466 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
467 | 0 | odsState.addTypes(resultTypes); |
468 | 0 | } |
469 | | |
470 | 0 | void AddFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
471 | 0 | odsState.addOperands(lhs); |
472 | 0 | odsState.addOperands(rhs); |
473 | 0 | odsState.addTypes({lhs.getType()}); |
474 | 0 |
|
475 | 0 | } |
476 | | |
477 | 0 | void AddFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
478 | 0 | odsState.addOperands(operands); |
479 | 0 | odsState.addAttributes(attributes); |
480 | 0 | odsState.addTypes({operands[0].getType()}); |
481 | 0 |
|
482 | 0 | } |
483 | | |
484 | 0 | ParseResult AddFOp::parse(OpAsmParser &parser, OperationState &result) { |
485 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
486 | 0 | } |
487 | | |
488 | 0 | void AddFOp::print(OpAsmPrinter &p) { |
489 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
490 | 0 | } |
491 | | |
492 | 0 | LogicalResult AddFOp::verify() { |
493 | 0 | { |
494 | 0 | unsigned index = 0; (void)index; |
495 | 0 | auto valueGroup0 = getODSOperands(0); |
496 | 0 | for (Value v : valueGroup0) { |
497 | 0 | (void)v; |
498 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
499 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
500 | 0 | } |
501 | 0 | ++index; |
502 | 0 | } |
503 | 0 | auto valueGroup1 = getODSOperands(1); |
504 | 0 | for (Value v : valueGroup1) { |
505 | 0 | (void)v; |
506 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
507 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
508 | 0 | } |
509 | 0 | ++index; |
510 | 0 | } |
511 | 0 | } |
512 | 0 | { |
513 | 0 | unsigned index = 0; (void)index; |
514 | 0 | auto valueGroup0 = getODSResults(0); |
515 | 0 | for (Value v : valueGroup0) { |
516 | 0 | (void)v; |
517 | 0 | if (!((true))) { |
518 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
519 | 0 | } |
520 | 0 | ++index; |
521 | 0 | } |
522 | 0 | } |
523 | 0 | return mlir::success(); |
524 | 0 | } |
525 | | |
526 | | |
527 | | |
528 | 0 | void AddFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
529 | 0 |
|
530 | 0 | } |
531 | | |
532 | | |
533 | | //===----------------------------------------------------------------------===// |
534 | | // AddIOp definitions |
535 | | //===----------------------------------------------------------------------===// |
536 | | |
537 | 0 | AddIOpOperandAdaptor::AddIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
538 | 0 |
|
539 | 0 | } |
540 | | |
541 | 0 | AddIOpOperandAdaptor::AddIOpOperandAdaptor(AddIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
542 | 0 |
|
543 | 0 | } |
544 | | |
545 | 0 | std::pair<unsigned, unsigned> AddIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
546 | 0 | return {index, 1}; |
547 | 0 | } |
548 | | |
549 | 0 | ValueRange AddIOpOperandAdaptor::getODSOperands(unsigned index) { |
550 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
551 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
552 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
553 | 0 | } |
554 | | |
555 | 0 | Value AddIOpOperandAdaptor::lhs() { |
556 | 0 | return *getODSOperands(0).begin(); |
557 | 0 | } |
558 | | |
559 | 0 | Value AddIOpOperandAdaptor::rhs() { |
560 | 0 | return *getODSOperands(1).begin(); |
561 | 0 | } |
562 | | |
563 | 0 | StringRef AddIOp::getOperationName() { |
564 | 0 | return "std.addi"; |
565 | 0 | } |
566 | | |
567 | 0 | std::pair<unsigned, unsigned> AddIOp::getODSOperandIndexAndLength(unsigned index) { |
568 | 0 | return {index, 1}; |
569 | 0 | } |
570 | | |
571 | 0 | Operation::operand_range AddIOp::getODSOperands(unsigned index) { |
572 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
573 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
574 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
575 | 0 | } |
576 | | |
577 | 0 | Value AddIOp::lhs() { |
578 | 0 | return *getODSOperands(0).begin(); |
579 | 0 | } |
580 | | |
581 | 0 | Value AddIOp::rhs() { |
582 | 0 | return *getODSOperands(1).begin(); |
583 | 0 | } |
584 | | |
585 | 0 | ::mlir::MutableOperandRange AddIOp::lhsMutable() { |
586 | 0 | auto range = getODSOperandIndexAndLength(0); |
587 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
588 | 0 | } |
589 | | |
590 | 0 | ::mlir::MutableOperandRange AddIOp::rhsMutable() { |
591 | 0 | auto range = getODSOperandIndexAndLength(1); |
592 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
593 | 0 | } |
594 | | |
595 | 0 | std::pair<unsigned, unsigned> AddIOp::getODSResultIndexAndLength(unsigned index) { |
596 | 0 | return {index, 1}; |
597 | 0 | } |
598 | | |
599 | 0 | Operation::result_range AddIOp::getODSResults(unsigned index) { |
600 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
601 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
602 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
603 | 0 | } |
604 | | |
605 | 0 | void AddIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
606 | 0 | odsState.addOperands(lhs); |
607 | 0 | odsState.addOperands(rhs); |
608 | 0 | odsState.addTypes(resultType0); |
609 | 0 | } |
610 | | |
611 | 0 | void AddIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
612 | 0 | odsState.addOperands(lhs); |
613 | 0 | odsState.addOperands(rhs); |
614 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
615 | 0 | odsState.addTypes(resultTypes); |
616 | 0 | } |
617 | | |
618 | 0 | void AddIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
619 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
620 | 0 | odsState.addOperands(operands); |
621 | 0 | odsState.addAttributes(attributes); |
622 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
623 | 0 | odsState.addTypes(resultTypes); |
624 | 0 | } |
625 | | |
626 | 0 | void AddIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
627 | 0 | odsState.addOperands(lhs); |
628 | 0 | odsState.addOperands(rhs); |
629 | 0 | odsState.addTypes({lhs.getType()}); |
630 | 0 |
|
631 | 0 | } |
632 | | |
633 | 0 | void AddIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
634 | 0 | odsState.addOperands(operands); |
635 | 0 | odsState.addAttributes(attributes); |
636 | 0 | odsState.addTypes({operands[0].getType()}); |
637 | 0 |
|
638 | 0 | } |
639 | | |
640 | 0 | ParseResult AddIOp::parse(OpAsmParser &parser, OperationState &result) { |
641 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
642 | 0 | } |
643 | | |
644 | 0 | void AddIOp::print(OpAsmPrinter &p) { |
645 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
646 | 0 | } |
647 | | |
648 | 0 | LogicalResult AddIOp::verify() { |
649 | 0 | { |
650 | 0 | unsigned index = 0; (void)index; |
651 | 0 | auto valueGroup0 = getODSOperands(0); |
652 | 0 | for (Value v : valueGroup0) { |
653 | 0 | (void)v; |
654 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
655 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
656 | 0 | } |
657 | 0 | ++index; |
658 | 0 | } |
659 | 0 | auto valueGroup1 = getODSOperands(1); |
660 | 0 | for (Value v : valueGroup1) { |
661 | 0 | (void)v; |
662 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
663 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
664 | 0 | } |
665 | 0 | ++index; |
666 | 0 | } |
667 | 0 | } |
668 | 0 | { |
669 | 0 | unsigned index = 0; (void)index; |
670 | 0 | auto valueGroup0 = getODSResults(0); |
671 | 0 | for (Value v : valueGroup0) { |
672 | 0 | (void)v; |
673 | 0 | if (!((true))) { |
674 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
675 | 0 | } |
676 | 0 | ++index; |
677 | 0 | } |
678 | 0 | } |
679 | 0 | return mlir::success(); |
680 | 0 | } |
681 | | |
682 | | |
683 | | |
684 | 0 | void AddIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
685 | 0 |
|
686 | 0 | } |
687 | | |
688 | | |
689 | | //===----------------------------------------------------------------------===// |
690 | | // AllocOp definitions |
691 | | //===----------------------------------------------------------------------===// |
692 | | |
693 | 0 | AllocOpOperandAdaptor::AllocOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
694 | 0 |
|
695 | 0 | } |
696 | | |
697 | 0 | AllocOpOperandAdaptor::AllocOpOperandAdaptor(AllocOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
698 | 0 |
|
699 | 0 | } |
700 | | |
701 | 0 | std::pair<unsigned, unsigned> AllocOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
702 | 0 | bool isVariadic[] = {true}; |
703 | 0 | int prevVariadicCount = 0; |
704 | 0 | for (unsigned i = 0; i < index; ++i) |
705 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
706 | 0 |
|
707 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
708 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
709 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
710 | 0 | // `index` passed in as the parameter is the static index which counts each |
711 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
712 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
713 | 0 | // value pack for this static operand starts. |
714 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
715 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
716 | 0 | return {start, size}; |
717 | 0 | } |
718 | | |
719 | 0 | ValueRange AllocOpOperandAdaptor::getODSOperands(unsigned index) { |
720 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
721 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
722 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
723 | 0 | } |
724 | | |
725 | 0 | ValueRange AllocOpOperandAdaptor::value() { |
726 | 0 | return getODSOperands(0); |
727 | 0 | } |
728 | | |
729 | 0 | IntegerAttr AllocOpOperandAdaptor::alignment() { |
730 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
731 | 0 | IntegerAttr attr = odsAttrs.get("alignment").dyn_cast_or_null<IntegerAttr>(); |
732 | 0 | return attr; |
733 | 0 | } |
734 | | |
735 | 0 | StringRef AllocOp::getOperationName() { |
736 | 0 | return "std.alloc"; |
737 | 0 | } |
738 | | |
739 | 0 | std::pair<unsigned, unsigned> AllocOp::getODSOperandIndexAndLength(unsigned index) { |
740 | 0 | bool isVariadic[] = {true}; |
741 | 0 | int prevVariadicCount = 0; |
742 | 0 | for (unsigned i = 0; i < index; ++i) |
743 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
744 | 0 |
|
745 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
746 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
747 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
748 | 0 | // `index` passed in as the parameter is the static index which counts each |
749 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
750 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
751 | 0 | // value pack for this static operand starts. |
752 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
753 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
754 | 0 | return {start, size}; |
755 | 0 | } |
756 | | |
757 | 0 | Operation::operand_range AllocOp::getODSOperands(unsigned index) { |
758 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
759 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
760 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
761 | 0 | } |
762 | | |
763 | 0 | Operation::operand_range AllocOp::value() { |
764 | 0 | return getODSOperands(0); |
765 | 0 | } |
766 | | |
767 | 0 | ::mlir::MutableOperandRange AllocOp::valueMutable() { |
768 | 0 | auto range = getODSOperandIndexAndLength(0); |
769 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
770 | 0 | } |
771 | | |
772 | 0 | std::pair<unsigned, unsigned> AllocOp::getODSResultIndexAndLength(unsigned index) { |
773 | 0 | return {index, 1}; |
774 | 0 | } |
775 | | |
776 | 0 | Operation::result_range AllocOp::getODSResults(unsigned index) { |
777 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
778 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
779 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
780 | 0 | } |
781 | | |
782 | 0 | IntegerAttr AllocOp::alignmentAttr() { |
783 | 0 | return this->getAttr("alignment").dyn_cast_or_null<IntegerAttr>(); |
784 | 0 | } |
785 | | |
786 | 0 | Optional< APInt > AllocOp::alignment() { |
787 | 0 | auto attr = alignmentAttr(); |
788 | 0 | return attr ? Optional< APInt >(attr.getValue()) : (llvm::None); |
789 | 0 | } |
790 | | |
791 | 0 | void AllocOp::alignmentAttr(IntegerAttr attr) { |
792 | 0 | this->getOperation()->setAttr("alignment", attr); |
793 | 0 | } |
794 | | |
795 | 0 | void AllocOp::build(OpBuilder &builder, OperationState &result, MemRefType memrefType) { |
796 | 0 | result.types.push_back(memrefType); |
797 | 0 | |
798 | 0 | } |
799 | | |
800 | 0 | void AllocOp::build(OpBuilder &builder, OperationState &result, MemRefType memrefType, ValueRange operands, IntegerAttr alignment ) { |
801 | 0 | result.addOperands(operands); |
802 | 0 | result.types.push_back(memrefType); |
803 | 0 | if (alignment) |
804 | 0 | result.addAttribute(getAlignmentAttrName(), alignment); |
805 | 0 | |
806 | 0 | } |
807 | | |
808 | 0 | void AllocOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, ValueRange value, /*optional*/IntegerAttr alignment) { |
809 | 0 | odsState.addOperands(value); |
810 | 0 | if (alignment) { |
811 | 0 | odsState.addAttribute("alignment", alignment); |
812 | 0 | } |
813 | 0 | odsState.addTypes(resultType0); |
814 | 0 | } |
815 | | |
816 | 0 | void AllocOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange value, /*optional*/IntegerAttr alignment) { |
817 | 0 | odsState.addOperands(value); |
818 | 0 | if (alignment) { |
819 | 0 | odsState.addAttribute("alignment", alignment); |
820 | 0 | } |
821 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
822 | 0 | odsState.addTypes(resultTypes); |
823 | 0 | } |
824 | | |
825 | 0 | void AllocOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
826 | 0 | odsState.addOperands(operands); |
827 | 0 | odsState.addAttributes(attributes); |
828 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
829 | 0 | odsState.addTypes(resultTypes); |
830 | 0 | } |
831 | | |
832 | 0 | ParseResult AllocOp::parse(OpAsmParser &parser, OperationState &result) { |
833 | 0 | return ::parseAllocLikeOp(parser, result); |
834 | 0 | } |
835 | | |
836 | 0 | void AllocOp::print(OpAsmPrinter &p) { |
837 | 0 | return ::print(p, *this); |
838 | 0 | } |
839 | | |
840 | 0 | LogicalResult AllocOp::verify() { |
841 | 0 | auto tblgen_alignment = this->getAttr("alignment"); |
842 | 0 | if (tblgen_alignment) { |
843 | 0 | if (!((((tblgen_alignment.isa<IntegerAttr>())) && ((tblgen_alignment.cast<IntegerAttr>().getType().isSignlessInteger(64)))) && ((tblgen_alignment.cast<IntegerAttr>().getInt() >= 0)))) return emitOpError("attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); |
844 | 0 | } |
845 | 0 | { |
846 | 0 | unsigned index = 0; (void)index; |
847 | 0 | auto valueGroup0 = getODSOperands(0); |
848 | 0 | for (Value v : valueGroup0) { |
849 | 0 | (void)v; |
850 | 0 | if (!((v.getType().isa<IndexType>()))) { |
851 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
852 | 0 | } |
853 | 0 | ++index; |
854 | 0 | } |
855 | 0 | } |
856 | 0 | { |
857 | 0 | unsigned index = 0; (void)index; |
858 | 0 | auto valueGroup0 = getODSResults(0); |
859 | 0 | for (Value v : valueGroup0) { |
860 | 0 | (void)v; |
861 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
862 | 0 | return emitOpError("result #") << index << " must be memref of any type values, but got " << v.getType(); |
863 | 0 | } |
864 | 0 | ++index; |
865 | 0 | } |
866 | 0 | } |
867 | 0 | return ::verify(*this); |
868 | 0 | } |
869 | | |
870 | | |
871 | | |
872 | 0 | void AllocOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
873 | 0 | effects.emplace_back(MemoryEffects::Allocate::get(), ::mlir::SideEffects::DefaultResource::get()); |
874 | 0 | for (Value value : getODSResults(0)) |
875 | 0 | effects.emplace_back(MemoryEffects::Allocate::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
876 | 0 | } |
877 | | |
878 | | |
879 | | //===----------------------------------------------------------------------===// |
880 | | // AllocaOp definitions |
881 | | //===----------------------------------------------------------------------===// |
882 | | |
883 | 0 | AllocaOpOperandAdaptor::AllocaOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
884 | 0 |
|
885 | 0 | } |
886 | | |
887 | 0 | AllocaOpOperandAdaptor::AllocaOpOperandAdaptor(AllocaOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
888 | 0 |
|
889 | 0 | } |
890 | | |
891 | 0 | std::pair<unsigned, unsigned> AllocaOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
892 | 0 | bool isVariadic[] = {true}; |
893 | 0 | int prevVariadicCount = 0; |
894 | 0 | for (unsigned i = 0; i < index; ++i) |
895 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
896 | 0 |
|
897 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
898 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
899 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
900 | 0 | // `index` passed in as the parameter is the static index which counts each |
901 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
902 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
903 | 0 | // value pack for this static operand starts. |
904 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
905 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
906 | 0 | return {start, size}; |
907 | 0 | } |
908 | | |
909 | 0 | ValueRange AllocaOpOperandAdaptor::getODSOperands(unsigned index) { |
910 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
911 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
912 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
913 | 0 | } |
914 | | |
915 | 0 | ValueRange AllocaOpOperandAdaptor::value() { |
916 | 0 | return getODSOperands(0); |
917 | 0 | } |
918 | | |
919 | 0 | IntegerAttr AllocaOpOperandAdaptor::alignment() { |
920 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
921 | 0 | IntegerAttr attr = odsAttrs.get("alignment").dyn_cast_or_null<IntegerAttr>(); |
922 | 0 | return attr; |
923 | 0 | } |
924 | | |
925 | 0 | StringRef AllocaOp::getOperationName() { |
926 | 0 | return "std.alloca"; |
927 | 0 | } |
928 | | |
929 | 0 | std::pair<unsigned, unsigned> AllocaOp::getODSOperandIndexAndLength(unsigned index) { |
930 | 0 | bool isVariadic[] = {true}; |
931 | 0 | int prevVariadicCount = 0; |
932 | 0 | for (unsigned i = 0; i < index; ++i) |
933 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
934 | 0 |
|
935 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
936 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
937 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
938 | 0 | // `index` passed in as the parameter is the static index which counts each |
939 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
940 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
941 | 0 | // value pack for this static operand starts. |
942 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
943 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
944 | 0 | return {start, size}; |
945 | 0 | } |
946 | | |
947 | 0 | Operation::operand_range AllocaOp::getODSOperands(unsigned index) { |
948 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
949 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
950 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
951 | 0 | } |
952 | | |
953 | 0 | Operation::operand_range AllocaOp::value() { |
954 | 0 | return getODSOperands(0); |
955 | 0 | } |
956 | | |
957 | 0 | ::mlir::MutableOperandRange AllocaOp::valueMutable() { |
958 | 0 | auto range = getODSOperandIndexAndLength(0); |
959 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
960 | 0 | } |
961 | | |
962 | 0 | std::pair<unsigned, unsigned> AllocaOp::getODSResultIndexAndLength(unsigned index) { |
963 | 0 | return {index, 1}; |
964 | 0 | } |
965 | | |
966 | 0 | Operation::result_range AllocaOp::getODSResults(unsigned index) { |
967 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
968 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
969 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
970 | 0 | } |
971 | | |
972 | 0 | IntegerAttr AllocaOp::alignmentAttr() { |
973 | 0 | return this->getAttr("alignment").dyn_cast_or_null<IntegerAttr>(); |
974 | 0 | } |
975 | | |
976 | 0 | Optional< APInt > AllocaOp::alignment() { |
977 | 0 | auto attr = alignmentAttr(); |
978 | 0 | return attr ? Optional< APInt >(attr.getValue()) : (llvm::None); |
979 | 0 | } |
980 | | |
981 | 0 | void AllocaOp::alignmentAttr(IntegerAttr attr) { |
982 | 0 | this->getOperation()->setAttr("alignment", attr); |
983 | 0 | } |
984 | | |
985 | 0 | void AllocaOp::build(OpBuilder &builder, OperationState &result, MemRefType memrefType) { |
986 | 0 | result.types.push_back(memrefType); |
987 | 0 | |
988 | 0 | } |
989 | | |
990 | 0 | void AllocaOp::build(OpBuilder &builder, OperationState &result, MemRefType memrefType, ValueRange operands, IntegerAttr alignment ) { |
991 | 0 | result.addOperands(operands); |
992 | 0 | result.types.push_back(memrefType); |
993 | 0 | if (alignment) |
994 | 0 | result.addAttribute(getAlignmentAttrName(), alignment); |
995 | 0 | |
996 | 0 | } |
997 | | |
998 | 0 | void AllocaOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, ValueRange value, /*optional*/IntegerAttr alignment) { |
999 | 0 | odsState.addOperands(value); |
1000 | 0 | if (alignment) { |
1001 | 0 | odsState.addAttribute("alignment", alignment); |
1002 | 0 | } |
1003 | 0 | odsState.addTypes(resultType0); |
1004 | 0 | } |
1005 | | |
1006 | 0 | void AllocaOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange value, /*optional*/IntegerAttr alignment) { |
1007 | 0 | odsState.addOperands(value); |
1008 | 0 | if (alignment) { |
1009 | 0 | odsState.addAttribute("alignment", alignment); |
1010 | 0 | } |
1011 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
1012 | 0 | odsState.addTypes(resultTypes); |
1013 | 0 | } |
1014 | | |
1015 | 0 | void AllocaOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1016 | 0 | odsState.addOperands(operands); |
1017 | 0 | odsState.addAttributes(attributes); |
1018 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
1019 | 0 | odsState.addTypes(resultTypes); |
1020 | 0 | } |
1021 | | |
1022 | 0 | ParseResult AllocaOp::parse(OpAsmParser &parser, OperationState &result) { |
1023 | 0 | return ::parseAllocLikeOp(parser, result); |
1024 | 0 | } |
1025 | | |
1026 | 0 | void AllocaOp::print(OpAsmPrinter &p) { |
1027 | 0 | return ::print(p, *this); |
1028 | 0 | } |
1029 | | |
1030 | 0 | LogicalResult AllocaOp::verify() { |
1031 | 0 | auto tblgen_alignment = this->getAttr("alignment"); |
1032 | 0 | if (tblgen_alignment) { |
1033 | 0 | if (!((((tblgen_alignment.isa<IntegerAttr>())) && ((tblgen_alignment.cast<IntegerAttr>().getType().isSignlessInteger(64)))) && ((tblgen_alignment.cast<IntegerAttr>().getInt() >= 0)))) return emitOpError("attribute 'alignment' failed to satisfy constraint: 64-bit signless integer attribute whose minimum value is 0"); |
1034 | 0 | } |
1035 | 0 | { |
1036 | 0 | unsigned index = 0; (void)index; |
1037 | 0 | auto valueGroup0 = getODSOperands(0); |
1038 | 0 | for (Value v : valueGroup0) { |
1039 | 0 | (void)v; |
1040 | 0 | if (!((v.getType().isa<IndexType>()))) { |
1041 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
1042 | 0 | } |
1043 | 0 | ++index; |
1044 | 0 | } |
1045 | 0 | } |
1046 | 0 | { |
1047 | 0 | unsigned index = 0; (void)index; |
1048 | 0 | auto valueGroup0 = getODSResults(0); |
1049 | 0 | for (Value v : valueGroup0) { |
1050 | 0 | (void)v; |
1051 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
1052 | 0 | return emitOpError("result #") << index << " must be memref of any type values, but got " << v.getType(); |
1053 | 0 | } |
1054 | 0 | ++index; |
1055 | 0 | } |
1056 | 0 | } |
1057 | 0 | return ::verify(*this); |
1058 | 0 | } |
1059 | | |
1060 | | |
1061 | | |
1062 | 0 | void AllocaOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
1063 | 0 | effects.emplace_back(MemoryEffects::Allocate::get(), ::mlir::SideEffects::AutomaticAllocationScopeResource::get()); |
1064 | 0 | for (Value value : getODSResults(0)) |
1065 | 0 | effects.emplace_back(MemoryEffects::Allocate::get(), value, ::mlir::SideEffects::AutomaticAllocationScopeResource::get()); |
1066 | 0 | } |
1067 | | |
1068 | | |
1069 | | //===----------------------------------------------------------------------===// |
1070 | | // AndOp definitions |
1071 | | //===----------------------------------------------------------------------===// |
1072 | | |
1073 | 0 | AndOpOperandAdaptor::AndOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
1074 | 0 |
|
1075 | 0 | } |
1076 | | |
1077 | 0 | AndOpOperandAdaptor::AndOpOperandAdaptor(AndOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
1078 | 0 |
|
1079 | 0 | } |
1080 | | |
1081 | 0 | std::pair<unsigned, unsigned> AndOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
1082 | 0 | return {index, 1}; |
1083 | 0 | } |
1084 | | |
1085 | 0 | ValueRange AndOpOperandAdaptor::getODSOperands(unsigned index) { |
1086 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1087 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
1088 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
1089 | 0 | } |
1090 | | |
1091 | 0 | Value AndOpOperandAdaptor::lhs() { |
1092 | 0 | return *getODSOperands(0).begin(); |
1093 | 0 | } |
1094 | | |
1095 | 0 | Value AndOpOperandAdaptor::rhs() { |
1096 | 0 | return *getODSOperands(1).begin(); |
1097 | 0 | } |
1098 | | |
1099 | 0 | StringRef AndOp::getOperationName() { |
1100 | 0 | return "std.and"; |
1101 | 0 | } |
1102 | | |
1103 | 0 | std::pair<unsigned, unsigned> AndOp::getODSOperandIndexAndLength(unsigned index) { |
1104 | 0 | return {index, 1}; |
1105 | 0 | } |
1106 | | |
1107 | 0 | Operation::operand_range AndOp::getODSOperands(unsigned index) { |
1108 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1109 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
1110 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
1111 | 0 | } |
1112 | | |
1113 | 0 | Value AndOp::lhs() { |
1114 | 0 | return *getODSOperands(0).begin(); |
1115 | 0 | } |
1116 | | |
1117 | 0 | Value AndOp::rhs() { |
1118 | 0 | return *getODSOperands(1).begin(); |
1119 | 0 | } |
1120 | | |
1121 | 0 | ::mlir::MutableOperandRange AndOp::lhsMutable() { |
1122 | 0 | auto range = getODSOperandIndexAndLength(0); |
1123 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1124 | 0 | } |
1125 | | |
1126 | 0 | ::mlir::MutableOperandRange AndOp::rhsMutable() { |
1127 | 0 | auto range = getODSOperandIndexAndLength(1); |
1128 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1129 | 0 | } |
1130 | | |
1131 | 0 | std::pair<unsigned, unsigned> AndOp::getODSResultIndexAndLength(unsigned index) { |
1132 | 0 | return {index, 1}; |
1133 | 0 | } |
1134 | | |
1135 | 0 | Operation::result_range AndOp::getODSResults(unsigned index) { |
1136 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
1137 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
1138 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
1139 | 0 | } |
1140 | | |
1141 | 0 | void AndOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
1142 | 0 | odsState.addOperands(lhs); |
1143 | 0 | odsState.addOperands(rhs); |
1144 | 0 | odsState.addTypes(resultType0); |
1145 | 0 | } |
1146 | | |
1147 | 0 | void AndOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
1148 | 0 | odsState.addOperands(lhs); |
1149 | 0 | odsState.addOperands(rhs); |
1150 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
1151 | 0 | odsState.addTypes(resultTypes); |
1152 | 0 | } |
1153 | | |
1154 | 0 | void AndOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1155 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
1156 | 0 | odsState.addOperands(operands); |
1157 | 0 | odsState.addAttributes(attributes); |
1158 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
1159 | 0 | odsState.addTypes(resultTypes); |
1160 | 0 | } |
1161 | | |
1162 | 0 | void AndOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
1163 | 0 | odsState.addOperands(lhs); |
1164 | 0 | odsState.addOperands(rhs); |
1165 | 0 | odsState.addTypes({lhs.getType()}); |
1166 | 0 |
|
1167 | 0 | } |
1168 | | |
1169 | 0 | void AndOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1170 | 0 | odsState.addOperands(operands); |
1171 | 0 | odsState.addAttributes(attributes); |
1172 | 0 | odsState.addTypes({operands[0].getType()}); |
1173 | 0 |
|
1174 | 0 | } |
1175 | | |
1176 | 0 | ParseResult AndOp::parse(OpAsmParser &parser, OperationState &result) { |
1177 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
1178 | 0 | } |
1179 | | |
1180 | 0 | void AndOp::print(OpAsmPrinter &p) { |
1181 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
1182 | 0 | } |
1183 | | |
1184 | 0 | LogicalResult AndOp::verify() { |
1185 | 0 | { |
1186 | 0 | unsigned index = 0; (void)index; |
1187 | 0 | auto valueGroup0 = getODSOperands(0); |
1188 | 0 | for (Value v : valueGroup0) { |
1189 | 0 | (void)v; |
1190 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
1191 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
1192 | 0 | } |
1193 | 0 | ++index; |
1194 | 0 | } |
1195 | 0 | auto valueGroup1 = getODSOperands(1); |
1196 | 0 | for (Value v : valueGroup1) { |
1197 | 0 | (void)v; |
1198 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
1199 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
1200 | 0 | } |
1201 | 0 | ++index; |
1202 | 0 | } |
1203 | 0 | } |
1204 | 0 | { |
1205 | 0 | unsigned index = 0; (void)index; |
1206 | 0 | auto valueGroup0 = getODSResults(0); |
1207 | 0 | for (Value v : valueGroup0) { |
1208 | 0 | (void)v; |
1209 | 0 | if (!((true))) { |
1210 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
1211 | 0 | } |
1212 | 0 | ++index; |
1213 | 0 | } |
1214 | 0 | } |
1215 | 0 | return mlir::success(); |
1216 | 0 | } |
1217 | | |
1218 | | |
1219 | | |
1220 | 0 | void AndOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
1221 | 0 |
|
1222 | 0 | } |
1223 | | |
1224 | | |
1225 | | //===----------------------------------------------------------------------===// |
1226 | | // AssumeAlignmentOp definitions |
1227 | | //===----------------------------------------------------------------------===// |
1228 | | |
1229 | 0 | AssumeAlignmentOpOperandAdaptor::AssumeAlignmentOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
1230 | 0 |
|
1231 | 0 | } |
1232 | | |
1233 | 0 | AssumeAlignmentOpOperandAdaptor::AssumeAlignmentOpOperandAdaptor(AssumeAlignmentOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
1234 | 0 |
|
1235 | 0 | } |
1236 | | |
1237 | 0 | std::pair<unsigned, unsigned> AssumeAlignmentOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
1238 | 0 | return {index, 1}; |
1239 | 0 | } |
1240 | | |
1241 | 0 | ValueRange AssumeAlignmentOpOperandAdaptor::getODSOperands(unsigned index) { |
1242 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1243 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
1244 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
1245 | 0 | } |
1246 | | |
1247 | 0 | Value AssumeAlignmentOpOperandAdaptor::memref() { |
1248 | 0 | return *getODSOperands(0).begin(); |
1249 | 0 | } |
1250 | | |
1251 | 0 | IntegerAttr AssumeAlignmentOpOperandAdaptor::alignment() { |
1252 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
1253 | 0 | IntegerAttr attr = odsAttrs.get("alignment").cast<IntegerAttr>(); |
1254 | 0 | return attr; |
1255 | 0 | } |
1256 | | |
1257 | 0 | StringRef AssumeAlignmentOp::getOperationName() { |
1258 | 0 | return "std.assume_alignment"; |
1259 | 0 | } |
1260 | | |
1261 | 0 | std::pair<unsigned, unsigned> AssumeAlignmentOp::getODSOperandIndexAndLength(unsigned index) { |
1262 | 0 | return {index, 1}; |
1263 | 0 | } |
1264 | | |
1265 | 0 | Operation::operand_range AssumeAlignmentOp::getODSOperands(unsigned index) { |
1266 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1267 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
1268 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
1269 | 0 | } |
1270 | | |
1271 | 0 | Value AssumeAlignmentOp::memref() { |
1272 | 0 | return *getODSOperands(0).begin(); |
1273 | 0 | } |
1274 | | |
1275 | 0 | ::mlir::MutableOperandRange AssumeAlignmentOp::memrefMutable() { |
1276 | 0 | auto range = getODSOperandIndexAndLength(0); |
1277 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1278 | 0 | } |
1279 | | |
1280 | 0 | std::pair<unsigned, unsigned> AssumeAlignmentOp::getODSResultIndexAndLength(unsigned index) { |
1281 | 0 | return {index, 1}; |
1282 | 0 | } |
1283 | | |
1284 | 0 | Operation::result_range AssumeAlignmentOp::getODSResults(unsigned index) { |
1285 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
1286 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
1287 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
1288 | 0 | } |
1289 | | |
1290 | 0 | IntegerAttr AssumeAlignmentOp::alignmentAttr() { |
1291 | 0 | return this->getAttr("alignment").cast<IntegerAttr>(); |
1292 | 0 | } |
1293 | | |
1294 | 0 | APInt AssumeAlignmentOp::alignment() { |
1295 | 0 | auto attr = alignmentAttr(); |
1296 | 0 | return attr.getValue(); |
1297 | 0 | } |
1298 | | |
1299 | 0 | void AssumeAlignmentOp::alignmentAttr(IntegerAttr attr) { |
1300 | 0 | this->getOperation()->setAttr("alignment", attr); |
1301 | 0 | } |
1302 | | |
1303 | 0 | void AssumeAlignmentOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, IntegerAttr alignment) { |
1304 | 0 | odsState.addOperands(memref); |
1305 | 0 | odsState.addAttribute("alignment", alignment); |
1306 | 0 | } |
1307 | | |
1308 | 0 | void AssumeAlignmentOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, IntegerAttr alignment) { |
1309 | 0 | odsState.addOperands(memref); |
1310 | 0 | odsState.addAttribute("alignment", alignment); |
1311 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
1312 | 0 | odsState.addTypes(resultTypes); |
1313 | 0 | } |
1314 | | |
1315 | 0 | void AssumeAlignmentOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, APInt alignment) { |
1316 | 0 | odsState.addOperands(memref); |
1317 | 0 | odsState.addAttribute("alignment", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment)); |
1318 | 0 | } |
1319 | | |
1320 | 0 | void AssumeAlignmentOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, APInt alignment) { |
1321 | 0 | odsState.addOperands(memref); |
1322 | 0 | odsState.addAttribute("alignment", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), alignment)); |
1323 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
1324 | 0 | odsState.addTypes(resultTypes); |
1325 | 0 | } |
1326 | | |
1327 | 0 | void AssumeAlignmentOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1328 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
1329 | 0 | odsState.addOperands(operands); |
1330 | 0 | odsState.addAttributes(attributes); |
1331 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
1332 | 0 | odsState.addTypes(resultTypes); |
1333 | 0 | } |
1334 | | |
1335 | 0 | LogicalResult AssumeAlignmentOp::verify() { |
1336 | 0 | auto tblgen_alignment = this->getAttr("alignment"); |
1337 | 0 | if (!tblgen_alignment) return emitOpError("requires attribute 'alignment'"); |
1338 | 0 | { |
1339 | 0 | if (!((((tblgen_alignment.isa<IntegerAttr>())) && ((tblgen_alignment.cast<IntegerAttr>().getType().isSignlessInteger(32)))) && ((tblgen_alignment.cast<IntegerAttr>().getValue().isStrictlyPositive())))) return emitOpError("attribute 'alignment' failed to satisfy constraint: 32-bit signless integer attribute whose value is positive"); |
1340 | 0 | } |
1341 | 0 | { |
1342 | 0 | unsigned index = 0; (void)index; |
1343 | 0 | auto valueGroup0 = getODSOperands(0); |
1344 | 0 | for (Value v : valueGroup0) { |
1345 | 0 | (void)v; |
1346 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
1347 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
1348 | 0 | } |
1349 | 0 | ++index; |
1350 | 0 | } |
1351 | 0 | } |
1352 | 0 | { |
1353 | 0 | unsigned index = 0; (void)index; |
1354 | 0 | } |
1355 | 0 | return ::verify(*this); |
1356 | 0 | } |
1357 | | |
1358 | 0 | ParseResult AssumeAlignmentOp::parse(OpAsmParser &parser, OperationState &result) { |
1359 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
1360 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
1361 | 0 | (void)memrefOperandsLoc; |
1362 | 0 | Type memrefRawTypes[1]; |
1363 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
1364 | 0 |
|
1365 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
1366 | 0 | return failure(); |
1367 | 0 | if (parser.parseComma()) |
1368 | 0 | return failure(); |
1369 | 0 | |
1370 | 0 | IntegerAttr alignmentAttr; |
1371 | 0 | if (parser.parseAttribute(alignmentAttr, parser.getBuilder().getIntegerType(32), "alignment", result.attributes)) |
1372 | 0 | return failure(); |
1373 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
1374 | 0 | return failure(); |
1375 | 0 | if (parser.parseColon()) |
1376 | 0 | return failure(); |
1377 | 0 | |
1378 | 0 | if (parser.parseType(memrefRawTypes[0])) |
1379 | 0 | return failure(); |
1380 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
1381 | 0 | return failure(); |
1382 | 0 | return success(); |
1383 | 0 | } |
1384 | | |
1385 | 0 | void AssumeAlignmentOp::print(OpAsmPrinter &p) { |
1386 | 0 | p << "assume_alignment"; |
1387 | 0 | p << " "; |
1388 | 0 | p << memref(); |
1389 | 0 | p << ","; |
1390 | 0 | p << " "; |
1391 | 0 | p.printAttributeWithoutType(alignmentAttr()); |
1392 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"alignment"}); |
1393 | 0 | p << " " << ":"; |
1394 | 0 | p << " "; |
1395 | 0 | p << ArrayRef<Type>(memref().getType()); |
1396 | 0 | } |
1397 | | |
1398 | | |
1399 | | //===----------------------------------------------------------------------===// |
1400 | | // AtomicRMWOp definitions |
1401 | | //===----------------------------------------------------------------------===// |
1402 | | |
1403 | 0 | AtomicRMWOpOperandAdaptor::AtomicRMWOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
1404 | 0 |
|
1405 | 0 | } |
1406 | | |
1407 | 0 | AtomicRMWOpOperandAdaptor::AtomicRMWOpOperandAdaptor(AtomicRMWOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
1408 | 0 |
|
1409 | 0 | } |
1410 | | |
1411 | 0 | std::pair<unsigned, unsigned> AtomicRMWOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
1412 | 0 | bool isVariadic[] = {false, false, true}; |
1413 | 0 | int prevVariadicCount = 0; |
1414 | 0 | for (unsigned i = 0; i < index; ++i) |
1415 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
1416 | 0 |
|
1417 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
1418 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
1419 | 0 | int variadicSize = (odsOperands.size() - 2) / 1; |
1420 | 0 | // `index` passed in as the parameter is the static index which counts each |
1421 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
1422 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
1423 | 0 | // value pack for this static operand starts. |
1424 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
1425 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
1426 | 0 | return {start, size}; |
1427 | 0 | } |
1428 | | |
1429 | 0 | ValueRange AtomicRMWOpOperandAdaptor::getODSOperands(unsigned index) { |
1430 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1431 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
1432 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
1433 | 0 | } |
1434 | | |
1435 | 0 | Value AtomicRMWOpOperandAdaptor::value() { |
1436 | 0 | return *getODSOperands(0).begin(); |
1437 | 0 | } |
1438 | | |
1439 | 0 | Value AtomicRMWOpOperandAdaptor::memref() { |
1440 | 0 | return *getODSOperands(1).begin(); |
1441 | 0 | } |
1442 | | |
1443 | 0 | ValueRange AtomicRMWOpOperandAdaptor::indices() { |
1444 | 0 | return getODSOperands(2); |
1445 | 0 | } |
1446 | | |
1447 | 0 | IntegerAttr AtomicRMWOpOperandAdaptor::kind() { |
1448 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
1449 | 0 | IntegerAttr attr = odsAttrs.get("kind").cast<IntegerAttr>(); |
1450 | 0 | return attr; |
1451 | 0 | } |
1452 | | |
1453 | 0 | StringRef AtomicRMWOp::getOperationName() { |
1454 | 0 | return "std.atomic_rmw"; |
1455 | 0 | } |
1456 | | |
1457 | 0 | std::pair<unsigned, unsigned> AtomicRMWOp::getODSOperandIndexAndLength(unsigned index) { |
1458 | 0 | bool isVariadic[] = {false, false, true}; |
1459 | 0 | int prevVariadicCount = 0; |
1460 | 0 | for (unsigned i = 0; i < index; ++i) |
1461 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
1462 | 0 |
|
1463 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
1464 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
1465 | 0 | int variadicSize = (getOperation()->getNumOperands() - 2) / 1; |
1466 | 0 | // `index` passed in as the parameter is the static index which counts each |
1467 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
1468 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
1469 | 0 | // value pack for this static operand starts. |
1470 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
1471 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
1472 | 0 | return {start, size}; |
1473 | 0 | } |
1474 | | |
1475 | 0 | Operation::operand_range AtomicRMWOp::getODSOperands(unsigned index) { |
1476 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1477 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
1478 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
1479 | 0 | } |
1480 | | |
1481 | 0 | Value AtomicRMWOp::value() { |
1482 | 0 | return *getODSOperands(0).begin(); |
1483 | 0 | } |
1484 | | |
1485 | 0 | Value AtomicRMWOp::memref() { |
1486 | 0 | return *getODSOperands(1).begin(); |
1487 | 0 | } |
1488 | | |
1489 | 0 | Operation::operand_range AtomicRMWOp::indices() { |
1490 | 0 | return getODSOperands(2); |
1491 | 0 | } |
1492 | | |
1493 | 0 | ::mlir::MutableOperandRange AtomicRMWOp::valueMutable() { |
1494 | 0 | auto range = getODSOperandIndexAndLength(0); |
1495 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1496 | 0 | } |
1497 | | |
1498 | 0 | ::mlir::MutableOperandRange AtomicRMWOp::memrefMutable() { |
1499 | 0 | auto range = getODSOperandIndexAndLength(1); |
1500 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1501 | 0 | } |
1502 | | |
1503 | 0 | ::mlir::MutableOperandRange AtomicRMWOp::indicesMutable() { |
1504 | 0 | auto range = getODSOperandIndexAndLength(2); |
1505 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1506 | 0 | } |
1507 | | |
1508 | 0 | std::pair<unsigned, unsigned> AtomicRMWOp::getODSResultIndexAndLength(unsigned index) { |
1509 | 0 | return {index, 1}; |
1510 | 0 | } |
1511 | | |
1512 | 0 | Operation::result_range AtomicRMWOp::getODSResults(unsigned index) { |
1513 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
1514 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
1515 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
1516 | 0 | } |
1517 | | |
1518 | 0 | Value AtomicRMWOp::result() { |
1519 | 0 | return *getODSResults(0).begin(); |
1520 | 0 | } |
1521 | | |
1522 | 0 | IntegerAttr AtomicRMWOp::kindAttr() { |
1523 | 0 | return this->getAttr("kind").cast<IntegerAttr>(); |
1524 | 0 | } |
1525 | | |
1526 | 0 | ::mlir::AtomicRMWKind AtomicRMWOp::kind() { |
1527 | 0 | auto attr = kindAttr(); |
1528 | 0 | return static_cast<::mlir::AtomicRMWKind>(attr.getInt()); |
1529 | 0 | } |
1530 | | |
1531 | 0 | void AtomicRMWOp::kindAttr(IntegerAttr attr) { |
1532 | 0 | this->getOperation()->setAttr("kind", attr); |
1533 | 0 | } |
1534 | | |
1535 | 0 | void AtomicRMWOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr kind, Value value, Value memref, ValueRange indices) { |
1536 | 0 | odsState.addOperands(value); |
1537 | 0 | odsState.addOperands(memref); |
1538 | 0 | odsState.addOperands(indices); |
1539 | 0 | odsState.addAttribute("kind", kind); |
1540 | 0 | odsState.addTypes(result); |
1541 | 0 | } |
1542 | | |
1543 | 0 | void AtomicRMWOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr kind, Value value, Value memref, ValueRange indices) { |
1544 | 0 | odsState.addOperands(value); |
1545 | 0 | odsState.addOperands(memref); |
1546 | 0 | odsState.addOperands(indices); |
1547 | 0 | odsState.addAttribute("kind", kind); |
1548 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
1549 | 0 | odsState.addTypes(resultTypes); |
1550 | 0 | } |
1551 | | |
1552 | 0 | void AtomicRMWOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::AtomicRMWKind kind, Value value, Value memref, ValueRange indices) { |
1553 | 0 | odsState.addOperands(value); |
1554 | 0 | odsState.addOperands(memref); |
1555 | 0 | odsState.addOperands(indices); |
1556 | 0 | odsState.addAttribute("kind", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(kind))); |
1557 | 0 | odsState.addTypes(result); |
1558 | 0 | } |
1559 | | |
1560 | 0 | void AtomicRMWOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::AtomicRMWKind kind, Value value, Value memref, ValueRange indices) { |
1561 | 0 | odsState.addOperands(value); |
1562 | 0 | odsState.addOperands(memref); |
1563 | 0 | odsState.addOperands(indices); |
1564 | 0 | odsState.addAttribute("kind", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(kind))); |
1565 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
1566 | 0 | odsState.addTypes(resultTypes); |
1567 | 0 | } |
1568 | | |
1569 | 0 | void AtomicRMWOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1570 | 0 | assert(operands.size() >= 2u && "mismatched number of parameters"); |
1571 | 0 | odsState.addOperands(operands); |
1572 | 0 | odsState.addAttributes(attributes); |
1573 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
1574 | 0 | odsState.addTypes(resultTypes); |
1575 | 0 | } |
1576 | | |
1577 | 0 | LogicalResult AtomicRMWOp::verify() { |
1578 | 0 | auto tblgen_kind = this->getAttr("kind"); |
1579 | 0 | if (!tblgen_kind) return emitOpError("requires attribute 'kind'"); |
1580 | 0 | { |
1581 | 0 | if (!((((tblgen_kind.isa<IntegerAttr>())) && ((tblgen_kind.cast<IntegerAttr>().getType().isSignlessInteger(64)))) && (((tblgen_kind.cast<IntegerAttr>().getInt() == 0)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 1)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 2)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 3)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 4)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 5)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 6)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 7)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 8)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 9)) || ((tblgen_kind.cast<IntegerAttr>().getInt() == 10))))) return emitOpError("attribute 'kind' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10"); |
1582 | 0 | } |
1583 | 0 | { |
1584 | 0 | unsigned index = 0; (void)index; |
1585 | 0 | auto valueGroup0 = getODSOperands(0); |
1586 | 0 | for (Value v : valueGroup0) { |
1587 | 0 | (void)v; |
1588 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<FloatType>())))) { |
1589 | 0 | return emitOpError("operand #") << index << " must be signless integer or floating-point, but got " << v.getType(); |
1590 | 0 | } |
1591 | 0 | ++index; |
1592 | 0 | } |
1593 | 0 | auto valueGroup1 = getODSOperands(1); |
1594 | 0 | for (Value v : valueGroup1) { |
1595 | 0 | (void)v; |
1596 | 0 | if (!(((v.getType().isa<MemRefType>())) && (((v.getType().cast<ShapedType>().getElementType().isSignlessInteger())) || ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
1597 | 0 | return emitOpError("operand #") << index << " must be memref of signless integer or floating-point values, but got " << v.getType(); |
1598 | 0 | } |
1599 | 0 | ++index; |
1600 | 0 | } |
1601 | 0 | auto valueGroup2 = getODSOperands(2); |
1602 | 0 | for (Value v : valueGroup2) { |
1603 | 0 | (void)v; |
1604 | 0 | if (!((v.getType().isa<IndexType>()))) { |
1605 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
1606 | 0 | } |
1607 | 0 | ++index; |
1608 | 0 | } |
1609 | 0 | } |
1610 | 0 | { |
1611 | 0 | unsigned index = 0; (void)index; |
1612 | 0 | auto valueGroup0 = getODSResults(0); |
1613 | 0 | for (Value v : valueGroup0) { |
1614 | 0 | (void)v; |
1615 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<FloatType>())))) { |
1616 | 0 | return emitOpError("result #") << index << " must be signless integer or floating-point, but got " << v.getType(); |
1617 | 0 | } |
1618 | 0 | ++index; |
1619 | 0 | } |
1620 | 0 | } |
1621 | 0 | if (!((llvm::is_splat(llvm::makeArrayRef({(*this->getODSOperands(0).begin()).getType(), (*this->getODSResults(0).begin()).getType()}))))) { |
1622 | 0 | return emitOpError("failed to verify that all of {value, result} have same type"); |
1623 | 0 | } |
1624 | 0 | if (!(((*this->getODSOperands(1).begin()).getType().cast<MemRefType>().getElementType() == (*this->getODSOperands(0).begin()).getType()))) { |
1625 | 0 | return emitOpError("failed to verify that value type matches element type of memref"); |
1626 | 0 | } |
1627 | 0 | return ::verify(*this); |
1628 | 0 | } |
1629 | | |
1630 | 0 | ParseResult AtomicRMWOp::parse(OpAsmParser &parser, OperationState &result) { |
1631 | 0 | OpAsmParser::OperandType valueRawOperands[1]; |
1632 | 0 | ArrayRef<OpAsmParser::OperandType> valueOperands(valueRawOperands); llvm::SMLoc valueOperandsLoc = parser.getCurrentLocation(); |
1633 | 0 | (void)valueOperandsLoc; |
1634 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
1635 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
1636 | 0 | (void)memrefOperandsLoc; |
1637 | 0 | SmallVector<OpAsmParser::OperandType, 4> indicesOperands; |
1638 | 0 | llvm::SMLoc indicesOperandsLoc = parser.getCurrentLocation(); |
1639 | 0 | (void)indicesOperandsLoc; |
1640 | 0 | Type valueRawTypes[1]; |
1641 | 0 | ArrayRef<Type> valueTypes(valueRawTypes); |
1642 | 0 | Type memrefRawTypes[1]; |
1643 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
1644 | 0 | Type resultRawTypes[1]; |
1645 | 0 | ArrayRef<Type> resultTypes(resultRawTypes); |
1646 | 0 |
|
1647 | 0 | { |
1648 | 0 | StringAttr attrVal; |
1649 | 0 | NamedAttrList attrStorage; |
1650 | 0 | auto loc = parser.getCurrentLocation(); |
1651 | 0 | if (parser.parseAttribute(attrVal, parser.getBuilder().getNoneType(), |
1652 | 0 | "kind", attrStorage)) |
1653 | 0 | return failure(); |
1654 | 0 | |
1655 | 0 | auto attrOptional = ::mlir::symbolizeAtomicRMWKind(attrVal.getValue()); |
1656 | 0 | if (!attrOptional) |
1657 | 0 | return parser.emitError(loc, "invalid ") |
1658 | 0 | << "kind attribute specification: " << attrVal; |
1659 | 0 | |
1660 | 0 | result.addAttribute("kind", parser.getBuilder().getI64IntegerAttr(static_cast<int64_t>(attrOptional.getValue()))); |
1661 | 0 | } |
1662 | 0 |
|
1663 | 0 | if (parser.parseOperand(valueRawOperands[0])) |
1664 | 0 | return failure(); |
1665 | 0 | if (parser.parseComma()) |
1666 | 0 | return failure(); |
1667 | 0 | |
1668 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
1669 | 0 | return failure(); |
1670 | 0 | if (parser.parseLSquare()) |
1671 | 0 | return failure(); |
1672 | 0 | |
1673 | 0 | if (parser.parseOperandList(indicesOperands)) |
1674 | 0 | return failure(); |
1675 | 0 | if (parser.parseRSquare()) |
1676 | 0 | return failure(); |
1677 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
1678 | 0 | return failure(); |
1679 | 0 | if (parser.parseColon()) |
1680 | 0 | return failure(); |
1681 | 0 | if (parser.parseLParen()) |
1682 | 0 | return failure(); |
1683 | 0 | |
1684 | 0 | if (parser.parseType(valueRawTypes[0])) |
1685 | 0 | return failure(); |
1686 | 0 | if (parser.parseComma()) |
1687 | 0 | return failure(); |
1688 | 0 | |
1689 | 0 | if (parser.parseType(memrefRawTypes[0])) |
1690 | 0 | return failure(); |
1691 | 0 | if (parser.parseRParen()) |
1692 | 0 | return failure(); |
1693 | 0 | if (parser.parseArrow()) |
1694 | 0 | return failure(); |
1695 | 0 | |
1696 | 0 | if (parser.parseType(resultRawTypes[0])) |
1697 | 0 | return failure(); |
1698 | 0 | Type odsBuildableType0 = parser.getBuilder().getIndexType(); |
1699 | 0 | result.addTypes(resultTypes); |
1700 | 0 | if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands)) |
1701 | 0 | return failure(); |
1702 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
1703 | 0 | return failure(); |
1704 | 0 | if (parser.resolveOperands(indicesOperands, odsBuildableType0, result.operands)) |
1705 | 0 | return failure(); |
1706 | 0 | return success(); |
1707 | 0 | } |
1708 | | |
1709 | 0 | void AtomicRMWOp::print(OpAsmPrinter &p) { |
1710 | 0 | p << "atomic_rmw"; |
1711 | 0 | p << " "; |
1712 | 0 | p << "\"" << stringifyAtomicRMWKind(kind()) << "\""; |
1713 | 0 | p << " "; |
1714 | 0 | p << value(); |
1715 | 0 | p << ","; |
1716 | 0 | p << " "; |
1717 | 0 | p << memref(); |
1718 | 0 | p << "["; |
1719 | 0 | p << indices(); |
1720 | 0 | p << "]"; |
1721 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"kind"}); |
1722 | 0 | p << " " << ":"; |
1723 | 0 | p << " " << "("; |
1724 | 0 | p << ArrayRef<Type>(value().getType()); |
1725 | 0 | p << ","; |
1726 | 0 | p << " "; |
1727 | 0 | p << ArrayRef<Type>(memref().getType()); |
1728 | 0 | p << ")"; |
1729 | 0 | p << " " << "->"; |
1730 | 0 | p << " "; |
1731 | 0 | p << ArrayRef<Type>(result().getType()); |
1732 | 0 | } |
1733 | | |
1734 | | |
1735 | | //===----------------------------------------------------------------------===// |
1736 | | // AtomicYieldOp definitions |
1737 | | //===----------------------------------------------------------------------===// |
1738 | | |
1739 | 0 | AtomicYieldOpOperandAdaptor::AtomicYieldOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
1740 | 0 |
|
1741 | 0 | } |
1742 | | |
1743 | 0 | AtomicYieldOpOperandAdaptor::AtomicYieldOpOperandAdaptor(AtomicYieldOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
1744 | 0 |
|
1745 | 0 | } |
1746 | | |
1747 | 0 | std::pair<unsigned, unsigned> AtomicYieldOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
1748 | 0 | return {index, 1}; |
1749 | 0 | } |
1750 | | |
1751 | 0 | ValueRange AtomicYieldOpOperandAdaptor::getODSOperands(unsigned index) { |
1752 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1753 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
1754 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
1755 | 0 | } |
1756 | | |
1757 | 0 | Value AtomicYieldOpOperandAdaptor::result() { |
1758 | 0 | return *getODSOperands(0).begin(); |
1759 | 0 | } |
1760 | | |
1761 | 0 | StringRef AtomicYieldOp::getOperationName() { |
1762 | 0 | return "std.atomic_yield"; |
1763 | 0 | } |
1764 | | |
1765 | 0 | std::pair<unsigned, unsigned> AtomicYieldOp::getODSOperandIndexAndLength(unsigned index) { |
1766 | 0 | return {index, 1}; |
1767 | 0 | } |
1768 | | |
1769 | 0 | Operation::operand_range AtomicYieldOp::getODSOperands(unsigned index) { |
1770 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1771 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
1772 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
1773 | 0 | } |
1774 | | |
1775 | 0 | Value AtomicYieldOp::result() { |
1776 | 0 | return *getODSOperands(0).begin(); |
1777 | 0 | } |
1778 | | |
1779 | 0 | ::mlir::MutableOperandRange AtomicYieldOp::resultMutable() { |
1780 | 0 | auto range = getODSOperandIndexAndLength(0); |
1781 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1782 | 0 | } |
1783 | | |
1784 | 0 | std::pair<unsigned, unsigned> AtomicYieldOp::getODSResultIndexAndLength(unsigned index) { |
1785 | 0 | return {index, 1}; |
1786 | 0 | } |
1787 | | |
1788 | 0 | Operation::result_range AtomicYieldOp::getODSResults(unsigned index) { |
1789 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
1790 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
1791 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
1792 | 0 | } |
1793 | | |
1794 | 0 | void AtomicYieldOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value result) { |
1795 | 0 | odsState.addOperands(result); |
1796 | 0 | } |
1797 | | |
1798 | 0 | void AtomicYieldOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value result) { |
1799 | 0 | odsState.addOperands(result); |
1800 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
1801 | 0 | odsState.addTypes(resultTypes); |
1802 | 0 | } |
1803 | | |
1804 | 0 | void AtomicYieldOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1805 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
1806 | 0 | odsState.addOperands(operands); |
1807 | 0 | odsState.addAttributes(attributes); |
1808 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
1809 | 0 | odsState.addTypes(resultTypes); |
1810 | 0 | } |
1811 | | |
1812 | 0 | LogicalResult AtomicYieldOp::verify() { |
1813 | 0 | { |
1814 | 0 | unsigned index = 0; (void)index; |
1815 | 0 | auto valueGroup0 = getODSOperands(0); |
1816 | 0 | for (Value v : valueGroup0) { |
1817 | 0 | (void)v; |
1818 | 0 | if (!((true))) { |
1819 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
1820 | 0 | } |
1821 | 0 | ++index; |
1822 | 0 | } |
1823 | 0 | } |
1824 | 0 | { |
1825 | 0 | unsigned index = 0; (void)index; |
1826 | 0 | } |
1827 | 0 | return ::verify(*this); |
1828 | 0 | } |
1829 | | |
1830 | 0 | ParseResult AtomicYieldOp::parse(OpAsmParser &parser, OperationState &result) { |
1831 | 0 | OpAsmParser::OperandType resultRawOperands[1]; |
1832 | 0 | ArrayRef<OpAsmParser::OperandType> resultOperands(resultRawOperands); llvm::SMLoc resultOperandsLoc = parser.getCurrentLocation(); |
1833 | 0 | (void)resultOperandsLoc; |
1834 | 0 | Type resultRawTypes[1]; |
1835 | 0 | ArrayRef<Type> resultTypes(resultRawTypes); |
1836 | 0 |
|
1837 | 0 | if (parser.parseOperand(resultRawOperands[0])) |
1838 | 0 | return failure(); |
1839 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
1840 | 0 | return failure(); |
1841 | 0 | if (parser.parseColon()) |
1842 | 0 | return failure(); |
1843 | 0 | |
1844 | 0 | if (parser.parseType(resultRawTypes[0])) |
1845 | 0 | return failure(); |
1846 | 0 | if (parser.resolveOperands(resultOperands, resultTypes, resultOperandsLoc, result.operands)) |
1847 | 0 | return failure(); |
1848 | 0 | return success(); |
1849 | 0 | } |
1850 | | |
1851 | 0 | void AtomicYieldOp::print(OpAsmPrinter &p) { |
1852 | 0 | p << "atomic_yield"; |
1853 | 0 | p << " "; |
1854 | 0 | p << result(); |
1855 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
1856 | 0 | p << " " << ":"; |
1857 | 0 | p << " "; |
1858 | 0 | p << ArrayRef<Type>(result().getType()); |
1859 | 0 | } |
1860 | | |
1861 | 0 | void AtomicYieldOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
1862 | 0 |
|
1863 | 0 | } |
1864 | | |
1865 | | |
1866 | | //===----------------------------------------------------------------------===// |
1867 | | // BranchOp definitions |
1868 | | //===----------------------------------------------------------------------===// |
1869 | | |
1870 | 0 | BranchOpOperandAdaptor::BranchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
1871 | 0 |
|
1872 | 0 | } |
1873 | | |
1874 | 0 | BranchOpOperandAdaptor::BranchOpOperandAdaptor(BranchOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
1875 | 0 |
|
1876 | 0 | } |
1877 | | |
1878 | 0 | std::pair<unsigned, unsigned> BranchOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
1879 | 0 | bool isVariadic[] = {true}; |
1880 | 0 | int prevVariadicCount = 0; |
1881 | 0 | for (unsigned i = 0; i < index; ++i) |
1882 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
1883 | 0 |
|
1884 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
1885 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
1886 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
1887 | 0 | // `index` passed in as the parameter is the static index which counts each |
1888 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
1889 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
1890 | 0 | // value pack for this static operand starts. |
1891 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
1892 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
1893 | 0 | return {start, size}; |
1894 | 0 | } |
1895 | | |
1896 | 0 | ValueRange BranchOpOperandAdaptor::getODSOperands(unsigned index) { |
1897 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1898 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
1899 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
1900 | 0 | } |
1901 | | |
1902 | 0 | ValueRange BranchOpOperandAdaptor::destOperands() { |
1903 | 0 | return getODSOperands(0); |
1904 | 0 | } |
1905 | | |
1906 | 0 | StringRef BranchOp::getOperationName() { |
1907 | 0 | return "std.br"; |
1908 | 0 | } |
1909 | | |
1910 | 0 | std::pair<unsigned, unsigned> BranchOp::getODSOperandIndexAndLength(unsigned index) { |
1911 | 0 | bool isVariadic[] = {true}; |
1912 | 0 | int prevVariadicCount = 0; |
1913 | 0 | for (unsigned i = 0; i < index; ++i) |
1914 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
1915 | 0 |
|
1916 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
1917 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
1918 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
1919 | 0 | // `index` passed in as the parameter is the static index which counts each |
1920 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
1921 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
1922 | 0 | // value pack for this static operand starts. |
1923 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
1924 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
1925 | 0 | return {start, size}; |
1926 | 0 | } |
1927 | | |
1928 | 0 | Operation::operand_range BranchOp::getODSOperands(unsigned index) { |
1929 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
1930 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
1931 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
1932 | 0 | } |
1933 | | |
1934 | 0 | Operation::operand_range BranchOp::destOperands() { |
1935 | 0 | return getODSOperands(0); |
1936 | 0 | } |
1937 | | |
1938 | 0 | ::mlir::MutableOperandRange BranchOp::destOperandsMutable() { |
1939 | 0 | auto range = getODSOperandIndexAndLength(0); |
1940 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
1941 | 0 | } |
1942 | | |
1943 | 0 | std::pair<unsigned, unsigned> BranchOp::getODSResultIndexAndLength(unsigned index) { |
1944 | 0 | return {index, 1}; |
1945 | 0 | } |
1946 | | |
1947 | 0 | Operation::result_range BranchOp::getODSResults(unsigned index) { |
1948 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
1949 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
1950 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
1951 | 0 | } |
1952 | | |
1953 | 0 | Block *BranchOp::dest() { |
1954 | 0 | return this->getOperation()->getSuccessor(0); |
1955 | 0 | } |
1956 | | |
1957 | 0 | void BranchOp::build(OpBuilder &, OperationState &result, Block *dest, ValueRange destOperands ) { |
1958 | 0 | result.addSuccessors(dest); |
1959 | 0 | result.addOperands(destOperands); |
1960 | 0 | |
1961 | 0 | } |
1962 | | |
1963 | 0 | void BranchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange destOperands, Block *dest) { |
1964 | 0 | odsState.addOperands(destOperands); |
1965 | 0 | odsState.addSuccessors(dest); |
1966 | 0 | } |
1967 | | |
1968 | 0 | void BranchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange destOperands, Block *dest) { |
1969 | 0 | odsState.addOperands(destOperands); |
1970 | 0 | odsState.addSuccessors(dest); |
1971 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
1972 | 0 | odsState.addTypes(resultTypes); |
1973 | 0 | } |
1974 | | |
1975 | 0 | void BranchOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
1976 | 0 | odsState.addOperands(operands); |
1977 | 0 | odsState.addAttributes(attributes); |
1978 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
1979 | 0 | odsState.addTypes(resultTypes); |
1980 | 0 | } |
1981 | | |
1982 | 0 | LogicalResult BranchOp::verify() { |
1983 | 0 | { |
1984 | 0 | unsigned index = 0; (void)index; |
1985 | 0 | auto valueGroup0 = getODSOperands(0); |
1986 | 0 | for (Value v : valueGroup0) { |
1987 | 0 | (void)v; |
1988 | 0 | if (!((true))) { |
1989 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
1990 | 0 | } |
1991 | 0 | ++index; |
1992 | 0 | } |
1993 | 0 | } |
1994 | 0 | { |
1995 | 0 | unsigned index = 0; (void)index; |
1996 | 0 | } |
1997 | 0 | { |
1998 | 0 | unsigned index = 0; (void)index; |
1999 | 0 | } |
2000 | 0 | return mlir::success(); |
2001 | 0 | } |
2002 | | |
2003 | | |
2004 | | |
2005 | | |
2006 | | |
2007 | | |
2008 | | |
2009 | 0 | ParseResult BranchOp::parse(OpAsmParser &parser, OperationState &result) { |
2010 | 0 | SmallVector<OpAsmParser::OperandType, 4> destOperandsOperands; |
2011 | 0 | llvm::SMLoc destOperandsOperandsLoc = parser.getCurrentLocation(); |
2012 | 0 | (void)destOperandsOperandsLoc; |
2013 | 0 | SmallVector<Type, 1> destOperandsTypes; |
2014 | 0 |
|
2015 | 0 | Block *destSuccessor = nullptr; |
2016 | 0 | if (parser.parseSuccessor(destSuccessor)) |
2017 | 0 | return failure(); |
2018 | 0 | if (succeeded(parser.parseOptionalLParen())) { |
2019 | 0 |
|
2020 | 0 | if (parser.parseOperandList(destOperandsOperands)) |
2021 | 0 | return failure(); |
2022 | 0 | if (parser.parseColon()) |
2023 | 0 | return failure(); |
2024 | 0 | |
2025 | 0 | if (parser.parseTypeList(destOperandsTypes)) |
2026 | 0 | return failure(); |
2027 | 0 | if (parser.parseRParen()) |
2028 | 0 | return failure(); |
2029 | 0 | } |
2030 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
2031 | 0 | return failure(); |
2032 | 0 | if (parser.resolveOperands(destOperandsOperands, destOperandsTypes, destOperandsOperandsLoc, result.operands)) |
2033 | 0 | return failure(); |
2034 | 0 | result.addSuccessors(destSuccessor); |
2035 | 0 | return success(); |
2036 | 0 | } |
2037 | | |
2038 | 0 | void BranchOp::print(OpAsmPrinter &p) { |
2039 | 0 | p << "br"; |
2040 | 0 | p << " "; |
2041 | 0 | p << dest(); |
2042 | 0 | if (!destOperands().empty()) { |
2043 | 0 | p << "("; |
2044 | 0 | p << destOperands(); |
2045 | 0 | p << " " << ":"; |
2046 | 0 | p << " "; |
2047 | 0 | p << destOperands().getTypes(); |
2048 | 0 | p << ")"; |
2049 | 0 | } |
2050 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
2051 | 0 | } |
2052 | | |
2053 | 0 | void BranchOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
2054 | 0 |
|
2055 | 0 | } |
2056 | | |
2057 | | |
2058 | | //===----------------------------------------------------------------------===// |
2059 | | // CallIndirectOp definitions |
2060 | | //===----------------------------------------------------------------------===// |
2061 | | |
2062 | 0 | CallIndirectOpOperandAdaptor::CallIndirectOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
2063 | 0 |
|
2064 | 0 | } |
2065 | | |
2066 | 0 | CallIndirectOpOperandAdaptor::CallIndirectOpOperandAdaptor(CallIndirectOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
2067 | 0 |
|
2068 | 0 | } |
2069 | | |
2070 | 0 | std::pair<unsigned, unsigned> CallIndirectOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
2071 | 0 | bool isVariadic[] = {false, true}; |
2072 | 0 | int prevVariadicCount = 0; |
2073 | 0 | for (unsigned i = 0; i < index; ++i) |
2074 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2075 | 0 |
|
2076 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2077 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2078 | 0 | int variadicSize = (odsOperands.size() - 1) / 1; |
2079 | 0 | // `index` passed in as the parameter is the static index which counts each |
2080 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2081 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2082 | 0 | // value pack for this static operand starts. |
2083 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2084 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2085 | 0 | return {start, size}; |
2086 | 0 | } |
2087 | | |
2088 | 0 | ValueRange CallIndirectOpOperandAdaptor::getODSOperands(unsigned index) { |
2089 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2090 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
2091 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
2092 | 0 | } |
2093 | | |
2094 | 0 | Value CallIndirectOpOperandAdaptor::callee() { |
2095 | 0 | return *getODSOperands(0).begin(); |
2096 | 0 | } |
2097 | | |
2098 | 0 | ValueRange CallIndirectOpOperandAdaptor::operands() { |
2099 | 0 | return getODSOperands(1); |
2100 | 0 | } |
2101 | | |
2102 | 0 | StringRef CallIndirectOp::getOperationName() { |
2103 | 0 | return "std.call_indirect"; |
2104 | 0 | } |
2105 | | |
2106 | 0 | std::pair<unsigned, unsigned> CallIndirectOp::getODSOperandIndexAndLength(unsigned index) { |
2107 | 0 | bool isVariadic[] = {false, true}; |
2108 | 0 | int prevVariadicCount = 0; |
2109 | 0 | for (unsigned i = 0; i < index; ++i) |
2110 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2111 | 0 |
|
2112 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2113 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2114 | 0 | int variadicSize = (getOperation()->getNumOperands() - 1) / 1; |
2115 | 0 | // `index` passed in as the parameter is the static index which counts each |
2116 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2117 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2118 | 0 | // value pack for this static operand starts. |
2119 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2120 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2121 | 0 | return {start, size}; |
2122 | 0 | } |
2123 | | |
2124 | 0 | Operation::operand_range CallIndirectOp::getODSOperands(unsigned index) { |
2125 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2126 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
2127 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
2128 | 0 | } |
2129 | | |
2130 | 0 | Value CallIndirectOp::callee() { |
2131 | 0 | return *getODSOperands(0).begin(); |
2132 | 0 | } |
2133 | | |
2134 | 0 | Operation::operand_range CallIndirectOp::operands() { |
2135 | 0 | return getODSOperands(1); |
2136 | 0 | } |
2137 | | |
2138 | 0 | ::mlir::MutableOperandRange CallIndirectOp::calleeMutable() { |
2139 | 0 | auto range = getODSOperandIndexAndLength(0); |
2140 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2141 | 0 | } |
2142 | | |
2143 | 0 | ::mlir::MutableOperandRange CallIndirectOp::operandsMutable() { |
2144 | 0 | auto range = getODSOperandIndexAndLength(1); |
2145 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2146 | 0 | } |
2147 | | |
2148 | 0 | std::pair<unsigned, unsigned> CallIndirectOp::getODSResultIndexAndLength(unsigned index) { |
2149 | 0 | bool isVariadic[] = {true}; |
2150 | 0 | int prevVariadicCount = 0; |
2151 | 0 | for (unsigned i = 0; i < index; ++i) |
2152 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2153 | 0 |
|
2154 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2155 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2156 | 0 | int variadicSize = (getOperation()->getNumResults() - 0) / 1; |
2157 | 0 | // `index` passed in as the parameter is the static index which counts each |
2158 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2159 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2160 | 0 | // value pack for this static operand starts. |
2161 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2162 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2163 | 0 | return {start, size}; |
2164 | 0 | } |
2165 | | |
2166 | 0 | Operation::result_range CallIndirectOp::getODSResults(unsigned index) { |
2167 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
2168 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
2169 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
2170 | 0 | } |
2171 | | |
2172 | 0 | Operation::result_range CallIndirectOp::results() { |
2173 | 0 | return getODSResults(0); |
2174 | 0 | } |
2175 | | |
2176 | 0 | void CallIndirectOp::build(OpBuilder &, OperationState &result, Value callee,ValueRange operands ) { |
2177 | 0 | result.operands.push_back(callee); |
2178 | 0 | result.addOperands(operands); |
2179 | 0 | result.addTypes(callee.getType().cast<FunctionType>().getResults()); |
2180 | 0 | |
2181 | 0 | } |
2182 | | |
2183 | 0 | void CallIndirectOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> results, Value callee, ValueRange operands) { |
2184 | 0 | odsState.addOperands(callee); |
2185 | 0 | odsState.addOperands(operands); |
2186 | 0 | odsState.addTypes(results); |
2187 | 0 | } |
2188 | | |
2189 | 0 | void CallIndirectOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
2190 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
2191 | 0 | odsState.addOperands(operands); |
2192 | 0 | odsState.addAttributes(attributes); |
2193 | 0 | odsState.addTypes(resultTypes); |
2194 | 0 | } |
2195 | | |
2196 | 0 | LogicalResult CallIndirectOp::verify() { |
2197 | 0 | { |
2198 | 0 | unsigned index = 0; (void)index; |
2199 | 0 | auto valueGroup0 = getODSOperands(0); |
2200 | 0 | for (Value v : valueGroup0) { |
2201 | 0 | (void)v; |
2202 | 0 | if (!((v.getType().isa<FunctionType>()))) { |
2203 | 0 | return emitOpError("operand #") << index << " must be function type, but got " << v.getType(); |
2204 | 0 | } |
2205 | 0 | ++index; |
2206 | 0 | } |
2207 | 0 | auto valueGroup1 = getODSOperands(1); |
2208 | 0 | for (Value v : valueGroup1) { |
2209 | 0 | (void)v; |
2210 | 0 | if (!((true))) { |
2211 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
2212 | 0 | } |
2213 | 0 | ++index; |
2214 | 0 | } |
2215 | 0 | } |
2216 | 0 | { |
2217 | 0 | unsigned index = 0; (void)index; |
2218 | 0 | auto valueGroup0 = getODSResults(0); |
2219 | 0 | for (Value v : valueGroup0) { |
2220 | 0 | (void)v; |
2221 | 0 | if (!((true))) { |
2222 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
2223 | 0 | } |
2224 | 0 | ++index; |
2225 | 0 | } |
2226 | 0 | } |
2227 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<FunctionType>().getInputs() == this->getODSOperands(1).getType()))) { |
2228 | 0 | return emitOpError("failed to verify that callee input types match argument types"); |
2229 | 0 | } |
2230 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<FunctionType>().getResults() == this->getODSResults(0).getType()))) { |
2231 | 0 | return emitOpError("failed to verify that callee result types match result types"); |
2232 | 0 | } |
2233 | 0 | return mlir::success(); |
2234 | 0 | } |
2235 | | |
2236 | | |
2237 | | |
2238 | 0 | ParseResult CallIndirectOp::parse(OpAsmParser &parser, OperationState &result) { |
2239 | 0 | OpAsmParser::OperandType calleeRawOperands[1]; |
2240 | 0 | ArrayRef<OpAsmParser::OperandType> calleeOperands(calleeRawOperands); llvm::SMLoc calleeOperandsLoc = parser.getCurrentLocation(); |
2241 | 0 | (void)calleeOperandsLoc; |
2242 | 0 | SmallVector<OpAsmParser::OperandType, 4> operandsOperands; |
2243 | 0 | llvm::SMLoc operandsOperandsLoc = parser.getCurrentLocation(); |
2244 | 0 | (void)operandsOperandsLoc; |
2245 | 0 | Type calleeRawTypes[1]; |
2246 | 0 | ArrayRef<Type> calleeTypes(calleeRawTypes); |
2247 | 0 |
|
2248 | 0 | if (parser.parseOperand(calleeRawOperands[0])) |
2249 | 0 | return failure(); |
2250 | 0 | if (parser.parseLParen()) |
2251 | 0 | return failure(); |
2252 | 0 | |
2253 | 0 | if (parser.parseOperandList(operandsOperands)) |
2254 | 0 | return failure(); |
2255 | 0 | if (parser.parseRParen()) |
2256 | 0 | return failure(); |
2257 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
2258 | 0 | return failure(); |
2259 | 0 | if (parser.parseColon()) |
2260 | 0 | return failure(); |
2261 | 0 | |
2262 | 0 | if (parser.parseType(calleeRawTypes[0])) |
2263 | 0 | return failure(); |
2264 | 0 | for (Type type : calleeTypes) { |
2265 | 0 | (void)type; |
2266 | 0 | if (!((type.isa<FunctionType>()))) { |
2267 | 0 | return parser.emitError(parser.getNameLoc()) << "'callee' must be function type, but got " << type; |
2268 | 0 | } |
2269 | 0 | } |
2270 | 0 | result.addTypes(calleeTypes[0].cast<FunctionType>().getResults()); |
2271 | 0 | if (parser.resolveOperands(calleeOperands, calleeTypes, calleeOperandsLoc, result.operands)) |
2272 | 0 | return failure(); |
2273 | 0 | if (parser.resolveOperands(operandsOperands, calleeTypes[0].cast<FunctionType>().getInputs(), operandsOperandsLoc, result.operands)) |
2274 | 0 | return failure(); |
2275 | 0 | return success(); |
2276 | 0 | } |
2277 | | |
2278 | 0 | void CallIndirectOp::print(OpAsmPrinter &p) { |
2279 | 0 | p << "call_indirect"; |
2280 | 0 | p << " "; |
2281 | 0 | p << callee(); |
2282 | 0 | p << "("; |
2283 | 0 | p << operands(); |
2284 | 0 | p << ")"; |
2285 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
2286 | 0 | p << " " << ":"; |
2287 | 0 | p << " "; |
2288 | 0 | p << ArrayRef<Type>(callee().getType()); |
2289 | 0 | } |
2290 | | |
2291 | | |
2292 | | //===----------------------------------------------------------------------===// |
2293 | | // CallOp definitions |
2294 | | //===----------------------------------------------------------------------===// |
2295 | | |
2296 | 0 | CallOpOperandAdaptor::CallOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
2297 | 0 |
|
2298 | 0 | } |
2299 | | |
2300 | 0 | CallOpOperandAdaptor::CallOpOperandAdaptor(CallOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
2301 | 0 |
|
2302 | 0 | } |
2303 | | |
2304 | 0 | std::pair<unsigned, unsigned> CallOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
2305 | 0 | bool isVariadic[] = {true}; |
2306 | 0 | int prevVariadicCount = 0; |
2307 | 0 | for (unsigned i = 0; i < index; ++i) |
2308 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2309 | 0 |
|
2310 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2311 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2312 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
2313 | 0 | // `index` passed in as the parameter is the static index which counts each |
2314 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2315 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2316 | 0 | // value pack for this static operand starts. |
2317 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2318 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2319 | 0 | return {start, size}; |
2320 | 0 | } |
2321 | | |
2322 | 0 | ValueRange CallOpOperandAdaptor::getODSOperands(unsigned index) { |
2323 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2324 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
2325 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
2326 | 0 | } |
2327 | | |
2328 | 0 | ValueRange CallOpOperandAdaptor::operands() { |
2329 | 0 | return getODSOperands(0); |
2330 | 0 | } |
2331 | | |
2332 | 0 | FlatSymbolRefAttr CallOpOperandAdaptor::callee() { |
2333 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
2334 | 0 | FlatSymbolRefAttr attr = odsAttrs.get("callee").cast<FlatSymbolRefAttr>(); |
2335 | 0 | return attr; |
2336 | 0 | } |
2337 | | |
2338 | 0 | StringRef CallOp::getOperationName() { |
2339 | 0 | return "std.call"; |
2340 | 0 | } |
2341 | | |
2342 | 0 | std::pair<unsigned, unsigned> CallOp::getODSOperandIndexAndLength(unsigned index) { |
2343 | 0 | bool isVariadic[] = {true}; |
2344 | 0 | int prevVariadicCount = 0; |
2345 | 0 | for (unsigned i = 0; i < index; ++i) |
2346 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2347 | 0 |
|
2348 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2349 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2350 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
2351 | 0 | // `index` passed in as the parameter is the static index which counts each |
2352 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2353 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2354 | 0 | // value pack for this static operand starts. |
2355 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2356 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2357 | 0 | return {start, size}; |
2358 | 0 | } |
2359 | | |
2360 | 0 | Operation::operand_range CallOp::getODSOperands(unsigned index) { |
2361 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2362 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
2363 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
2364 | 0 | } |
2365 | | |
2366 | 0 | Operation::operand_range CallOp::operands() { |
2367 | 0 | return getODSOperands(0); |
2368 | 0 | } |
2369 | | |
2370 | 0 | ::mlir::MutableOperandRange CallOp::operandsMutable() { |
2371 | 0 | auto range = getODSOperandIndexAndLength(0); |
2372 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2373 | 0 | } |
2374 | | |
2375 | 0 | std::pair<unsigned, unsigned> CallOp::getODSResultIndexAndLength(unsigned index) { |
2376 | 0 | bool isVariadic[] = {true}; |
2377 | 0 | int prevVariadicCount = 0; |
2378 | 0 | for (unsigned i = 0; i < index; ++i) |
2379 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
2380 | 0 |
|
2381 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
2382 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
2383 | 0 | int variadicSize = (getOperation()->getNumResults() - 0) / 1; |
2384 | 0 | // `index` passed in as the parameter is the static index which counts each |
2385 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
2386 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
2387 | 0 | // value pack for this static operand starts. |
2388 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
2389 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
2390 | 0 | return {start, size}; |
2391 | 0 | } |
2392 | | |
2393 | 0 | Operation::result_range CallOp::getODSResults(unsigned index) { |
2394 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
2395 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
2396 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
2397 | 0 | } |
2398 | | |
2399 | 0 | FlatSymbolRefAttr CallOp::calleeAttr() { |
2400 | 0 | return this->getAttr("callee").cast<FlatSymbolRefAttr>(); |
2401 | 0 | } |
2402 | | |
2403 | 0 | StringRef CallOp::callee() { |
2404 | 0 | auto attr = calleeAttr(); |
2405 | 0 | return attr.getValue(); |
2406 | 0 | } |
2407 | | |
2408 | 0 | void CallOp::calleeAttr(FlatSymbolRefAttr attr) { |
2409 | 0 | this->getOperation()->setAttr("callee", attr); |
2410 | 0 | } |
2411 | | |
2412 | 0 | void CallOp::build(OpBuilder &builder, OperationState &result, FuncOp callee,ValueRange operands ) { |
2413 | 0 | result.addOperands(operands); |
2414 | 0 | result.addAttribute("callee", builder.getSymbolRefAttr(callee)); |
2415 | 0 | result.addTypes(callee.getType().getResults()); |
2416 | 0 | |
2417 | 0 | } |
2418 | | |
2419 | 0 | void CallOp::build(OpBuilder &builder, OperationState &result, SymbolRefAttr callee,ArrayRef<Type> results, ValueRange operands ) { |
2420 | 0 | result.addOperands(operands); |
2421 | 0 | result.addAttribute("callee", callee); |
2422 | 0 | result.addTypes(results); |
2423 | 0 | |
2424 | 0 | } |
2425 | | |
2426 | 0 | void CallOp::build(OpBuilder &builder, OperationState &result, StringRef callee,ArrayRef<Type> results, ValueRange operands ) { |
2427 | 0 | build(builder, result, builder.getSymbolRefAttr(callee), results, |
2428 | 0 | operands); |
2429 | 0 | |
2430 | 0 | } |
2431 | | |
2432 | 0 | void CallOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultType0, FlatSymbolRefAttr callee, ValueRange operands) { |
2433 | 0 | odsState.addOperands(operands); |
2434 | 0 | odsState.addAttribute("callee", callee); |
2435 | 0 | odsState.addTypes(resultType0); |
2436 | 0 | } |
2437 | | |
2438 | 0 | void CallOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultType0, StringRef callee, ValueRange operands) { |
2439 | 0 | odsState.addOperands(operands); |
2440 | 0 | odsState.addAttribute("callee", odsBuilder.getSymbolRefAttr(callee)); |
2441 | 0 | odsState.addTypes(resultType0); |
2442 | 0 | } |
2443 | | |
2444 | 0 | void CallOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
2445 | 0 | odsState.addOperands(operands); |
2446 | 0 | odsState.addAttributes(attributes); |
2447 | 0 | odsState.addTypes(resultTypes); |
2448 | 0 | } |
2449 | | |
2450 | 0 | LogicalResult CallOp::verify() { |
2451 | 0 | auto tblgen_callee = this->getAttr("callee"); |
2452 | 0 | if (!tblgen_callee) return emitOpError("requires attribute 'callee'"); |
2453 | 0 | { |
2454 | 0 | if (!((tblgen_callee.isa<FlatSymbolRefAttr>()))) return emitOpError("attribute 'callee' failed to satisfy constraint: flat symbol reference attribute"); |
2455 | 0 | } |
2456 | 0 | { |
2457 | 0 | unsigned index = 0; (void)index; |
2458 | 0 | auto valueGroup0 = getODSOperands(0); |
2459 | 0 | for (Value v : valueGroup0) { |
2460 | 0 | (void)v; |
2461 | 0 | if (!((true))) { |
2462 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
2463 | 0 | } |
2464 | 0 | ++index; |
2465 | 0 | } |
2466 | 0 | } |
2467 | 0 | { |
2468 | 0 | unsigned index = 0; (void)index; |
2469 | 0 | auto valueGroup0 = getODSResults(0); |
2470 | 0 | for (Value v : valueGroup0) { |
2471 | 0 | (void)v; |
2472 | 0 | if (!((true))) { |
2473 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
2474 | 0 | } |
2475 | 0 | ++index; |
2476 | 0 | } |
2477 | 0 | } |
2478 | 0 | return ::verify(*this); |
2479 | 0 | } |
2480 | | |
2481 | 0 | ParseResult CallOp::parse(OpAsmParser &parser, OperationState &result) { |
2482 | 0 | SmallVector<OpAsmParser::OperandType, 4> operandsOperands; |
2483 | 0 | llvm::SMLoc operandsOperandsLoc = parser.getCurrentLocation(); |
2484 | 0 | (void)operandsOperandsLoc; |
2485 | 0 | ArrayRef<Type> operandsTypes; |
2486 | 0 | ArrayRef<Type> allResultTypes; |
2487 | 0 |
|
2488 | 0 | FlatSymbolRefAttr calleeAttr; |
2489 | 0 | if (parser.parseAttribute(calleeAttr, parser.getBuilder().getType<NoneType>(), "callee", result.attributes)) |
2490 | 0 | return failure(); |
2491 | 0 | if (parser.parseLParen()) |
2492 | 0 | return failure(); |
2493 | 0 | |
2494 | 0 | if (parser.parseOperandList(operandsOperands)) |
2495 | 0 | return failure(); |
2496 | 0 | if (parser.parseRParen()) |
2497 | 0 | return failure(); |
2498 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
2499 | 0 | return failure(); |
2500 | 0 | if (parser.parseColon()) |
2501 | 0 | return failure(); |
2502 | 0 | |
2503 | 0 | FunctionType operands__allResult_functionType; |
2504 | 0 | if (parser.parseType(operands__allResult_functionType)) |
2505 | 0 | return failure(); |
2506 | 0 | operandsTypes = operands__allResult_functionType.getInputs(); |
2507 | 0 | allResultTypes = operands__allResult_functionType.getResults(); |
2508 | 0 | result.addTypes(allResultTypes); |
2509 | 0 | if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) |
2510 | 0 | return failure(); |
2511 | 0 | return success(); |
2512 | 0 | } |
2513 | | |
2514 | 0 | void CallOp::print(OpAsmPrinter &p) { |
2515 | 0 | p << "call"; |
2516 | 0 | p << " "; |
2517 | 0 | p.printAttributeWithoutType(calleeAttr()); |
2518 | 0 | p << "("; |
2519 | 0 | p << operands(); |
2520 | 0 | p << ")"; |
2521 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"callee"}); |
2522 | 0 | p << " " << ":"; |
2523 | 0 | p << " "; |
2524 | 0 | p.printFunctionalType(operands().getTypes(), getOperation()->getResultTypes()); |
2525 | 0 | } |
2526 | | |
2527 | | |
2528 | | //===----------------------------------------------------------------------===// |
2529 | | // CeilFOp definitions |
2530 | | //===----------------------------------------------------------------------===// |
2531 | | |
2532 | 0 | CeilFOpOperandAdaptor::CeilFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
2533 | 0 |
|
2534 | 0 | } |
2535 | | |
2536 | 0 | CeilFOpOperandAdaptor::CeilFOpOperandAdaptor(CeilFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
2537 | 0 |
|
2538 | 0 | } |
2539 | | |
2540 | 0 | std::pair<unsigned, unsigned> CeilFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
2541 | 0 | return {index, 1}; |
2542 | 0 | } |
2543 | | |
2544 | 0 | ValueRange CeilFOpOperandAdaptor::getODSOperands(unsigned index) { |
2545 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2546 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
2547 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
2548 | 0 | } |
2549 | | |
2550 | 0 | Value CeilFOpOperandAdaptor::operand() { |
2551 | 0 | return *getODSOperands(0).begin(); |
2552 | 0 | } |
2553 | | |
2554 | 0 | StringRef CeilFOp::getOperationName() { |
2555 | 0 | return "std.ceilf"; |
2556 | 0 | } |
2557 | | |
2558 | 0 | std::pair<unsigned, unsigned> CeilFOp::getODSOperandIndexAndLength(unsigned index) { |
2559 | 0 | return {index, 1}; |
2560 | 0 | } |
2561 | | |
2562 | 0 | Operation::operand_range CeilFOp::getODSOperands(unsigned index) { |
2563 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2564 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
2565 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
2566 | 0 | } |
2567 | | |
2568 | 0 | Value CeilFOp::operand() { |
2569 | 0 | return *getODSOperands(0).begin(); |
2570 | 0 | } |
2571 | | |
2572 | 0 | ::mlir::MutableOperandRange CeilFOp::operandMutable() { |
2573 | 0 | auto range = getODSOperandIndexAndLength(0); |
2574 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2575 | 0 | } |
2576 | | |
2577 | 0 | std::pair<unsigned, unsigned> CeilFOp::getODSResultIndexAndLength(unsigned index) { |
2578 | 0 | return {index, 1}; |
2579 | 0 | } |
2580 | | |
2581 | 0 | Operation::result_range CeilFOp::getODSResults(unsigned index) { |
2582 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
2583 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
2584 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
2585 | 0 | } |
2586 | | |
2587 | 0 | void CeilFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
2588 | 0 | odsState.addOperands(operand); |
2589 | 0 | odsState.addTypes(resultType0); |
2590 | 0 | } |
2591 | | |
2592 | 0 | void CeilFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
2593 | 0 | odsState.addOperands(operand); |
2594 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
2595 | 0 | odsState.addTypes(resultTypes); |
2596 | 0 | } |
2597 | | |
2598 | 0 | void CeilFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
2599 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
2600 | 0 | odsState.addOperands(operands); |
2601 | 0 | odsState.addAttributes(attributes); |
2602 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
2603 | 0 | odsState.addTypes(resultTypes); |
2604 | 0 | } |
2605 | | |
2606 | 0 | void CeilFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
2607 | 0 | odsState.addOperands(operand); |
2608 | 0 | odsState.addTypes({operand.getType()}); |
2609 | 0 |
|
2610 | 0 | } |
2611 | | |
2612 | 0 | void CeilFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
2613 | 0 | odsState.addOperands(operands); |
2614 | 0 | odsState.addAttributes(attributes); |
2615 | 0 | odsState.addTypes({operands[0].getType()}); |
2616 | 0 |
|
2617 | 0 | } |
2618 | | |
2619 | 0 | ParseResult CeilFOp::parse(OpAsmParser &parser, OperationState &result) { |
2620 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
2621 | 0 | } |
2622 | | |
2623 | 0 | void CeilFOp::print(OpAsmPrinter &p) { |
2624 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
2625 | 0 | } |
2626 | | |
2627 | 0 | LogicalResult CeilFOp::verify() { |
2628 | 0 | { |
2629 | 0 | unsigned index = 0; (void)index; |
2630 | 0 | auto valueGroup0 = getODSOperands(0); |
2631 | 0 | for (Value v : valueGroup0) { |
2632 | 0 | (void)v; |
2633 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
2634 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
2635 | 0 | } |
2636 | 0 | ++index; |
2637 | 0 | } |
2638 | 0 | } |
2639 | 0 | { |
2640 | 0 | unsigned index = 0; (void)index; |
2641 | 0 | auto valueGroup0 = getODSResults(0); |
2642 | 0 | for (Value v : valueGroup0) { |
2643 | 0 | (void)v; |
2644 | 0 | if (!((true))) { |
2645 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
2646 | 0 | } |
2647 | 0 | ++index; |
2648 | 0 | } |
2649 | 0 | } |
2650 | 0 | return mlir::success(); |
2651 | 0 | } |
2652 | | |
2653 | 0 | void CeilFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
2654 | 0 |
|
2655 | 0 | } |
2656 | | |
2657 | | |
2658 | | //===----------------------------------------------------------------------===// |
2659 | | // CmpFOp definitions |
2660 | | //===----------------------------------------------------------------------===// |
2661 | | |
2662 | 0 | CmpFOpOperandAdaptor::CmpFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
2663 | 0 |
|
2664 | 0 | } |
2665 | | |
2666 | 0 | CmpFOpOperandAdaptor::CmpFOpOperandAdaptor(CmpFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
2667 | 0 |
|
2668 | 0 | } |
2669 | | |
2670 | 0 | std::pair<unsigned, unsigned> CmpFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
2671 | 0 | return {index, 1}; |
2672 | 0 | } |
2673 | | |
2674 | 0 | ValueRange CmpFOpOperandAdaptor::getODSOperands(unsigned index) { |
2675 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2676 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
2677 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
2678 | 0 | } |
2679 | | |
2680 | 0 | Value CmpFOpOperandAdaptor::lhs() { |
2681 | 0 | return *getODSOperands(0).begin(); |
2682 | 0 | } |
2683 | | |
2684 | 0 | Value CmpFOpOperandAdaptor::rhs() { |
2685 | 0 | return *getODSOperands(1).begin(); |
2686 | 0 | } |
2687 | | |
2688 | 0 | IntegerAttr CmpFOpOperandAdaptor::predicate() { |
2689 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
2690 | 0 | IntegerAttr attr = odsAttrs.get("predicate").cast<IntegerAttr>(); |
2691 | 0 | return attr; |
2692 | 0 | } |
2693 | | |
2694 | 0 | StringRef CmpFOp::getOperationName() { |
2695 | 0 | return "std.cmpf"; |
2696 | 0 | } |
2697 | | |
2698 | 0 | std::pair<unsigned, unsigned> CmpFOp::getODSOperandIndexAndLength(unsigned index) { |
2699 | 0 | return {index, 1}; |
2700 | 0 | } |
2701 | | |
2702 | 0 | Operation::operand_range CmpFOp::getODSOperands(unsigned index) { |
2703 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2704 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
2705 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
2706 | 0 | } |
2707 | | |
2708 | 0 | Value CmpFOp::lhs() { |
2709 | 0 | return *getODSOperands(0).begin(); |
2710 | 0 | } |
2711 | | |
2712 | 0 | Value CmpFOp::rhs() { |
2713 | 0 | return *getODSOperands(1).begin(); |
2714 | 0 | } |
2715 | | |
2716 | 0 | ::mlir::MutableOperandRange CmpFOp::lhsMutable() { |
2717 | 0 | auto range = getODSOperandIndexAndLength(0); |
2718 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2719 | 0 | } |
2720 | | |
2721 | 0 | ::mlir::MutableOperandRange CmpFOp::rhsMutable() { |
2722 | 0 | auto range = getODSOperandIndexAndLength(1); |
2723 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2724 | 0 | } |
2725 | | |
2726 | 0 | std::pair<unsigned, unsigned> CmpFOp::getODSResultIndexAndLength(unsigned index) { |
2727 | 0 | return {index, 1}; |
2728 | 0 | } |
2729 | | |
2730 | 0 | Operation::result_range CmpFOp::getODSResults(unsigned index) { |
2731 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
2732 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
2733 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
2734 | 0 | } |
2735 | | |
2736 | 0 | Value CmpFOp::result() { |
2737 | 0 | return *getODSResults(0).begin(); |
2738 | 0 | } |
2739 | | |
2740 | 0 | IntegerAttr CmpFOp::predicateAttr() { |
2741 | 0 | return this->getAttr("predicate").cast<IntegerAttr>(); |
2742 | 0 | } |
2743 | | |
2744 | 0 | ::mlir::CmpFPredicate CmpFOp::predicate() { |
2745 | 0 | auto attr = predicateAttr(); |
2746 | 0 | return static_cast<::mlir::CmpFPredicate>(attr.getInt()); |
2747 | 0 | } |
2748 | | |
2749 | 0 | void CmpFOp::predicateAttr(IntegerAttr attr) { |
2750 | 0 | this->getOperation()->setAttr("predicate", attr); |
2751 | 0 | } |
2752 | | |
2753 | 0 | void CmpFOp::build(OpBuilder &builder, OperationState &result, CmpFPredicate predicate,Value lhs, Value rhs) { |
2754 | 0 | ::buildCmpFOp(builder, result, predicate, lhs, rhs); |
2755 | 0 | |
2756 | 0 | } |
2757 | | |
2758 | 0 | void CmpFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr predicate, Value lhs, Value rhs) { |
2759 | 0 | odsState.addOperands(lhs); |
2760 | 0 | odsState.addOperands(rhs); |
2761 | 0 | odsState.addAttribute("predicate", predicate); |
2762 | 0 | odsState.addTypes(result); |
2763 | 0 | } |
2764 | | |
2765 | 0 | void CmpFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr predicate, Value lhs, Value rhs) { |
2766 | 0 | odsState.addOperands(lhs); |
2767 | 0 | odsState.addOperands(rhs); |
2768 | 0 | odsState.addAttribute("predicate", predicate); |
2769 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
2770 | 0 | odsState.addTypes(resultTypes); |
2771 | 0 | } |
2772 | | |
2773 | 0 | void CmpFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::CmpFPredicate predicate, Value lhs, Value rhs) { |
2774 | 0 | odsState.addOperands(lhs); |
2775 | 0 | odsState.addOperands(rhs); |
2776 | 0 | odsState.addAttribute("predicate", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(predicate))); |
2777 | 0 | odsState.addTypes(result); |
2778 | 0 | } |
2779 | | |
2780 | 0 | void CmpFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::CmpFPredicate predicate, Value lhs, Value rhs) { |
2781 | 0 | odsState.addOperands(lhs); |
2782 | 0 | odsState.addOperands(rhs); |
2783 | 0 | odsState.addAttribute("predicate", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(predicate))); |
2784 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
2785 | 0 | odsState.addTypes(resultTypes); |
2786 | 0 | } |
2787 | | |
2788 | 0 | void CmpFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
2789 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
2790 | 0 | odsState.addOperands(operands); |
2791 | 0 | odsState.addAttributes(attributes); |
2792 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
2793 | 0 | odsState.addTypes(resultTypes); |
2794 | 0 | } |
2795 | | |
2796 | 0 | LogicalResult CmpFOp::verify() { |
2797 | 0 | auto tblgen_predicate = this->getAttr("predicate"); |
2798 | 0 | if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); |
2799 | 0 | { |
2800 | 0 | if (!((((tblgen_predicate.isa<IntegerAttr>())) && ((tblgen_predicate.cast<IntegerAttr>().getType().isSignlessInteger(64)))) && (((tblgen_predicate.cast<IntegerAttr>().getInt() == 0)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 1)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 2)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 3)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 4)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 5)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 6)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 7)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 8)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 9)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 10)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 11)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 12)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 13)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 14)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 15))))) return emitOpError("attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15"); |
2801 | 0 | } |
2802 | 0 | { |
2803 | 0 | unsigned index = 0; (void)index; |
2804 | 0 | auto valueGroup0 = getODSOperands(0); |
2805 | 0 | for (Value v : valueGroup0) { |
2806 | 0 | (void)v; |
2807 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
2808 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
2809 | 0 | } |
2810 | 0 | ++index; |
2811 | 0 | } |
2812 | 0 | auto valueGroup1 = getODSOperands(1); |
2813 | 0 | for (Value v : valueGroup1) { |
2814 | 0 | (void)v; |
2815 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
2816 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
2817 | 0 | } |
2818 | 0 | ++index; |
2819 | 0 | } |
2820 | 0 | } |
2821 | 0 | { |
2822 | 0 | unsigned index = 0; (void)index; |
2823 | 0 | auto valueGroup0 = getODSResults(0); |
2824 | 0 | for (Value v : valueGroup0) { |
2825 | 0 | (void)v; |
2826 | 0 | if (!(((v.getType().isSignlessInteger(1))) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))))) { |
2827 | 0 | return emitOpError("result #") << index << " must be bool-like, but got " << v.getType(); |
2828 | 0 | } |
2829 | 0 | ++index; |
2830 | 0 | } |
2831 | 0 | } |
2832 | 0 | if (!((getI1SameShape((*this->getODSOperands(0).begin()).getType()) == (*this->getODSResults(0).begin()).getType()))) { |
2833 | 0 | return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); |
2834 | 0 | } |
2835 | 0 | return success(); |
2836 | 0 | } |
2837 | | |
2838 | | |
2839 | | |
2840 | 0 | ParseResult CmpFOp::parse(OpAsmParser &parser, OperationState &result) { |
2841 | 0 | OpAsmParser::OperandType lhsRawOperands[1]; |
2842 | 0 | ArrayRef<OpAsmParser::OperandType> lhsOperands(lhsRawOperands); llvm::SMLoc lhsOperandsLoc = parser.getCurrentLocation(); |
2843 | 0 | (void)lhsOperandsLoc; |
2844 | 0 | OpAsmParser::OperandType rhsRawOperands[1]; |
2845 | 0 | ArrayRef<OpAsmParser::OperandType> rhsOperands(rhsRawOperands); llvm::SMLoc rhsOperandsLoc = parser.getCurrentLocation(); |
2846 | 0 | (void)rhsOperandsLoc; |
2847 | 0 | Type lhsRawTypes[1]; |
2848 | 0 | ArrayRef<Type> lhsTypes(lhsRawTypes); |
2849 | 0 |
|
2850 | 0 | { |
2851 | 0 | StringAttr attrVal; |
2852 | 0 | NamedAttrList attrStorage; |
2853 | 0 | auto loc = parser.getCurrentLocation(); |
2854 | 0 | if (parser.parseAttribute(attrVal, parser.getBuilder().getNoneType(), |
2855 | 0 | "predicate", attrStorage)) |
2856 | 0 | return failure(); |
2857 | 0 | |
2858 | 0 | auto attrOptional = ::mlir::symbolizeCmpFPredicate(attrVal.getValue()); |
2859 | 0 | if (!attrOptional) |
2860 | 0 | return parser.emitError(loc, "invalid ") |
2861 | 0 | << "predicate attribute specification: " << attrVal; |
2862 | 0 | |
2863 | 0 | result.addAttribute("predicate", parser.getBuilder().getI64IntegerAttr(static_cast<int64_t>(attrOptional.getValue()))); |
2864 | 0 | } |
2865 | 0 | if (parser.parseComma()) |
2866 | 0 | return failure(); |
2867 | 0 | |
2868 | 0 | if (parser.parseOperand(lhsRawOperands[0])) |
2869 | 0 | return failure(); |
2870 | 0 | if (parser.parseComma()) |
2871 | 0 | return failure(); |
2872 | 0 | |
2873 | 0 | if (parser.parseOperand(rhsRawOperands[0])) |
2874 | 0 | return failure(); |
2875 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
2876 | 0 | return failure(); |
2877 | 0 | if (parser.parseColon()) |
2878 | 0 | return failure(); |
2879 | 0 | |
2880 | 0 | if (parser.parseType(lhsRawTypes[0])) |
2881 | 0 | return failure(); |
2882 | 0 | for (Type type : lhsTypes) { |
2883 | 0 | (void)type; |
2884 | 0 | if (!(((type.isa<FloatType>())) || (((type.isa<VectorType>())) && ((type.cast<ShapedType>().getElementType().isa<FloatType>()))) || (((type.isa<TensorType>())) && ((type.cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
2885 | 0 | return parser.emitError(parser.getNameLoc()) << "'lhs' must be floating-point-like, but got " << type; |
2886 | 0 | } |
2887 | 0 | } |
2888 | 0 | result.addTypes(getI1SameShape(lhsTypes[0])); |
2889 | 0 | if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) |
2890 | 0 | return failure(); |
2891 | 0 | if (parser.resolveOperands(rhsOperands, lhsTypes, rhsOperandsLoc, result.operands)) |
2892 | 0 | return failure(); |
2893 | 0 | return success(); |
2894 | 0 | } |
2895 | | |
2896 | 0 | void CmpFOp::print(OpAsmPrinter &p) { |
2897 | 0 | p << "cmpf"; |
2898 | 0 | p << " "; |
2899 | 0 | p << "\"" << stringifyCmpFPredicate(predicate()) << "\""; |
2900 | 0 | p << ","; |
2901 | 0 | p << " "; |
2902 | 0 | p << lhs(); |
2903 | 0 | p << ","; |
2904 | 0 | p << " "; |
2905 | 0 | p << rhs(); |
2906 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"predicate"}); |
2907 | 0 | p << " " << ":"; |
2908 | 0 | p << " "; |
2909 | 0 | p << ArrayRef<Type>(lhs().getType()); |
2910 | 0 | } |
2911 | | |
2912 | 0 | void CmpFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
2913 | 0 |
|
2914 | 0 | } |
2915 | | |
2916 | | |
2917 | | //===----------------------------------------------------------------------===// |
2918 | | // CmpIOp definitions |
2919 | | //===----------------------------------------------------------------------===// |
2920 | | |
2921 | 0 | CmpIOpOperandAdaptor::CmpIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
2922 | 0 |
|
2923 | 0 | } |
2924 | | |
2925 | 0 | CmpIOpOperandAdaptor::CmpIOpOperandAdaptor(CmpIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
2926 | 0 |
|
2927 | 0 | } |
2928 | | |
2929 | 0 | std::pair<unsigned, unsigned> CmpIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
2930 | 0 | return {index, 1}; |
2931 | 0 | } |
2932 | | |
2933 | 0 | ValueRange CmpIOpOperandAdaptor::getODSOperands(unsigned index) { |
2934 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2935 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
2936 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
2937 | 0 | } |
2938 | | |
2939 | 0 | Value CmpIOpOperandAdaptor::lhs() { |
2940 | 0 | return *getODSOperands(0).begin(); |
2941 | 0 | } |
2942 | | |
2943 | 0 | Value CmpIOpOperandAdaptor::rhs() { |
2944 | 0 | return *getODSOperands(1).begin(); |
2945 | 0 | } |
2946 | | |
2947 | 0 | IntegerAttr CmpIOpOperandAdaptor::predicate() { |
2948 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
2949 | 0 | IntegerAttr attr = odsAttrs.get("predicate").cast<IntegerAttr>(); |
2950 | 0 | return attr; |
2951 | 0 | } |
2952 | | |
2953 | 0 | StringRef CmpIOp::getOperationName() { |
2954 | 0 | return "std.cmpi"; |
2955 | 0 | } |
2956 | | |
2957 | 0 | std::pair<unsigned, unsigned> CmpIOp::getODSOperandIndexAndLength(unsigned index) { |
2958 | 0 | return {index, 1}; |
2959 | 0 | } |
2960 | | |
2961 | 0 | Operation::operand_range CmpIOp::getODSOperands(unsigned index) { |
2962 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
2963 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
2964 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
2965 | 0 | } |
2966 | | |
2967 | 0 | Value CmpIOp::lhs() { |
2968 | 0 | return *getODSOperands(0).begin(); |
2969 | 0 | } |
2970 | | |
2971 | 0 | Value CmpIOp::rhs() { |
2972 | 0 | return *getODSOperands(1).begin(); |
2973 | 0 | } |
2974 | | |
2975 | 0 | ::mlir::MutableOperandRange CmpIOp::lhsMutable() { |
2976 | 0 | auto range = getODSOperandIndexAndLength(0); |
2977 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2978 | 0 | } |
2979 | | |
2980 | 0 | ::mlir::MutableOperandRange CmpIOp::rhsMutable() { |
2981 | 0 | auto range = getODSOperandIndexAndLength(1); |
2982 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
2983 | 0 | } |
2984 | | |
2985 | 0 | std::pair<unsigned, unsigned> CmpIOp::getODSResultIndexAndLength(unsigned index) { |
2986 | 0 | return {index, 1}; |
2987 | 0 | } |
2988 | | |
2989 | 0 | Operation::result_range CmpIOp::getODSResults(unsigned index) { |
2990 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
2991 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
2992 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
2993 | 0 | } |
2994 | | |
2995 | 0 | Value CmpIOp::result() { |
2996 | 0 | return *getODSResults(0).begin(); |
2997 | 0 | } |
2998 | | |
2999 | 0 | IntegerAttr CmpIOp::predicateAttr() { |
3000 | 0 | return this->getAttr("predicate").cast<IntegerAttr>(); |
3001 | 0 | } |
3002 | | |
3003 | 0 | ::mlir::CmpIPredicate CmpIOp::predicate() { |
3004 | 0 | auto attr = predicateAttr(); |
3005 | 0 | return static_cast<::mlir::CmpIPredicate>(attr.getInt()); |
3006 | 0 | } |
3007 | | |
3008 | 0 | void CmpIOp::predicateAttr(IntegerAttr attr) { |
3009 | 0 | this->getOperation()->setAttr("predicate", attr); |
3010 | 0 | } |
3011 | | |
3012 | 0 | void CmpIOp::build(OpBuilder &builder, OperationState &result, CmpIPredicate predicate,Value lhs, Value rhs) { |
3013 | 0 | ::buildCmpIOp(builder, result, predicate, lhs, rhs); |
3014 | 0 | |
3015 | 0 | } |
3016 | | |
3017 | 0 | void CmpIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr predicate, Value lhs, Value rhs) { |
3018 | 0 | odsState.addOperands(lhs); |
3019 | 0 | odsState.addOperands(rhs); |
3020 | 0 | odsState.addAttribute("predicate", predicate); |
3021 | 0 | odsState.addTypes(result); |
3022 | 0 | } |
3023 | | |
3024 | 0 | void CmpIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr predicate, Value lhs, Value rhs) { |
3025 | 0 | odsState.addOperands(lhs); |
3026 | 0 | odsState.addOperands(rhs); |
3027 | 0 | odsState.addAttribute("predicate", predicate); |
3028 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3029 | 0 | odsState.addTypes(resultTypes); |
3030 | 0 | } |
3031 | | |
3032 | 0 | void CmpIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::CmpIPredicate predicate, Value lhs, Value rhs) { |
3033 | 0 | odsState.addOperands(lhs); |
3034 | 0 | odsState.addOperands(rhs); |
3035 | 0 | odsState.addAttribute("predicate", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(predicate))); |
3036 | 0 | odsState.addTypes(result); |
3037 | 0 | } |
3038 | | |
3039 | 0 | void CmpIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::CmpIPredicate predicate, Value lhs, Value rhs) { |
3040 | 0 | odsState.addOperands(lhs); |
3041 | 0 | odsState.addOperands(rhs); |
3042 | 0 | odsState.addAttribute("predicate", odsBuilder.getI64IntegerAttr(static_cast<int64_t>(predicate))); |
3043 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3044 | 0 | odsState.addTypes(resultTypes); |
3045 | 0 | } |
3046 | | |
3047 | 0 | void CmpIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3048 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
3049 | 0 | odsState.addOperands(operands); |
3050 | 0 | odsState.addAttributes(attributes); |
3051 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
3052 | 0 | odsState.addTypes(resultTypes); |
3053 | 0 | } |
3054 | | |
3055 | 0 | LogicalResult CmpIOp::verify() { |
3056 | 0 | auto tblgen_predicate = this->getAttr("predicate"); |
3057 | 0 | if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'"); |
3058 | 0 | { |
3059 | 0 | if (!((((tblgen_predicate.isa<IntegerAttr>())) && ((tblgen_predicate.cast<IntegerAttr>().getType().isSignlessInteger(64)))) && (((tblgen_predicate.cast<IntegerAttr>().getInt() == 0)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 1)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 2)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 3)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 4)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 5)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 6)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 7)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 8)) || ((tblgen_predicate.cast<IntegerAttr>().getInt() == 9))))) return emitOpError("attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9"); |
3060 | 0 | } |
3061 | 0 | { |
3062 | 0 | unsigned index = 0; (void)index; |
3063 | 0 | auto valueGroup0 = getODSOperands(0); |
3064 | 0 | for (Value v : valueGroup0) { |
3065 | 0 | (void)v; |
3066 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
3067 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
3068 | 0 | } |
3069 | 0 | ++index; |
3070 | 0 | } |
3071 | 0 | auto valueGroup1 = getODSOperands(1); |
3072 | 0 | for (Value v : valueGroup1) { |
3073 | 0 | (void)v; |
3074 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
3075 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
3076 | 0 | } |
3077 | 0 | ++index; |
3078 | 0 | } |
3079 | 0 | } |
3080 | 0 | { |
3081 | 0 | unsigned index = 0; (void)index; |
3082 | 0 | auto valueGroup0 = getODSResults(0); |
3083 | 0 | for (Value v : valueGroup0) { |
3084 | 0 | (void)v; |
3085 | 0 | if (!(((v.getType().isSignlessInteger(1))) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))))) { |
3086 | 0 | return emitOpError("result #") << index << " must be bool-like, but got " << v.getType(); |
3087 | 0 | } |
3088 | 0 | ++index; |
3089 | 0 | } |
3090 | 0 | } |
3091 | 0 | if (!((getI1SameShape((*this->getODSOperands(0).begin()).getType()) == (*this->getODSResults(0).begin()).getType()))) { |
3092 | 0 | return emitOpError("failed to verify that result type has i1 element type and same shape as operands"); |
3093 | 0 | } |
3094 | 0 | return success(); |
3095 | 0 | } |
3096 | | |
3097 | | |
3098 | | |
3099 | 0 | ParseResult CmpIOp::parse(OpAsmParser &parser, OperationState &result) { |
3100 | 0 | OpAsmParser::OperandType lhsRawOperands[1]; |
3101 | 0 | ArrayRef<OpAsmParser::OperandType> lhsOperands(lhsRawOperands); llvm::SMLoc lhsOperandsLoc = parser.getCurrentLocation(); |
3102 | 0 | (void)lhsOperandsLoc; |
3103 | 0 | OpAsmParser::OperandType rhsRawOperands[1]; |
3104 | 0 | ArrayRef<OpAsmParser::OperandType> rhsOperands(rhsRawOperands); llvm::SMLoc rhsOperandsLoc = parser.getCurrentLocation(); |
3105 | 0 | (void)rhsOperandsLoc; |
3106 | 0 | Type lhsRawTypes[1]; |
3107 | 0 | ArrayRef<Type> lhsTypes(lhsRawTypes); |
3108 | 0 |
|
3109 | 0 | { |
3110 | 0 | StringAttr attrVal; |
3111 | 0 | NamedAttrList attrStorage; |
3112 | 0 | auto loc = parser.getCurrentLocation(); |
3113 | 0 | if (parser.parseAttribute(attrVal, parser.getBuilder().getNoneType(), |
3114 | 0 | "predicate", attrStorage)) |
3115 | 0 | return failure(); |
3116 | 0 | |
3117 | 0 | auto attrOptional = ::mlir::symbolizeCmpIPredicate(attrVal.getValue()); |
3118 | 0 | if (!attrOptional) |
3119 | 0 | return parser.emitError(loc, "invalid ") |
3120 | 0 | << "predicate attribute specification: " << attrVal; |
3121 | 0 | |
3122 | 0 | result.addAttribute("predicate", parser.getBuilder().getI64IntegerAttr(static_cast<int64_t>(attrOptional.getValue()))); |
3123 | 0 | } |
3124 | 0 | if (parser.parseComma()) |
3125 | 0 | return failure(); |
3126 | 0 | |
3127 | 0 | if (parser.parseOperand(lhsRawOperands[0])) |
3128 | 0 | return failure(); |
3129 | 0 | if (parser.parseComma()) |
3130 | 0 | return failure(); |
3131 | 0 | |
3132 | 0 | if (parser.parseOperand(rhsRawOperands[0])) |
3133 | 0 | return failure(); |
3134 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
3135 | 0 | return failure(); |
3136 | 0 | if (parser.parseColon()) |
3137 | 0 | return failure(); |
3138 | 0 | |
3139 | 0 | if (parser.parseType(lhsRawTypes[0])) |
3140 | 0 | return failure(); |
3141 | 0 | for (Type type : lhsTypes) { |
3142 | 0 | (void)type; |
3143 | 0 | if (!(((type.isSignlessInteger())) || ((type.isa<IndexType>())) || (((type.isa<VectorType>())) && ((type.cast<ShapedType>().getElementType().isSignlessInteger()))) || (((type.isa<TensorType>())) && ((type.cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
3144 | 0 | return parser.emitError(parser.getNameLoc()) << "'lhs' must be signless-integer-like, but got " << type; |
3145 | 0 | } |
3146 | 0 | } |
3147 | 0 | result.addTypes(getI1SameShape(lhsTypes[0])); |
3148 | 0 | if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands)) |
3149 | 0 | return failure(); |
3150 | 0 | if (parser.resolveOperands(rhsOperands, lhsTypes, rhsOperandsLoc, result.operands)) |
3151 | 0 | return failure(); |
3152 | 0 | return success(); |
3153 | 0 | } |
3154 | | |
3155 | 0 | void CmpIOp::print(OpAsmPrinter &p) { |
3156 | 0 | p << "cmpi"; |
3157 | 0 | p << " "; |
3158 | 0 | p << "\"" << stringifyCmpIPredicate(predicate()) << "\""; |
3159 | 0 | p << ","; |
3160 | 0 | p << " "; |
3161 | 0 | p << lhs(); |
3162 | 0 | p << ","; |
3163 | 0 | p << " "; |
3164 | 0 | p << rhs(); |
3165 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"predicate"}); |
3166 | 0 | p << " " << ":"; |
3167 | 0 | p << " "; |
3168 | 0 | p << ArrayRef<Type>(lhs().getType()); |
3169 | 0 | } |
3170 | | |
3171 | 0 | void CmpIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
3172 | 0 |
|
3173 | 0 | } |
3174 | | |
3175 | | |
3176 | | //===----------------------------------------------------------------------===// |
3177 | | // CondBranchOp definitions |
3178 | | //===----------------------------------------------------------------------===// |
3179 | | |
3180 | 0 | CondBranchOpOperandAdaptor::CondBranchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs) : odsOperands(values), odsAttrs(attrs) { |
3181 | 0 |
|
3182 | 0 | } |
3183 | | |
3184 | 0 | CondBranchOpOperandAdaptor::CondBranchOpOperandAdaptor(CondBranchOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
3185 | 0 |
|
3186 | 0 | } |
3187 | | |
3188 | 0 | std::pair<unsigned, unsigned> CondBranchOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
3189 | 0 | assert(odsAttrs && "missing segment size attribute for op"); |
3190 | 0 | auto sizeAttr = odsAttrs.get("operand_segment_sizes").cast<DenseIntElementsAttr>(); |
3191 | 0 |
|
3192 | 0 | unsigned start = 0; |
3193 | 0 | for (unsigned i = 0; i < index; ++i) |
3194 | 0 | start += (*(sizeAttr.begin() + i)).getZExtValue(); |
3195 | 0 | unsigned size = (*(sizeAttr.begin() + index)).getZExtValue(); |
3196 | 0 | return {start, size}; |
3197 | 0 | } |
3198 | | |
3199 | 0 | ValueRange CondBranchOpOperandAdaptor::getODSOperands(unsigned index) { |
3200 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3201 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
3202 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
3203 | 0 | } |
3204 | | |
3205 | 0 | Value CondBranchOpOperandAdaptor::condition() { |
3206 | 0 | return *getODSOperands(0).begin(); |
3207 | 0 | } |
3208 | | |
3209 | 0 | ValueRange CondBranchOpOperandAdaptor::trueDestOperands() { |
3210 | 0 | return getODSOperands(1); |
3211 | 0 | } |
3212 | | |
3213 | 0 | ValueRange CondBranchOpOperandAdaptor::falseDestOperands() { |
3214 | 0 | return getODSOperands(2); |
3215 | 0 | } |
3216 | | |
3217 | 0 | StringRef CondBranchOp::getOperationName() { |
3218 | 0 | return "std.cond_br"; |
3219 | 0 | } |
3220 | | |
3221 | 0 | std::pair<unsigned, unsigned> CondBranchOp::getODSOperandIndexAndLength(unsigned index) { |
3222 | 0 | auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("operand_segment_sizes"); |
3223 | 0 |
|
3224 | 0 | unsigned start = 0; |
3225 | 0 | for (unsigned i = 0; i < index; ++i) |
3226 | 0 | start += (*(sizeAttr.begin() + i)).getZExtValue(); |
3227 | 0 | unsigned size = (*(sizeAttr.begin() + index)).getZExtValue(); |
3228 | 0 | return {start, size}; |
3229 | 0 | } |
3230 | | |
3231 | 0 | Operation::operand_range CondBranchOp::getODSOperands(unsigned index) { |
3232 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3233 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
3234 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
3235 | 0 | } |
3236 | | |
3237 | 0 | Value CondBranchOp::condition() { |
3238 | 0 | return *getODSOperands(0).begin(); |
3239 | 0 | } |
3240 | | |
3241 | 0 | Operation::operand_range CondBranchOp::trueDestOperands() { |
3242 | 0 | return getODSOperands(1); |
3243 | 0 | } |
3244 | | |
3245 | 0 | Operation::operand_range CondBranchOp::falseDestOperands() { |
3246 | 0 | return getODSOperands(2); |
3247 | 0 | } |
3248 | | |
3249 | 0 | ::mlir::MutableOperandRange CondBranchOp::conditionMutable() { |
3250 | 0 | auto range = getODSOperandIndexAndLength(0); |
3251 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
3252 | 0 | } |
3253 | | |
3254 | 0 | ::mlir::MutableOperandRange CondBranchOp::trueDestOperandsMutable() { |
3255 | 0 | auto range = getODSOperandIndexAndLength(1); |
3256 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
3257 | 0 | } |
3258 | | |
3259 | 0 | ::mlir::MutableOperandRange CondBranchOp::falseDestOperandsMutable() { |
3260 | 0 | auto range = getODSOperandIndexAndLength(2); |
3261 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
3262 | 0 | } |
3263 | | |
3264 | 0 | std::pair<unsigned, unsigned> CondBranchOp::getODSResultIndexAndLength(unsigned index) { |
3265 | 0 | return {index, 1}; |
3266 | 0 | } |
3267 | | |
3268 | 0 | Operation::result_range CondBranchOp::getODSResults(unsigned index) { |
3269 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
3270 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
3271 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
3272 | 0 | } |
3273 | | |
3274 | 0 | Block *CondBranchOp::trueDest() { |
3275 | 0 | return this->getOperation()->getSuccessor(0); |
3276 | 0 | } |
3277 | | |
3278 | 0 | Block *CondBranchOp::falseDest() { |
3279 | 0 | return this->getOperation()->getSuccessor(1); |
3280 | 0 | } |
3281 | | |
3282 | 0 | void CondBranchOp::build(OpBuilder &builder, OperationState &result, Value condition,Block *trueDest, ValueRange trueOperands,Block *falseDest, ValueRange falseOperands) { |
3283 | 0 | build(builder, result, condition, trueOperands, falseOperands, trueDest, |
3284 | 0 | falseDest); |
3285 | 0 | |
3286 | 0 | } |
3287 | | |
3288 | 0 | void CondBranchOp::build(OpBuilder &builder, OperationState &result, Value condition,Block *trueDest, Block *falseDest, ValueRange falseOperands ) { |
3289 | 0 | build(builder, result, condition, trueDest, ValueRange(), falseDest, |
3290 | 0 | falseOperands); |
3291 | 0 | |
3292 | 0 | } |
3293 | | |
3294 | 0 | void CondBranchOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value condition, ValueRange trueDestOperands, ValueRange falseDestOperands, Block *trueDest, Block *falseDest) { |
3295 | 0 | odsState.addOperands(condition); |
3296 | 0 | odsState.addOperands(trueDestOperands); |
3297 | 0 | odsState.addOperands(falseDestOperands); |
3298 | 0 | odsState.addAttribute("operand_segment_sizes", odsBuilder.getI32VectorAttr({1, static_cast<int32_t>(trueDestOperands.size()), static_cast<int32_t>(falseDestOperands.size())})); |
3299 | 0 | odsState.addSuccessors(trueDest); |
3300 | 0 | odsState.addSuccessors(falseDest); |
3301 | 0 | } |
3302 | | |
3303 | 0 | void CondBranchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value condition, ValueRange trueDestOperands, ValueRange falseDestOperands, Block *trueDest, Block *falseDest) { |
3304 | 0 | odsState.addOperands(condition); |
3305 | 0 | odsState.addOperands(trueDestOperands); |
3306 | 0 | odsState.addOperands(falseDestOperands); |
3307 | 0 | odsState.addAttribute("operand_segment_sizes", odsBuilder.getI32VectorAttr({1, static_cast<int32_t>(trueDestOperands.size()), static_cast<int32_t>(falseDestOperands.size())})); |
3308 | 0 | odsState.addSuccessors(trueDest); |
3309 | 0 | odsState.addSuccessors(falseDest); |
3310 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
3311 | 0 | odsState.addTypes(resultTypes); |
3312 | 0 | } |
3313 | | |
3314 | 0 | void CondBranchOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3315 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
3316 | 0 | odsState.addOperands(operands); |
3317 | 0 | odsState.addAttributes(attributes); |
3318 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
3319 | 0 | odsState.addTypes(resultTypes); |
3320 | 0 | } |
3321 | | |
3322 | 0 | LogicalResult CondBranchOp::verify() { |
3323 | 0 | { |
3324 | 0 | auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("operand_segment_sizes"); |
3325 | 0 | auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements(); |
3326 | 0 | if (numElements != 3) { |
3327 | 0 | return emitOpError("'operand_segment_sizes' attribute for specifying operand segments " |
3328 | 0 | "must have 3 elements"); |
3329 | 0 | } |
3330 | 0 | } |
3331 | 0 | { |
3332 | 0 | unsigned index = 0; (void)index; |
3333 | 0 | auto valueGroup0 = getODSOperands(0); |
3334 | 0 | for (Value v : valueGroup0) { |
3335 | 0 | (void)v; |
3336 | 0 | if (!((v.getType().isSignlessInteger(1)))) { |
3337 | 0 | return emitOpError("operand #") << index << " must be 1-bit signless integer, but got " << v.getType(); |
3338 | 0 | } |
3339 | 0 | ++index; |
3340 | 0 | } |
3341 | 0 | auto valueGroup1 = getODSOperands(1); |
3342 | 0 | for (Value v : valueGroup1) { |
3343 | 0 | (void)v; |
3344 | 0 | if (!((true))) { |
3345 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
3346 | 0 | } |
3347 | 0 | ++index; |
3348 | 0 | } |
3349 | 0 | auto valueGroup2 = getODSOperands(2); |
3350 | 0 | for (Value v : valueGroup2) { |
3351 | 0 | (void)v; |
3352 | 0 | if (!((true))) { |
3353 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
3354 | 0 | } |
3355 | 0 | ++index; |
3356 | 0 | } |
3357 | 0 | } |
3358 | 0 | { |
3359 | 0 | unsigned index = 0; (void)index; |
3360 | 0 | } |
3361 | 0 | { |
3362 | 0 | unsigned index = 0; (void)index; |
3363 | 0 | } |
3364 | 0 | return mlir::success(); |
3365 | 0 | } |
3366 | | |
3367 | | |
3368 | | |
3369 | | |
3370 | | |
3371 | | |
3372 | | |
3373 | 0 | ParseResult CondBranchOp::parse(OpAsmParser &parser, OperationState &result) { |
3374 | 0 | OpAsmParser::OperandType conditionRawOperands[1]; |
3375 | 0 | ArrayRef<OpAsmParser::OperandType> conditionOperands(conditionRawOperands); llvm::SMLoc conditionOperandsLoc = parser.getCurrentLocation(); |
3376 | 0 | (void)conditionOperandsLoc; |
3377 | 0 | SmallVector<OpAsmParser::OperandType, 4> trueDestOperandsOperands; |
3378 | 0 | llvm::SMLoc trueDestOperandsOperandsLoc = parser.getCurrentLocation(); |
3379 | 0 | (void)trueDestOperandsOperandsLoc; |
3380 | 0 | SmallVector<Type, 1> trueDestOperandsTypes; |
3381 | 0 | SmallVector<OpAsmParser::OperandType, 4> falseDestOperandsOperands; |
3382 | 0 | llvm::SMLoc falseDestOperandsOperandsLoc = parser.getCurrentLocation(); |
3383 | 0 | (void)falseDestOperandsOperandsLoc; |
3384 | 0 | SmallVector<Type, 1> falseDestOperandsTypes; |
3385 | 0 |
|
3386 | 0 | if (parser.parseOperand(conditionRawOperands[0])) |
3387 | 0 | return failure(); |
3388 | 0 | if (parser.parseComma()) |
3389 | 0 | return failure(); |
3390 | 0 | |
3391 | 0 | Block *trueDestSuccessor = nullptr; |
3392 | 0 | if (parser.parseSuccessor(trueDestSuccessor)) |
3393 | 0 | return failure(); |
3394 | 0 | if (succeeded(parser.parseOptionalLParen())) { |
3395 | 0 |
|
3396 | 0 | if (parser.parseOperandList(trueDestOperandsOperands)) |
3397 | 0 | return failure(); |
3398 | 0 | if (parser.parseColon()) |
3399 | 0 | return failure(); |
3400 | 0 | |
3401 | 0 | if (parser.parseTypeList(trueDestOperandsTypes)) |
3402 | 0 | return failure(); |
3403 | 0 | if (parser.parseRParen()) |
3404 | 0 | return failure(); |
3405 | 0 | } |
3406 | 0 | if (parser.parseComma()) |
3407 | 0 | return failure(); |
3408 | 0 | |
3409 | 0 | Block *falseDestSuccessor = nullptr; |
3410 | 0 | if (parser.parseSuccessor(falseDestSuccessor)) |
3411 | 0 | return failure(); |
3412 | 0 | if (succeeded(parser.parseOptionalLParen())) { |
3413 | 0 |
|
3414 | 0 | if (parser.parseOperandList(falseDestOperandsOperands)) |
3415 | 0 | return failure(); |
3416 | 0 | if (parser.parseColon()) |
3417 | 0 | return failure(); |
3418 | 0 | |
3419 | 0 | if (parser.parseTypeList(falseDestOperandsTypes)) |
3420 | 0 | return failure(); |
3421 | 0 | if (parser.parseRParen()) |
3422 | 0 | return failure(); |
3423 | 0 | } |
3424 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
3425 | 0 | return failure(); |
3426 | 0 | Type odsBuildableType0 = parser.getBuilder().getIntegerType(1); |
3427 | 0 | if (parser.resolveOperands(conditionOperands, odsBuildableType0, result.operands)) |
3428 | 0 | return failure(); |
3429 | 0 | if (parser.resolveOperands(trueDestOperandsOperands, trueDestOperandsTypes, trueDestOperandsOperandsLoc, result.operands)) |
3430 | 0 | return failure(); |
3431 | 0 | if (parser.resolveOperands(falseDestOperandsOperands, falseDestOperandsTypes, falseDestOperandsOperandsLoc, result.operands)) |
3432 | 0 | return failure(); |
3433 | 0 | result.addSuccessors(trueDestSuccessor); |
3434 | 0 | result.addSuccessors(falseDestSuccessor); |
3435 | 0 | result.addAttribute("operand_segment_sizes", parser.getBuilder().getI32VectorAttr({1, static_cast<int32_t>(trueDestOperandsOperands.size()), static_cast<int32_t>(falseDestOperandsOperands.size())})); |
3436 | 0 | return success(); |
3437 | 0 | } |
3438 | | |
3439 | 0 | void CondBranchOp::print(OpAsmPrinter &p) { |
3440 | 0 | p << "cond_br"; |
3441 | 0 | p << " "; |
3442 | 0 | p << condition(); |
3443 | 0 | p << ","; |
3444 | 0 | p << " "; |
3445 | 0 | p << trueDest(); |
3446 | 0 | if (!trueDestOperands().empty()) { |
3447 | 0 | p << "("; |
3448 | 0 | p << trueDestOperands(); |
3449 | 0 | p << " " << ":"; |
3450 | 0 | p << " "; |
3451 | 0 | p << trueDestOperands().getTypes(); |
3452 | 0 | p << ")"; |
3453 | 0 | } |
3454 | 0 | p << ","; |
3455 | 0 | p << " "; |
3456 | 0 | p << falseDest(); |
3457 | 0 | if (!falseDestOperands().empty()) { |
3458 | 0 | p << "("; |
3459 | 0 | p << falseDestOperands(); |
3460 | 0 | p << " " << ":"; |
3461 | 0 | p << " "; |
3462 | 0 | p << falseDestOperands().getTypes(); |
3463 | 0 | p << ")"; |
3464 | 0 | } |
3465 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{"operand_segment_sizes", }); |
3466 | 0 | } |
3467 | | |
3468 | 0 | void CondBranchOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
3469 | 0 |
|
3470 | 0 | } |
3471 | | |
3472 | | |
3473 | | //===----------------------------------------------------------------------===// |
3474 | | // ConstantOp definitions |
3475 | | //===----------------------------------------------------------------------===// |
3476 | | |
3477 | 0 | ConstantOpOperandAdaptor::ConstantOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
3478 | 0 |
|
3479 | 0 | } |
3480 | | |
3481 | 0 | ConstantOpOperandAdaptor::ConstantOpOperandAdaptor(ConstantOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
3482 | 0 |
|
3483 | 0 | } |
3484 | | |
3485 | 0 | std::pair<unsigned, unsigned> ConstantOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
3486 | 0 | return {index, 1}; |
3487 | 0 | } |
3488 | | |
3489 | 0 | ValueRange ConstantOpOperandAdaptor::getODSOperands(unsigned index) { |
3490 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3491 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
3492 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
3493 | 0 | } |
3494 | | |
3495 | 0 | Attribute ConstantOpOperandAdaptor::value() { |
3496 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
3497 | 0 | Attribute attr = odsAttrs.get("value").cast<Attribute>(); |
3498 | 0 | return attr; |
3499 | 0 | } |
3500 | | |
3501 | 0 | StringRef ConstantOp::getOperationName() { |
3502 | 0 | return "std.constant"; |
3503 | 0 | } |
3504 | | |
3505 | 0 | std::pair<unsigned, unsigned> ConstantOp::getODSOperandIndexAndLength(unsigned index) { |
3506 | 0 | return {index, 1}; |
3507 | 0 | } |
3508 | | |
3509 | 0 | Operation::operand_range ConstantOp::getODSOperands(unsigned index) { |
3510 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3511 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
3512 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
3513 | 0 | } |
3514 | | |
3515 | 0 | std::pair<unsigned, unsigned> ConstantOp::getODSResultIndexAndLength(unsigned index) { |
3516 | 0 | return {index, 1}; |
3517 | 0 | } |
3518 | | |
3519 | 0 | Operation::result_range ConstantOp::getODSResults(unsigned index) { |
3520 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
3521 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
3522 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
3523 | 0 | } |
3524 | | |
3525 | 0 | Attribute ConstantOp::valueAttr() { |
3526 | 0 | return this->getAttr("value").cast<Attribute>(); |
3527 | 0 | } |
3528 | | |
3529 | 0 | Attribute ConstantOp::value() { |
3530 | 0 | auto attr = valueAttr(); |
3531 | 0 | return attr; |
3532 | 0 | } |
3533 | | |
3534 | 0 | void ConstantOp::valueAttr(Attribute attr) { |
3535 | 0 | this->getOperation()->setAttr("value", attr); |
3536 | 0 | } |
3537 | | |
3538 | 0 | void ConstantOp::build(OpBuilder &builder, OperationState &result, Attribute value) { |
3539 | 0 | build(builder, result, value.getType(), value); |
3540 | 0 | } |
3541 | | |
3542 | 0 | void ConstantOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Attribute value) { |
3543 | 0 | odsState.addAttribute("value", value); |
3544 | 0 | odsState.addTypes(resultType0); |
3545 | 0 | } |
3546 | | |
3547 | 0 | void ConstantOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Attribute value) { |
3548 | 0 | odsState.addAttribute("value", value); |
3549 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3550 | 0 | odsState.addTypes(resultTypes); |
3551 | 0 | } |
3552 | | |
3553 | 0 | void ConstantOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3554 | 0 | assert(operands.size() == 0u && "mismatched number of parameters"); |
3555 | 0 | odsState.addOperands(operands); |
3556 | 0 | odsState.addAttributes(attributes); |
3557 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
3558 | 0 | odsState.addTypes(resultTypes); |
3559 | 0 | } |
3560 | | |
3561 | 0 | ParseResult ConstantOp::parse(OpAsmParser &parser, OperationState &result) { |
3562 | 0 | return ::parseConstantOp(parser, result); |
3563 | 0 | } |
3564 | | |
3565 | 0 | void ConstantOp::print(OpAsmPrinter &p) { |
3566 | 0 | return ::print(p, *this); |
3567 | 0 | } |
3568 | | |
3569 | 0 | LogicalResult ConstantOp::verify() { |
3570 | 0 | auto tblgen_value = this->getAttr("value"); |
3571 | 0 | if (!tblgen_value) return emitOpError("requires attribute 'value'"); |
3572 | 0 | { |
3573 | 0 | if (!((true))) return emitOpError("attribute 'value' failed to satisfy constraint: any attribute"); |
3574 | 0 | } |
3575 | 0 | { |
3576 | 0 | unsigned index = 0; (void)index; |
3577 | 0 | } |
3578 | 0 | { |
3579 | 0 | unsigned index = 0; (void)index; |
3580 | 0 | auto valueGroup0 = getODSResults(0); |
3581 | 0 | for (Value v : valueGroup0) { |
3582 | 0 | (void)v; |
3583 | 0 | if (!((true))) { |
3584 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
3585 | 0 | } |
3586 | 0 | ++index; |
3587 | 0 | } |
3588 | 0 | } |
3589 | 0 | return ::verify(*this); |
3590 | 0 | } |
3591 | | |
3592 | | |
3593 | | |
3594 | | |
3595 | | |
3596 | 0 | void ConstantOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
3597 | 0 |
|
3598 | 0 | } |
3599 | | |
3600 | | |
3601 | | //===----------------------------------------------------------------------===// |
3602 | | // CopySignOp definitions |
3603 | | //===----------------------------------------------------------------------===// |
3604 | | |
3605 | 0 | CopySignOpOperandAdaptor::CopySignOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
3606 | 0 |
|
3607 | 0 | } |
3608 | | |
3609 | 0 | CopySignOpOperandAdaptor::CopySignOpOperandAdaptor(CopySignOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
3610 | 0 |
|
3611 | 0 | } |
3612 | | |
3613 | 0 | std::pair<unsigned, unsigned> CopySignOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
3614 | 0 | return {index, 1}; |
3615 | 0 | } |
3616 | | |
3617 | 0 | ValueRange CopySignOpOperandAdaptor::getODSOperands(unsigned index) { |
3618 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3619 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
3620 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
3621 | 0 | } |
3622 | | |
3623 | 0 | Value CopySignOpOperandAdaptor::lhs() { |
3624 | 0 | return *getODSOperands(0).begin(); |
3625 | 0 | } |
3626 | | |
3627 | 0 | Value CopySignOpOperandAdaptor::rhs() { |
3628 | 0 | return *getODSOperands(1).begin(); |
3629 | 0 | } |
3630 | | |
3631 | 0 | StringRef CopySignOp::getOperationName() { |
3632 | 0 | return "std.copysign"; |
3633 | 0 | } |
3634 | | |
3635 | 0 | std::pair<unsigned, unsigned> CopySignOp::getODSOperandIndexAndLength(unsigned index) { |
3636 | 0 | return {index, 1}; |
3637 | 0 | } |
3638 | | |
3639 | 0 | Operation::operand_range CopySignOp::getODSOperands(unsigned index) { |
3640 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3641 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
3642 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
3643 | 0 | } |
3644 | | |
3645 | 0 | Value CopySignOp::lhs() { |
3646 | 0 | return *getODSOperands(0).begin(); |
3647 | 0 | } |
3648 | | |
3649 | 0 | Value CopySignOp::rhs() { |
3650 | 0 | return *getODSOperands(1).begin(); |
3651 | 0 | } |
3652 | | |
3653 | 0 | ::mlir::MutableOperandRange CopySignOp::lhsMutable() { |
3654 | 0 | auto range = getODSOperandIndexAndLength(0); |
3655 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
3656 | 0 | } |
3657 | | |
3658 | 0 | ::mlir::MutableOperandRange CopySignOp::rhsMutable() { |
3659 | 0 | auto range = getODSOperandIndexAndLength(1); |
3660 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
3661 | 0 | } |
3662 | | |
3663 | 0 | std::pair<unsigned, unsigned> CopySignOp::getODSResultIndexAndLength(unsigned index) { |
3664 | 0 | return {index, 1}; |
3665 | 0 | } |
3666 | | |
3667 | 0 | Operation::result_range CopySignOp::getODSResults(unsigned index) { |
3668 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
3669 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
3670 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
3671 | 0 | } |
3672 | | |
3673 | 0 | void CopySignOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
3674 | 0 | odsState.addOperands(lhs); |
3675 | 0 | odsState.addOperands(rhs); |
3676 | 0 | odsState.addTypes(resultType0); |
3677 | 0 | } |
3678 | | |
3679 | 0 | void CopySignOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
3680 | 0 | odsState.addOperands(lhs); |
3681 | 0 | odsState.addOperands(rhs); |
3682 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3683 | 0 | odsState.addTypes(resultTypes); |
3684 | 0 | } |
3685 | | |
3686 | 0 | void CopySignOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3687 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
3688 | 0 | odsState.addOperands(operands); |
3689 | 0 | odsState.addAttributes(attributes); |
3690 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
3691 | 0 | odsState.addTypes(resultTypes); |
3692 | 0 | } |
3693 | | |
3694 | 0 | void CopySignOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
3695 | 0 | odsState.addOperands(lhs); |
3696 | 0 | odsState.addOperands(rhs); |
3697 | 0 | odsState.addTypes({lhs.getType()}); |
3698 | 0 |
|
3699 | 0 | } |
3700 | | |
3701 | 0 | void CopySignOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3702 | 0 | odsState.addOperands(operands); |
3703 | 0 | odsState.addAttributes(attributes); |
3704 | 0 | odsState.addTypes({operands[0].getType()}); |
3705 | 0 |
|
3706 | 0 | } |
3707 | | |
3708 | 0 | ParseResult CopySignOp::parse(OpAsmParser &parser, OperationState &result) { |
3709 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
3710 | 0 | } |
3711 | | |
3712 | 0 | void CopySignOp::print(OpAsmPrinter &p) { |
3713 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
3714 | 0 | } |
3715 | | |
3716 | 0 | LogicalResult CopySignOp::verify() { |
3717 | 0 | { |
3718 | 0 | unsigned index = 0; (void)index; |
3719 | 0 | auto valueGroup0 = getODSOperands(0); |
3720 | 0 | for (Value v : valueGroup0) { |
3721 | 0 | (void)v; |
3722 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
3723 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
3724 | 0 | } |
3725 | 0 | ++index; |
3726 | 0 | } |
3727 | 0 | auto valueGroup1 = getODSOperands(1); |
3728 | 0 | for (Value v : valueGroup1) { |
3729 | 0 | (void)v; |
3730 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
3731 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
3732 | 0 | } |
3733 | 0 | ++index; |
3734 | 0 | } |
3735 | 0 | } |
3736 | 0 | { |
3737 | 0 | unsigned index = 0; (void)index; |
3738 | 0 | auto valueGroup0 = getODSResults(0); |
3739 | 0 | for (Value v : valueGroup0) { |
3740 | 0 | (void)v; |
3741 | 0 | if (!((true))) { |
3742 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
3743 | 0 | } |
3744 | 0 | ++index; |
3745 | 0 | } |
3746 | 0 | } |
3747 | 0 | return mlir::success(); |
3748 | 0 | } |
3749 | | |
3750 | 0 | void CopySignOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
3751 | 0 |
|
3752 | 0 | } |
3753 | | |
3754 | | |
3755 | | //===----------------------------------------------------------------------===// |
3756 | | // CosOp definitions |
3757 | | //===----------------------------------------------------------------------===// |
3758 | | |
3759 | 0 | CosOpOperandAdaptor::CosOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
3760 | 0 |
|
3761 | 0 | } |
3762 | | |
3763 | 0 | CosOpOperandAdaptor::CosOpOperandAdaptor(CosOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
3764 | 0 |
|
3765 | 0 | } |
3766 | | |
3767 | 0 | std::pair<unsigned, unsigned> CosOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
3768 | 0 | return {index, 1}; |
3769 | 0 | } |
3770 | | |
3771 | 0 | ValueRange CosOpOperandAdaptor::getODSOperands(unsigned index) { |
3772 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3773 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
3774 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
3775 | 0 | } |
3776 | | |
3777 | 0 | Value CosOpOperandAdaptor::operand() { |
3778 | 0 | return *getODSOperands(0).begin(); |
3779 | 0 | } |
3780 | | |
3781 | 0 | StringRef CosOp::getOperationName() { |
3782 | 0 | return "std.cos"; |
3783 | 0 | } |
3784 | | |
3785 | 0 | std::pair<unsigned, unsigned> CosOp::getODSOperandIndexAndLength(unsigned index) { |
3786 | 0 | return {index, 1}; |
3787 | 0 | } |
3788 | | |
3789 | 0 | Operation::operand_range CosOp::getODSOperands(unsigned index) { |
3790 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3791 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
3792 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
3793 | 0 | } |
3794 | | |
3795 | 0 | Value CosOp::operand() { |
3796 | 0 | return *getODSOperands(0).begin(); |
3797 | 0 | } |
3798 | | |
3799 | 0 | ::mlir::MutableOperandRange CosOp::operandMutable() { |
3800 | 0 | auto range = getODSOperandIndexAndLength(0); |
3801 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
3802 | 0 | } |
3803 | | |
3804 | 0 | std::pair<unsigned, unsigned> CosOp::getODSResultIndexAndLength(unsigned index) { |
3805 | 0 | return {index, 1}; |
3806 | 0 | } |
3807 | | |
3808 | 0 | Operation::result_range CosOp::getODSResults(unsigned index) { |
3809 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
3810 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
3811 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
3812 | 0 | } |
3813 | | |
3814 | 0 | void CosOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
3815 | 0 | odsState.addOperands(operand); |
3816 | 0 | odsState.addTypes(resultType0); |
3817 | 0 | } |
3818 | | |
3819 | 0 | void CosOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
3820 | 0 | odsState.addOperands(operand); |
3821 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3822 | 0 | odsState.addTypes(resultTypes); |
3823 | 0 | } |
3824 | | |
3825 | 0 | void CosOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3826 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
3827 | 0 | odsState.addOperands(operands); |
3828 | 0 | odsState.addAttributes(attributes); |
3829 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
3830 | 0 | odsState.addTypes(resultTypes); |
3831 | 0 | } |
3832 | | |
3833 | 0 | void CosOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
3834 | 0 | odsState.addOperands(operand); |
3835 | 0 | odsState.addTypes({operand.getType()}); |
3836 | 0 |
|
3837 | 0 | } |
3838 | | |
3839 | 0 | void CosOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3840 | 0 | odsState.addOperands(operands); |
3841 | 0 | odsState.addAttributes(attributes); |
3842 | 0 | odsState.addTypes({operands[0].getType()}); |
3843 | 0 |
|
3844 | 0 | } |
3845 | | |
3846 | 0 | ParseResult CosOp::parse(OpAsmParser &parser, OperationState &result) { |
3847 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
3848 | 0 | } |
3849 | | |
3850 | 0 | void CosOp::print(OpAsmPrinter &p) { |
3851 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
3852 | 0 | } |
3853 | | |
3854 | 0 | LogicalResult CosOp::verify() { |
3855 | 0 | { |
3856 | 0 | unsigned index = 0; (void)index; |
3857 | 0 | auto valueGroup0 = getODSOperands(0); |
3858 | 0 | for (Value v : valueGroup0) { |
3859 | 0 | (void)v; |
3860 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
3861 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
3862 | 0 | } |
3863 | 0 | ++index; |
3864 | 0 | } |
3865 | 0 | } |
3866 | 0 | { |
3867 | 0 | unsigned index = 0; (void)index; |
3868 | 0 | auto valueGroup0 = getODSResults(0); |
3869 | 0 | for (Value v : valueGroup0) { |
3870 | 0 | (void)v; |
3871 | 0 | if (!((true))) { |
3872 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
3873 | 0 | } |
3874 | 0 | ++index; |
3875 | 0 | } |
3876 | 0 | } |
3877 | 0 | return mlir::success(); |
3878 | 0 | } |
3879 | | |
3880 | 0 | void CosOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
3881 | 0 |
|
3882 | 0 | } |
3883 | | |
3884 | | |
3885 | | //===----------------------------------------------------------------------===// |
3886 | | // CreateComplexOp definitions |
3887 | | //===----------------------------------------------------------------------===// |
3888 | | |
3889 | 0 | CreateComplexOpOperandAdaptor::CreateComplexOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
3890 | 0 |
|
3891 | 0 | } |
3892 | | |
3893 | 0 | CreateComplexOpOperandAdaptor::CreateComplexOpOperandAdaptor(CreateComplexOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
3894 | 0 |
|
3895 | 0 | } |
3896 | | |
3897 | 0 | std::pair<unsigned, unsigned> CreateComplexOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
3898 | 0 | return {index, 1}; |
3899 | 0 | } |
3900 | | |
3901 | 0 | ValueRange CreateComplexOpOperandAdaptor::getODSOperands(unsigned index) { |
3902 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3903 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
3904 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
3905 | 0 | } |
3906 | | |
3907 | 0 | Value CreateComplexOpOperandAdaptor::real() { |
3908 | 0 | return *getODSOperands(0).begin(); |
3909 | 0 | } |
3910 | | |
3911 | 0 | Value CreateComplexOpOperandAdaptor::imaginary() { |
3912 | 0 | return *getODSOperands(1).begin(); |
3913 | 0 | } |
3914 | | |
3915 | 0 | StringRef CreateComplexOp::getOperationName() { |
3916 | 0 | return "std.create_complex"; |
3917 | 0 | } |
3918 | | |
3919 | 0 | std::pair<unsigned, unsigned> CreateComplexOp::getODSOperandIndexAndLength(unsigned index) { |
3920 | 0 | return {index, 1}; |
3921 | 0 | } |
3922 | | |
3923 | 0 | Operation::operand_range CreateComplexOp::getODSOperands(unsigned index) { |
3924 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
3925 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
3926 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
3927 | 0 | } |
3928 | | |
3929 | 0 | Value CreateComplexOp::real() { |
3930 | 0 | return *getODSOperands(0).begin(); |
3931 | 0 | } |
3932 | | |
3933 | 0 | Value CreateComplexOp::imaginary() { |
3934 | 0 | return *getODSOperands(1).begin(); |
3935 | 0 | } |
3936 | | |
3937 | 0 | ::mlir::MutableOperandRange CreateComplexOp::realMutable() { |
3938 | 0 | auto range = getODSOperandIndexAndLength(0); |
3939 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
3940 | 0 | } |
3941 | | |
3942 | 0 | ::mlir::MutableOperandRange CreateComplexOp::imaginaryMutable() { |
3943 | 0 | auto range = getODSOperandIndexAndLength(1); |
3944 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
3945 | 0 | } |
3946 | | |
3947 | 0 | std::pair<unsigned, unsigned> CreateComplexOp::getODSResultIndexAndLength(unsigned index) { |
3948 | 0 | return {index, 1}; |
3949 | 0 | } |
3950 | | |
3951 | 0 | Operation::result_range CreateComplexOp::getODSResults(unsigned index) { |
3952 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
3953 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
3954 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
3955 | 0 | } |
3956 | | |
3957 | 0 | Value CreateComplexOp::complex() { |
3958 | 0 | return *getODSResults(0).begin(); |
3959 | 0 | } |
3960 | | |
3961 | 0 | void CreateComplexOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type complex, Value real, Value imaginary) { |
3962 | 0 | odsState.addOperands(real); |
3963 | 0 | odsState.addOperands(imaginary); |
3964 | 0 | odsState.addTypes(complex); |
3965 | 0 | } |
3966 | | |
3967 | 0 | void CreateComplexOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value real, Value imaginary) { |
3968 | 0 | odsState.addOperands(real); |
3969 | 0 | odsState.addOperands(imaginary); |
3970 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
3971 | 0 | odsState.addTypes(resultTypes); |
3972 | 0 | } |
3973 | | |
3974 | 0 | void CreateComplexOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
3975 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
3976 | 0 | odsState.addOperands(operands); |
3977 | 0 | odsState.addAttributes(attributes); |
3978 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
3979 | 0 | odsState.addTypes(resultTypes); |
3980 | 0 | } |
3981 | | |
3982 | 0 | LogicalResult CreateComplexOp::verify() { |
3983 | 0 | { |
3984 | 0 | unsigned index = 0; (void)index; |
3985 | 0 | auto valueGroup0 = getODSOperands(0); |
3986 | 0 | for (Value v : valueGroup0) { |
3987 | 0 | (void)v; |
3988 | 0 | if (!((v.getType().isa<FloatType>()))) { |
3989 | 0 | return emitOpError("operand #") << index << " must be floating-point, but got " << v.getType(); |
3990 | 0 | } |
3991 | 0 | ++index; |
3992 | 0 | } |
3993 | 0 | auto valueGroup1 = getODSOperands(1); |
3994 | 0 | for (Value v : valueGroup1) { |
3995 | 0 | (void)v; |
3996 | 0 | if (!((v.getType().isa<FloatType>()))) { |
3997 | 0 | return emitOpError("operand #") << index << " must be floating-point, but got " << v.getType(); |
3998 | 0 | } |
3999 | 0 | ++index; |
4000 | 0 | } |
4001 | 0 | } |
4002 | 0 | { |
4003 | 0 | unsigned index = 0; (void)index; |
4004 | 0 | auto valueGroup0 = getODSResults(0); |
4005 | 0 | for (Value v : valueGroup0) { |
4006 | 0 | (void)v; |
4007 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
4008 | 0 | return emitOpError("result #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
4009 | 0 | } |
4010 | 0 | ++index; |
4011 | 0 | } |
4012 | 0 | } |
4013 | 0 | if (!((llvm::is_splat(llvm::makeArrayRef({(*this->getODSOperands(0).begin()).getType(), (*this->getODSOperands(1).begin()).getType()}))))) { |
4014 | 0 | return emitOpError("failed to verify that all of {real, imaginary} have same type"); |
4015 | 0 | } |
4016 | 0 | if (!(((*this->getODSResults(0).begin()).getType().cast<ComplexType>().getElementType() == (*this->getODSOperands(0).begin()).getType()))) { |
4017 | 0 | return emitOpError("failed to verify that complex element type matches real operand type"); |
4018 | 0 | } |
4019 | 0 | if (!(((*this->getODSResults(0).begin()).getType().cast<ComplexType>().getElementType() == (*this->getODSOperands(1).begin()).getType()))) { |
4020 | 0 | return emitOpError("failed to verify that complex element type matches imaginary operand type"); |
4021 | 0 | } |
4022 | 0 | return mlir::success(); |
4023 | 0 | } |
4024 | | |
4025 | 0 | ParseResult CreateComplexOp::parse(OpAsmParser &parser, OperationState &result) { |
4026 | 0 | OpAsmParser::OperandType realRawOperands[1]; |
4027 | 0 | ArrayRef<OpAsmParser::OperandType> realOperands(realRawOperands); llvm::SMLoc realOperandsLoc = parser.getCurrentLocation(); |
4028 | 0 | (void)realOperandsLoc; |
4029 | 0 | OpAsmParser::OperandType imaginaryRawOperands[1]; |
4030 | 0 | ArrayRef<OpAsmParser::OperandType> imaginaryOperands(imaginaryRawOperands); llvm::SMLoc imaginaryOperandsLoc = parser.getCurrentLocation(); |
4031 | 0 | (void)imaginaryOperandsLoc; |
4032 | 0 | Type complexRawTypes[1]; |
4033 | 0 | ArrayRef<Type> complexTypes(complexRawTypes); |
4034 | 0 |
|
4035 | 0 | if (parser.parseOperand(realRawOperands[0])) |
4036 | 0 | return failure(); |
4037 | 0 | if (parser.parseComma()) |
4038 | 0 | return failure(); |
4039 | 0 | |
4040 | 0 | if (parser.parseOperand(imaginaryRawOperands[0])) |
4041 | 0 | return failure(); |
4042 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
4043 | 0 | return failure(); |
4044 | 0 | if (parser.parseColon()) |
4045 | 0 | return failure(); |
4046 | 0 | |
4047 | 0 | if (parser.parseType(complexRawTypes[0])) |
4048 | 0 | return failure(); |
4049 | 0 | for (Type type : complexTypes) { |
4050 | 0 | (void)type; |
4051 | 0 | if (!(((type.isa<ComplexType>())) && ((type.cast<ComplexType>().getElementType().isa<FloatType>())))) { |
4052 | 0 | return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; |
4053 | 0 | } |
4054 | 0 | } |
4055 | 0 | result.addTypes(complexTypes); |
4056 | 0 | if (parser.resolveOperands(realOperands, complexTypes[0].cast<ComplexType>().getElementType(), realOperandsLoc, result.operands)) |
4057 | 0 | return failure(); |
4058 | 0 | if (parser.resolveOperands(imaginaryOperands, complexTypes[0].cast<ComplexType>().getElementType(), imaginaryOperandsLoc, result.operands)) |
4059 | 0 | return failure(); |
4060 | 0 | return success(); |
4061 | 0 | } |
4062 | | |
4063 | 0 | void CreateComplexOp::print(OpAsmPrinter &p) { |
4064 | 0 | p << "create_complex"; |
4065 | 0 | p << " "; |
4066 | 0 | p << real(); |
4067 | 0 | p << ","; |
4068 | 0 | p << " "; |
4069 | 0 | p << imaginary(); |
4070 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
4071 | 0 | p << " " << ":"; |
4072 | 0 | p << " "; |
4073 | 0 | p << ArrayRef<Type>(complex().getType()); |
4074 | 0 | } |
4075 | | |
4076 | 0 | void CreateComplexOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4077 | 0 |
|
4078 | 0 | } |
4079 | | |
4080 | | |
4081 | | //===----------------------------------------------------------------------===// |
4082 | | // DeallocOp definitions |
4083 | | //===----------------------------------------------------------------------===// |
4084 | | |
4085 | 0 | DeallocOpOperandAdaptor::DeallocOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4086 | 0 |
|
4087 | 0 | } |
4088 | | |
4089 | 0 | DeallocOpOperandAdaptor::DeallocOpOperandAdaptor(DeallocOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4090 | 0 |
|
4091 | 0 | } |
4092 | | |
4093 | 0 | std::pair<unsigned, unsigned> DeallocOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4094 | 0 | return {index, 1}; |
4095 | 0 | } |
4096 | | |
4097 | 0 | ValueRange DeallocOpOperandAdaptor::getODSOperands(unsigned index) { |
4098 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4099 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4100 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4101 | 0 | } |
4102 | | |
4103 | 0 | Value DeallocOpOperandAdaptor::memref() { |
4104 | 0 | return *getODSOperands(0).begin(); |
4105 | 0 | } |
4106 | | |
4107 | 0 | StringRef DeallocOp::getOperationName() { |
4108 | 0 | return "std.dealloc"; |
4109 | 0 | } |
4110 | | |
4111 | 0 | std::pair<unsigned, unsigned> DeallocOp::getODSOperandIndexAndLength(unsigned index) { |
4112 | 0 | return {index, 1}; |
4113 | 0 | } |
4114 | | |
4115 | 0 | Operation::operand_range DeallocOp::getODSOperands(unsigned index) { |
4116 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4117 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4118 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4119 | 0 | } |
4120 | | |
4121 | 0 | Value DeallocOp::memref() { |
4122 | 0 | return *getODSOperands(0).begin(); |
4123 | 0 | } |
4124 | | |
4125 | 0 | ::mlir::MutableOperandRange DeallocOp::memrefMutable() { |
4126 | 0 | auto range = getODSOperandIndexAndLength(0); |
4127 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4128 | 0 | } |
4129 | | |
4130 | 0 | std::pair<unsigned, unsigned> DeallocOp::getODSResultIndexAndLength(unsigned index) { |
4131 | 0 | return {index, 1}; |
4132 | 0 | } |
4133 | | |
4134 | 0 | Operation::result_range DeallocOp::getODSResults(unsigned index) { |
4135 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4136 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4137 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4138 | 0 | } |
4139 | | |
4140 | 0 | void DeallocOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref) { |
4141 | 0 | odsState.addOperands(memref); |
4142 | 0 | } |
4143 | | |
4144 | 0 | void DeallocOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref) { |
4145 | 0 | odsState.addOperands(memref); |
4146 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
4147 | 0 | odsState.addTypes(resultTypes); |
4148 | 0 | } |
4149 | | |
4150 | 0 | void DeallocOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4151 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
4152 | 0 | odsState.addOperands(operands); |
4153 | 0 | odsState.addAttributes(attributes); |
4154 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
4155 | 0 | odsState.addTypes(resultTypes); |
4156 | 0 | } |
4157 | | |
4158 | 0 | LogicalResult DeallocOp::verify() { |
4159 | 0 | { |
4160 | 0 | unsigned index = 0; (void)index; |
4161 | 0 | auto valueGroup0 = getODSOperands(0); |
4162 | 0 | for (Value v : valueGroup0) { |
4163 | 0 | (void)v; |
4164 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
4165 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
4166 | 0 | } |
4167 | 0 | ++index; |
4168 | 0 | } |
4169 | 0 | } |
4170 | 0 | { |
4171 | 0 | unsigned index = 0; (void)index; |
4172 | 0 | } |
4173 | 0 | return ::verify(*this); |
4174 | 0 | } |
4175 | | |
4176 | | |
4177 | | |
4178 | | |
4179 | | |
4180 | 0 | ParseResult DeallocOp::parse(OpAsmParser &parser, OperationState &result) { |
4181 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
4182 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
4183 | 0 | (void)memrefOperandsLoc; |
4184 | 0 | Type memrefRawTypes[1]; |
4185 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
4186 | 0 |
|
4187 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
4188 | 0 | return failure(); |
4189 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
4190 | 0 | return failure(); |
4191 | 0 | if (parser.parseColon()) |
4192 | 0 | return failure(); |
4193 | 0 | |
4194 | 0 | if (parser.parseType(memrefRawTypes[0])) |
4195 | 0 | return failure(); |
4196 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
4197 | 0 | return failure(); |
4198 | 0 | return success(); |
4199 | 0 | } |
4200 | | |
4201 | 0 | void DeallocOp::print(OpAsmPrinter &p) { |
4202 | 0 | p << "dealloc"; |
4203 | 0 | p << " "; |
4204 | 0 | p << memref(); |
4205 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
4206 | 0 | p << " " << ":"; |
4207 | 0 | p << " "; |
4208 | 0 | p << ArrayRef<Type>(memref().getType()); |
4209 | 0 | } |
4210 | | |
4211 | 0 | void DeallocOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4212 | 0 | effects.emplace_back(MemoryEffects::Free::get(), ::mlir::SideEffects::DefaultResource::get()); |
4213 | 0 | for (Value value : getODSOperands(0)) |
4214 | 0 | effects.emplace_back(MemoryEffects::Free::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
4215 | 0 | } |
4216 | | |
4217 | | |
4218 | | //===----------------------------------------------------------------------===// |
4219 | | // DimOp definitions |
4220 | | //===----------------------------------------------------------------------===// |
4221 | | |
4222 | 0 | DimOpOperandAdaptor::DimOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4223 | 0 |
|
4224 | 0 | } |
4225 | | |
4226 | 0 | DimOpOperandAdaptor::DimOpOperandAdaptor(DimOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4227 | 0 |
|
4228 | 0 | } |
4229 | | |
4230 | 0 | std::pair<unsigned, unsigned> DimOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4231 | 0 | return {index, 1}; |
4232 | 0 | } |
4233 | | |
4234 | 0 | ValueRange DimOpOperandAdaptor::getODSOperands(unsigned index) { |
4235 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4236 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4237 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4238 | 0 | } |
4239 | | |
4240 | 0 | Value DimOpOperandAdaptor::memrefOrTensor() { |
4241 | 0 | return *getODSOperands(0).begin(); |
4242 | 0 | } |
4243 | | |
4244 | 0 | IntegerAttr DimOpOperandAdaptor::index() { |
4245 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
4246 | 0 | IntegerAttr attr = odsAttrs.get("index").cast<IntegerAttr>(); |
4247 | 0 | return attr; |
4248 | 0 | } |
4249 | | |
4250 | 0 | StringRef DimOp::getOperationName() { |
4251 | 0 | return "std.dim"; |
4252 | 0 | } |
4253 | | |
4254 | 0 | std::pair<unsigned, unsigned> DimOp::getODSOperandIndexAndLength(unsigned index) { |
4255 | 0 | return {index, 1}; |
4256 | 0 | } |
4257 | | |
4258 | 0 | Operation::operand_range DimOp::getODSOperands(unsigned index) { |
4259 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4260 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4261 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4262 | 0 | } |
4263 | | |
4264 | 0 | Value DimOp::memrefOrTensor() { |
4265 | 0 | return *getODSOperands(0).begin(); |
4266 | 0 | } |
4267 | | |
4268 | 0 | ::mlir::MutableOperandRange DimOp::memrefOrTensorMutable() { |
4269 | 0 | auto range = getODSOperandIndexAndLength(0); |
4270 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4271 | 0 | } |
4272 | | |
4273 | 0 | std::pair<unsigned, unsigned> DimOp::getODSResultIndexAndLength(unsigned index) { |
4274 | 0 | return {index, 1}; |
4275 | 0 | } |
4276 | | |
4277 | 0 | Operation::result_range DimOp::getODSResults(unsigned index) { |
4278 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4279 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4280 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4281 | 0 | } |
4282 | | |
4283 | 0 | IntegerAttr DimOp::indexAttr() { |
4284 | 0 | return this->getAttr("index").cast<IntegerAttr>(); |
4285 | 0 | } |
4286 | | |
4287 | 0 | APInt DimOp::index() { |
4288 | 0 | auto attr = indexAttr(); |
4289 | 0 | return attr.getValue(); |
4290 | 0 | } |
4291 | | |
4292 | 0 | void DimOp::indexAttr(IntegerAttr attr) { |
4293 | 0 | this->getOperation()->setAttr("index", attr); |
4294 | 0 | } |
4295 | | |
4296 | 0 | void DimOp::build(OpBuilder &builder, OperationState &result, Value memrefOrTensor,unsigned index) { |
4297 | 0 | auto indexType = builder.getIndexType(); |
4298 | 0 | auto indexAttr = builder.getIntegerAttr(indexType, index); |
4299 | 0 | build(builder, result, indexType, memrefOrTensor, indexAttr); |
4300 | 0 | |
4301 | 0 | } |
4302 | | |
4303 | 0 | void DimOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value memrefOrTensor, IntegerAttr index) { |
4304 | 0 | odsState.addOperands(memrefOrTensor); |
4305 | 0 | odsState.addAttribute("index", index); |
4306 | 0 | odsState.addTypes(resultType0); |
4307 | 0 | } |
4308 | | |
4309 | 0 | void DimOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memrefOrTensor, IntegerAttr index) { |
4310 | 0 | odsState.addOperands(memrefOrTensor); |
4311 | 0 | odsState.addAttribute("index", index); |
4312 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
4313 | 0 | odsState.addTypes(resultTypes); |
4314 | 0 | } |
4315 | | |
4316 | 0 | void DimOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4317 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
4318 | 0 | odsState.addOperands(operands); |
4319 | 0 | odsState.addAttributes(attributes); |
4320 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
4321 | 0 | odsState.addTypes(resultTypes); |
4322 | 0 | } |
4323 | | |
4324 | 0 | ParseResult DimOp::parse(OpAsmParser &parser, OperationState &result) { |
4325 | 0 | return ::parseDimOp(parser, result); |
4326 | 0 | } |
4327 | | |
4328 | 0 | void DimOp::print(OpAsmPrinter &p) { |
4329 | 0 | return ::print(p, *this); |
4330 | 0 | } |
4331 | | |
4332 | 0 | LogicalResult DimOp::verify() { |
4333 | 0 | auto tblgen_index = this->getAttr("index"); |
4334 | 0 | if (!tblgen_index) return emitOpError("requires attribute 'index'"); |
4335 | 0 | { |
4336 | 0 | if (!((tblgen_index.isa<IntegerAttr>()))) return emitOpError("attribute 'index' failed to satisfy constraint: arbitrary integer attribute"); |
4337 | 0 | } |
4338 | 0 | { |
4339 | 0 | unsigned index = 0; (void)index; |
4340 | 0 | auto valueGroup0 = getODSOperands(0); |
4341 | 0 | for (Value v : valueGroup0) { |
4342 | 0 | (void)v; |
4343 | 0 | if (!((((v.getType().isa<MemRefType>())) && ((true))) || (((v.getType().isa<TensorType>())) && ((true))))) { |
4344 | 0 | return emitOpError("operand #") << index << " must be any tensor or memref type, but got " << v.getType(); |
4345 | 0 | } |
4346 | 0 | ++index; |
4347 | 0 | } |
4348 | 0 | } |
4349 | 0 | { |
4350 | 0 | unsigned index = 0; (void)index; |
4351 | 0 | auto valueGroup0 = getODSResults(0); |
4352 | 0 | for (Value v : valueGroup0) { |
4353 | 0 | (void)v; |
4354 | 0 | if (!((v.getType().isa<IndexType>()))) { |
4355 | 0 | return emitOpError("result #") << index << " must be index, but got " << v.getType(); |
4356 | 0 | } |
4357 | 0 | ++index; |
4358 | 0 | } |
4359 | 0 | } |
4360 | 0 | return ::verify(*this); |
4361 | 0 | } |
4362 | | |
4363 | | |
4364 | | |
4365 | 0 | void DimOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4366 | 0 |
|
4367 | 0 | } |
4368 | | |
4369 | | |
4370 | | //===----------------------------------------------------------------------===// |
4371 | | // DivFOp definitions |
4372 | | //===----------------------------------------------------------------------===// |
4373 | | |
4374 | 0 | DivFOpOperandAdaptor::DivFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4375 | 0 |
|
4376 | 0 | } |
4377 | | |
4378 | 0 | DivFOpOperandAdaptor::DivFOpOperandAdaptor(DivFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4379 | 0 |
|
4380 | 0 | } |
4381 | | |
4382 | 0 | std::pair<unsigned, unsigned> DivFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4383 | 0 | return {index, 1}; |
4384 | 0 | } |
4385 | | |
4386 | 0 | ValueRange DivFOpOperandAdaptor::getODSOperands(unsigned index) { |
4387 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4388 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4389 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4390 | 0 | } |
4391 | | |
4392 | 0 | Value DivFOpOperandAdaptor::lhs() { |
4393 | 0 | return *getODSOperands(0).begin(); |
4394 | 0 | } |
4395 | | |
4396 | 0 | Value DivFOpOperandAdaptor::rhs() { |
4397 | 0 | return *getODSOperands(1).begin(); |
4398 | 0 | } |
4399 | | |
4400 | 0 | StringRef DivFOp::getOperationName() { |
4401 | 0 | return "std.divf"; |
4402 | 0 | } |
4403 | | |
4404 | 0 | std::pair<unsigned, unsigned> DivFOp::getODSOperandIndexAndLength(unsigned index) { |
4405 | 0 | return {index, 1}; |
4406 | 0 | } |
4407 | | |
4408 | 0 | Operation::operand_range DivFOp::getODSOperands(unsigned index) { |
4409 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4410 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4411 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4412 | 0 | } |
4413 | | |
4414 | 0 | Value DivFOp::lhs() { |
4415 | 0 | return *getODSOperands(0).begin(); |
4416 | 0 | } |
4417 | | |
4418 | 0 | Value DivFOp::rhs() { |
4419 | 0 | return *getODSOperands(1).begin(); |
4420 | 0 | } |
4421 | | |
4422 | 0 | ::mlir::MutableOperandRange DivFOp::lhsMutable() { |
4423 | 0 | auto range = getODSOperandIndexAndLength(0); |
4424 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4425 | 0 | } |
4426 | | |
4427 | 0 | ::mlir::MutableOperandRange DivFOp::rhsMutable() { |
4428 | 0 | auto range = getODSOperandIndexAndLength(1); |
4429 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4430 | 0 | } |
4431 | | |
4432 | 0 | std::pair<unsigned, unsigned> DivFOp::getODSResultIndexAndLength(unsigned index) { |
4433 | 0 | return {index, 1}; |
4434 | 0 | } |
4435 | | |
4436 | 0 | Operation::result_range DivFOp::getODSResults(unsigned index) { |
4437 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4438 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4439 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4440 | 0 | } |
4441 | | |
4442 | 0 | void DivFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
4443 | 0 | odsState.addOperands(lhs); |
4444 | 0 | odsState.addOperands(rhs); |
4445 | 0 | odsState.addTypes(resultType0); |
4446 | 0 | } |
4447 | | |
4448 | 0 | void DivFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
4449 | 0 | odsState.addOperands(lhs); |
4450 | 0 | odsState.addOperands(rhs); |
4451 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
4452 | 0 | odsState.addTypes(resultTypes); |
4453 | 0 | } |
4454 | | |
4455 | 0 | void DivFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4456 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
4457 | 0 | odsState.addOperands(operands); |
4458 | 0 | odsState.addAttributes(attributes); |
4459 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
4460 | 0 | odsState.addTypes(resultTypes); |
4461 | 0 | } |
4462 | | |
4463 | 0 | void DivFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
4464 | 0 | odsState.addOperands(lhs); |
4465 | 0 | odsState.addOperands(rhs); |
4466 | 0 | odsState.addTypes({lhs.getType()}); |
4467 | 0 |
|
4468 | 0 | } |
4469 | | |
4470 | 0 | void DivFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4471 | 0 | odsState.addOperands(operands); |
4472 | 0 | odsState.addAttributes(attributes); |
4473 | 0 | odsState.addTypes({operands[0].getType()}); |
4474 | 0 |
|
4475 | 0 | } |
4476 | | |
4477 | 0 | ParseResult DivFOp::parse(OpAsmParser &parser, OperationState &result) { |
4478 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
4479 | 0 | } |
4480 | | |
4481 | 0 | void DivFOp::print(OpAsmPrinter &p) { |
4482 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
4483 | 0 | } |
4484 | | |
4485 | 0 | LogicalResult DivFOp::verify() { |
4486 | 0 | { |
4487 | 0 | unsigned index = 0; (void)index; |
4488 | 0 | auto valueGroup0 = getODSOperands(0); |
4489 | 0 | for (Value v : valueGroup0) { |
4490 | 0 | (void)v; |
4491 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
4492 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
4493 | 0 | } |
4494 | 0 | ++index; |
4495 | 0 | } |
4496 | 0 | auto valueGroup1 = getODSOperands(1); |
4497 | 0 | for (Value v : valueGroup1) { |
4498 | 0 | (void)v; |
4499 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
4500 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
4501 | 0 | } |
4502 | 0 | ++index; |
4503 | 0 | } |
4504 | 0 | } |
4505 | 0 | { |
4506 | 0 | unsigned index = 0; (void)index; |
4507 | 0 | auto valueGroup0 = getODSResults(0); |
4508 | 0 | for (Value v : valueGroup0) { |
4509 | 0 | (void)v; |
4510 | 0 | if (!((true))) { |
4511 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
4512 | 0 | } |
4513 | 0 | ++index; |
4514 | 0 | } |
4515 | 0 | } |
4516 | 0 | return mlir::success(); |
4517 | 0 | } |
4518 | | |
4519 | 0 | void DivFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4520 | 0 |
|
4521 | 0 | } |
4522 | | |
4523 | | |
4524 | | //===----------------------------------------------------------------------===// |
4525 | | // Exp2Op definitions |
4526 | | //===----------------------------------------------------------------------===// |
4527 | | |
4528 | 0 | Exp2OpOperandAdaptor::Exp2OpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4529 | 0 |
|
4530 | 0 | } |
4531 | | |
4532 | 0 | Exp2OpOperandAdaptor::Exp2OpOperandAdaptor(Exp2Op& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4533 | 0 |
|
4534 | 0 | } |
4535 | | |
4536 | 0 | std::pair<unsigned, unsigned> Exp2OpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4537 | 0 | return {index, 1}; |
4538 | 0 | } |
4539 | | |
4540 | 0 | ValueRange Exp2OpOperandAdaptor::getODSOperands(unsigned index) { |
4541 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4542 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4543 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4544 | 0 | } |
4545 | | |
4546 | 0 | Value Exp2OpOperandAdaptor::operand() { |
4547 | 0 | return *getODSOperands(0).begin(); |
4548 | 0 | } |
4549 | | |
4550 | 0 | StringRef Exp2Op::getOperationName() { |
4551 | 0 | return "std.exp2"; |
4552 | 0 | } |
4553 | | |
4554 | 0 | std::pair<unsigned, unsigned> Exp2Op::getODSOperandIndexAndLength(unsigned index) { |
4555 | 0 | return {index, 1}; |
4556 | 0 | } |
4557 | | |
4558 | 0 | Operation::operand_range Exp2Op::getODSOperands(unsigned index) { |
4559 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4560 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4561 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4562 | 0 | } |
4563 | | |
4564 | 0 | Value Exp2Op::operand() { |
4565 | 0 | return *getODSOperands(0).begin(); |
4566 | 0 | } |
4567 | | |
4568 | 0 | ::mlir::MutableOperandRange Exp2Op::operandMutable() { |
4569 | 0 | auto range = getODSOperandIndexAndLength(0); |
4570 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4571 | 0 | } |
4572 | | |
4573 | 0 | std::pair<unsigned, unsigned> Exp2Op::getODSResultIndexAndLength(unsigned index) { |
4574 | 0 | return {index, 1}; |
4575 | 0 | } |
4576 | | |
4577 | 0 | Operation::result_range Exp2Op::getODSResults(unsigned index) { |
4578 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4579 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4580 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4581 | 0 | } |
4582 | | |
4583 | 0 | void Exp2Op::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
4584 | 0 | odsState.addOperands(operand); |
4585 | 0 | odsState.addTypes(resultType0); |
4586 | 0 | } |
4587 | | |
4588 | 0 | void Exp2Op::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
4589 | 0 | odsState.addOperands(operand); |
4590 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
4591 | 0 | odsState.addTypes(resultTypes); |
4592 | 0 | } |
4593 | | |
4594 | 0 | void Exp2Op::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4595 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
4596 | 0 | odsState.addOperands(operands); |
4597 | 0 | odsState.addAttributes(attributes); |
4598 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
4599 | 0 | odsState.addTypes(resultTypes); |
4600 | 0 | } |
4601 | | |
4602 | 0 | void Exp2Op::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
4603 | 0 | odsState.addOperands(operand); |
4604 | 0 | odsState.addTypes({operand.getType()}); |
4605 | 0 |
|
4606 | 0 | } |
4607 | | |
4608 | 0 | void Exp2Op::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4609 | 0 | odsState.addOperands(operands); |
4610 | 0 | odsState.addAttributes(attributes); |
4611 | 0 | odsState.addTypes({operands[0].getType()}); |
4612 | 0 |
|
4613 | 0 | } |
4614 | | |
4615 | 0 | ParseResult Exp2Op::parse(OpAsmParser &parser, OperationState &result) { |
4616 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
4617 | 0 | } |
4618 | | |
4619 | 0 | void Exp2Op::print(OpAsmPrinter &p) { |
4620 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
4621 | 0 | } |
4622 | | |
4623 | 0 | LogicalResult Exp2Op::verify() { |
4624 | 0 | { |
4625 | 0 | unsigned index = 0; (void)index; |
4626 | 0 | auto valueGroup0 = getODSOperands(0); |
4627 | 0 | for (Value v : valueGroup0) { |
4628 | 0 | (void)v; |
4629 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
4630 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
4631 | 0 | } |
4632 | 0 | ++index; |
4633 | 0 | } |
4634 | 0 | } |
4635 | 0 | { |
4636 | 0 | unsigned index = 0; (void)index; |
4637 | 0 | auto valueGroup0 = getODSResults(0); |
4638 | 0 | for (Value v : valueGroup0) { |
4639 | 0 | (void)v; |
4640 | 0 | if (!((true))) { |
4641 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
4642 | 0 | } |
4643 | 0 | ++index; |
4644 | 0 | } |
4645 | 0 | } |
4646 | 0 | return mlir::success(); |
4647 | 0 | } |
4648 | | |
4649 | 0 | void Exp2Op::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4650 | 0 |
|
4651 | 0 | } |
4652 | | |
4653 | | |
4654 | | //===----------------------------------------------------------------------===// |
4655 | | // ExpOp definitions |
4656 | | //===----------------------------------------------------------------------===// |
4657 | | |
4658 | 0 | ExpOpOperandAdaptor::ExpOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4659 | 0 |
|
4660 | 0 | } |
4661 | | |
4662 | 0 | ExpOpOperandAdaptor::ExpOpOperandAdaptor(ExpOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4663 | 0 |
|
4664 | 0 | } |
4665 | | |
4666 | 0 | std::pair<unsigned, unsigned> ExpOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4667 | 0 | return {index, 1}; |
4668 | 0 | } |
4669 | | |
4670 | 0 | ValueRange ExpOpOperandAdaptor::getODSOperands(unsigned index) { |
4671 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4672 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4673 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4674 | 0 | } |
4675 | | |
4676 | 0 | Value ExpOpOperandAdaptor::operand() { |
4677 | 0 | return *getODSOperands(0).begin(); |
4678 | 0 | } |
4679 | | |
4680 | 0 | StringRef ExpOp::getOperationName() { |
4681 | 0 | return "std.exp"; |
4682 | 0 | } |
4683 | | |
4684 | 0 | std::pair<unsigned, unsigned> ExpOp::getODSOperandIndexAndLength(unsigned index) { |
4685 | 0 | return {index, 1}; |
4686 | 0 | } |
4687 | | |
4688 | 0 | Operation::operand_range ExpOp::getODSOperands(unsigned index) { |
4689 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4690 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4691 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4692 | 0 | } |
4693 | | |
4694 | 0 | Value ExpOp::operand() { |
4695 | 0 | return *getODSOperands(0).begin(); |
4696 | 0 | } |
4697 | | |
4698 | 0 | ::mlir::MutableOperandRange ExpOp::operandMutable() { |
4699 | 0 | auto range = getODSOperandIndexAndLength(0); |
4700 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4701 | 0 | } |
4702 | | |
4703 | 0 | std::pair<unsigned, unsigned> ExpOp::getODSResultIndexAndLength(unsigned index) { |
4704 | 0 | return {index, 1}; |
4705 | 0 | } |
4706 | | |
4707 | 0 | Operation::result_range ExpOp::getODSResults(unsigned index) { |
4708 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4709 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4710 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4711 | 0 | } |
4712 | | |
4713 | 0 | void ExpOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
4714 | 0 | odsState.addOperands(operand); |
4715 | 0 | odsState.addTypes(resultType0); |
4716 | 0 | } |
4717 | | |
4718 | 0 | void ExpOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
4719 | 0 | odsState.addOperands(operand); |
4720 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
4721 | 0 | odsState.addTypes(resultTypes); |
4722 | 0 | } |
4723 | | |
4724 | 0 | void ExpOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4725 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
4726 | 0 | odsState.addOperands(operands); |
4727 | 0 | odsState.addAttributes(attributes); |
4728 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
4729 | 0 | odsState.addTypes(resultTypes); |
4730 | 0 | } |
4731 | | |
4732 | 0 | void ExpOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
4733 | 0 | odsState.addOperands(operand); |
4734 | 0 | odsState.addTypes({operand.getType()}); |
4735 | 0 |
|
4736 | 0 | } |
4737 | | |
4738 | 0 | void ExpOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4739 | 0 | odsState.addOperands(operands); |
4740 | 0 | odsState.addAttributes(attributes); |
4741 | 0 | odsState.addTypes({operands[0].getType()}); |
4742 | 0 |
|
4743 | 0 | } |
4744 | | |
4745 | 0 | ParseResult ExpOp::parse(OpAsmParser &parser, OperationState &result) { |
4746 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
4747 | 0 | } |
4748 | | |
4749 | 0 | void ExpOp::print(OpAsmPrinter &p) { |
4750 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
4751 | 0 | } |
4752 | | |
4753 | 0 | LogicalResult ExpOp::verify() { |
4754 | 0 | { |
4755 | 0 | unsigned index = 0; (void)index; |
4756 | 0 | auto valueGroup0 = getODSOperands(0); |
4757 | 0 | for (Value v : valueGroup0) { |
4758 | 0 | (void)v; |
4759 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
4760 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
4761 | 0 | } |
4762 | 0 | ++index; |
4763 | 0 | } |
4764 | 0 | } |
4765 | 0 | { |
4766 | 0 | unsigned index = 0; (void)index; |
4767 | 0 | auto valueGroup0 = getODSResults(0); |
4768 | 0 | for (Value v : valueGroup0) { |
4769 | 0 | (void)v; |
4770 | 0 | if (!((true))) { |
4771 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
4772 | 0 | } |
4773 | 0 | ++index; |
4774 | 0 | } |
4775 | 0 | } |
4776 | 0 | return mlir::success(); |
4777 | 0 | } |
4778 | | |
4779 | 0 | void ExpOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
4780 | 0 |
|
4781 | 0 | } |
4782 | | |
4783 | | |
4784 | | //===----------------------------------------------------------------------===// |
4785 | | // ExtractElementOp definitions |
4786 | | //===----------------------------------------------------------------------===// |
4787 | | |
4788 | 0 | ExtractElementOpOperandAdaptor::ExtractElementOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
4789 | 0 |
|
4790 | 0 | } |
4791 | | |
4792 | 0 | ExtractElementOpOperandAdaptor::ExtractElementOpOperandAdaptor(ExtractElementOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
4793 | 0 |
|
4794 | 0 | } |
4795 | | |
4796 | 0 | std::pair<unsigned, unsigned> ExtractElementOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
4797 | 0 | bool isVariadic[] = {false, true}; |
4798 | 0 | int prevVariadicCount = 0; |
4799 | 0 | for (unsigned i = 0; i < index; ++i) |
4800 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
4801 | 0 |
|
4802 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
4803 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
4804 | 0 | int variadicSize = (odsOperands.size() - 1) / 1; |
4805 | 0 | // `index` passed in as the parameter is the static index which counts each |
4806 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
4807 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
4808 | 0 | // value pack for this static operand starts. |
4809 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
4810 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
4811 | 0 | return {start, size}; |
4812 | 0 | } |
4813 | | |
4814 | 0 | ValueRange ExtractElementOpOperandAdaptor::getODSOperands(unsigned index) { |
4815 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4816 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
4817 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
4818 | 0 | } |
4819 | | |
4820 | 0 | Value ExtractElementOpOperandAdaptor::aggregate() { |
4821 | 0 | return *getODSOperands(0).begin(); |
4822 | 0 | } |
4823 | | |
4824 | 0 | ValueRange ExtractElementOpOperandAdaptor::indices() { |
4825 | 0 | return getODSOperands(1); |
4826 | 0 | } |
4827 | | |
4828 | 0 | StringRef ExtractElementOp::getOperationName() { |
4829 | 0 | return "std.extract_element"; |
4830 | 0 | } |
4831 | | |
4832 | 0 | std::pair<unsigned, unsigned> ExtractElementOp::getODSOperandIndexAndLength(unsigned index) { |
4833 | 0 | bool isVariadic[] = {false, true}; |
4834 | 0 | int prevVariadicCount = 0; |
4835 | 0 | for (unsigned i = 0; i < index; ++i) |
4836 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
4837 | 0 |
|
4838 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
4839 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
4840 | 0 | int variadicSize = (getOperation()->getNumOperands() - 1) / 1; |
4841 | 0 | // `index` passed in as the parameter is the static index which counts each |
4842 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
4843 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
4844 | 0 | // value pack for this static operand starts. |
4845 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
4846 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
4847 | 0 | return {start, size}; |
4848 | 0 | } |
4849 | | |
4850 | 0 | Operation::operand_range ExtractElementOp::getODSOperands(unsigned index) { |
4851 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
4852 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
4853 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
4854 | 0 | } |
4855 | | |
4856 | 0 | Value ExtractElementOp::aggregate() { |
4857 | 0 | return *getODSOperands(0).begin(); |
4858 | 0 | } |
4859 | | |
4860 | 0 | Operation::operand_range ExtractElementOp::indices() { |
4861 | 0 | return getODSOperands(1); |
4862 | 0 | } |
4863 | | |
4864 | 0 | ::mlir::MutableOperandRange ExtractElementOp::aggregateMutable() { |
4865 | 0 | auto range = getODSOperandIndexAndLength(0); |
4866 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4867 | 0 | } |
4868 | | |
4869 | 0 | ::mlir::MutableOperandRange ExtractElementOp::indicesMutable() { |
4870 | 0 | auto range = getODSOperandIndexAndLength(1); |
4871 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
4872 | 0 | } |
4873 | | |
4874 | 0 | std::pair<unsigned, unsigned> ExtractElementOp::getODSResultIndexAndLength(unsigned index) { |
4875 | 0 | return {index, 1}; |
4876 | 0 | } |
4877 | | |
4878 | 0 | Operation::result_range ExtractElementOp::getODSResults(unsigned index) { |
4879 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
4880 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
4881 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
4882 | 0 | } |
4883 | | |
4884 | 0 | Value ExtractElementOp::result() { |
4885 | 0 | return *getODSResults(0).begin(); |
4886 | 0 | } |
4887 | | |
4888 | 0 | void ExtractElementOp::build(OpBuilder &builder, OperationState &result, Value aggregate,ValueRange indices ) { |
4889 | 0 | auto resType = aggregate.getType().cast<ShapedType>() |
4890 | 0 | .getElementType(); |
4891 | 0 | build(builder, result, resType, aggregate, indices); |
4892 | 0 | |
4893 | 0 | } |
4894 | | |
4895 | 0 | void ExtractElementOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value aggregate, ValueRange indices) { |
4896 | 0 | odsState.addOperands(aggregate); |
4897 | 0 | odsState.addOperands(indices); |
4898 | 0 | odsState.addTypes(result); |
4899 | 0 | } |
4900 | | |
4901 | 0 | void ExtractElementOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value aggregate, ValueRange indices) { |
4902 | 0 | odsState.addOperands(aggregate); |
4903 | 0 | odsState.addOperands(indices); |
4904 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
4905 | 0 | odsState.addTypes(resultTypes); |
4906 | 0 | } |
4907 | | |
4908 | 0 | void ExtractElementOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
4909 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
4910 | 0 | odsState.addOperands(operands); |
4911 | 0 | odsState.addAttributes(attributes); |
4912 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
4913 | 0 | odsState.addTypes(resultTypes); |
4914 | 0 | } |
4915 | | |
4916 | 0 | LogicalResult ExtractElementOp::verify() { |
4917 | 0 | { |
4918 | 0 | unsigned index = 0; (void)index; |
4919 | 0 | auto valueGroup0 = getODSOperands(0); |
4920 | 0 | for (Value v : valueGroup0) { |
4921 | 0 | (void)v; |
4922 | 0 | if (!((((v.getType().isa<VectorType>())) && ((true))) || (((v.getType().isa<TensorType>())) && ((true))))) { |
4923 | 0 | return emitOpError("operand #") << index << " must be vector of any type values or tensor of any type values, but got " << v.getType(); |
4924 | 0 | } |
4925 | 0 | ++index; |
4926 | 0 | } |
4927 | 0 | auto valueGroup1 = getODSOperands(1); |
4928 | 0 | for (Value v : valueGroup1) { |
4929 | 0 | (void)v; |
4930 | 0 | if (!((v.getType().isa<IndexType>()))) { |
4931 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
4932 | 0 | } |
4933 | 0 | ++index; |
4934 | 0 | } |
4935 | 0 | } |
4936 | 0 | { |
4937 | 0 | unsigned index = 0; (void)index; |
4938 | 0 | auto valueGroup0 = getODSResults(0); |
4939 | 0 | for (Value v : valueGroup0) { |
4940 | 0 | (void)v; |
4941 | 0 | if (!((true))) { |
4942 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
4943 | 0 | } |
4944 | 0 | ++index; |
4945 | 0 | } |
4946 | 0 | } |
4947 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<ShapedType>().getElementType() == (*this->getODSResults(0).begin()).getType()))) { |
4948 | 0 | return emitOpError("failed to verify that result type matches element type of aggregate"); |
4949 | 0 | } |
4950 | 0 | return ::verify(*this); |
4951 | 0 | } |
4952 | | |
4953 | | |
4954 | | |
4955 | 0 | ParseResult ExtractElementOp::parse(OpAsmParser &parser, OperationState &result) { |
4956 | 0 | OpAsmParser::OperandType aggregateRawOperands[1]; |
4957 | 0 | ArrayRef<OpAsmParser::OperandType> aggregateOperands(aggregateRawOperands); llvm::SMLoc aggregateOperandsLoc = parser.getCurrentLocation(); |
4958 | 0 | (void)aggregateOperandsLoc; |
4959 | 0 | SmallVector<OpAsmParser::OperandType, 4> indicesOperands; |
4960 | 0 | llvm::SMLoc indicesOperandsLoc = parser.getCurrentLocation(); |
4961 | 0 | (void)indicesOperandsLoc; |
4962 | 0 | Type aggregateRawTypes[1]; |
4963 | 0 | ArrayRef<Type> aggregateTypes(aggregateRawTypes); |
4964 | 0 |
|
4965 | 0 | if (parser.parseOperand(aggregateRawOperands[0])) |
4966 | 0 | return failure(); |
4967 | 0 | if (parser.parseLSquare()) |
4968 | 0 | return failure(); |
4969 | 0 | |
4970 | 0 | if (parser.parseOperandList(indicesOperands)) |
4971 | 0 | return failure(); |
4972 | 0 | if (parser.parseRSquare()) |
4973 | 0 | return failure(); |
4974 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
4975 | 0 | return failure(); |
4976 | 0 | if (parser.parseColon()) |
4977 | 0 | return failure(); |
4978 | 0 | |
4979 | 0 | if (parser.parseType(aggregateRawTypes[0])) |
4980 | 0 | return failure(); |
4981 | 0 | for (Type type : aggregateTypes) { |
4982 | 0 | (void)type; |
4983 | 0 | if (!((((type.isa<VectorType>())) && ((true))) || (((type.isa<TensorType>())) && ((true))))) { |
4984 | 0 | return parser.emitError(parser.getNameLoc()) << "'aggregate' must be vector of any type values or tensor of any type values, but got " << type; |
4985 | 0 | } |
4986 | 0 | } |
4987 | 0 | Type odsBuildableType0 = parser.getBuilder().getIndexType(); |
4988 | 0 | result.addTypes(aggregateTypes[0].cast<ShapedType>().getElementType()); |
4989 | 0 | if (parser.resolveOperands(aggregateOperands, aggregateTypes, aggregateOperandsLoc, result.operands)) |
4990 | 0 | return failure(); |
4991 | 0 | if (parser.resolveOperands(indicesOperands, odsBuildableType0, result.operands)) |
4992 | 0 | return failure(); |
4993 | 0 | return success(); |
4994 | 0 | } |
4995 | | |
4996 | 0 | void ExtractElementOp::print(OpAsmPrinter &p) { |
4997 | 0 | p << "extract_element"; |
4998 | 0 | p << " "; |
4999 | 0 | p << aggregate(); |
5000 | 0 | p << "["; |
5001 | 0 | p << indices(); |
5002 | 0 | p << "]"; |
5003 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
5004 | 0 | p << " " << ":"; |
5005 | 0 | p << " "; |
5006 | 0 | p << ArrayRef<Type>(aggregate().getType()); |
5007 | 0 | } |
5008 | | |
5009 | 0 | void ExtractElementOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5010 | 0 |
|
5011 | 0 | } |
5012 | | |
5013 | | |
5014 | | //===----------------------------------------------------------------------===// |
5015 | | // FPExtOp definitions |
5016 | | //===----------------------------------------------------------------------===// |
5017 | | |
5018 | 0 | FPExtOpOperandAdaptor::FPExtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5019 | 0 |
|
5020 | 0 | } |
5021 | | |
5022 | 0 | FPExtOpOperandAdaptor::FPExtOpOperandAdaptor(FPExtOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5023 | 0 |
|
5024 | 0 | } |
5025 | | |
5026 | 0 | std::pair<unsigned, unsigned> FPExtOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5027 | 0 | return {index, 1}; |
5028 | 0 | } |
5029 | | |
5030 | 0 | ValueRange FPExtOpOperandAdaptor::getODSOperands(unsigned index) { |
5031 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5032 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5033 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5034 | 0 | } |
5035 | | |
5036 | 0 | Value FPExtOpOperandAdaptor::in() { |
5037 | 0 | return *getODSOperands(0).begin(); |
5038 | 0 | } |
5039 | | |
5040 | 0 | StringRef FPExtOp::getOperationName() { |
5041 | 0 | return "std.fpext"; |
5042 | 0 | } |
5043 | | |
5044 | 0 | std::pair<unsigned, unsigned> FPExtOp::getODSOperandIndexAndLength(unsigned index) { |
5045 | 0 | return {index, 1}; |
5046 | 0 | } |
5047 | | |
5048 | 0 | Operation::operand_range FPExtOp::getODSOperands(unsigned index) { |
5049 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5050 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5051 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5052 | 0 | } |
5053 | | |
5054 | 0 | Value FPExtOp::in() { |
5055 | 0 | return *getODSOperands(0).begin(); |
5056 | 0 | } |
5057 | | |
5058 | 0 | ::mlir::MutableOperandRange FPExtOp::inMutable() { |
5059 | 0 | auto range = getODSOperandIndexAndLength(0); |
5060 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5061 | 0 | } |
5062 | | |
5063 | 0 | std::pair<unsigned, unsigned> FPExtOp::getODSResultIndexAndLength(unsigned index) { |
5064 | 0 | return {index, 1}; |
5065 | 0 | } |
5066 | | |
5067 | 0 | Operation::result_range FPExtOp::getODSResults(unsigned index) { |
5068 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5069 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5070 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5071 | 0 | } |
5072 | | |
5073 | 0 | void FPExtOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
5074 | 0 | impl::buildCastOp(builder, result, source, destType); |
5075 | 0 | |
5076 | 0 | } |
5077 | | |
5078 | 0 | void FPExtOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in) { |
5079 | 0 | odsState.addOperands(in); |
5080 | 0 | odsState.addTypes(resultType0); |
5081 | 0 | } |
5082 | | |
5083 | 0 | void FPExtOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in) { |
5084 | 0 | odsState.addOperands(in); |
5085 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5086 | 0 | odsState.addTypes(resultTypes); |
5087 | 0 | } |
5088 | | |
5089 | 0 | void FPExtOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5090 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
5091 | 0 | odsState.addOperands(operands); |
5092 | 0 | odsState.addAttributes(attributes); |
5093 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5094 | 0 | odsState.addTypes(resultTypes); |
5095 | 0 | } |
5096 | | |
5097 | 0 | ParseResult FPExtOp::parse(OpAsmParser &parser, OperationState &result) { |
5098 | 0 | return impl::parseCastOp(parser, result); |
5099 | 0 | } |
5100 | | |
5101 | 0 | void FPExtOp::print(OpAsmPrinter &p) { |
5102 | 0 | return printStandardCastOp(this->getOperation(), p); |
5103 | 0 | } |
5104 | | |
5105 | 0 | LogicalResult FPExtOp::verify() { |
5106 | 0 | { |
5107 | 0 | unsigned index = 0; (void)index; |
5108 | 0 | auto valueGroup0 = getODSOperands(0); |
5109 | 0 | for (Value v : valueGroup0) { |
5110 | 0 | (void)v; |
5111 | 0 | if (!((true))) { |
5112 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
5113 | 0 | } |
5114 | 0 | ++index; |
5115 | 0 | } |
5116 | 0 | } |
5117 | 0 | { |
5118 | 0 | unsigned index = 0; (void)index; |
5119 | 0 | auto valueGroup0 = getODSResults(0); |
5120 | 0 | for (Value v : valueGroup0) { |
5121 | 0 | (void)v; |
5122 | 0 | if (!((true))) { |
5123 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
5124 | 0 | } |
5125 | 0 | ++index; |
5126 | 0 | } |
5127 | 0 | } |
5128 | 0 | return ::verifyCastOp(*this); |
5129 | 0 | } |
5130 | | |
5131 | 0 | void FPExtOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5132 | 0 |
|
5133 | 0 | } |
5134 | | |
5135 | | |
5136 | | //===----------------------------------------------------------------------===// |
5137 | | // FPToSIOp definitions |
5138 | | //===----------------------------------------------------------------------===// |
5139 | | |
5140 | 0 | FPToSIOpOperandAdaptor::FPToSIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5141 | 0 |
|
5142 | 0 | } |
5143 | | |
5144 | 0 | FPToSIOpOperandAdaptor::FPToSIOpOperandAdaptor(FPToSIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5145 | 0 |
|
5146 | 0 | } |
5147 | | |
5148 | 0 | std::pair<unsigned, unsigned> FPToSIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5149 | 0 | return {index, 1}; |
5150 | 0 | } |
5151 | | |
5152 | 0 | ValueRange FPToSIOpOperandAdaptor::getODSOperands(unsigned index) { |
5153 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5154 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5155 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5156 | 0 | } |
5157 | | |
5158 | 0 | Value FPToSIOpOperandAdaptor::in() { |
5159 | 0 | return *getODSOperands(0).begin(); |
5160 | 0 | } |
5161 | | |
5162 | 0 | StringRef FPToSIOp::getOperationName() { |
5163 | 0 | return "std.fptosi"; |
5164 | 0 | } |
5165 | | |
5166 | 0 | std::pair<unsigned, unsigned> FPToSIOp::getODSOperandIndexAndLength(unsigned index) { |
5167 | 0 | return {index, 1}; |
5168 | 0 | } |
5169 | | |
5170 | 0 | Operation::operand_range FPToSIOp::getODSOperands(unsigned index) { |
5171 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5172 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5173 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5174 | 0 | } |
5175 | | |
5176 | 0 | Value FPToSIOp::in() { |
5177 | 0 | return *getODSOperands(0).begin(); |
5178 | 0 | } |
5179 | | |
5180 | 0 | ::mlir::MutableOperandRange FPToSIOp::inMutable() { |
5181 | 0 | auto range = getODSOperandIndexAndLength(0); |
5182 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5183 | 0 | } |
5184 | | |
5185 | 0 | std::pair<unsigned, unsigned> FPToSIOp::getODSResultIndexAndLength(unsigned index) { |
5186 | 0 | return {index, 1}; |
5187 | 0 | } |
5188 | | |
5189 | 0 | Operation::result_range FPToSIOp::getODSResults(unsigned index) { |
5190 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5191 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5192 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5193 | 0 | } |
5194 | | |
5195 | 0 | void FPToSIOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
5196 | 0 | impl::buildCastOp(builder, result, source, destType); |
5197 | 0 | |
5198 | 0 | } |
5199 | | |
5200 | 0 | void FPToSIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in) { |
5201 | 0 | odsState.addOperands(in); |
5202 | 0 | odsState.addTypes(resultType0); |
5203 | 0 | } |
5204 | | |
5205 | 0 | void FPToSIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in) { |
5206 | 0 | odsState.addOperands(in); |
5207 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5208 | 0 | odsState.addTypes(resultTypes); |
5209 | 0 | } |
5210 | | |
5211 | 0 | void FPToSIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5212 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
5213 | 0 | odsState.addOperands(operands); |
5214 | 0 | odsState.addAttributes(attributes); |
5215 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5216 | 0 | odsState.addTypes(resultTypes); |
5217 | 0 | } |
5218 | | |
5219 | 0 | ParseResult FPToSIOp::parse(OpAsmParser &parser, OperationState &result) { |
5220 | 0 | return impl::parseCastOp(parser, result); |
5221 | 0 | } |
5222 | | |
5223 | 0 | void FPToSIOp::print(OpAsmPrinter &p) { |
5224 | 0 | return printStandardCastOp(this->getOperation(), p); |
5225 | 0 | } |
5226 | | |
5227 | 0 | LogicalResult FPToSIOp::verify() { |
5228 | 0 | { |
5229 | 0 | unsigned index = 0; (void)index; |
5230 | 0 | auto valueGroup0 = getODSOperands(0); |
5231 | 0 | for (Value v : valueGroup0) { |
5232 | 0 | (void)v; |
5233 | 0 | if (!((true))) { |
5234 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
5235 | 0 | } |
5236 | 0 | ++index; |
5237 | 0 | } |
5238 | 0 | } |
5239 | 0 | { |
5240 | 0 | unsigned index = 0; (void)index; |
5241 | 0 | auto valueGroup0 = getODSResults(0); |
5242 | 0 | for (Value v : valueGroup0) { |
5243 | 0 | (void)v; |
5244 | 0 | if (!((true))) { |
5245 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
5246 | 0 | } |
5247 | 0 | ++index; |
5248 | 0 | } |
5249 | 0 | } |
5250 | 0 | return ::verifyCastOp(*this); |
5251 | 0 | } |
5252 | | |
5253 | 0 | void FPToSIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5254 | 0 |
|
5255 | 0 | } |
5256 | | |
5257 | | |
5258 | | //===----------------------------------------------------------------------===// |
5259 | | // FPTruncOp definitions |
5260 | | //===----------------------------------------------------------------------===// |
5261 | | |
5262 | 0 | FPTruncOpOperandAdaptor::FPTruncOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5263 | 0 |
|
5264 | 0 | } |
5265 | | |
5266 | 0 | FPTruncOpOperandAdaptor::FPTruncOpOperandAdaptor(FPTruncOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5267 | 0 |
|
5268 | 0 | } |
5269 | | |
5270 | 0 | std::pair<unsigned, unsigned> FPTruncOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5271 | 0 | return {index, 1}; |
5272 | 0 | } |
5273 | | |
5274 | 0 | ValueRange FPTruncOpOperandAdaptor::getODSOperands(unsigned index) { |
5275 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5276 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5277 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5278 | 0 | } |
5279 | | |
5280 | 0 | Value FPTruncOpOperandAdaptor::in() { |
5281 | 0 | return *getODSOperands(0).begin(); |
5282 | 0 | } |
5283 | | |
5284 | 0 | StringRef FPTruncOp::getOperationName() { |
5285 | 0 | return "std.fptrunc"; |
5286 | 0 | } |
5287 | | |
5288 | 0 | std::pair<unsigned, unsigned> FPTruncOp::getODSOperandIndexAndLength(unsigned index) { |
5289 | 0 | return {index, 1}; |
5290 | 0 | } |
5291 | | |
5292 | 0 | Operation::operand_range FPTruncOp::getODSOperands(unsigned index) { |
5293 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5294 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5295 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5296 | 0 | } |
5297 | | |
5298 | 0 | Value FPTruncOp::in() { |
5299 | 0 | return *getODSOperands(0).begin(); |
5300 | 0 | } |
5301 | | |
5302 | 0 | ::mlir::MutableOperandRange FPTruncOp::inMutable() { |
5303 | 0 | auto range = getODSOperandIndexAndLength(0); |
5304 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5305 | 0 | } |
5306 | | |
5307 | 0 | std::pair<unsigned, unsigned> FPTruncOp::getODSResultIndexAndLength(unsigned index) { |
5308 | 0 | return {index, 1}; |
5309 | 0 | } |
5310 | | |
5311 | 0 | Operation::result_range FPTruncOp::getODSResults(unsigned index) { |
5312 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5313 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5314 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5315 | 0 | } |
5316 | | |
5317 | 0 | void FPTruncOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
5318 | 0 | impl::buildCastOp(builder, result, source, destType); |
5319 | 0 | |
5320 | 0 | } |
5321 | | |
5322 | 0 | void FPTruncOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in) { |
5323 | 0 | odsState.addOperands(in); |
5324 | 0 | odsState.addTypes(resultType0); |
5325 | 0 | } |
5326 | | |
5327 | 0 | void FPTruncOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in) { |
5328 | 0 | odsState.addOperands(in); |
5329 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5330 | 0 | odsState.addTypes(resultTypes); |
5331 | 0 | } |
5332 | | |
5333 | 0 | void FPTruncOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5334 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
5335 | 0 | odsState.addOperands(operands); |
5336 | 0 | odsState.addAttributes(attributes); |
5337 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5338 | 0 | odsState.addTypes(resultTypes); |
5339 | 0 | } |
5340 | | |
5341 | 0 | ParseResult FPTruncOp::parse(OpAsmParser &parser, OperationState &result) { |
5342 | 0 | return impl::parseCastOp(parser, result); |
5343 | 0 | } |
5344 | | |
5345 | 0 | void FPTruncOp::print(OpAsmPrinter &p) { |
5346 | 0 | return printStandardCastOp(this->getOperation(), p); |
5347 | 0 | } |
5348 | | |
5349 | 0 | LogicalResult FPTruncOp::verify() { |
5350 | 0 | { |
5351 | 0 | unsigned index = 0; (void)index; |
5352 | 0 | auto valueGroup0 = getODSOperands(0); |
5353 | 0 | for (Value v : valueGroup0) { |
5354 | 0 | (void)v; |
5355 | 0 | if (!((true))) { |
5356 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
5357 | 0 | } |
5358 | 0 | ++index; |
5359 | 0 | } |
5360 | 0 | } |
5361 | 0 | { |
5362 | 0 | unsigned index = 0; (void)index; |
5363 | 0 | auto valueGroup0 = getODSResults(0); |
5364 | 0 | for (Value v : valueGroup0) { |
5365 | 0 | (void)v; |
5366 | 0 | if (!((true))) { |
5367 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
5368 | 0 | } |
5369 | 0 | ++index; |
5370 | 0 | } |
5371 | 0 | } |
5372 | 0 | return ::verifyCastOp(*this); |
5373 | 0 | } |
5374 | | |
5375 | 0 | void FPTruncOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5376 | 0 |
|
5377 | 0 | } |
5378 | | |
5379 | | |
5380 | | //===----------------------------------------------------------------------===// |
5381 | | // GenericAtomicRMWOp definitions |
5382 | | //===----------------------------------------------------------------------===// |
5383 | | |
5384 | 0 | GenericAtomicRMWOpOperandAdaptor::GenericAtomicRMWOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5385 | 0 |
|
5386 | 0 | } |
5387 | | |
5388 | 0 | GenericAtomicRMWOpOperandAdaptor::GenericAtomicRMWOpOperandAdaptor(GenericAtomicRMWOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5389 | 0 |
|
5390 | 0 | } |
5391 | | |
5392 | 0 | std::pair<unsigned, unsigned> GenericAtomicRMWOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5393 | 0 | bool isVariadic[] = {false, true}; |
5394 | 0 | int prevVariadicCount = 0; |
5395 | 0 | for (unsigned i = 0; i < index; ++i) |
5396 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
5397 | 0 |
|
5398 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
5399 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
5400 | 0 | int variadicSize = (odsOperands.size() - 1) / 1; |
5401 | 0 | // `index` passed in as the parameter is the static index which counts each |
5402 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
5403 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
5404 | 0 | // value pack for this static operand starts. |
5405 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
5406 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
5407 | 0 | return {start, size}; |
5408 | 0 | } |
5409 | | |
5410 | 0 | ValueRange GenericAtomicRMWOpOperandAdaptor::getODSOperands(unsigned index) { |
5411 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5412 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5413 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5414 | 0 | } |
5415 | | |
5416 | 0 | Value GenericAtomicRMWOpOperandAdaptor::memref() { |
5417 | 0 | return *getODSOperands(0).begin(); |
5418 | 0 | } |
5419 | | |
5420 | 0 | ValueRange GenericAtomicRMWOpOperandAdaptor::indices() { |
5421 | 0 | return getODSOperands(1); |
5422 | 0 | } |
5423 | | |
5424 | 0 | StringRef GenericAtomicRMWOp::getOperationName() { |
5425 | 0 | return "std.generic_atomic_rmw"; |
5426 | 0 | } |
5427 | | |
5428 | 0 | std::pair<unsigned, unsigned> GenericAtomicRMWOp::getODSOperandIndexAndLength(unsigned index) { |
5429 | 0 | bool isVariadic[] = {false, true}; |
5430 | 0 | int prevVariadicCount = 0; |
5431 | 0 | for (unsigned i = 0; i < index; ++i) |
5432 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
5433 | 0 |
|
5434 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
5435 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
5436 | 0 | int variadicSize = (getOperation()->getNumOperands() - 1) / 1; |
5437 | 0 | // `index` passed in as the parameter is the static index which counts each |
5438 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
5439 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
5440 | 0 | // value pack for this static operand starts. |
5441 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
5442 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
5443 | 0 | return {start, size}; |
5444 | 0 | } |
5445 | | |
5446 | 0 | Operation::operand_range GenericAtomicRMWOp::getODSOperands(unsigned index) { |
5447 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5448 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5449 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5450 | 0 | } |
5451 | | |
5452 | 0 | Value GenericAtomicRMWOp::memref() { |
5453 | 0 | return *getODSOperands(0).begin(); |
5454 | 0 | } |
5455 | | |
5456 | 0 | Operation::operand_range GenericAtomicRMWOp::indices() { |
5457 | 0 | return getODSOperands(1); |
5458 | 0 | } |
5459 | | |
5460 | 0 | ::mlir::MutableOperandRange GenericAtomicRMWOp::memrefMutable() { |
5461 | 0 | auto range = getODSOperandIndexAndLength(0); |
5462 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5463 | 0 | } |
5464 | | |
5465 | 0 | ::mlir::MutableOperandRange GenericAtomicRMWOp::indicesMutable() { |
5466 | 0 | auto range = getODSOperandIndexAndLength(1); |
5467 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5468 | 0 | } |
5469 | | |
5470 | 0 | std::pair<unsigned, unsigned> GenericAtomicRMWOp::getODSResultIndexAndLength(unsigned index) { |
5471 | 0 | return {index, 1}; |
5472 | 0 | } |
5473 | | |
5474 | 0 | Operation::result_range GenericAtomicRMWOp::getODSResults(unsigned index) { |
5475 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5476 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5477 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5478 | 0 | } |
5479 | | |
5480 | 0 | Value GenericAtomicRMWOp::result() { |
5481 | 0 | return *getODSResults(0).begin(); |
5482 | 0 | } |
5483 | | |
5484 | 0 | Region &GenericAtomicRMWOp::body() { |
5485 | 0 | return this->getOperation()->getRegion(0); |
5486 | 0 | } |
5487 | | |
5488 | | |
5489 | | |
5490 | 0 | ParseResult GenericAtomicRMWOp::parse(OpAsmParser &parser, OperationState &result) { |
5491 | 0 | return ::parseGenericAtomicRMWOp(parser, result); |
5492 | 0 | } |
5493 | | |
5494 | 0 | void GenericAtomicRMWOp::print(OpAsmPrinter &p) { |
5495 | 0 | return ::print(p, *this); |
5496 | 0 | } |
5497 | | |
5498 | 0 | LogicalResult GenericAtomicRMWOp::verify() { |
5499 | 0 | { |
5500 | 0 | unsigned index = 0; (void)index; |
5501 | 0 | auto valueGroup0 = getODSOperands(0); |
5502 | 0 | for (Value v : valueGroup0) { |
5503 | 0 | (void)v; |
5504 | 0 | if (!(((v.getType().isa<MemRefType>())) && (((v.getType().cast<ShapedType>().getElementType().isSignlessInteger())) || ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
5505 | 0 | return emitOpError("operand #") << index << " must be memref of signless integer or floating-point values, but got " << v.getType(); |
5506 | 0 | } |
5507 | 0 | ++index; |
5508 | 0 | } |
5509 | 0 | auto valueGroup1 = getODSOperands(1); |
5510 | 0 | for (Value v : valueGroup1) { |
5511 | 0 | (void)v; |
5512 | 0 | if (!((v.getType().isa<IndexType>()))) { |
5513 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
5514 | 0 | } |
5515 | 0 | ++index; |
5516 | 0 | } |
5517 | 0 | } |
5518 | 0 | { |
5519 | 0 | unsigned index = 0; (void)index; |
5520 | 0 | auto valueGroup0 = getODSResults(0); |
5521 | 0 | for (Value v : valueGroup0) { |
5522 | 0 | (void)v; |
5523 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<FloatType>())))) { |
5524 | 0 | return emitOpError("result #") << index << " must be signless integer or floating-point, but got " << v.getType(); |
5525 | 0 | } |
5526 | 0 | ++index; |
5527 | 0 | } |
5528 | 0 | } |
5529 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<MemRefType>().getElementType() == (*this->getODSResults(0).begin()).getType()))) { |
5530 | 0 | return emitOpError("failed to verify that result type matches element type of memref"); |
5531 | 0 | } |
5532 | 0 | { |
5533 | 0 | unsigned index = 0; (void)index; |
5534 | 0 | for (Region ®ion : MutableArrayRef<Region>(this->getOperation()->getRegion(0))) { |
5535 | 0 | (void)region; |
5536 | 0 | if (!((true))) { |
5537 | 0 | return emitOpError("region #") << index << " ('body') failed to verify constraint: any region"; |
5538 | 0 | } |
5539 | 0 | ++index; |
5540 | 0 | } |
5541 | 0 | } |
5542 | 0 | return ::verify(*this); |
5543 | 0 | } |
5544 | | |
5545 | | |
5546 | | //===----------------------------------------------------------------------===// |
5547 | | // ImOp definitions |
5548 | | //===----------------------------------------------------------------------===// |
5549 | | |
5550 | 0 | ImOpOperandAdaptor::ImOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5551 | 0 |
|
5552 | 0 | } |
5553 | | |
5554 | 0 | ImOpOperandAdaptor::ImOpOperandAdaptor(ImOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5555 | 0 |
|
5556 | 0 | } |
5557 | | |
5558 | 0 | std::pair<unsigned, unsigned> ImOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5559 | 0 | return {index, 1}; |
5560 | 0 | } |
5561 | | |
5562 | 0 | ValueRange ImOpOperandAdaptor::getODSOperands(unsigned index) { |
5563 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5564 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5565 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5566 | 0 | } |
5567 | | |
5568 | 0 | Value ImOpOperandAdaptor::complex() { |
5569 | 0 | return *getODSOperands(0).begin(); |
5570 | 0 | } |
5571 | | |
5572 | 0 | StringRef ImOp::getOperationName() { |
5573 | 0 | return "std.im"; |
5574 | 0 | } |
5575 | | |
5576 | 0 | std::pair<unsigned, unsigned> ImOp::getODSOperandIndexAndLength(unsigned index) { |
5577 | 0 | return {index, 1}; |
5578 | 0 | } |
5579 | | |
5580 | 0 | Operation::operand_range ImOp::getODSOperands(unsigned index) { |
5581 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5582 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5583 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5584 | 0 | } |
5585 | | |
5586 | 0 | Value ImOp::complex() { |
5587 | 0 | return *getODSOperands(0).begin(); |
5588 | 0 | } |
5589 | | |
5590 | 0 | ::mlir::MutableOperandRange ImOp::complexMutable() { |
5591 | 0 | auto range = getODSOperandIndexAndLength(0); |
5592 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5593 | 0 | } |
5594 | | |
5595 | 0 | std::pair<unsigned, unsigned> ImOp::getODSResultIndexAndLength(unsigned index) { |
5596 | 0 | return {index, 1}; |
5597 | 0 | } |
5598 | | |
5599 | 0 | Operation::result_range ImOp::getODSResults(unsigned index) { |
5600 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5601 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5602 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5603 | 0 | } |
5604 | | |
5605 | 0 | Value ImOp::imaginary() { |
5606 | 0 | return *getODSResults(0).begin(); |
5607 | 0 | } |
5608 | | |
5609 | 0 | void ImOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type imaginary, Value complex) { |
5610 | 0 | odsState.addOperands(complex); |
5611 | 0 | odsState.addTypes(imaginary); |
5612 | 0 | } |
5613 | | |
5614 | 0 | void ImOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value complex) { |
5615 | 0 | odsState.addOperands(complex); |
5616 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5617 | 0 | odsState.addTypes(resultTypes); |
5618 | 0 | } |
5619 | | |
5620 | 0 | void ImOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5621 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
5622 | 0 | odsState.addOperands(operands); |
5623 | 0 | odsState.addAttributes(attributes); |
5624 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5625 | 0 | odsState.addTypes(resultTypes); |
5626 | 0 | } |
5627 | | |
5628 | 0 | LogicalResult ImOp::verify() { |
5629 | 0 | { |
5630 | 0 | unsigned index = 0; (void)index; |
5631 | 0 | auto valueGroup0 = getODSOperands(0); |
5632 | 0 | for (Value v : valueGroup0) { |
5633 | 0 | (void)v; |
5634 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
5635 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
5636 | 0 | } |
5637 | 0 | ++index; |
5638 | 0 | } |
5639 | 0 | } |
5640 | 0 | { |
5641 | 0 | unsigned index = 0; (void)index; |
5642 | 0 | auto valueGroup0 = getODSResults(0); |
5643 | 0 | for (Value v : valueGroup0) { |
5644 | 0 | (void)v; |
5645 | 0 | if (!((v.getType().isa<FloatType>()))) { |
5646 | 0 | return emitOpError("result #") << index << " must be floating-point, but got " << v.getType(); |
5647 | 0 | } |
5648 | 0 | ++index; |
5649 | 0 | } |
5650 | 0 | } |
5651 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<ComplexType>().getElementType() == (*this->getODSResults(0).begin()).getType()))) { |
5652 | 0 | return emitOpError("failed to verify that complex element type matches result type"); |
5653 | 0 | } |
5654 | 0 | return mlir::success(); |
5655 | 0 | } |
5656 | | |
5657 | 0 | ParseResult ImOp::parse(OpAsmParser &parser, OperationState &result) { |
5658 | 0 | OpAsmParser::OperandType complexRawOperands[1]; |
5659 | 0 | ArrayRef<OpAsmParser::OperandType> complexOperands(complexRawOperands); llvm::SMLoc complexOperandsLoc = parser.getCurrentLocation(); |
5660 | 0 | (void)complexOperandsLoc; |
5661 | 0 | Type complexRawTypes[1]; |
5662 | 0 | ArrayRef<Type> complexTypes(complexRawTypes); |
5663 | 0 |
|
5664 | 0 | if (parser.parseOperand(complexRawOperands[0])) |
5665 | 0 | return failure(); |
5666 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
5667 | 0 | return failure(); |
5668 | 0 | if (parser.parseColon()) |
5669 | 0 | return failure(); |
5670 | 0 | |
5671 | 0 | if (parser.parseType(complexRawTypes[0])) |
5672 | 0 | return failure(); |
5673 | 0 | for (Type type : complexTypes) { |
5674 | 0 | (void)type; |
5675 | 0 | if (!(((type.isa<ComplexType>())) && ((type.cast<ComplexType>().getElementType().isa<FloatType>())))) { |
5676 | 0 | return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; |
5677 | 0 | } |
5678 | 0 | } |
5679 | 0 | result.addTypes(complexTypes[0].cast<ComplexType>().getElementType()); |
5680 | 0 | if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) |
5681 | 0 | return failure(); |
5682 | 0 | return success(); |
5683 | 0 | } |
5684 | | |
5685 | 0 | void ImOp::print(OpAsmPrinter &p) { |
5686 | 0 | p << "im"; |
5687 | 0 | p << " "; |
5688 | 0 | p << complex(); |
5689 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
5690 | 0 | p << " " << ":"; |
5691 | 0 | p << " "; |
5692 | 0 | p << ArrayRef<Type>(complex().getType()); |
5693 | 0 | } |
5694 | | |
5695 | 0 | void ImOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5696 | 0 |
|
5697 | 0 | } |
5698 | | |
5699 | | |
5700 | | //===----------------------------------------------------------------------===// |
5701 | | // IndexCastOp definitions |
5702 | | //===----------------------------------------------------------------------===// |
5703 | | |
5704 | 0 | IndexCastOpOperandAdaptor::IndexCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5705 | 0 |
|
5706 | 0 | } |
5707 | | |
5708 | 0 | IndexCastOpOperandAdaptor::IndexCastOpOperandAdaptor(IndexCastOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5709 | 0 |
|
5710 | 0 | } |
5711 | | |
5712 | 0 | std::pair<unsigned, unsigned> IndexCastOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5713 | 0 | return {index, 1}; |
5714 | 0 | } |
5715 | | |
5716 | 0 | ValueRange IndexCastOpOperandAdaptor::getODSOperands(unsigned index) { |
5717 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5718 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5719 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5720 | 0 | } |
5721 | | |
5722 | 0 | Value IndexCastOpOperandAdaptor::in() { |
5723 | 0 | return *getODSOperands(0).begin(); |
5724 | 0 | } |
5725 | | |
5726 | 0 | StringRef IndexCastOp::getOperationName() { |
5727 | 0 | return "std.index_cast"; |
5728 | 0 | } |
5729 | | |
5730 | 0 | std::pair<unsigned, unsigned> IndexCastOp::getODSOperandIndexAndLength(unsigned index) { |
5731 | 0 | return {index, 1}; |
5732 | 0 | } |
5733 | | |
5734 | 0 | Operation::operand_range IndexCastOp::getODSOperands(unsigned index) { |
5735 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5736 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5737 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5738 | 0 | } |
5739 | | |
5740 | 0 | Value IndexCastOp::in() { |
5741 | 0 | return *getODSOperands(0).begin(); |
5742 | 0 | } |
5743 | | |
5744 | 0 | ::mlir::MutableOperandRange IndexCastOp::inMutable() { |
5745 | 0 | auto range = getODSOperandIndexAndLength(0); |
5746 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5747 | 0 | } |
5748 | | |
5749 | 0 | std::pair<unsigned, unsigned> IndexCastOp::getODSResultIndexAndLength(unsigned index) { |
5750 | 0 | return {index, 1}; |
5751 | 0 | } |
5752 | | |
5753 | 0 | Operation::result_range IndexCastOp::getODSResults(unsigned index) { |
5754 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5755 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5756 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5757 | 0 | } |
5758 | | |
5759 | 0 | void IndexCastOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
5760 | 0 | impl::buildCastOp(builder, result, source, destType); |
5761 | 0 | |
5762 | 0 | } |
5763 | | |
5764 | 0 | void IndexCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in) { |
5765 | 0 | odsState.addOperands(in); |
5766 | 0 | odsState.addTypes(resultType0); |
5767 | 0 | } |
5768 | | |
5769 | 0 | void IndexCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in) { |
5770 | 0 | odsState.addOperands(in); |
5771 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5772 | 0 | odsState.addTypes(resultTypes); |
5773 | 0 | } |
5774 | | |
5775 | 0 | void IndexCastOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5776 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
5777 | 0 | odsState.addOperands(operands); |
5778 | 0 | odsState.addAttributes(attributes); |
5779 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5780 | 0 | odsState.addTypes(resultTypes); |
5781 | 0 | } |
5782 | | |
5783 | 0 | ParseResult IndexCastOp::parse(OpAsmParser &parser, OperationState &result) { |
5784 | 0 | return impl::parseCastOp(parser, result); |
5785 | 0 | } |
5786 | | |
5787 | 0 | void IndexCastOp::print(OpAsmPrinter &p) { |
5788 | 0 | return printStandardCastOp(this->getOperation(), p); |
5789 | 0 | } |
5790 | | |
5791 | 0 | LogicalResult IndexCastOp::verify() { |
5792 | 0 | { |
5793 | 0 | unsigned index = 0; (void)index; |
5794 | 0 | auto valueGroup0 = getODSOperands(0); |
5795 | 0 | for (Value v : valueGroup0) { |
5796 | 0 | (void)v; |
5797 | 0 | if (!((true))) { |
5798 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
5799 | 0 | } |
5800 | 0 | ++index; |
5801 | 0 | } |
5802 | 0 | } |
5803 | 0 | { |
5804 | 0 | unsigned index = 0; (void)index; |
5805 | 0 | auto valueGroup0 = getODSResults(0); |
5806 | 0 | for (Value v : valueGroup0) { |
5807 | 0 | (void)v; |
5808 | 0 | if (!((true))) { |
5809 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
5810 | 0 | } |
5811 | 0 | ++index; |
5812 | 0 | } |
5813 | 0 | } |
5814 | 0 | return ::verifyCastOp(*this); |
5815 | 0 | } |
5816 | | |
5817 | | |
5818 | | |
5819 | 0 | void IndexCastOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
5820 | 0 |
|
5821 | 0 | } |
5822 | | |
5823 | | |
5824 | | //===----------------------------------------------------------------------===// |
5825 | | // LoadOp definitions |
5826 | | //===----------------------------------------------------------------------===// |
5827 | | |
5828 | 0 | LoadOpOperandAdaptor::LoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
5829 | 0 |
|
5830 | 0 | } |
5831 | | |
5832 | 0 | LoadOpOperandAdaptor::LoadOpOperandAdaptor(LoadOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
5833 | 0 |
|
5834 | 0 | } |
5835 | | |
5836 | 0 | std::pair<unsigned, unsigned> LoadOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
5837 | 0 | bool isVariadic[] = {false, true}; |
5838 | 0 | int prevVariadicCount = 0; |
5839 | 0 | for (unsigned i = 0; i < index; ++i) |
5840 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
5841 | 0 |
|
5842 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
5843 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
5844 | 0 | int variadicSize = (odsOperands.size() - 1) / 1; |
5845 | 0 | // `index` passed in as the parameter is the static index which counts each |
5846 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
5847 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
5848 | 0 | // value pack for this static operand starts. |
5849 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
5850 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
5851 | 0 | return {start, size}; |
5852 | 0 | } |
5853 | | |
5854 | 0 | ValueRange LoadOpOperandAdaptor::getODSOperands(unsigned index) { |
5855 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5856 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
5857 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
5858 | 0 | } |
5859 | | |
5860 | 0 | Value LoadOpOperandAdaptor::memref() { |
5861 | 0 | return *getODSOperands(0).begin(); |
5862 | 0 | } |
5863 | | |
5864 | 0 | ValueRange LoadOpOperandAdaptor::indices() { |
5865 | 0 | return getODSOperands(1); |
5866 | 0 | } |
5867 | | |
5868 | 0 | StringRef LoadOp::getOperationName() { |
5869 | 0 | return "std.load"; |
5870 | 0 | } |
5871 | | |
5872 | 0 | std::pair<unsigned, unsigned> LoadOp::getODSOperandIndexAndLength(unsigned index) { |
5873 | 0 | bool isVariadic[] = {false, true}; |
5874 | 0 | int prevVariadicCount = 0; |
5875 | 0 | for (unsigned i = 0; i < index; ++i) |
5876 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
5877 | 0 |
|
5878 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
5879 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
5880 | 0 | int variadicSize = (getOperation()->getNumOperands() - 1) / 1; |
5881 | 0 | // `index` passed in as the parameter is the static index which counts each |
5882 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
5883 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
5884 | 0 | // value pack for this static operand starts. |
5885 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
5886 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
5887 | 0 | return {start, size}; |
5888 | 0 | } |
5889 | | |
5890 | 0 | Operation::operand_range LoadOp::getODSOperands(unsigned index) { |
5891 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
5892 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
5893 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
5894 | 0 | } |
5895 | | |
5896 | 0 | Value LoadOp::memref() { |
5897 | 0 | return *getODSOperands(0).begin(); |
5898 | 0 | } |
5899 | | |
5900 | 0 | Operation::operand_range LoadOp::indices() { |
5901 | 0 | return getODSOperands(1); |
5902 | 0 | } |
5903 | | |
5904 | 0 | ::mlir::MutableOperandRange LoadOp::memrefMutable() { |
5905 | 0 | auto range = getODSOperandIndexAndLength(0); |
5906 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5907 | 0 | } |
5908 | | |
5909 | 0 | ::mlir::MutableOperandRange LoadOp::indicesMutable() { |
5910 | 0 | auto range = getODSOperandIndexAndLength(1); |
5911 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
5912 | 0 | } |
5913 | | |
5914 | 0 | std::pair<unsigned, unsigned> LoadOp::getODSResultIndexAndLength(unsigned index) { |
5915 | 0 | return {index, 1}; |
5916 | 0 | } |
5917 | | |
5918 | 0 | Operation::result_range LoadOp::getODSResults(unsigned index) { |
5919 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
5920 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
5921 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
5922 | 0 | } |
5923 | | |
5924 | 0 | Value LoadOp::result() { |
5925 | 0 | return *getODSResults(0).begin(); |
5926 | 0 | } |
5927 | | |
5928 | 0 | void LoadOp::build(OpBuilder &, OperationState &result, Value memref,ValueRange indices ) { |
5929 | 0 | auto memrefType = memref.getType().cast<MemRefType>(); |
5930 | 0 | result.addOperands(memref); |
5931 | 0 | result.addOperands(indices); |
5932 | 0 | result.types.push_back(memrefType.getElementType()); |
5933 | 0 | |
5934 | 0 | } |
5935 | | |
5936 | 0 | void LoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices) { |
5937 | 0 | odsState.addOperands(memref); |
5938 | 0 | odsState.addOperands(indices); |
5939 | 0 | odsState.addTypes(result); |
5940 | 0 | } |
5941 | | |
5942 | 0 | void LoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices) { |
5943 | 0 | odsState.addOperands(memref); |
5944 | 0 | odsState.addOperands(indices); |
5945 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
5946 | 0 | odsState.addTypes(resultTypes); |
5947 | 0 | } |
5948 | | |
5949 | 0 | void LoadOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
5950 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
5951 | 0 | odsState.addOperands(operands); |
5952 | 0 | odsState.addAttributes(attributes); |
5953 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
5954 | 0 | odsState.addTypes(resultTypes); |
5955 | 0 | } |
5956 | | |
5957 | 0 | LogicalResult LoadOp::verify() { |
5958 | 0 | { |
5959 | 0 | unsigned index = 0; (void)index; |
5960 | 0 | auto valueGroup0 = getODSOperands(0); |
5961 | 0 | for (Value v : valueGroup0) { |
5962 | 0 | (void)v; |
5963 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
5964 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
5965 | 0 | } |
5966 | 0 | ++index; |
5967 | 0 | } |
5968 | 0 | auto valueGroup1 = getODSOperands(1); |
5969 | 0 | for (Value v : valueGroup1) { |
5970 | 0 | (void)v; |
5971 | 0 | if (!((v.getType().isa<IndexType>()))) { |
5972 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
5973 | 0 | } |
5974 | 0 | ++index; |
5975 | 0 | } |
5976 | 0 | } |
5977 | 0 | { |
5978 | 0 | unsigned index = 0; (void)index; |
5979 | 0 | auto valueGroup0 = getODSResults(0); |
5980 | 0 | for (Value v : valueGroup0) { |
5981 | 0 | (void)v; |
5982 | 0 | if (!((true))) { |
5983 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
5984 | 0 | } |
5985 | 0 | ++index; |
5986 | 0 | } |
5987 | 0 | } |
5988 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<MemRefType>().getElementType() == (*this->getODSResults(0).begin()).getType()))) { |
5989 | 0 | return emitOpError("failed to verify that result type matches element type of 'memref'"); |
5990 | 0 | } |
5991 | 0 | return ::verify(*this); |
5992 | 0 | } |
5993 | | |
5994 | | |
5995 | | |
5996 | 0 | ParseResult LoadOp::parse(OpAsmParser &parser, OperationState &result) { |
5997 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
5998 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
5999 | 0 | (void)memrefOperandsLoc; |
6000 | 0 | SmallVector<OpAsmParser::OperandType, 4> indicesOperands; |
6001 | 0 | llvm::SMLoc indicesOperandsLoc = parser.getCurrentLocation(); |
6002 | 0 | (void)indicesOperandsLoc; |
6003 | 0 | Type memrefRawTypes[1]; |
6004 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
6005 | 0 |
|
6006 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
6007 | 0 | return failure(); |
6008 | 0 | if (parser.parseLSquare()) |
6009 | 0 | return failure(); |
6010 | 0 | |
6011 | 0 | if (parser.parseOperandList(indicesOperands)) |
6012 | 0 | return failure(); |
6013 | 0 | if (parser.parseRSquare()) |
6014 | 0 | return failure(); |
6015 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
6016 | 0 | return failure(); |
6017 | 0 | if (parser.parseColon()) |
6018 | 0 | return failure(); |
6019 | 0 | |
6020 | 0 | if (parser.parseType(memrefRawTypes[0])) |
6021 | 0 | return failure(); |
6022 | 0 | for (Type type : memrefTypes) { |
6023 | 0 | (void)type; |
6024 | 0 | if (!(((type.isa<MemRefType>())) && ((true)))) { |
6025 | 0 | return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; |
6026 | 0 | } |
6027 | 0 | } |
6028 | 0 | Type odsBuildableType0 = parser.getBuilder().getIndexType(); |
6029 | 0 | result.addTypes(memrefTypes[0].cast<MemRefType>().getElementType()); |
6030 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
6031 | 0 | return failure(); |
6032 | 0 | if (parser.resolveOperands(indicesOperands, odsBuildableType0, result.operands)) |
6033 | 0 | return failure(); |
6034 | 0 | return success(); |
6035 | 0 | } |
6036 | | |
6037 | 0 | void LoadOp::print(OpAsmPrinter &p) { |
6038 | 0 | p << "load"; |
6039 | 0 | p << " "; |
6040 | 0 | p << memref(); |
6041 | 0 | p << "["; |
6042 | 0 | p << indices(); |
6043 | 0 | p << "]"; |
6044 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
6045 | 0 | p << " " << ":"; |
6046 | 0 | p << " "; |
6047 | 0 | p << ArrayRef<Type>(memref().getType()); |
6048 | 0 | } |
6049 | | |
6050 | 0 | void LoadOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6051 | 0 | for (Value value : getODSOperands(0)) |
6052 | 0 | effects.emplace_back(MemoryEffects::Read::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
6053 | 0 | } |
6054 | | |
6055 | | |
6056 | | //===----------------------------------------------------------------------===// |
6057 | | // Log10Op definitions |
6058 | | //===----------------------------------------------------------------------===// |
6059 | | |
6060 | 0 | Log10OpOperandAdaptor::Log10OpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6061 | 0 |
|
6062 | 0 | } |
6063 | | |
6064 | 0 | Log10OpOperandAdaptor::Log10OpOperandAdaptor(Log10Op& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6065 | 0 |
|
6066 | 0 | } |
6067 | | |
6068 | 0 | std::pair<unsigned, unsigned> Log10OpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6069 | 0 | return {index, 1}; |
6070 | 0 | } |
6071 | | |
6072 | 0 | ValueRange Log10OpOperandAdaptor::getODSOperands(unsigned index) { |
6073 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6074 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6075 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6076 | 0 | } |
6077 | | |
6078 | 0 | Value Log10OpOperandAdaptor::operand() { |
6079 | 0 | return *getODSOperands(0).begin(); |
6080 | 0 | } |
6081 | | |
6082 | 0 | StringRef Log10Op::getOperationName() { |
6083 | 0 | return "std.log10"; |
6084 | 0 | } |
6085 | | |
6086 | 0 | std::pair<unsigned, unsigned> Log10Op::getODSOperandIndexAndLength(unsigned index) { |
6087 | 0 | return {index, 1}; |
6088 | 0 | } |
6089 | | |
6090 | 0 | Operation::operand_range Log10Op::getODSOperands(unsigned index) { |
6091 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6092 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6093 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6094 | 0 | } |
6095 | | |
6096 | 0 | Value Log10Op::operand() { |
6097 | 0 | return *getODSOperands(0).begin(); |
6098 | 0 | } |
6099 | | |
6100 | 0 | ::mlir::MutableOperandRange Log10Op::operandMutable() { |
6101 | 0 | auto range = getODSOperandIndexAndLength(0); |
6102 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6103 | 0 | } |
6104 | | |
6105 | 0 | std::pair<unsigned, unsigned> Log10Op::getODSResultIndexAndLength(unsigned index) { |
6106 | 0 | return {index, 1}; |
6107 | 0 | } |
6108 | | |
6109 | 0 | Operation::result_range Log10Op::getODSResults(unsigned index) { |
6110 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6111 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6112 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6113 | 0 | } |
6114 | | |
6115 | 0 | void Log10Op::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
6116 | 0 | odsState.addOperands(operand); |
6117 | 0 | odsState.addTypes(resultType0); |
6118 | 0 | } |
6119 | | |
6120 | 0 | void Log10Op::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
6121 | 0 | odsState.addOperands(operand); |
6122 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6123 | 0 | odsState.addTypes(resultTypes); |
6124 | 0 | } |
6125 | | |
6126 | 0 | void Log10Op::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6127 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
6128 | 0 | odsState.addOperands(operands); |
6129 | 0 | odsState.addAttributes(attributes); |
6130 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6131 | 0 | odsState.addTypes(resultTypes); |
6132 | 0 | } |
6133 | | |
6134 | 0 | void Log10Op::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
6135 | 0 | odsState.addOperands(operand); |
6136 | 0 | odsState.addTypes({operand.getType()}); |
6137 | 0 |
|
6138 | 0 | } |
6139 | | |
6140 | 0 | void Log10Op::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6141 | 0 | odsState.addOperands(operands); |
6142 | 0 | odsState.addAttributes(attributes); |
6143 | 0 | odsState.addTypes({operands[0].getType()}); |
6144 | 0 |
|
6145 | 0 | } |
6146 | | |
6147 | 0 | ParseResult Log10Op::parse(OpAsmParser &parser, OperationState &result) { |
6148 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6149 | 0 | } |
6150 | | |
6151 | 0 | void Log10Op::print(OpAsmPrinter &p) { |
6152 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
6153 | 0 | } |
6154 | | |
6155 | 0 | LogicalResult Log10Op::verify() { |
6156 | 0 | { |
6157 | 0 | unsigned index = 0; (void)index; |
6158 | 0 | auto valueGroup0 = getODSOperands(0); |
6159 | 0 | for (Value v : valueGroup0) { |
6160 | 0 | (void)v; |
6161 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6162 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6163 | 0 | } |
6164 | 0 | ++index; |
6165 | 0 | } |
6166 | 0 | } |
6167 | 0 | { |
6168 | 0 | unsigned index = 0; (void)index; |
6169 | 0 | auto valueGroup0 = getODSResults(0); |
6170 | 0 | for (Value v : valueGroup0) { |
6171 | 0 | (void)v; |
6172 | 0 | if (!((true))) { |
6173 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
6174 | 0 | } |
6175 | 0 | ++index; |
6176 | 0 | } |
6177 | 0 | } |
6178 | 0 | return mlir::success(); |
6179 | 0 | } |
6180 | | |
6181 | 0 | void Log10Op::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6182 | 0 |
|
6183 | 0 | } |
6184 | | |
6185 | | |
6186 | | //===----------------------------------------------------------------------===// |
6187 | | // Log2Op definitions |
6188 | | //===----------------------------------------------------------------------===// |
6189 | | |
6190 | 0 | Log2OpOperandAdaptor::Log2OpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6191 | 0 |
|
6192 | 0 | } |
6193 | | |
6194 | 0 | Log2OpOperandAdaptor::Log2OpOperandAdaptor(Log2Op& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6195 | 0 |
|
6196 | 0 | } |
6197 | | |
6198 | 0 | std::pair<unsigned, unsigned> Log2OpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6199 | 0 | return {index, 1}; |
6200 | 0 | } |
6201 | | |
6202 | 0 | ValueRange Log2OpOperandAdaptor::getODSOperands(unsigned index) { |
6203 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6204 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6205 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6206 | 0 | } |
6207 | | |
6208 | 0 | Value Log2OpOperandAdaptor::operand() { |
6209 | 0 | return *getODSOperands(0).begin(); |
6210 | 0 | } |
6211 | | |
6212 | 0 | StringRef Log2Op::getOperationName() { |
6213 | 0 | return "std.log2"; |
6214 | 0 | } |
6215 | | |
6216 | 0 | std::pair<unsigned, unsigned> Log2Op::getODSOperandIndexAndLength(unsigned index) { |
6217 | 0 | return {index, 1}; |
6218 | 0 | } |
6219 | | |
6220 | 0 | Operation::operand_range Log2Op::getODSOperands(unsigned index) { |
6221 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6222 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6223 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6224 | 0 | } |
6225 | | |
6226 | 0 | Value Log2Op::operand() { |
6227 | 0 | return *getODSOperands(0).begin(); |
6228 | 0 | } |
6229 | | |
6230 | 0 | ::mlir::MutableOperandRange Log2Op::operandMutable() { |
6231 | 0 | auto range = getODSOperandIndexAndLength(0); |
6232 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6233 | 0 | } |
6234 | | |
6235 | 0 | std::pair<unsigned, unsigned> Log2Op::getODSResultIndexAndLength(unsigned index) { |
6236 | 0 | return {index, 1}; |
6237 | 0 | } |
6238 | | |
6239 | 0 | Operation::result_range Log2Op::getODSResults(unsigned index) { |
6240 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6241 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6242 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6243 | 0 | } |
6244 | | |
6245 | 0 | void Log2Op::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
6246 | 0 | odsState.addOperands(operand); |
6247 | 0 | odsState.addTypes(resultType0); |
6248 | 0 | } |
6249 | | |
6250 | 0 | void Log2Op::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
6251 | 0 | odsState.addOperands(operand); |
6252 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6253 | 0 | odsState.addTypes(resultTypes); |
6254 | 0 | } |
6255 | | |
6256 | 0 | void Log2Op::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6257 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
6258 | 0 | odsState.addOperands(operands); |
6259 | 0 | odsState.addAttributes(attributes); |
6260 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6261 | 0 | odsState.addTypes(resultTypes); |
6262 | 0 | } |
6263 | | |
6264 | 0 | void Log2Op::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
6265 | 0 | odsState.addOperands(operand); |
6266 | 0 | odsState.addTypes({operand.getType()}); |
6267 | 0 |
|
6268 | 0 | } |
6269 | | |
6270 | 0 | void Log2Op::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6271 | 0 | odsState.addOperands(operands); |
6272 | 0 | odsState.addAttributes(attributes); |
6273 | 0 | odsState.addTypes({operands[0].getType()}); |
6274 | 0 |
|
6275 | 0 | } |
6276 | | |
6277 | 0 | ParseResult Log2Op::parse(OpAsmParser &parser, OperationState &result) { |
6278 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6279 | 0 | } |
6280 | | |
6281 | 0 | void Log2Op::print(OpAsmPrinter &p) { |
6282 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
6283 | 0 | } |
6284 | | |
6285 | 0 | LogicalResult Log2Op::verify() { |
6286 | 0 | { |
6287 | 0 | unsigned index = 0; (void)index; |
6288 | 0 | auto valueGroup0 = getODSOperands(0); |
6289 | 0 | for (Value v : valueGroup0) { |
6290 | 0 | (void)v; |
6291 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6292 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6293 | 0 | } |
6294 | 0 | ++index; |
6295 | 0 | } |
6296 | 0 | } |
6297 | 0 | { |
6298 | 0 | unsigned index = 0; (void)index; |
6299 | 0 | auto valueGroup0 = getODSResults(0); |
6300 | 0 | for (Value v : valueGroup0) { |
6301 | 0 | (void)v; |
6302 | 0 | if (!((true))) { |
6303 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
6304 | 0 | } |
6305 | 0 | ++index; |
6306 | 0 | } |
6307 | 0 | } |
6308 | 0 | return mlir::success(); |
6309 | 0 | } |
6310 | | |
6311 | 0 | void Log2Op::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6312 | 0 |
|
6313 | 0 | } |
6314 | | |
6315 | | |
6316 | | //===----------------------------------------------------------------------===// |
6317 | | // LogOp definitions |
6318 | | //===----------------------------------------------------------------------===// |
6319 | | |
6320 | 0 | LogOpOperandAdaptor::LogOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6321 | 0 |
|
6322 | 0 | } |
6323 | | |
6324 | 0 | LogOpOperandAdaptor::LogOpOperandAdaptor(LogOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6325 | 0 |
|
6326 | 0 | } |
6327 | | |
6328 | 0 | std::pair<unsigned, unsigned> LogOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6329 | 0 | return {index, 1}; |
6330 | 0 | } |
6331 | | |
6332 | 0 | ValueRange LogOpOperandAdaptor::getODSOperands(unsigned index) { |
6333 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6334 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6335 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6336 | 0 | } |
6337 | | |
6338 | 0 | Value LogOpOperandAdaptor::operand() { |
6339 | 0 | return *getODSOperands(0).begin(); |
6340 | 0 | } |
6341 | | |
6342 | 0 | StringRef LogOp::getOperationName() { |
6343 | 0 | return "std.log"; |
6344 | 0 | } |
6345 | | |
6346 | 0 | std::pair<unsigned, unsigned> LogOp::getODSOperandIndexAndLength(unsigned index) { |
6347 | 0 | return {index, 1}; |
6348 | 0 | } |
6349 | | |
6350 | 0 | Operation::operand_range LogOp::getODSOperands(unsigned index) { |
6351 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6352 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6353 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6354 | 0 | } |
6355 | | |
6356 | 0 | Value LogOp::operand() { |
6357 | 0 | return *getODSOperands(0).begin(); |
6358 | 0 | } |
6359 | | |
6360 | 0 | ::mlir::MutableOperandRange LogOp::operandMutable() { |
6361 | 0 | auto range = getODSOperandIndexAndLength(0); |
6362 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6363 | 0 | } |
6364 | | |
6365 | 0 | std::pair<unsigned, unsigned> LogOp::getODSResultIndexAndLength(unsigned index) { |
6366 | 0 | return {index, 1}; |
6367 | 0 | } |
6368 | | |
6369 | 0 | Operation::result_range LogOp::getODSResults(unsigned index) { |
6370 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6371 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6372 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6373 | 0 | } |
6374 | | |
6375 | 0 | void LogOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
6376 | 0 | odsState.addOperands(operand); |
6377 | 0 | odsState.addTypes(resultType0); |
6378 | 0 | } |
6379 | | |
6380 | 0 | void LogOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
6381 | 0 | odsState.addOperands(operand); |
6382 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6383 | 0 | odsState.addTypes(resultTypes); |
6384 | 0 | } |
6385 | | |
6386 | 0 | void LogOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6387 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
6388 | 0 | odsState.addOperands(operands); |
6389 | 0 | odsState.addAttributes(attributes); |
6390 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6391 | 0 | odsState.addTypes(resultTypes); |
6392 | 0 | } |
6393 | | |
6394 | 0 | void LogOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
6395 | 0 | odsState.addOperands(operand); |
6396 | 0 | odsState.addTypes({operand.getType()}); |
6397 | 0 |
|
6398 | 0 | } |
6399 | | |
6400 | 0 | void LogOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6401 | 0 | odsState.addOperands(operands); |
6402 | 0 | odsState.addAttributes(attributes); |
6403 | 0 | odsState.addTypes({operands[0].getType()}); |
6404 | 0 |
|
6405 | 0 | } |
6406 | | |
6407 | 0 | ParseResult LogOp::parse(OpAsmParser &parser, OperationState &result) { |
6408 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6409 | 0 | } |
6410 | | |
6411 | 0 | void LogOp::print(OpAsmPrinter &p) { |
6412 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
6413 | 0 | } |
6414 | | |
6415 | 0 | LogicalResult LogOp::verify() { |
6416 | 0 | { |
6417 | 0 | unsigned index = 0; (void)index; |
6418 | 0 | auto valueGroup0 = getODSOperands(0); |
6419 | 0 | for (Value v : valueGroup0) { |
6420 | 0 | (void)v; |
6421 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6422 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6423 | 0 | } |
6424 | 0 | ++index; |
6425 | 0 | } |
6426 | 0 | } |
6427 | 0 | { |
6428 | 0 | unsigned index = 0; (void)index; |
6429 | 0 | auto valueGroup0 = getODSResults(0); |
6430 | 0 | for (Value v : valueGroup0) { |
6431 | 0 | (void)v; |
6432 | 0 | if (!((true))) { |
6433 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
6434 | 0 | } |
6435 | 0 | ++index; |
6436 | 0 | } |
6437 | 0 | } |
6438 | 0 | return mlir::success(); |
6439 | 0 | } |
6440 | | |
6441 | 0 | void LogOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6442 | 0 |
|
6443 | 0 | } |
6444 | | |
6445 | | |
6446 | | //===----------------------------------------------------------------------===// |
6447 | | // MemRefCastOp definitions |
6448 | | //===----------------------------------------------------------------------===// |
6449 | | |
6450 | 0 | MemRefCastOpOperandAdaptor::MemRefCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6451 | 0 |
|
6452 | 0 | } |
6453 | | |
6454 | 0 | MemRefCastOpOperandAdaptor::MemRefCastOpOperandAdaptor(MemRefCastOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6455 | 0 |
|
6456 | 0 | } |
6457 | | |
6458 | 0 | std::pair<unsigned, unsigned> MemRefCastOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6459 | 0 | return {index, 1}; |
6460 | 0 | } |
6461 | | |
6462 | 0 | ValueRange MemRefCastOpOperandAdaptor::getODSOperands(unsigned index) { |
6463 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6464 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6465 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6466 | 0 | } |
6467 | | |
6468 | 0 | Value MemRefCastOpOperandAdaptor::source() { |
6469 | 0 | return *getODSOperands(0).begin(); |
6470 | 0 | } |
6471 | | |
6472 | 0 | StringRef MemRefCastOp::getOperationName() { |
6473 | 0 | return "std.memref_cast"; |
6474 | 0 | } |
6475 | | |
6476 | 0 | std::pair<unsigned, unsigned> MemRefCastOp::getODSOperandIndexAndLength(unsigned index) { |
6477 | 0 | return {index, 1}; |
6478 | 0 | } |
6479 | | |
6480 | 0 | Operation::operand_range MemRefCastOp::getODSOperands(unsigned index) { |
6481 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6482 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6483 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6484 | 0 | } |
6485 | | |
6486 | 0 | Value MemRefCastOp::source() { |
6487 | 0 | return *getODSOperands(0).begin(); |
6488 | 0 | } |
6489 | | |
6490 | 0 | ::mlir::MutableOperandRange MemRefCastOp::sourceMutable() { |
6491 | 0 | auto range = getODSOperandIndexAndLength(0); |
6492 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6493 | 0 | } |
6494 | | |
6495 | 0 | std::pair<unsigned, unsigned> MemRefCastOp::getODSResultIndexAndLength(unsigned index) { |
6496 | 0 | return {index, 1}; |
6497 | 0 | } |
6498 | | |
6499 | 0 | Operation::result_range MemRefCastOp::getODSResults(unsigned index) { |
6500 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6501 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6502 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6503 | 0 | } |
6504 | | |
6505 | 0 | void MemRefCastOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
6506 | 0 | impl::buildCastOp(builder, result, source, destType); |
6507 | 0 | |
6508 | 0 | } |
6509 | | |
6510 | 0 | void MemRefCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value source) { |
6511 | 0 | odsState.addOperands(source); |
6512 | 0 | odsState.addTypes(resultType0); |
6513 | 0 | } |
6514 | | |
6515 | 0 | void MemRefCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source) { |
6516 | 0 | odsState.addOperands(source); |
6517 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6518 | 0 | odsState.addTypes(resultTypes); |
6519 | 0 | } |
6520 | | |
6521 | 0 | void MemRefCastOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6522 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
6523 | 0 | odsState.addOperands(operands); |
6524 | 0 | odsState.addAttributes(attributes); |
6525 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6526 | 0 | odsState.addTypes(resultTypes); |
6527 | 0 | } |
6528 | | |
6529 | 0 | ParseResult MemRefCastOp::parse(OpAsmParser &parser, OperationState &result) { |
6530 | 0 | return impl::parseCastOp(parser, result); |
6531 | 0 | } |
6532 | | |
6533 | 0 | void MemRefCastOp::print(OpAsmPrinter &p) { |
6534 | 0 | return printStandardCastOp(this->getOperation(), p); |
6535 | 0 | } |
6536 | | |
6537 | 0 | LogicalResult MemRefCastOp::verify() { |
6538 | 0 | { |
6539 | 0 | unsigned index = 0; (void)index; |
6540 | 0 | auto valueGroup0 = getODSOperands(0); |
6541 | 0 | for (Value v : valueGroup0) { |
6542 | 0 | (void)v; |
6543 | 0 | if (!((((v.getType().isa<UnrankedMemRefType>())) && ((true))) || (((v.getType().isa<MemRefType>())) && ((true))))) { |
6544 | 0 | return emitOpError("operand #") << index << " must be unranked.memref of any type values or memref of any type values, but got " << v.getType(); |
6545 | 0 | } |
6546 | 0 | ++index; |
6547 | 0 | } |
6548 | 0 | } |
6549 | 0 | { |
6550 | 0 | unsigned index = 0; (void)index; |
6551 | 0 | auto valueGroup0 = getODSResults(0); |
6552 | 0 | for (Value v : valueGroup0) { |
6553 | 0 | (void)v; |
6554 | 0 | if (!((((v.getType().isa<UnrankedMemRefType>())) && ((true))) || (((v.getType().isa<MemRefType>())) && ((true))))) { |
6555 | 0 | return emitOpError("result #") << index << " must be unranked.memref of any type values or memref of any type values, but got " << v.getType(); |
6556 | 0 | } |
6557 | 0 | ++index; |
6558 | 0 | } |
6559 | 0 | } |
6560 | 0 | return ::verifyCastOp(*this); |
6561 | 0 | } |
6562 | | |
6563 | | |
6564 | | |
6565 | 0 | void MemRefCastOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6566 | 0 |
|
6567 | 0 | } |
6568 | | |
6569 | | |
6570 | | //===----------------------------------------------------------------------===// |
6571 | | // MulFOp definitions |
6572 | | //===----------------------------------------------------------------------===// |
6573 | | |
6574 | 0 | MulFOpOperandAdaptor::MulFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6575 | 0 |
|
6576 | 0 | } |
6577 | | |
6578 | 0 | MulFOpOperandAdaptor::MulFOpOperandAdaptor(MulFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6579 | 0 |
|
6580 | 0 | } |
6581 | | |
6582 | 0 | std::pair<unsigned, unsigned> MulFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6583 | 0 | return {index, 1}; |
6584 | 0 | } |
6585 | | |
6586 | 0 | ValueRange MulFOpOperandAdaptor::getODSOperands(unsigned index) { |
6587 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6588 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6589 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6590 | 0 | } |
6591 | | |
6592 | 0 | Value MulFOpOperandAdaptor::lhs() { |
6593 | 0 | return *getODSOperands(0).begin(); |
6594 | 0 | } |
6595 | | |
6596 | 0 | Value MulFOpOperandAdaptor::rhs() { |
6597 | 0 | return *getODSOperands(1).begin(); |
6598 | 0 | } |
6599 | | |
6600 | 0 | StringRef MulFOp::getOperationName() { |
6601 | 0 | return "std.mulf"; |
6602 | 0 | } |
6603 | | |
6604 | 0 | std::pair<unsigned, unsigned> MulFOp::getODSOperandIndexAndLength(unsigned index) { |
6605 | 0 | return {index, 1}; |
6606 | 0 | } |
6607 | | |
6608 | 0 | Operation::operand_range MulFOp::getODSOperands(unsigned index) { |
6609 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6610 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6611 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6612 | 0 | } |
6613 | | |
6614 | 0 | Value MulFOp::lhs() { |
6615 | 0 | return *getODSOperands(0).begin(); |
6616 | 0 | } |
6617 | | |
6618 | 0 | Value MulFOp::rhs() { |
6619 | 0 | return *getODSOperands(1).begin(); |
6620 | 0 | } |
6621 | | |
6622 | 0 | ::mlir::MutableOperandRange MulFOp::lhsMutable() { |
6623 | 0 | auto range = getODSOperandIndexAndLength(0); |
6624 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6625 | 0 | } |
6626 | | |
6627 | 0 | ::mlir::MutableOperandRange MulFOp::rhsMutable() { |
6628 | 0 | auto range = getODSOperandIndexAndLength(1); |
6629 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6630 | 0 | } |
6631 | | |
6632 | 0 | std::pair<unsigned, unsigned> MulFOp::getODSResultIndexAndLength(unsigned index) { |
6633 | 0 | return {index, 1}; |
6634 | 0 | } |
6635 | | |
6636 | 0 | Operation::result_range MulFOp::getODSResults(unsigned index) { |
6637 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6638 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6639 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6640 | 0 | } |
6641 | | |
6642 | 0 | void MulFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
6643 | 0 | odsState.addOperands(lhs); |
6644 | 0 | odsState.addOperands(rhs); |
6645 | 0 | odsState.addTypes(resultType0); |
6646 | 0 | } |
6647 | | |
6648 | 0 | void MulFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
6649 | 0 | odsState.addOperands(lhs); |
6650 | 0 | odsState.addOperands(rhs); |
6651 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6652 | 0 | odsState.addTypes(resultTypes); |
6653 | 0 | } |
6654 | | |
6655 | 0 | void MulFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6656 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
6657 | 0 | odsState.addOperands(operands); |
6658 | 0 | odsState.addAttributes(attributes); |
6659 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6660 | 0 | odsState.addTypes(resultTypes); |
6661 | 0 | } |
6662 | | |
6663 | 0 | void MulFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
6664 | 0 | odsState.addOperands(lhs); |
6665 | 0 | odsState.addOperands(rhs); |
6666 | 0 | odsState.addTypes({lhs.getType()}); |
6667 | 0 |
|
6668 | 0 | } |
6669 | | |
6670 | 0 | void MulFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6671 | 0 | odsState.addOperands(operands); |
6672 | 0 | odsState.addAttributes(attributes); |
6673 | 0 | odsState.addTypes({operands[0].getType()}); |
6674 | 0 |
|
6675 | 0 | } |
6676 | | |
6677 | 0 | ParseResult MulFOp::parse(OpAsmParser &parser, OperationState &result) { |
6678 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6679 | 0 | } |
6680 | | |
6681 | 0 | void MulFOp::print(OpAsmPrinter &p) { |
6682 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
6683 | 0 | } |
6684 | | |
6685 | 0 | LogicalResult MulFOp::verify() { |
6686 | 0 | { |
6687 | 0 | unsigned index = 0; (void)index; |
6688 | 0 | auto valueGroup0 = getODSOperands(0); |
6689 | 0 | for (Value v : valueGroup0) { |
6690 | 0 | (void)v; |
6691 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6692 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6693 | 0 | } |
6694 | 0 | ++index; |
6695 | 0 | } |
6696 | 0 | auto valueGroup1 = getODSOperands(1); |
6697 | 0 | for (Value v : valueGroup1) { |
6698 | 0 | (void)v; |
6699 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6700 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6701 | 0 | } |
6702 | 0 | ++index; |
6703 | 0 | } |
6704 | 0 | } |
6705 | 0 | { |
6706 | 0 | unsigned index = 0; (void)index; |
6707 | 0 | auto valueGroup0 = getODSResults(0); |
6708 | 0 | for (Value v : valueGroup0) { |
6709 | 0 | (void)v; |
6710 | 0 | if (!((true))) { |
6711 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
6712 | 0 | } |
6713 | 0 | ++index; |
6714 | 0 | } |
6715 | 0 | } |
6716 | 0 | return mlir::success(); |
6717 | 0 | } |
6718 | | |
6719 | | |
6720 | | |
6721 | 0 | void MulFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6722 | 0 |
|
6723 | 0 | } |
6724 | | |
6725 | | |
6726 | | //===----------------------------------------------------------------------===// |
6727 | | // MulIOp definitions |
6728 | | //===----------------------------------------------------------------------===// |
6729 | | |
6730 | 0 | MulIOpOperandAdaptor::MulIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6731 | 0 |
|
6732 | 0 | } |
6733 | | |
6734 | 0 | MulIOpOperandAdaptor::MulIOpOperandAdaptor(MulIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6735 | 0 |
|
6736 | 0 | } |
6737 | | |
6738 | 0 | std::pair<unsigned, unsigned> MulIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6739 | 0 | return {index, 1}; |
6740 | 0 | } |
6741 | | |
6742 | 0 | ValueRange MulIOpOperandAdaptor::getODSOperands(unsigned index) { |
6743 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6744 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6745 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6746 | 0 | } |
6747 | | |
6748 | 0 | Value MulIOpOperandAdaptor::lhs() { |
6749 | 0 | return *getODSOperands(0).begin(); |
6750 | 0 | } |
6751 | | |
6752 | 0 | Value MulIOpOperandAdaptor::rhs() { |
6753 | 0 | return *getODSOperands(1).begin(); |
6754 | 0 | } |
6755 | | |
6756 | 0 | StringRef MulIOp::getOperationName() { |
6757 | 0 | return "std.muli"; |
6758 | 0 | } |
6759 | | |
6760 | 0 | std::pair<unsigned, unsigned> MulIOp::getODSOperandIndexAndLength(unsigned index) { |
6761 | 0 | return {index, 1}; |
6762 | 0 | } |
6763 | | |
6764 | 0 | Operation::operand_range MulIOp::getODSOperands(unsigned index) { |
6765 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6766 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6767 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6768 | 0 | } |
6769 | | |
6770 | 0 | Value MulIOp::lhs() { |
6771 | 0 | return *getODSOperands(0).begin(); |
6772 | 0 | } |
6773 | | |
6774 | 0 | Value MulIOp::rhs() { |
6775 | 0 | return *getODSOperands(1).begin(); |
6776 | 0 | } |
6777 | | |
6778 | 0 | ::mlir::MutableOperandRange MulIOp::lhsMutable() { |
6779 | 0 | auto range = getODSOperandIndexAndLength(0); |
6780 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6781 | 0 | } |
6782 | | |
6783 | 0 | ::mlir::MutableOperandRange MulIOp::rhsMutable() { |
6784 | 0 | auto range = getODSOperandIndexAndLength(1); |
6785 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6786 | 0 | } |
6787 | | |
6788 | 0 | std::pair<unsigned, unsigned> MulIOp::getODSResultIndexAndLength(unsigned index) { |
6789 | 0 | return {index, 1}; |
6790 | 0 | } |
6791 | | |
6792 | 0 | Operation::result_range MulIOp::getODSResults(unsigned index) { |
6793 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6794 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6795 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6796 | 0 | } |
6797 | | |
6798 | 0 | void MulIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
6799 | 0 | odsState.addOperands(lhs); |
6800 | 0 | odsState.addOperands(rhs); |
6801 | 0 | odsState.addTypes(resultType0); |
6802 | 0 | } |
6803 | | |
6804 | 0 | void MulIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
6805 | 0 | odsState.addOperands(lhs); |
6806 | 0 | odsState.addOperands(rhs); |
6807 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6808 | 0 | odsState.addTypes(resultTypes); |
6809 | 0 | } |
6810 | | |
6811 | 0 | void MulIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6812 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
6813 | 0 | odsState.addOperands(operands); |
6814 | 0 | odsState.addAttributes(attributes); |
6815 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6816 | 0 | odsState.addTypes(resultTypes); |
6817 | 0 | } |
6818 | | |
6819 | 0 | void MulIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
6820 | 0 | odsState.addOperands(lhs); |
6821 | 0 | odsState.addOperands(rhs); |
6822 | 0 | odsState.addTypes({lhs.getType()}); |
6823 | 0 |
|
6824 | 0 | } |
6825 | | |
6826 | 0 | void MulIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6827 | 0 | odsState.addOperands(operands); |
6828 | 0 | odsState.addAttributes(attributes); |
6829 | 0 | odsState.addTypes({operands[0].getType()}); |
6830 | 0 |
|
6831 | 0 | } |
6832 | | |
6833 | 0 | ParseResult MulIOp::parse(OpAsmParser &parser, OperationState &result) { |
6834 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6835 | 0 | } |
6836 | | |
6837 | 0 | void MulIOp::print(OpAsmPrinter &p) { |
6838 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
6839 | 0 | } |
6840 | | |
6841 | 0 | LogicalResult MulIOp::verify() { |
6842 | 0 | { |
6843 | 0 | unsigned index = 0; (void)index; |
6844 | 0 | auto valueGroup0 = getODSOperands(0); |
6845 | 0 | for (Value v : valueGroup0) { |
6846 | 0 | (void)v; |
6847 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
6848 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
6849 | 0 | } |
6850 | 0 | ++index; |
6851 | 0 | } |
6852 | 0 | auto valueGroup1 = getODSOperands(1); |
6853 | 0 | for (Value v : valueGroup1) { |
6854 | 0 | (void)v; |
6855 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
6856 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
6857 | 0 | } |
6858 | 0 | ++index; |
6859 | 0 | } |
6860 | 0 | } |
6861 | 0 | { |
6862 | 0 | unsigned index = 0; (void)index; |
6863 | 0 | auto valueGroup0 = getODSResults(0); |
6864 | 0 | for (Value v : valueGroup0) { |
6865 | 0 | (void)v; |
6866 | 0 | if (!((true))) { |
6867 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
6868 | 0 | } |
6869 | 0 | ++index; |
6870 | 0 | } |
6871 | 0 | } |
6872 | 0 | return mlir::success(); |
6873 | 0 | } |
6874 | | |
6875 | | |
6876 | | |
6877 | 0 | void MulIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
6878 | 0 |
|
6879 | 0 | } |
6880 | | |
6881 | | |
6882 | | //===----------------------------------------------------------------------===// |
6883 | | // NegFOp definitions |
6884 | | //===----------------------------------------------------------------------===// |
6885 | | |
6886 | 0 | NegFOpOperandAdaptor::NegFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
6887 | 0 |
|
6888 | 0 | } |
6889 | | |
6890 | 0 | NegFOpOperandAdaptor::NegFOpOperandAdaptor(NegFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
6891 | 0 |
|
6892 | 0 | } |
6893 | | |
6894 | 0 | std::pair<unsigned, unsigned> NegFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
6895 | 0 | return {index, 1}; |
6896 | 0 | } |
6897 | | |
6898 | 0 | ValueRange NegFOpOperandAdaptor::getODSOperands(unsigned index) { |
6899 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6900 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
6901 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
6902 | 0 | } |
6903 | | |
6904 | 0 | Value NegFOpOperandAdaptor::operand() { |
6905 | 0 | return *getODSOperands(0).begin(); |
6906 | 0 | } |
6907 | | |
6908 | 0 | StringRef NegFOp::getOperationName() { |
6909 | 0 | return "std.negf"; |
6910 | 0 | } |
6911 | | |
6912 | 0 | std::pair<unsigned, unsigned> NegFOp::getODSOperandIndexAndLength(unsigned index) { |
6913 | 0 | return {index, 1}; |
6914 | 0 | } |
6915 | | |
6916 | 0 | Operation::operand_range NegFOp::getODSOperands(unsigned index) { |
6917 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
6918 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
6919 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
6920 | 0 | } |
6921 | | |
6922 | 0 | Value NegFOp::operand() { |
6923 | 0 | return *getODSOperands(0).begin(); |
6924 | 0 | } |
6925 | | |
6926 | 0 | ::mlir::MutableOperandRange NegFOp::operandMutable() { |
6927 | 0 | auto range = getODSOperandIndexAndLength(0); |
6928 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
6929 | 0 | } |
6930 | | |
6931 | 0 | std::pair<unsigned, unsigned> NegFOp::getODSResultIndexAndLength(unsigned index) { |
6932 | 0 | return {index, 1}; |
6933 | 0 | } |
6934 | | |
6935 | 0 | Operation::result_range NegFOp::getODSResults(unsigned index) { |
6936 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
6937 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
6938 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
6939 | 0 | } |
6940 | | |
6941 | 0 | void NegFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
6942 | 0 | odsState.addOperands(operand); |
6943 | 0 | odsState.addTypes(resultType0); |
6944 | 0 | } |
6945 | | |
6946 | 0 | void NegFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
6947 | 0 | odsState.addOperands(operand); |
6948 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
6949 | 0 | odsState.addTypes(resultTypes); |
6950 | 0 | } |
6951 | | |
6952 | 0 | void NegFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6953 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
6954 | 0 | odsState.addOperands(operands); |
6955 | 0 | odsState.addAttributes(attributes); |
6956 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
6957 | 0 | odsState.addTypes(resultTypes); |
6958 | 0 | } |
6959 | | |
6960 | 0 | void NegFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
6961 | 0 | odsState.addOperands(operand); |
6962 | 0 | odsState.addTypes({operand.getType()}); |
6963 | 0 |
|
6964 | 0 | } |
6965 | | |
6966 | 0 | void NegFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
6967 | 0 | odsState.addOperands(operands); |
6968 | 0 | odsState.addAttributes(attributes); |
6969 | 0 | odsState.addTypes({operands[0].getType()}); |
6970 | 0 |
|
6971 | 0 | } |
6972 | | |
6973 | 0 | ParseResult NegFOp::parse(OpAsmParser &parser, OperationState &result) { |
6974 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
6975 | 0 | } |
6976 | | |
6977 | 0 | void NegFOp::print(OpAsmPrinter &p) { |
6978 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
6979 | 0 | } |
6980 | | |
6981 | 0 | LogicalResult NegFOp::verify() { |
6982 | 0 | { |
6983 | 0 | unsigned index = 0; (void)index; |
6984 | 0 | auto valueGroup0 = getODSOperands(0); |
6985 | 0 | for (Value v : valueGroup0) { |
6986 | 0 | (void)v; |
6987 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
6988 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
6989 | 0 | } |
6990 | 0 | ++index; |
6991 | 0 | } |
6992 | 0 | } |
6993 | 0 | { |
6994 | 0 | unsigned index = 0; (void)index; |
6995 | 0 | auto valueGroup0 = getODSResults(0); |
6996 | 0 | for (Value v : valueGroup0) { |
6997 | 0 | (void)v; |
6998 | 0 | if (!((true))) { |
6999 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
7000 | 0 | } |
7001 | 0 | ++index; |
7002 | 0 | } |
7003 | 0 | } |
7004 | 0 | return mlir::success(); |
7005 | 0 | } |
7006 | | |
7007 | 0 | void NegFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
7008 | 0 |
|
7009 | 0 | } |
7010 | | |
7011 | | |
7012 | | //===----------------------------------------------------------------------===// |
7013 | | // OrOp definitions |
7014 | | //===----------------------------------------------------------------------===// |
7015 | | |
7016 | 0 | OrOpOperandAdaptor::OrOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7017 | 0 |
|
7018 | 0 | } |
7019 | | |
7020 | 0 | OrOpOperandAdaptor::OrOpOperandAdaptor(OrOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7021 | 0 |
|
7022 | 0 | } |
7023 | | |
7024 | 0 | std::pair<unsigned, unsigned> OrOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7025 | 0 | return {index, 1}; |
7026 | 0 | } |
7027 | | |
7028 | 0 | ValueRange OrOpOperandAdaptor::getODSOperands(unsigned index) { |
7029 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7030 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7031 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7032 | 0 | } |
7033 | | |
7034 | 0 | Value OrOpOperandAdaptor::lhs() { |
7035 | 0 | return *getODSOperands(0).begin(); |
7036 | 0 | } |
7037 | | |
7038 | 0 | Value OrOpOperandAdaptor::rhs() { |
7039 | 0 | return *getODSOperands(1).begin(); |
7040 | 0 | } |
7041 | | |
7042 | 0 | StringRef OrOp::getOperationName() { |
7043 | 0 | return "std.or"; |
7044 | 0 | } |
7045 | | |
7046 | 0 | std::pair<unsigned, unsigned> OrOp::getODSOperandIndexAndLength(unsigned index) { |
7047 | 0 | return {index, 1}; |
7048 | 0 | } |
7049 | | |
7050 | 0 | Operation::operand_range OrOp::getODSOperands(unsigned index) { |
7051 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7052 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7053 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7054 | 0 | } |
7055 | | |
7056 | 0 | Value OrOp::lhs() { |
7057 | 0 | return *getODSOperands(0).begin(); |
7058 | 0 | } |
7059 | | |
7060 | 0 | Value OrOp::rhs() { |
7061 | 0 | return *getODSOperands(1).begin(); |
7062 | 0 | } |
7063 | | |
7064 | 0 | ::mlir::MutableOperandRange OrOp::lhsMutable() { |
7065 | 0 | auto range = getODSOperandIndexAndLength(0); |
7066 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7067 | 0 | } |
7068 | | |
7069 | 0 | ::mlir::MutableOperandRange OrOp::rhsMutable() { |
7070 | 0 | auto range = getODSOperandIndexAndLength(1); |
7071 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7072 | 0 | } |
7073 | | |
7074 | 0 | std::pair<unsigned, unsigned> OrOp::getODSResultIndexAndLength(unsigned index) { |
7075 | 0 | return {index, 1}; |
7076 | 0 | } |
7077 | | |
7078 | 0 | Operation::result_range OrOp::getODSResults(unsigned index) { |
7079 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7080 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7081 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7082 | 0 | } |
7083 | | |
7084 | 0 | void OrOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
7085 | 0 | odsState.addOperands(lhs); |
7086 | 0 | odsState.addOperands(rhs); |
7087 | 0 | odsState.addTypes(resultType0); |
7088 | 0 | } |
7089 | | |
7090 | 0 | void OrOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
7091 | 0 | odsState.addOperands(lhs); |
7092 | 0 | odsState.addOperands(rhs); |
7093 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
7094 | 0 | odsState.addTypes(resultTypes); |
7095 | 0 | } |
7096 | | |
7097 | 0 | void OrOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7098 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
7099 | 0 | odsState.addOperands(operands); |
7100 | 0 | odsState.addAttributes(attributes); |
7101 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
7102 | 0 | odsState.addTypes(resultTypes); |
7103 | 0 | } |
7104 | | |
7105 | 0 | void OrOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
7106 | 0 | odsState.addOperands(lhs); |
7107 | 0 | odsState.addOperands(rhs); |
7108 | 0 | odsState.addTypes({lhs.getType()}); |
7109 | 0 |
|
7110 | 0 | } |
7111 | | |
7112 | 0 | void OrOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7113 | 0 | odsState.addOperands(operands); |
7114 | 0 | odsState.addAttributes(attributes); |
7115 | 0 | odsState.addTypes({operands[0].getType()}); |
7116 | 0 |
|
7117 | 0 | } |
7118 | | |
7119 | 0 | ParseResult OrOp::parse(OpAsmParser &parser, OperationState &result) { |
7120 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
7121 | 0 | } |
7122 | | |
7123 | 0 | void OrOp::print(OpAsmPrinter &p) { |
7124 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
7125 | 0 | } |
7126 | | |
7127 | 0 | LogicalResult OrOp::verify() { |
7128 | 0 | { |
7129 | 0 | unsigned index = 0; (void)index; |
7130 | 0 | auto valueGroup0 = getODSOperands(0); |
7131 | 0 | for (Value v : valueGroup0) { |
7132 | 0 | (void)v; |
7133 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
7134 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
7135 | 0 | } |
7136 | 0 | ++index; |
7137 | 0 | } |
7138 | 0 | auto valueGroup1 = getODSOperands(1); |
7139 | 0 | for (Value v : valueGroup1) { |
7140 | 0 | (void)v; |
7141 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
7142 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
7143 | 0 | } |
7144 | 0 | ++index; |
7145 | 0 | } |
7146 | 0 | } |
7147 | 0 | { |
7148 | 0 | unsigned index = 0; (void)index; |
7149 | 0 | auto valueGroup0 = getODSResults(0); |
7150 | 0 | for (Value v : valueGroup0) { |
7151 | 0 | (void)v; |
7152 | 0 | if (!((true))) { |
7153 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
7154 | 0 | } |
7155 | 0 | ++index; |
7156 | 0 | } |
7157 | 0 | } |
7158 | 0 | return mlir::success(); |
7159 | 0 | } |
7160 | | |
7161 | | |
7162 | | |
7163 | 0 | void OrOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
7164 | 0 |
|
7165 | 0 | } |
7166 | | |
7167 | | |
7168 | | //===----------------------------------------------------------------------===// |
7169 | | // PrefetchOp definitions |
7170 | | //===----------------------------------------------------------------------===// |
7171 | | |
7172 | 0 | PrefetchOpOperandAdaptor::PrefetchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7173 | 0 |
|
7174 | 0 | } |
7175 | | |
7176 | 0 | PrefetchOpOperandAdaptor::PrefetchOpOperandAdaptor(PrefetchOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7177 | 0 |
|
7178 | 0 | } |
7179 | | |
7180 | 0 | std::pair<unsigned, unsigned> PrefetchOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7181 | 0 | bool isVariadic[] = {false, true}; |
7182 | 0 | int prevVariadicCount = 0; |
7183 | 0 | for (unsigned i = 0; i < index; ++i) |
7184 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
7185 | 0 |
|
7186 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
7187 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
7188 | 0 | int variadicSize = (odsOperands.size() - 1) / 1; |
7189 | 0 | // `index` passed in as the parameter is the static index which counts each |
7190 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
7191 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
7192 | 0 | // value pack for this static operand starts. |
7193 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
7194 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
7195 | 0 | return {start, size}; |
7196 | 0 | } |
7197 | | |
7198 | 0 | ValueRange PrefetchOpOperandAdaptor::getODSOperands(unsigned index) { |
7199 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7200 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7201 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7202 | 0 | } |
7203 | | |
7204 | 0 | Value PrefetchOpOperandAdaptor::memref() { |
7205 | 0 | return *getODSOperands(0).begin(); |
7206 | 0 | } |
7207 | | |
7208 | 0 | ValueRange PrefetchOpOperandAdaptor::indices() { |
7209 | 0 | return getODSOperands(1); |
7210 | 0 | } |
7211 | | |
7212 | 0 | BoolAttr PrefetchOpOperandAdaptor::isWrite() { |
7213 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
7214 | 0 | BoolAttr attr = odsAttrs.get("isWrite").cast<BoolAttr>(); |
7215 | 0 | return attr; |
7216 | 0 | } |
7217 | | |
7218 | 0 | IntegerAttr PrefetchOpOperandAdaptor::localityHint() { |
7219 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
7220 | 0 | IntegerAttr attr = odsAttrs.get("localityHint").cast<IntegerAttr>(); |
7221 | 0 | return attr; |
7222 | 0 | } |
7223 | | |
7224 | 0 | BoolAttr PrefetchOpOperandAdaptor::isDataCache() { |
7225 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
7226 | 0 | BoolAttr attr = odsAttrs.get("isDataCache").cast<BoolAttr>(); |
7227 | 0 | return attr; |
7228 | 0 | } |
7229 | | |
7230 | 0 | StringRef PrefetchOp::getOperationName() { |
7231 | 0 | return "std.prefetch"; |
7232 | 0 | } |
7233 | | |
7234 | 0 | std::pair<unsigned, unsigned> PrefetchOp::getODSOperandIndexAndLength(unsigned index) { |
7235 | 0 | bool isVariadic[] = {false, true}; |
7236 | 0 | int prevVariadicCount = 0; |
7237 | 0 | for (unsigned i = 0; i < index; ++i) |
7238 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
7239 | 0 |
|
7240 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
7241 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
7242 | 0 | int variadicSize = (getOperation()->getNumOperands() - 1) / 1; |
7243 | 0 | // `index` passed in as the parameter is the static index which counts each |
7244 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
7245 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
7246 | 0 | // value pack for this static operand starts. |
7247 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
7248 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
7249 | 0 | return {start, size}; |
7250 | 0 | } |
7251 | | |
7252 | 0 | Operation::operand_range PrefetchOp::getODSOperands(unsigned index) { |
7253 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7254 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7255 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7256 | 0 | } |
7257 | | |
7258 | 0 | Value PrefetchOp::memref() { |
7259 | 0 | return *getODSOperands(0).begin(); |
7260 | 0 | } |
7261 | | |
7262 | 0 | Operation::operand_range PrefetchOp::indices() { |
7263 | 0 | return getODSOperands(1); |
7264 | 0 | } |
7265 | | |
7266 | 0 | ::mlir::MutableOperandRange PrefetchOp::memrefMutable() { |
7267 | 0 | auto range = getODSOperandIndexAndLength(0); |
7268 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7269 | 0 | } |
7270 | | |
7271 | 0 | ::mlir::MutableOperandRange PrefetchOp::indicesMutable() { |
7272 | 0 | auto range = getODSOperandIndexAndLength(1); |
7273 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7274 | 0 | } |
7275 | | |
7276 | 0 | std::pair<unsigned, unsigned> PrefetchOp::getODSResultIndexAndLength(unsigned index) { |
7277 | 0 | return {index, 1}; |
7278 | 0 | } |
7279 | | |
7280 | 0 | Operation::result_range PrefetchOp::getODSResults(unsigned index) { |
7281 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7282 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7283 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7284 | 0 | } |
7285 | | |
7286 | 0 | BoolAttr PrefetchOp::isWriteAttr() { |
7287 | 0 | return this->getAttr("isWrite").cast<BoolAttr>(); |
7288 | 0 | } |
7289 | | |
7290 | 0 | bool PrefetchOp::isWrite() { |
7291 | 0 | auto attr = isWriteAttr(); |
7292 | 0 | return attr.getValue(); |
7293 | 0 | } |
7294 | | |
7295 | 0 | IntegerAttr PrefetchOp::localityHintAttr() { |
7296 | 0 | return this->getAttr("localityHint").cast<IntegerAttr>(); |
7297 | 0 | } |
7298 | | |
7299 | 0 | APInt PrefetchOp::localityHint() { |
7300 | 0 | auto attr = localityHintAttr(); |
7301 | 0 | return attr.getValue(); |
7302 | 0 | } |
7303 | | |
7304 | 0 | BoolAttr PrefetchOp::isDataCacheAttr() { |
7305 | 0 | return this->getAttr("isDataCache").cast<BoolAttr>(); |
7306 | 0 | } |
7307 | | |
7308 | 0 | bool PrefetchOp::isDataCache() { |
7309 | 0 | auto attr = isDataCacheAttr(); |
7310 | 0 | return attr.getValue(); |
7311 | 0 | } |
7312 | | |
7313 | 0 | void PrefetchOp::isWriteAttr(BoolAttr attr) { |
7314 | 0 | this->getOperation()->setAttr("isWrite", attr); |
7315 | 0 | } |
7316 | | |
7317 | 0 | void PrefetchOp::localityHintAttr(IntegerAttr attr) { |
7318 | 0 | this->getOperation()->setAttr("localityHint", attr); |
7319 | 0 | } |
7320 | | |
7321 | 0 | void PrefetchOp::isDataCacheAttr(BoolAttr attr) { |
7322 | 0 | this->getOperation()->setAttr("isDataCache", attr); |
7323 | 0 | } |
7324 | | |
7325 | 0 | void PrefetchOp::build(OpBuilder &builder, OperationState &result, Value memref,ArrayRef<Value> indices, bool isWrite, unsigned hint, bool isData) { |
7326 | 0 | auto hintAttr = builder.getI32IntegerAttr(hint); |
7327 | 0 | auto isWriteAttr = builder.getBoolAttr(isWrite); |
7328 | 0 | auto isDataCacheAttr = builder.getBoolAttr(isData); |
7329 | 0 | result.addOperands(memref); |
7330 | 0 | result.addOperands(indices); |
7331 | 0 | result.addAttribute("localityHint", hintAttr); |
7332 | 0 | result.addAttribute("isWrite", isWriteAttr); |
7333 | 0 | result.addAttribute("isDataCache", isDataCacheAttr); |
7334 | 0 | |
7335 | 0 | } |
7336 | | |
7337 | 0 | void PrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache) { |
7338 | 0 | odsState.addOperands(memref); |
7339 | 0 | odsState.addOperands(indices); |
7340 | 0 | odsState.addAttribute("isWrite", isWrite); |
7341 | 0 | odsState.addAttribute("localityHint", localityHint); |
7342 | 0 | odsState.addAttribute("isDataCache", isDataCache); |
7343 | 0 | } |
7344 | | |
7345 | 0 | void PrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache) { |
7346 | 0 | odsState.addOperands(memref); |
7347 | 0 | odsState.addOperands(indices); |
7348 | 0 | odsState.addAttribute("isWrite", isWrite); |
7349 | 0 | odsState.addAttribute("localityHint", localityHint); |
7350 | 0 | odsState.addAttribute("isDataCache", isDataCache); |
7351 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
7352 | 0 | odsState.addTypes(resultTypes); |
7353 | 0 | } |
7354 | | |
7355 | 0 | void PrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache) { |
7356 | 0 | odsState.addOperands(memref); |
7357 | 0 | odsState.addOperands(indices); |
7358 | 0 | odsState.addAttribute("isWrite", odsBuilder.getBoolAttr(isWrite)); |
7359 | 0 | odsState.addAttribute("localityHint", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint)); |
7360 | 0 | odsState.addAttribute("isDataCache", odsBuilder.getBoolAttr(isDataCache)); |
7361 | 0 | } |
7362 | | |
7363 | 0 | void PrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache) { |
7364 | 0 | odsState.addOperands(memref); |
7365 | 0 | odsState.addOperands(indices); |
7366 | 0 | odsState.addAttribute("isWrite", odsBuilder.getBoolAttr(isWrite)); |
7367 | 0 | odsState.addAttribute("localityHint", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint)); |
7368 | 0 | odsState.addAttribute("isDataCache", odsBuilder.getBoolAttr(isDataCache)); |
7369 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
7370 | 0 | odsState.addTypes(resultTypes); |
7371 | 0 | } |
7372 | | |
7373 | 0 | void PrefetchOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7374 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
7375 | 0 | odsState.addOperands(operands); |
7376 | 0 | odsState.addAttributes(attributes); |
7377 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
7378 | 0 | odsState.addTypes(resultTypes); |
7379 | 0 | } |
7380 | | |
7381 | 0 | ParseResult PrefetchOp::parse(OpAsmParser &parser, OperationState &result) { |
7382 | 0 | return ::parsePrefetchOp(parser, result); |
7383 | 0 | } |
7384 | | |
7385 | 0 | void PrefetchOp::print(OpAsmPrinter &p) { |
7386 | 0 | return ::print(p, *this); |
7387 | 0 | } |
7388 | | |
7389 | 0 | LogicalResult PrefetchOp::verify() { |
7390 | 0 | auto tblgen_isWrite = this->getAttr("isWrite"); |
7391 | 0 | if (!tblgen_isWrite) return emitOpError("requires attribute 'isWrite'"); |
7392 | 0 | { |
7393 | 0 | if (!((tblgen_isWrite.isa<BoolAttr>()))) return emitOpError("attribute 'isWrite' failed to satisfy constraint: bool attribute"); |
7394 | 0 | } |
7395 | 0 | auto tblgen_localityHint = this->getAttr("localityHint"); |
7396 | 0 | if (!tblgen_localityHint) return emitOpError("requires attribute 'localityHint'"); |
7397 | 0 | { |
7398 | 0 | if (!((((tblgen_localityHint.isa<IntegerAttr>())) && ((tblgen_localityHint.cast<IntegerAttr>().getType().isSignlessInteger(32)))) && ((tblgen_localityHint.cast<IntegerAttr>().getInt() >= 0)) && ((tblgen_localityHint.cast<IntegerAttr>().getInt() <= 3)))) return emitOpError("attribute 'localityHint' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3"); |
7399 | 0 | } |
7400 | 0 | auto tblgen_isDataCache = this->getAttr("isDataCache"); |
7401 | 0 | if (!tblgen_isDataCache) return emitOpError("requires attribute 'isDataCache'"); |
7402 | 0 | { |
7403 | 0 | if (!((tblgen_isDataCache.isa<BoolAttr>()))) return emitOpError("attribute 'isDataCache' failed to satisfy constraint: bool attribute"); |
7404 | 0 | } |
7405 | 0 | { |
7406 | 0 | unsigned index = 0; (void)index; |
7407 | 0 | auto valueGroup0 = getODSOperands(0); |
7408 | 0 | for (Value v : valueGroup0) { |
7409 | 0 | (void)v; |
7410 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
7411 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
7412 | 0 | } |
7413 | 0 | ++index; |
7414 | 0 | } |
7415 | 0 | auto valueGroup1 = getODSOperands(1); |
7416 | 0 | for (Value v : valueGroup1) { |
7417 | 0 | (void)v; |
7418 | 0 | if (!((v.getType().isa<IndexType>()))) { |
7419 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
7420 | 0 | } |
7421 | 0 | ++index; |
7422 | 0 | } |
7423 | 0 | } |
7424 | 0 | { |
7425 | 0 | unsigned index = 0; (void)index; |
7426 | 0 | } |
7427 | 0 | return ::verify(*this); |
7428 | 0 | } |
7429 | | |
7430 | | |
7431 | | |
7432 | | |
7433 | | //===----------------------------------------------------------------------===// |
7434 | | // RankOp definitions |
7435 | | //===----------------------------------------------------------------------===// |
7436 | | |
7437 | 0 | RankOpOperandAdaptor::RankOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7438 | 0 |
|
7439 | 0 | } |
7440 | | |
7441 | 0 | RankOpOperandAdaptor::RankOpOperandAdaptor(RankOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7442 | 0 |
|
7443 | 0 | } |
7444 | | |
7445 | 0 | std::pair<unsigned, unsigned> RankOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7446 | 0 | return {index, 1}; |
7447 | 0 | } |
7448 | | |
7449 | 0 | ValueRange RankOpOperandAdaptor::getODSOperands(unsigned index) { |
7450 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7451 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7452 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7453 | 0 | } |
7454 | | |
7455 | 0 | StringRef RankOp::getOperationName() { |
7456 | 0 | return "std.rank"; |
7457 | 0 | } |
7458 | | |
7459 | 0 | std::pair<unsigned, unsigned> RankOp::getODSOperandIndexAndLength(unsigned index) { |
7460 | 0 | return {index, 1}; |
7461 | 0 | } |
7462 | | |
7463 | 0 | Operation::operand_range RankOp::getODSOperands(unsigned index) { |
7464 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7465 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7466 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7467 | 0 | } |
7468 | | |
7469 | 0 | std::pair<unsigned, unsigned> RankOp::getODSResultIndexAndLength(unsigned index) { |
7470 | 0 | return {index, 1}; |
7471 | 0 | } |
7472 | | |
7473 | 0 | Operation::result_range RankOp::getODSResults(unsigned index) { |
7474 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7475 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7476 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7477 | 0 | } |
7478 | | |
7479 | 0 | void RankOp::build(OpBuilder &builder, OperationState &result, Value tensor) { |
7480 | 0 | auto indexType = builder.getIndexType(); |
7481 | 0 | build(builder, result, indexType, tensor); |
7482 | 0 | |
7483 | 0 | } |
7484 | | |
7485 | 0 | void RankOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value odsArg_0) { |
7486 | 0 | odsState.addOperands(odsArg_0); |
7487 | 0 | odsState.addTypes(resultType0); |
7488 | 0 | } |
7489 | | |
7490 | 0 | void RankOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value odsArg_0) { |
7491 | 0 | odsState.addOperands(odsArg_0); |
7492 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
7493 | 0 | odsState.addTypes(resultTypes); |
7494 | 0 | } |
7495 | | |
7496 | 0 | void RankOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7497 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
7498 | 0 | odsState.addOperands(operands); |
7499 | 0 | odsState.addAttributes(attributes); |
7500 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
7501 | 0 | odsState.addTypes(resultTypes); |
7502 | 0 | } |
7503 | | |
7504 | 0 | LogicalResult RankOp::verify() { |
7505 | 0 | { |
7506 | 0 | unsigned index = 0; (void)index; |
7507 | 0 | auto valueGroup0 = getODSOperands(0); |
7508 | 0 | for (Value v : valueGroup0) { |
7509 | 0 | (void)v; |
7510 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
7511 | 0 | return emitOpError("operand #") << index << " must be tensor of any type values, but got " << v.getType(); |
7512 | 0 | } |
7513 | 0 | ++index; |
7514 | 0 | } |
7515 | 0 | } |
7516 | 0 | { |
7517 | 0 | unsigned index = 0; (void)index; |
7518 | 0 | auto valueGroup0 = getODSResults(0); |
7519 | 0 | for (Value v : valueGroup0) { |
7520 | 0 | (void)v; |
7521 | 0 | if (!((v.getType().isa<IndexType>()))) { |
7522 | 0 | return emitOpError("result #") << index << " must be index, but got " << v.getType(); |
7523 | 0 | } |
7524 | 0 | ++index; |
7525 | 0 | } |
7526 | 0 | } |
7527 | 0 | return mlir::success(); |
7528 | 0 | } |
7529 | | |
7530 | | |
7531 | | |
7532 | 0 | ParseResult RankOp::parse(OpAsmParser &parser, OperationState &result) { |
7533 | 0 | SmallVector<Type, 1> allOperandTypes; |
7534 | 0 | llvm::SMLoc allOperandLoc = parser.getCurrentLocation(); |
7535 | 0 | SmallVector<OpAsmParser::OperandType, 4> allOperands; |
7536 | 0 | if (parser.parseOperandList(allOperands)) |
7537 | 0 | return failure(); |
7538 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
7539 | 0 | return failure(); |
7540 | 0 | if (parser.parseColon()) |
7541 | 0 | return failure(); |
7542 | 0 | |
7543 | 0 | if (parser.parseTypeList(allOperandTypes)) |
7544 | 0 | return failure(); |
7545 | 0 | Type odsBuildableType0 = parser.getBuilder().getIndexType(); |
7546 | 0 | result.addTypes(odsBuildableType0); |
7547 | 0 | if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands)) |
7548 | 0 | return failure(); |
7549 | 0 | return success(); |
7550 | 0 | } |
7551 | | |
7552 | 0 | void RankOp::print(OpAsmPrinter &p) { |
7553 | 0 | p << "rank"; |
7554 | 0 | p << " "; |
7555 | 0 | p << getOperation()->getOperands(); |
7556 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
7557 | 0 | p << " " << ":"; |
7558 | 0 | p << " "; |
7559 | 0 | p << getOperation()->getOperandTypes(); |
7560 | 0 | } |
7561 | | |
7562 | 0 | void RankOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
7563 | 0 |
|
7564 | 0 | } |
7565 | | |
7566 | | |
7567 | | //===----------------------------------------------------------------------===// |
7568 | | // ReOp definitions |
7569 | | //===----------------------------------------------------------------------===// |
7570 | | |
7571 | 0 | ReOpOperandAdaptor::ReOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7572 | 0 |
|
7573 | 0 | } |
7574 | | |
7575 | 0 | ReOpOperandAdaptor::ReOpOperandAdaptor(ReOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7576 | 0 |
|
7577 | 0 | } |
7578 | | |
7579 | 0 | std::pair<unsigned, unsigned> ReOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7580 | 0 | return {index, 1}; |
7581 | 0 | } |
7582 | | |
7583 | 0 | ValueRange ReOpOperandAdaptor::getODSOperands(unsigned index) { |
7584 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7585 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7586 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7587 | 0 | } |
7588 | | |
7589 | 0 | Value ReOpOperandAdaptor::complex() { |
7590 | 0 | return *getODSOperands(0).begin(); |
7591 | 0 | } |
7592 | | |
7593 | 0 | StringRef ReOp::getOperationName() { |
7594 | 0 | return "std.re"; |
7595 | 0 | } |
7596 | | |
7597 | 0 | std::pair<unsigned, unsigned> ReOp::getODSOperandIndexAndLength(unsigned index) { |
7598 | 0 | return {index, 1}; |
7599 | 0 | } |
7600 | | |
7601 | 0 | Operation::operand_range ReOp::getODSOperands(unsigned index) { |
7602 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7603 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7604 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7605 | 0 | } |
7606 | | |
7607 | 0 | Value ReOp::complex() { |
7608 | 0 | return *getODSOperands(0).begin(); |
7609 | 0 | } |
7610 | | |
7611 | 0 | ::mlir::MutableOperandRange ReOp::complexMutable() { |
7612 | 0 | auto range = getODSOperandIndexAndLength(0); |
7613 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7614 | 0 | } |
7615 | | |
7616 | 0 | std::pair<unsigned, unsigned> ReOp::getODSResultIndexAndLength(unsigned index) { |
7617 | 0 | return {index, 1}; |
7618 | 0 | } |
7619 | | |
7620 | 0 | Operation::result_range ReOp::getODSResults(unsigned index) { |
7621 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7622 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7623 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7624 | 0 | } |
7625 | | |
7626 | 0 | Value ReOp::real() { |
7627 | 0 | return *getODSResults(0).begin(); |
7628 | 0 | } |
7629 | | |
7630 | 0 | void ReOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type real, Value complex) { |
7631 | 0 | odsState.addOperands(complex); |
7632 | 0 | odsState.addTypes(real); |
7633 | 0 | } |
7634 | | |
7635 | 0 | void ReOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value complex) { |
7636 | 0 | odsState.addOperands(complex); |
7637 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
7638 | 0 | odsState.addTypes(resultTypes); |
7639 | 0 | } |
7640 | | |
7641 | 0 | void ReOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7642 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
7643 | 0 | odsState.addOperands(operands); |
7644 | 0 | odsState.addAttributes(attributes); |
7645 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
7646 | 0 | odsState.addTypes(resultTypes); |
7647 | 0 | } |
7648 | | |
7649 | 0 | LogicalResult ReOp::verify() { |
7650 | 0 | { |
7651 | 0 | unsigned index = 0; (void)index; |
7652 | 0 | auto valueGroup0 = getODSOperands(0); |
7653 | 0 | for (Value v : valueGroup0) { |
7654 | 0 | (void)v; |
7655 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
7656 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
7657 | 0 | } |
7658 | 0 | ++index; |
7659 | 0 | } |
7660 | 0 | } |
7661 | 0 | { |
7662 | 0 | unsigned index = 0; (void)index; |
7663 | 0 | auto valueGroup0 = getODSResults(0); |
7664 | 0 | for (Value v : valueGroup0) { |
7665 | 0 | (void)v; |
7666 | 0 | if (!((v.getType().isa<FloatType>()))) { |
7667 | 0 | return emitOpError("result #") << index << " must be floating-point, but got " << v.getType(); |
7668 | 0 | } |
7669 | 0 | ++index; |
7670 | 0 | } |
7671 | 0 | } |
7672 | 0 | if (!(((*this->getODSOperands(0).begin()).getType().cast<ComplexType>().getElementType() == (*this->getODSResults(0).begin()).getType()))) { |
7673 | 0 | return emitOpError("failed to verify that complex element type matches result type"); |
7674 | 0 | } |
7675 | 0 | return mlir::success(); |
7676 | 0 | } |
7677 | | |
7678 | 0 | ParseResult ReOp::parse(OpAsmParser &parser, OperationState &result) { |
7679 | 0 | OpAsmParser::OperandType complexRawOperands[1]; |
7680 | 0 | ArrayRef<OpAsmParser::OperandType> complexOperands(complexRawOperands); llvm::SMLoc complexOperandsLoc = parser.getCurrentLocation(); |
7681 | 0 | (void)complexOperandsLoc; |
7682 | 0 | Type complexRawTypes[1]; |
7683 | 0 | ArrayRef<Type> complexTypes(complexRawTypes); |
7684 | 0 |
|
7685 | 0 | if (parser.parseOperand(complexRawOperands[0])) |
7686 | 0 | return failure(); |
7687 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
7688 | 0 | return failure(); |
7689 | 0 | if (parser.parseColon()) |
7690 | 0 | return failure(); |
7691 | 0 | |
7692 | 0 | if (parser.parseType(complexRawTypes[0])) |
7693 | 0 | return failure(); |
7694 | 0 | for (Type type : complexTypes) { |
7695 | 0 | (void)type; |
7696 | 0 | if (!(((type.isa<ComplexType>())) && ((type.cast<ComplexType>().getElementType().isa<FloatType>())))) { |
7697 | 0 | return parser.emitError(parser.getNameLoc()) << "'complex' must be complex type with floating-point elements, but got " << type; |
7698 | 0 | } |
7699 | 0 | } |
7700 | 0 | result.addTypes(complexTypes[0].cast<ComplexType>().getElementType()); |
7701 | 0 | if (parser.resolveOperands(complexOperands, complexTypes, complexOperandsLoc, result.operands)) |
7702 | 0 | return failure(); |
7703 | 0 | return success(); |
7704 | 0 | } |
7705 | | |
7706 | 0 | void ReOp::print(OpAsmPrinter &p) { |
7707 | 0 | p << "re"; |
7708 | 0 | p << " "; |
7709 | 0 | p << complex(); |
7710 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
7711 | 0 | p << " " << ":"; |
7712 | 0 | p << " "; |
7713 | 0 | p << ArrayRef<Type>(complex().getType()); |
7714 | 0 | } |
7715 | | |
7716 | 0 | void ReOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
7717 | 0 |
|
7718 | 0 | } |
7719 | | |
7720 | | |
7721 | | //===----------------------------------------------------------------------===// |
7722 | | // RemFOp definitions |
7723 | | //===----------------------------------------------------------------------===// |
7724 | | |
7725 | 0 | RemFOpOperandAdaptor::RemFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7726 | 0 |
|
7727 | 0 | } |
7728 | | |
7729 | 0 | RemFOpOperandAdaptor::RemFOpOperandAdaptor(RemFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7730 | 0 |
|
7731 | 0 | } |
7732 | | |
7733 | 0 | std::pair<unsigned, unsigned> RemFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7734 | 0 | return {index, 1}; |
7735 | 0 | } |
7736 | | |
7737 | 0 | ValueRange RemFOpOperandAdaptor::getODSOperands(unsigned index) { |
7738 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7739 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7740 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7741 | 0 | } |
7742 | | |
7743 | 0 | Value RemFOpOperandAdaptor::lhs() { |
7744 | 0 | return *getODSOperands(0).begin(); |
7745 | 0 | } |
7746 | | |
7747 | 0 | Value RemFOpOperandAdaptor::rhs() { |
7748 | 0 | return *getODSOperands(1).begin(); |
7749 | 0 | } |
7750 | | |
7751 | 0 | StringRef RemFOp::getOperationName() { |
7752 | 0 | return "std.remf"; |
7753 | 0 | } |
7754 | | |
7755 | 0 | std::pair<unsigned, unsigned> RemFOp::getODSOperandIndexAndLength(unsigned index) { |
7756 | 0 | return {index, 1}; |
7757 | 0 | } |
7758 | | |
7759 | 0 | Operation::operand_range RemFOp::getODSOperands(unsigned index) { |
7760 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7761 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7762 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7763 | 0 | } |
7764 | | |
7765 | 0 | Value RemFOp::lhs() { |
7766 | 0 | return *getODSOperands(0).begin(); |
7767 | 0 | } |
7768 | | |
7769 | 0 | Value RemFOp::rhs() { |
7770 | 0 | return *getODSOperands(1).begin(); |
7771 | 0 | } |
7772 | | |
7773 | 0 | ::mlir::MutableOperandRange RemFOp::lhsMutable() { |
7774 | 0 | auto range = getODSOperandIndexAndLength(0); |
7775 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7776 | 0 | } |
7777 | | |
7778 | 0 | ::mlir::MutableOperandRange RemFOp::rhsMutable() { |
7779 | 0 | auto range = getODSOperandIndexAndLength(1); |
7780 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7781 | 0 | } |
7782 | | |
7783 | 0 | std::pair<unsigned, unsigned> RemFOp::getODSResultIndexAndLength(unsigned index) { |
7784 | 0 | return {index, 1}; |
7785 | 0 | } |
7786 | | |
7787 | 0 | Operation::result_range RemFOp::getODSResults(unsigned index) { |
7788 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7789 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7790 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7791 | 0 | } |
7792 | | |
7793 | 0 | void RemFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
7794 | 0 | odsState.addOperands(lhs); |
7795 | 0 | odsState.addOperands(rhs); |
7796 | 0 | odsState.addTypes(resultType0); |
7797 | 0 | } |
7798 | | |
7799 | 0 | void RemFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
7800 | 0 | odsState.addOperands(lhs); |
7801 | 0 | odsState.addOperands(rhs); |
7802 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
7803 | 0 | odsState.addTypes(resultTypes); |
7804 | 0 | } |
7805 | | |
7806 | 0 | void RemFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7807 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
7808 | 0 | odsState.addOperands(operands); |
7809 | 0 | odsState.addAttributes(attributes); |
7810 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
7811 | 0 | odsState.addTypes(resultTypes); |
7812 | 0 | } |
7813 | | |
7814 | 0 | void RemFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
7815 | 0 | odsState.addOperands(lhs); |
7816 | 0 | odsState.addOperands(rhs); |
7817 | 0 | odsState.addTypes({lhs.getType()}); |
7818 | 0 |
|
7819 | 0 | } |
7820 | | |
7821 | 0 | void RemFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7822 | 0 | odsState.addOperands(operands); |
7823 | 0 | odsState.addAttributes(attributes); |
7824 | 0 | odsState.addTypes({operands[0].getType()}); |
7825 | 0 |
|
7826 | 0 | } |
7827 | | |
7828 | 0 | ParseResult RemFOp::parse(OpAsmParser &parser, OperationState &result) { |
7829 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
7830 | 0 | } |
7831 | | |
7832 | 0 | void RemFOp::print(OpAsmPrinter &p) { |
7833 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
7834 | 0 | } |
7835 | | |
7836 | 0 | LogicalResult RemFOp::verify() { |
7837 | 0 | { |
7838 | 0 | unsigned index = 0; (void)index; |
7839 | 0 | auto valueGroup0 = getODSOperands(0); |
7840 | 0 | for (Value v : valueGroup0) { |
7841 | 0 | (void)v; |
7842 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
7843 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
7844 | 0 | } |
7845 | 0 | ++index; |
7846 | 0 | } |
7847 | 0 | auto valueGroup1 = getODSOperands(1); |
7848 | 0 | for (Value v : valueGroup1) { |
7849 | 0 | (void)v; |
7850 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
7851 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
7852 | 0 | } |
7853 | 0 | ++index; |
7854 | 0 | } |
7855 | 0 | } |
7856 | 0 | { |
7857 | 0 | unsigned index = 0; (void)index; |
7858 | 0 | auto valueGroup0 = getODSResults(0); |
7859 | 0 | for (Value v : valueGroup0) { |
7860 | 0 | (void)v; |
7861 | 0 | if (!((true))) { |
7862 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
7863 | 0 | } |
7864 | 0 | ++index; |
7865 | 0 | } |
7866 | 0 | } |
7867 | 0 | return mlir::success(); |
7868 | 0 | } |
7869 | | |
7870 | 0 | void RemFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
7871 | 0 |
|
7872 | 0 | } |
7873 | | |
7874 | | |
7875 | | //===----------------------------------------------------------------------===// |
7876 | | // ReturnOp definitions |
7877 | | //===----------------------------------------------------------------------===// |
7878 | | |
7879 | 0 | ReturnOpOperandAdaptor::ReturnOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
7880 | 0 |
|
7881 | 0 | } |
7882 | | |
7883 | 0 | ReturnOpOperandAdaptor::ReturnOpOperandAdaptor(ReturnOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
7884 | 0 |
|
7885 | 0 | } |
7886 | | |
7887 | 0 | std::pair<unsigned, unsigned> ReturnOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
7888 | 0 | bool isVariadic[] = {true}; |
7889 | 0 | int prevVariadicCount = 0; |
7890 | 0 | for (unsigned i = 0; i < index; ++i) |
7891 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
7892 | 0 |
|
7893 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
7894 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
7895 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
7896 | 0 | // `index` passed in as the parameter is the static index which counts each |
7897 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
7898 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
7899 | 0 | // value pack for this static operand starts. |
7900 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
7901 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
7902 | 0 | return {start, size}; |
7903 | 0 | } |
7904 | | |
7905 | 0 | ValueRange ReturnOpOperandAdaptor::getODSOperands(unsigned index) { |
7906 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7907 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
7908 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
7909 | 0 | } |
7910 | | |
7911 | 0 | ValueRange ReturnOpOperandAdaptor::operands() { |
7912 | 0 | return getODSOperands(0); |
7913 | 0 | } |
7914 | | |
7915 | 0 | StringRef ReturnOp::getOperationName() { |
7916 | 0 | return "std.return"; |
7917 | 0 | } |
7918 | | |
7919 | 0 | std::pair<unsigned, unsigned> ReturnOp::getODSOperandIndexAndLength(unsigned index) { |
7920 | 0 | bool isVariadic[] = {true}; |
7921 | 0 | int prevVariadicCount = 0; |
7922 | 0 | for (unsigned i = 0; i < index; ++i) |
7923 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
7924 | 0 |
|
7925 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
7926 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
7927 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
7928 | 0 | // `index` passed in as the parameter is the static index which counts each |
7929 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
7930 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
7931 | 0 | // value pack for this static operand starts. |
7932 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
7933 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
7934 | 0 | return {start, size}; |
7935 | 0 | } |
7936 | | |
7937 | 0 | Operation::operand_range ReturnOp::getODSOperands(unsigned index) { |
7938 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
7939 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
7940 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
7941 | 0 | } |
7942 | | |
7943 | 0 | Operation::operand_range ReturnOp::operands() { |
7944 | 0 | return getODSOperands(0); |
7945 | 0 | } |
7946 | | |
7947 | 0 | ::mlir::MutableOperandRange ReturnOp::operandsMutable() { |
7948 | 0 | auto range = getODSOperandIndexAndLength(0); |
7949 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
7950 | 0 | } |
7951 | | |
7952 | 0 | std::pair<unsigned, unsigned> ReturnOp::getODSResultIndexAndLength(unsigned index) { |
7953 | 0 | return {index, 1}; |
7954 | 0 | } |
7955 | | |
7956 | 0 | Operation::result_range ReturnOp::getODSResults(unsigned index) { |
7957 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
7958 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
7959 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
7960 | 0 | } |
7961 | | |
7962 | 0 | void ReturnOp::build(OpBuilder &b, OperationState &result) { |
7963 | 0 | build(b, result, llvm::None); |
7964 | 0 | } |
7965 | | |
7966 | 0 | void ReturnOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands) { |
7967 | 0 | odsState.addOperands(operands); |
7968 | 0 | } |
7969 | | |
7970 | 0 | void ReturnOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands) { |
7971 | 0 | odsState.addOperands(operands); |
7972 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
7973 | 0 | odsState.addTypes(resultTypes); |
7974 | 0 | } |
7975 | | |
7976 | 0 | void ReturnOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
7977 | 0 | odsState.addOperands(operands); |
7978 | 0 | odsState.addAttributes(attributes); |
7979 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
7980 | 0 | odsState.addTypes(resultTypes); |
7981 | 0 | } |
7982 | | |
7983 | 0 | LogicalResult ReturnOp::verify() { |
7984 | 0 | { |
7985 | 0 | unsigned index = 0; (void)index; |
7986 | 0 | auto valueGroup0 = getODSOperands(0); |
7987 | 0 | for (Value v : valueGroup0) { |
7988 | 0 | (void)v; |
7989 | 0 | if (!((true))) { |
7990 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
7991 | 0 | } |
7992 | 0 | ++index; |
7993 | 0 | } |
7994 | 0 | } |
7995 | 0 | { |
7996 | 0 | unsigned index = 0; (void)index; |
7997 | 0 | } |
7998 | 0 | return ::verify(*this); |
7999 | 0 | } |
8000 | | |
8001 | 0 | ParseResult ReturnOp::parse(OpAsmParser &parser, OperationState &result) { |
8002 | 0 | SmallVector<OpAsmParser::OperandType, 4> operandsOperands; |
8003 | 0 | llvm::SMLoc operandsOperandsLoc = parser.getCurrentLocation(); |
8004 | 0 | (void)operandsOperandsLoc; |
8005 | 0 | SmallVector<Type, 1> operandsTypes; |
8006 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
8007 | 0 | return failure(); |
8008 | 0 | |
8009 | 0 | if (parser.parseOperandList(operandsOperands)) |
8010 | 0 | return failure(); |
8011 | 0 | if (!operandsOperands.empty()) { |
8012 | 0 | if (parser.parseColon()) |
8013 | 0 | return failure(); |
8014 | 0 | |
8015 | 0 | if (parser.parseTypeList(operandsTypes)) |
8016 | 0 | return failure(); |
8017 | 0 | } |
8018 | 0 | if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands)) |
8019 | 0 | return failure(); |
8020 | 0 | return success(); |
8021 | 0 | } |
8022 | | |
8023 | 0 | void ReturnOp::print(OpAsmPrinter &p) { |
8024 | 0 | p << "return"; |
8025 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
8026 | 0 | if (!operands().empty()) { |
8027 | 0 | p << " "; |
8028 | 0 | p << operands(); |
8029 | 0 | p << " " << ":"; |
8030 | 0 | p << " "; |
8031 | 0 | p << operands().getTypes(); |
8032 | 0 | } |
8033 | 0 | } |
8034 | | |
8035 | 0 | void ReturnOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8036 | 0 |
|
8037 | 0 | } |
8038 | | |
8039 | | |
8040 | | //===----------------------------------------------------------------------===// |
8041 | | // RsqrtOp definitions |
8042 | | //===----------------------------------------------------------------------===// |
8043 | | |
8044 | 0 | RsqrtOpOperandAdaptor::RsqrtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8045 | 0 |
|
8046 | 0 | } |
8047 | | |
8048 | 0 | RsqrtOpOperandAdaptor::RsqrtOpOperandAdaptor(RsqrtOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8049 | 0 |
|
8050 | 0 | } |
8051 | | |
8052 | 0 | std::pair<unsigned, unsigned> RsqrtOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8053 | 0 | return {index, 1}; |
8054 | 0 | } |
8055 | | |
8056 | 0 | ValueRange RsqrtOpOperandAdaptor::getODSOperands(unsigned index) { |
8057 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8058 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8059 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8060 | 0 | } |
8061 | | |
8062 | 0 | Value RsqrtOpOperandAdaptor::operand() { |
8063 | 0 | return *getODSOperands(0).begin(); |
8064 | 0 | } |
8065 | | |
8066 | 0 | StringRef RsqrtOp::getOperationName() { |
8067 | 0 | return "std.rsqrt"; |
8068 | 0 | } |
8069 | | |
8070 | 0 | std::pair<unsigned, unsigned> RsqrtOp::getODSOperandIndexAndLength(unsigned index) { |
8071 | 0 | return {index, 1}; |
8072 | 0 | } |
8073 | | |
8074 | 0 | Operation::operand_range RsqrtOp::getODSOperands(unsigned index) { |
8075 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8076 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8077 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8078 | 0 | } |
8079 | | |
8080 | 0 | Value RsqrtOp::operand() { |
8081 | 0 | return *getODSOperands(0).begin(); |
8082 | 0 | } |
8083 | | |
8084 | 0 | ::mlir::MutableOperandRange RsqrtOp::operandMutable() { |
8085 | 0 | auto range = getODSOperandIndexAndLength(0); |
8086 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8087 | 0 | } |
8088 | | |
8089 | 0 | std::pair<unsigned, unsigned> RsqrtOp::getODSResultIndexAndLength(unsigned index) { |
8090 | 0 | return {index, 1}; |
8091 | 0 | } |
8092 | | |
8093 | 0 | Operation::result_range RsqrtOp::getODSResults(unsigned index) { |
8094 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8095 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8096 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8097 | 0 | } |
8098 | | |
8099 | 0 | void RsqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
8100 | 0 | odsState.addOperands(operand); |
8101 | 0 | odsState.addTypes(resultType0); |
8102 | 0 | } |
8103 | | |
8104 | 0 | void RsqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
8105 | 0 | odsState.addOperands(operand); |
8106 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8107 | 0 | odsState.addTypes(resultTypes); |
8108 | 0 | } |
8109 | | |
8110 | 0 | void RsqrtOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8111 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
8112 | 0 | odsState.addOperands(operands); |
8113 | 0 | odsState.addAttributes(attributes); |
8114 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8115 | 0 | odsState.addTypes(resultTypes); |
8116 | 0 | } |
8117 | | |
8118 | 0 | void RsqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
8119 | 0 | odsState.addOperands(operand); |
8120 | 0 | odsState.addTypes({operand.getType()}); |
8121 | 0 |
|
8122 | 0 | } |
8123 | | |
8124 | 0 | void RsqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8125 | 0 | odsState.addOperands(operands); |
8126 | 0 | odsState.addAttributes(attributes); |
8127 | 0 | odsState.addTypes({operands[0].getType()}); |
8128 | 0 |
|
8129 | 0 | } |
8130 | | |
8131 | 0 | ParseResult RsqrtOp::parse(OpAsmParser &parser, OperationState &result) { |
8132 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
8133 | 0 | } |
8134 | | |
8135 | 0 | void RsqrtOp::print(OpAsmPrinter &p) { |
8136 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
8137 | 0 | } |
8138 | | |
8139 | 0 | LogicalResult RsqrtOp::verify() { |
8140 | 0 | { |
8141 | 0 | unsigned index = 0; (void)index; |
8142 | 0 | auto valueGroup0 = getODSOperands(0); |
8143 | 0 | for (Value v : valueGroup0) { |
8144 | 0 | (void)v; |
8145 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
8146 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
8147 | 0 | } |
8148 | 0 | ++index; |
8149 | 0 | } |
8150 | 0 | } |
8151 | 0 | { |
8152 | 0 | unsigned index = 0; (void)index; |
8153 | 0 | auto valueGroup0 = getODSResults(0); |
8154 | 0 | for (Value v : valueGroup0) { |
8155 | 0 | (void)v; |
8156 | 0 | if (!((true))) { |
8157 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
8158 | 0 | } |
8159 | 0 | ++index; |
8160 | 0 | } |
8161 | 0 | } |
8162 | 0 | return mlir::success(); |
8163 | 0 | } |
8164 | | |
8165 | 0 | void RsqrtOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8166 | 0 |
|
8167 | 0 | } |
8168 | | |
8169 | | |
8170 | | //===----------------------------------------------------------------------===// |
8171 | | // SIToFPOp definitions |
8172 | | //===----------------------------------------------------------------------===// |
8173 | | |
8174 | 0 | SIToFPOpOperandAdaptor::SIToFPOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8175 | 0 |
|
8176 | 0 | } |
8177 | | |
8178 | 0 | SIToFPOpOperandAdaptor::SIToFPOpOperandAdaptor(SIToFPOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8179 | 0 |
|
8180 | 0 | } |
8181 | | |
8182 | 0 | std::pair<unsigned, unsigned> SIToFPOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8183 | 0 | return {index, 1}; |
8184 | 0 | } |
8185 | | |
8186 | 0 | ValueRange SIToFPOpOperandAdaptor::getODSOperands(unsigned index) { |
8187 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8188 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8189 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8190 | 0 | } |
8191 | | |
8192 | 0 | Value SIToFPOpOperandAdaptor::in() { |
8193 | 0 | return *getODSOperands(0).begin(); |
8194 | 0 | } |
8195 | | |
8196 | 0 | StringRef SIToFPOp::getOperationName() { |
8197 | 0 | return "std.sitofp"; |
8198 | 0 | } |
8199 | | |
8200 | 0 | std::pair<unsigned, unsigned> SIToFPOp::getODSOperandIndexAndLength(unsigned index) { |
8201 | 0 | return {index, 1}; |
8202 | 0 | } |
8203 | | |
8204 | 0 | Operation::operand_range SIToFPOp::getODSOperands(unsigned index) { |
8205 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8206 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8207 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8208 | 0 | } |
8209 | | |
8210 | 0 | Value SIToFPOp::in() { |
8211 | 0 | return *getODSOperands(0).begin(); |
8212 | 0 | } |
8213 | | |
8214 | 0 | ::mlir::MutableOperandRange SIToFPOp::inMutable() { |
8215 | 0 | auto range = getODSOperandIndexAndLength(0); |
8216 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8217 | 0 | } |
8218 | | |
8219 | 0 | std::pair<unsigned, unsigned> SIToFPOp::getODSResultIndexAndLength(unsigned index) { |
8220 | 0 | return {index, 1}; |
8221 | 0 | } |
8222 | | |
8223 | 0 | Operation::result_range SIToFPOp::getODSResults(unsigned index) { |
8224 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8225 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8226 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8227 | 0 | } |
8228 | | |
8229 | 0 | void SIToFPOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
8230 | 0 | impl::buildCastOp(builder, result, source, destType); |
8231 | 0 | |
8232 | 0 | } |
8233 | | |
8234 | 0 | void SIToFPOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in) { |
8235 | 0 | odsState.addOperands(in); |
8236 | 0 | odsState.addTypes(resultType0); |
8237 | 0 | } |
8238 | | |
8239 | 0 | void SIToFPOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in) { |
8240 | 0 | odsState.addOperands(in); |
8241 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8242 | 0 | odsState.addTypes(resultTypes); |
8243 | 0 | } |
8244 | | |
8245 | 0 | void SIToFPOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8246 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
8247 | 0 | odsState.addOperands(operands); |
8248 | 0 | odsState.addAttributes(attributes); |
8249 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8250 | 0 | odsState.addTypes(resultTypes); |
8251 | 0 | } |
8252 | | |
8253 | 0 | ParseResult SIToFPOp::parse(OpAsmParser &parser, OperationState &result) { |
8254 | 0 | return impl::parseCastOp(parser, result); |
8255 | 0 | } |
8256 | | |
8257 | 0 | void SIToFPOp::print(OpAsmPrinter &p) { |
8258 | 0 | return printStandardCastOp(this->getOperation(), p); |
8259 | 0 | } |
8260 | | |
8261 | 0 | LogicalResult SIToFPOp::verify() { |
8262 | 0 | { |
8263 | 0 | unsigned index = 0; (void)index; |
8264 | 0 | auto valueGroup0 = getODSOperands(0); |
8265 | 0 | for (Value v : valueGroup0) { |
8266 | 0 | (void)v; |
8267 | 0 | if (!((true))) { |
8268 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
8269 | 0 | } |
8270 | 0 | ++index; |
8271 | 0 | } |
8272 | 0 | } |
8273 | 0 | { |
8274 | 0 | unsigned index = 0; (void)index; |
8275 | 0 | auto valueGroup0 = getODSResults(0); |
8276 | 0 | for (Value v : valueGroup0) { |
8277 | 0 | (void)v; |
8278 | 0 | if (!((true))) { |
8279 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
8280 | 0 | } |
8281 | 0 | ++index; |
8282 | 0 | } |
8283 | 0 | } |
8284 | 0 | return ::verifyCastOp(*this); |
8285 | 0 | } |
8286 | | |
8287 | 0 | void SIToFPOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8288 | 0 |
|
8289 | 0 | } |
8290 | | |
8291 | | |
8292 | | //===----------------------------------------------------------------------===// |
8293 | | // SelectOp definitions |
8294 | | //===----------------------------------------------------------------------===// |
8295 | | |
8296 | 0 | SelectOpOperandAdaptor::SelectOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8297 | 0 |
|
8298 | 0 | } |
8299 | | |
8300 | 0 | SelectOpOperandAdaptor::SelectOpOperandAdaptor(SelectOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8301 | 0 |
|
8302 | 0 | } |
8303 | | |
8304 | 0 | std::pair<unsigned, unsigned> SelectOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8305 | 0 | return {index, 1}; |
8306 | 0 | } |
8307 | | |
8308 | 0 | ValueRange SelectOpOperandAdaptor::getODSOperands(unsigned index) { |
8309 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8310 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8311 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8312 | 0 | } |
8313 | | |
8314 | 0 | Value SelectOpOperandAdaptor::condition() { |
8315 | 0 | return *getODSOperands(0).begin(); |
8316 | 0 | } |
8317 | | |
8318 | 0 | Value SelectOpOperandAdaptor::true_value() { |
8319 | 0 | return *getODSOperands(1).begin(); |
8320 | 0 | } |
8321 | | |
8322 | 0 | Value SelectOpOperandAdaptor::false_value() { |
8323 | 0 | return *getODSOperands(2).begin(); |
8324 | 0 | } |
8325 | | |
8326 | 0 | StringRef SelectOp::getOperationName() { |
8327 | 0 | return "std.select"; |
8328 | 0 | } |
8329 | | |
8330 | 0 | std::pair<unsigned, unsigned> SelectOp::getODSOperandIndexAndLength(unsigned index) { |
8331 | 0 | return {index, 1}; |
8332 | 0 | } |
8333 | | |
8334 | 0 | Operation::operand_range SelectOp::getODSOperands(unsigned index) { |
8335 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8336 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8337 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8338 | 0 | } |
8339 | | |
8340 | 0 | Value SelectOp::condition() { |
8341 | 0 | return *getODSOperands(0).begin(); |
8342 | 0 | } |
8343 | | |
8344 | 0 | Value SelectOp::true_value() { |
8345 | 0 | return *getODSOperands(1).begin(); |
8346 | 0 | } |
8347 | | |
8348 | 0 | Value SelectOp::false_value() { |
8349 | 0 | return *getODSOperands(2).begin(); |
8350 | 0 | } |
8351 | | |
8352 | 0 | ::mlir::MutableOperandRange SelectOp::conditionMutable() { |
8353 | 0 | auto range = getODSOperandIndexAndLength(0); |
8354 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8355 | 0 | } |
8356 | | |
8357 | 0 | ::mlir::MutableOperandRange SelectOp::true_valueMutable() { |
8358 | 0 | auto range = getODSOperandIndexAndLength(1); |
8359 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8360 | 0 | } |
8361 | | |
8362 | 0 | ::mlir::MutableOperandRange SelectOp::false_valueMutable() { |
8363 | 0 | auto range = getODSOperandIndexAndLength(2); |
8364 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8365 | 0 | } |
8366 | | |
8367 | 0 | std::pair<unsigned, unsigned> SelectOp::getODSResultIndexAndLength(unsigned index) { |
8368 | 0 | return {index, 1}; |
8369 | 0 | } |
8370 | | |
8371 | 0 | Operation::result_range SelectOp::getODSResults(unsigned index) { |
8372 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8373 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8374 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8375 | 0 | } |
8376 | | |
8377 | 0 | Value SelectOp::result() { |
8378 | 0 | return *getODSResults(0).begin(); |
8379 | 0 | } |
8380 | | |
8381 | 0 | void SelectOp::build(OpBuilder &builder, OperationState &result, Value condition,Value trueValue, Value falseValue) { |
8382 | 0 | result.addOperands({condition, trueValue, falseValue}); |
8383 | 0 | result.addTypes(trueValue.getType()); |
8384 | 0 | |
8385 | 0 | } |
8386 | | |
8387 | 0 | void SelectOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value condition, Value true_value, Value false_value) { |
8388 | 0 | odsState.addOperands(condition); |
8389 | 0 | odsState.addOperands(true_value); |
8390 | 0 | odsState.addOperands(false_value); |
8391 | 0 | odsState.addTypes(result); |
8392 | 0 | } |
8393 | | |
8394 | 0 | void SelectOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value condition, Value true_value, Value false_value) { |
8395 | 0 | odsState.addOperands(condition); |
8396 | 0 | odsState.addOperands(true_value); |
8397 | 0 | odsState.addOperands(false_value); |
8398 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8399 | 0 | odsState.addTypes(resultTypes); |
8400 | 0 | } |
8401 | | |
8402 | 0 | void SelectOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8403 | 0 | assert(operands.size() == 3u && "mismatched number of parameters"); |
8404 | 0 | odsState.addOperands(operands); |
8405 | 0 | odsState.addAttributes(attributes); |
8406 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8407 | 0 | odsState.addTypes(resultTypes); |
8408 | 0 | } |
8409 | | |
8410 | 0 | ParseResult SelectOp::parse(OpAsmParser &parser, OperationState &result) { |
8411 | 0 | return ::parseSelectOp(parser, result); |
8412 | 0 | } |
8413 | | |
8414 | 0 | void SelectOp::print(OpAsmPrinter &p) { |
8415 | 0 | return ::print(p, *this); |
8416 | 0 | } |
8417 | | |
8418 | 0 | LogicalResult SelectOp::verify() { |
8419 | 0 | { |
8420 | 0 | unsigned index = 0; (void)index; |
8421 | 0 | auto valueGroup0 = getODSOperands(0); |
8422 | 0 | for (Value v : valueGroup0) { |
8423 | 0 | (void)v; |
8424 | 0 | if (!(((v.getType().isSignlessInteger(1))) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(1)))))) { |
8425 | 0 | return emitOpError("operand #") << index << " must be bool-like, but got " << v.getType(); |
8426 | 0 | } |
8427 | 0 | ++index; |
8428 | 0 | } |
8429 | 0 | auto valueGroup1 = getODSOperands(1); |
8430 | 0 | for (Value v : valueGroup1) { |
8431 | 0 | (void)v; |
8432 | 0 | if (!((true))) { |
8433 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
8434 | 0 | } |
8435 | 0 | ++index; |
8436 | 0 | } |
8437 | 0 | auto valueGroup2 = getODSOperands(2); |
8438 | 0 | for (Value v : valueGroup2) { |
8439 | 0 | (void)v; |
8440 | 0 | if (!((true))) { |
8441 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
8442 | 0 | } |
8443 | 0 | ++index; |
8444 | 0 | } |
8445 | 0 | } |
8446 | 0 | { |
8447 | 0 | unsigned index = 0; (void)index; |
8448 | 0 | auto valueGroup0 = getODSResults(0); |
8449 | 0 | for (Value v : valueGroup0) { |
8450 | 0 | (void)v; |
8451 | 0 | if (!((true))) { |
8452 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
8453 | 0 | } |
8454 | 0 | ++index; |
8455 | 0 | } |
8456 | 0 | } |
8457 | 0 | if (!((llvm::is_splat(llvm::makeArrayRef({(*this->getODSOperands(1).begin()).getType(), (*this->getODSOperands(2).begin()).getType(), (*this->getODSResults(0).begin()).getType()}))))) { |
8458 | 0 | return emitOpError("failed to verify that all of {true_value, false_value, result} have same type"); |
8459 | 0 | } |
8460 | 0 | return ::verify(*this); |
8461 | 0 | } |
8462 | | |
8463 | | |
8464 | | |
8465 | 0 | void SelectOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8466 | 0 |
|
8467 | 0 | } |
8468 | | |
8469 | | |
8470 | | //===----------------------------------------------------------------------===// |
8471 | | // ShiftLeftOp definitions |
8472 | | //===----------------------------------------------------------------------===// |
8473 | | |
8474 | 0 | ShiftLeftOpOperandAdaptor::ShiftLeftOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8475 | 0 |
|
8476 | 0 | } |
8477 | | |
8478 | 0 | ShiftLeftOpOperandAdaptor::ShiftLeftOpOperandAdaptor(ShiftLeftOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8479 | 0 |
|
8480 | 0 | } |
8481 | | |
8482 | 0 | std::pair<unsigned, unsigned> ShiftLeftOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8483 | 0 | return {index, 1}; |
8484 | 0 | } |
8485 | | |
8486 | 0 | ValueRange ShiftLeftOpOperandAdaptor::getODSOperands(unsigned index) { |
8487 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8488 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8489 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8490 | 0 | } |
8491 | | |
8492 | 0 | Value ShiftLeftOpOperandAdaptor::lhs() { |
8493 | 0 | return *getODSOperands(0).begin(); |
8494 | 0 | } |
8495 | | |
8496 | 0 | Value ShiftLeftOpOperandAdaptor::rhs() { |
8497 | 0 | return *getODSOperands(1).begin(); |
8498 | 0 | } |
8499 | | |
8500 | 0 | StringRef ShiftLeftOp::getOperationName() { |
8501 | 0 | return "std.shift_left"; |
8502 | 0 | } |
8503 | | |
8504 | 0 | std::pair<unsigned, unsigned> ShiftLeftOp::getODSOperandIndexAndLength(unsigned index) { |
8505 | 0 | return {index, 1}; |
8506 | 0 | } |
8507 | | |
8508 | 0 | Operation::operand_range ShiftLeftOp::getODSOperands(unsigned index) { |
8509 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8510 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8511 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8512 | 0 | } |
8513 | | |
8514 | 0 | Value ShiftLeftOp::lhs() { |
8515 | 0 | return *getODSOperands(0).begin(); |
8516 | 0 | } |
8517 | | |
8518 | 0 | Value ShiftLeftOp::rhs() { |
8519 | 0 | return *getODSOperands(1).begin(); |
8520 | 0 | } |
8521 | | |
8522 | 0 | ::mlir::MutableOperandRange ShiftLeftOp::lhsMutable() { |
8523 | 0 | auto range = getODSOperandIndexAndLength(0); |
8524 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8525 | 0 | } |
8526 | | |
8527 | 0 | ::mlir::MutableOperandRange ShiftLeftOp::rhsMutable() { |
8528 | 0 | auto range = getODSOperandIndexAndLength(1); |
8529 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8530 | 0 | } |
8531 | | |
8532 | 0 | std::pair<unsigned, unsigned> ShiftLeftOp::getODSResultIndexAndLength(unsigned index) { |
8533 | 0 | return {index, 1}; |
8534 | 0 | } |
8535 | | |
8536 | 0 | Operation::result_range ShiftLeftOp::getODSResults(unsigned index) { |
8537 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8538 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8539 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8540 | 0 | } |
8541 | | |
8542 | 0 | void ShiftLeftOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
8543 | 0 | odsState.addOperands(lhs); |
8544 | 0 | odsState.addOperands(rhs); |
8545 | 0 | odsState.addTypes(resultType0); |
8546 | 0 | } |
8547 | | |
8548 | 0 | void ShiftLeftOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
8549 | 0 | odsState.addOperands(lhs); |
8550 | 0 | odsState.addOperands(rhs); |
8551 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8552 | 0 | odsState.addTypes(resultTypes); |
8553 | 0 | } |
8554 | | |
8555 | 0 | void ShiftLeftOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8556 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
8557 | 0 | odsState.addOperands(operands); |
8558 | 0 | odsState.addAttributes(attributes); |
8559 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8560 | 0 | odsState.addTypes(resultTypes); |
8561 | 0 | } |
8562 | | |
8563 | 0 | void ShiftLeftOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
8564 | 0 | odsState.addOperands(lhs); |
8565 | 0 | odsState.addOperands(rhs); |
8566 | 0 | odsState.addTypes({lhs.getType()}); |
8567 | 0 |
|
8568 | 0 | } |
8569 | | |
8570 | 0 | void ShiftLeftOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8571 | 0 | odsState.addOperands(operands); |
8572 | 0 | odsState.addAttributes(attributes); |
8573 | 0 | odsState.addTypes({operands[0].getType()}); |
8574 | 0 |
|
8575 | 0 | } |
8576 | | |
8577 | 0 | ParseResult ShiftLeftOp::parse(OpAsmParser &parser, OperationState &result) { |
8578 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
8579 | 0 | } |
8580 | | |
8581 | 0 | void ShiftLeftOp::print(OpAsmPrinter &p) { |
8582 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
8583 | 0 | } |
8584 | | |
8585 | 0 | LogicalResult ShiftLeftOp::verify() { |
8586 | 0 | { |
8587 | 0 | unsigned index = 0; (void)index; |
8588 | 0 | auto valueGroup0 = getODSOperands(0); |
8589 | 0 | for (Value v : valueGroup0) { |
8590 | 0 | (void)v; |
8591 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8592 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
8593 | 0 | } |
8594 | 0 | ++index; |
8595 | 0 | } |
8596 | 0 | auto valueGroup1 = getODSOperands(1); |
8597 | 0 | for (Value v : valueGroup1) { |
8598 | 0 | (void)v; |
8599 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8600 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
8601 | 0 | } |
8602 | 0 | ++index; |
8603 | 0 | } |
8604 | 0 | } |
8605 | 0 | { |
8606 | 0 | unsigned index = 0; (void)index; |
8607 | 0 | auto valueGroup0 = getODSResults(0); |
8608 | 0 | for (Value v : valueGroup0) { |
8609 | 0 | (void)v; |
8610 | 0 | if (!((true))) { |
8611 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
8612 | 0 | } |
8613 | 0 | ++index; |
8614 | 0 | } |
8615 | 0 | } |
8616 | 0 | return mlir::success(); |
8617 | 0 | } |
8618 | | |
8619 | 0 | void ShiftLeftOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8620 | 0 |
|
8621 | 0 | } |
8622 | | |
8623 | | |
8624 | | //===----------------------------------------------------------------------===// |
8625 | | // SignExtendIOp definitions |
8626 | | //===----------------------------------------------------------------------===// |
8627 | | |
8628 | 0 | SignExtendIOpOperandAdaptor::SignExtendIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8629 | 0 |
|
8630 | 0 | } |
8631 | | |
8632 | 0 | SignExtendIOpOperandAdaptor::SignExtendIOpOperandAdaptor(SignExtendIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8633 | 0 |
|
8634 | 0 | } |
8635 | | |
8636 | 0 | std::pair<unsigned, unsigned> SignExtendIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8637 | 0 | return {index, 1}; |
8638 | 0 | } |
8639 | | |
8640 | 0 | ValueRange SignExtendIOpOperandAdaptor::getODSOperands(unsigned index) { |
8641 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8642 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8643 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8644 | 0 | } |
8645 | | |
8646 | 0 | Value SignExtendIOpOperandAdaptor::value() { |
8647 | 0 | return *getODSOperands(0).begin(); |
8648 | 0 | } |
8649 | | |
8650 | 0 | StringRef SignExtendIOp::getOperationName() { |
8651 | 0 | return "std.sexti"; |
8652 | 0 | } |
8653 | | |
8654 | 0 | std::pair<unsigned, unsigned> SignExtendIOp::getODSOperandIndexAndLength(unsigned index) { |
8655 | 0 | return {index, 1}; |
8656 | 0 | } |
8657 | | |
8658 | 0 | Operation::operand_range SignExtendIOp::getODSOperands(unsigned index) { |
8659 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8660 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8661 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8662 | 0 | } |
8663 | | |
8664 | 0 | Value SignExtendIOp::value() { |
8665 | 0 | return *getODSOperands(0).begin(); |
8666 | 0 | } |
8667 | | |
8668 | 0 | ::mlir::MutableOperandRange SignExtendIOp::valueMutable() { |
8669 | 0 | auto range = getODSOperandIndexAndLength(0); |
8670 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8671 | 0 | } |
8672 | | |
8673 | 0 | std::pair<unsigned, unsigned> SignExtendIOp::getODSResultIndexAndLength(unsigned index) { |
8674 | 0 | return {index, 1}; |
8675 | 0 | } |
8676 | | |
8677 | 0 | Operation::result_range SignExtendIOp::getODSResults(unsigned index) { |
8678 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8679 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8680 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8681 | 0 | } |
8682 | | |
8683 | 0 | void SignExtendIOp::build(OpBuilder &builder, OperationState &result, Value value, Type destType) { |
8684 | 0 | result.addOperands(value); |
8685 | 0 | result.addTypes(destType); |
8686 | 0 | |
8687 | 0 | } |
8688 | | |
8689 | 0 | void SignExtendIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value) { |
8690 | 0 | odsState.addOperands(value); |
8691 | 0 | odsState.addTypes(resultType0); |
8692 | 0 | } |
8693 | | |
8694 | 0 | void SignExtendIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value) { |
8695 | 0 | odsState.addOperands(value); |
8696 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8697 | 0 | odsState.addTypes(resultTypes); |
8698 | 0 | } |
8699 | | |
8700 | 0 | void SignExtendIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8701 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
8702 | 0 | odsState.addOperands(operands); |
8703 | 0 | odsState.addAttributes(attributes); |
8704 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8705 | 0 | odsState.addTypes(resultTypes); |
8706 | 0 | } |
8707 | | |
8708 | 0 | ParseResult SignExtendIOp::parse(OpAsmParser &parser, OperationState &result) { |
8709 | 0 | return impl::parseCastOp(parser, result); |
8710 | 0 | } |
8711 | | |
8712 | 0 | void SignExtendIOp::print(OpAsmPrinter &p) { |
8713 | 0 | return printStandardCastOp(this->getOperation(), p); |
8714 | 0 | } |
8715 | | |
8716 | 0 | LogicalResult SignExtendIOp::verify() { |
8717 | 0 | { |
8718 | 0 | unsigned index = 0; (void)index; |
8719 | 0 | auto valueGroup0 = getODSOperands(0); |
8720 | 0 | for (Value v : valueGroup0) { |
8721 | 0 | (void)v; |
8722 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8723 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
8724 | 0 | } |
8725 | 0 | ++index; |
8726 | 0 | } |
8727 | 0 | } |
8728 | 0 | { |
8729 | 0 | unsigned index = 0; (void)index; |
8730 | 0 | auto valueGroup0 = getODSResults(0); |
8731 | 0 | for (Value v : valueGroup0) { |
8732 | 0 | (void)v; |
8733 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8734 | 0 | return emitOpError("result #") << index << " must be signless-integer-like, but got " << v.getType(); |
8735 | 0 | } |
8736 | 0 | ++index; |
8737 | 0 | } |
8738 | 0 | } |
8739 | 0 | return ::verify(*this); |
8740 | 0 | } |
8741 | | |
8742 | 0 | void SignExtendIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8743 | 0 |
|
8744 | 0 | } |
8745 | | |
8746 | | |
8747 | | //===----------------------------------------------------------------------===// |
8748 | | // SignedDivIOp definitions |
8749 | | //===----------------------------------------------------------------------===// |
8750 | | |
8751 | 0 | SignedDivIOpOperandAdaptor::SignedDivIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8752 | 0 |
|
8753 | 0 | } |
8754 | | |
8755 | 0 | SignedDivIOpOperandAdaptor::SignedDivIOpOperandAdaptor(SignedDivIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8756 | 0 |
|
8757 | 0 | } |
8758 | | |
8759 | 0 | std::pair<unsigned, unsigned> SignedDivIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8760 | 0 | return {index, 1}; |
8761 | 0 | } |
8762 | | |
8763 | 0 | ValueRange SignedDivIOpOperandAdaptor::getODSOperands(unsigned index) { |
8764 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8765 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8766 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8767 | 0 | } |
8768 | | |
8769 | 0 | Value SignedDivIOpOperandAdaptor::lhs() { |
8770 | 0 | return *getODSOperands(0).begin(); |
8771 | 0 | } |
8772 | | |
8773 | 0 | Value SignedDivIOpOperandAdaptor::rhs() { |
8774 | 0 | return *getODSOperands(1).begin(); |
8775 | 0 | } |
8776 | | |
8777 | 0 | StringRef SignedDivIOp::getOperationName() { |
8778 | 0 | return "std.divi_signed"; |
8779 | 0 | } |
8780 | | |
8781 | 0 | std::pair<unsigned, unsigned> SignedDivIOp::getODSOperandIndexAndLength(unsigned index) { |
8782 | 0 | return {index, 1}; |
8783 | 0 | } |
8784 | | |
8785 | 0 | Operation::operand_range SignedDivIOp::getODSOperands(unsigned index) { |
8786 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8787 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8788 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8789 | 0 | } |
8790 | | |
8791 | 0 | Value SignedDivIOp::lhs() { |
8792 | 0 | return *getODSOperands(0).begin(); |
8793 | 0 | } |
8794 | | |
8795 | 0 | Value SignedDivIOp::rhs() { |
8796 | 0 | return *getODSOperands(1).begin(); |
8797 | 0 | } |
8798 | | |
8799 | 0 | ::mlir::MutableOperandRange SignedDivIOp::lhsMutable() { |
8800 | 0 | auto range = getODSOperandIndexAndLength(0); |
8801 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8802 | 0 | } |
8803 | | |
8804 | 0 | ::mlir::MutableOperandRange SignedDivIOp::rhsMutable() { |
8805 | 0 | auto range = getODSOperandIndexAndLength(1); |
8806 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8807 | 0 | } |
8808 | | |
8809 | 0 | std::pair<unsigned, unsigned> SignedDivIOp::getODSResultIndexAndLength(unsigned index) { |
8810 | 0 | return {index, 1}; |
8811 | 0 | } |
8812 | | |
8813 | 0 | Operation::result_range SignedDivIOp::getODSResults(unsigned index) { |
8814 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8815 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8816 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8817 | 0 | } |
8818 | | |
8819 | 0 | void SignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
8820 | 0 | odsState.addOperands(lhs); |
8821 | 0 | odsState.addOperands(rhs); |
8822 | 0 | odsState.addTypes(resultType0); |
8823 | 0 | } |
8824 | | |
8825 | 0 | void SignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
8826 | 0 | odsState.addOperands(lhs); |
8827 | 0 | odsState.addOperands(rhs); |
8828 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8829 | 0 | odsState.addTypes(resultTypes); |
8830 | 0 | } |
8831 | | |
8832 | 0 | void SignedDivIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8833 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
8834 | 0 | odsState.addOperands(operands); |
8835 | 0 | odsState.addAttributes(attributes); |
8836 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8837 | 0 | odsState.addTypes(resultTypes); |
8838 | 0 | } |
8839 | | |
8840 | 0 | void SignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
8841 | 0 | odsState.addOperands(lhs); |
8842 | 0 | odsState.addOperands(rhs); |
8843 | 0 | odsState.addTypes({lhs.getType()}); |
8844 | 0 |
|
8845 | 0 | } |
8846 | | |
8847 | 0 | void SignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8848 | 0 | odsState.addOperands(operands); |
8849 | 0 | odsState.addAttributes(attributes); |
8850 | 0 | odsState.addTypes({operands[0].getType()}); |
8851 | 0 |
|
8852 | 0 | } |
8853 | | |
8854 | 0 | ParseResult SignedDivIOp::parse(OpAsmParser &parser, OperationState &result) { |
8855 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
8856 | 0 | } |
8857 | | |
8858 | 0 | void SignedDivIOp::print(OpAsmPrinter &p) { |
8859 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
8860 | 0 | } |
8861 | | |
8862 | 0 | LogicalResult SignedDivIOp::verify() { |
8863 | 0 | { |
8864 | 0 | unsigned index = 0; (void)index; |
8865 | 0 | auto valueGroup0 = getODSOperands(0); |
8866 | 0 | for (Value v : valueGroup0) { |
8867 | 0 | (void)v; |
8868 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8869 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
8870 | 0 | } |
8871 | 0 | ++index; |
8872 | 0 | } |
8873 | 0 | auto valueGroup1 = getODSOperands(1); |
8874 | 0 | for (Value v : valueGroup1) { |
8875 | 0 | (void)v; |
8876 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
8877 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
8878 | 0 | } |
8879 | 0 | ++index; |
8880 | 0 | } |
8881 | 0 | } |
8882 | 0 | { |
8883 | 0 | unsigned index = 0; (void)index; |
8884 | 0 | auto valueGroup0 = getODSResults(0); |
8885 | 0 | for (Value v : valueGroup0) { |
8886 | 0 | (void)v; |
8887 | 0 | if (!((true))) { |
8888 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
8889 | 0 | } |
8890 | 0 | ++index; |
8891 | 0 | } |
8892 | 0 | } |
8893 | 0 | return mlir::success(); |
8894 | 0 | } |
8895 | | |
8896 | | |
8897 | | |
8898 | 0 | void SignedDivIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
8899 | 0 |
|
8900 | 0 | } |
8901 | | |
8902 | | |
8903 | | //===----------------------------------------------------------------------===// |
8904 | | // SignedRemIOp definitions |
8905 | | //===----------------------------------------------------------------------===// |
8906 | | |
8907 | 0 | SignedRemIOpOperandAdaptor::SignedRemIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
8908 | 0 |
|
8909 | 0 | } |
8910 | | |
8911 | 0 | SignedRemIOpOperandAdaptor::SignedRemIOpOperandAdaptor(SignedRemIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
8912 | 0 |
|
8913 | 0 | } |
8914 | | |
8915 | 0 | std::pair<unsigned, unsigned> SignedRemIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
8916 | 0 | return {index, 1}; |
8917 | 0 | } |
8918 | | |
8919 | 0 | ValueRange SignedRemIOpOperandAdaptor::getODSOperands(unsigned index) { |
8920 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8921 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
8922 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
8923 | 0 | } |
8924 | | |
8925 | 0 | Value SignedRemIOpOperandAdaptor::lhs() { |
8926 | 0 | return *getODSOperands(0).begin(); |
8927 | 0 | } |
8928 | | |
8929 | 0 | Value SignedRemIOpOperandAdaptor::rhs() { |
8930 | 0 | return *getODSOperands(1).begin(); |
8931 | 0 | } |
8932 | | |
8933 | 0 | StringRef SignedRemIOp::getOperationName() { |
8934 | 0 | return "std.remi_signed"; |
8935 | 0 | } |
8936 | | |
8937 | 0 | std::pair<unsigned, unsigned> SignedRemIOp::getODSOperandIndexAndLength(unsigned index) { |
8938 | 0 | return {index, 1}; |
8939 | 0 | } |
8940 | | |
8941 | 0 | Operation::operand_range SignedRemIOp::getODSOperands(unsigned index) { |
8942 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
8943 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
8944 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
8945 | 0 | } |
8946 | | |
8947 | 0 | Value SignedRemIOp::lhs() { |
8948 | 0 | return *getODSOperands(0).begin(); |
8949 | 0 | } |
8950 | | |
8951 | 0 | Value SignedRemIOp::rhs() { |
8952 | 0 | return *getODSOperands(1).begin(); |
8953 | 0 | } |
8954 | | |
8955 | 0 | ::mlir::MutableOperandRange SignedRemIOp::lhsMutable() { |
8956 | 0 | auto range = getODSOperandIndexAndLength(0); |
8957 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8958 | 0 | } |
8959 | | |
8960 | 0 | ::mlir::MutableOperandRange SignedRemIOp::rhsMutable() { |
8961 | 0 | auto range = getODSOperandIndexAndLength(1); |
8962 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
8963 | 0 | } |
8964 | | |
8965 | 0 | std::pair<unsigned, unsigned> SignedRemIOp::getODSResultIndexAndLength(unsigned index) { |
8966 | 0 | return {index, 1}; |
8967 | 0 | } |
8968 | | |
8969 | 0 | Operation::result_range SignedRemIOp::getODSResults(unsigned index) { |
8970 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
8971 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
8972 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
8973 | 0 | } |
8974 | | |
8975 | 0 | void SignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
8976 | 0 | odsState.addOperands(lhs); |
8977 | 0 | odsState.addOperands(rhs); |
8978 | 0 | odsState.addTypes(resultType0); |
8979 | 0 | } |
8980 | | |
8981 | 0 | void SignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
8982 | 0 | odsState.addOperands(lhs); |
8983 | 0 | odsState.addOperands(rhs); |
8984 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
8985 | 0 | odsState.addTypes(resultTypes); |
8986 | 0 | } |
8987 | | |
8988 | 0 | void SignedRemIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
8989 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
8990 | 0 | odsState.addOperands(operands); |
8991 | 0 | odsState.addAttributes(attributes); |
8992 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
8993 | 0 | odsState.addTypes(resultTypes); |
8994 | 0 | } |
8995 | | |
8996 | 0 | void SignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
8997 | 0 | odsState.addOperands(lhs); |
8998 | 0 | odsState.addOperands(rhs); |
8999 | 0 | odsState.addTypes({lhs.getType()}); |
9000 | 0 |
|
9001 | 0 | } |
9002 | | |
9003 | 0 | void SignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9004 | 0 | odsState.addOperands(operands); |
9005 | 0 | odsState.addAttributes(attributes); |
9006 | 0 | odsState.addTypes({operands[0].getType()}); |
9007 | 0 |
|
9008 | 0 | } |
9009 | | |
9010 | 0 | ParseResult SignedRemIOp::parse(OpAsmParser &parser, OperationState &result) { |
9011 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
9012 | 0 | } |
9013 | | |
9014 | 0 | void SignedRemIOp::print(OpAsmPrinter &p) { |
9015 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
9016 | 0 | } |
9017 | | |
9018 | 0 | LogicalResult SignedRemIOp::verify() { |
9019 | 0 | { |
9020 | 0 | unsigned index = 0; (void)index; |
9021 | 0 | auto valueGroup0 = getODSOperands(0); |
9022 | 0 | for (Value v : valueGroup0) { |
9023 | 0 | (void)v; |
9024 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
9025 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
9026 | 0 | } |
9027 | 0 | ++index; |
9028 | 0 | } |
9029 | 0 | auto valueGroup1 = getODSOperands(1); |
9030 | 0 | for (Value v : valueGroup1) { |
9031 | 0 | (void)v; |
9032 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
9033 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
9034 | 0 | } |
9035 | 0 | ++index; |
9036 | 0 | } |
9037 | 0 | } |
9038 | 0 | { |
9039 | 0 | unsigned index = 0; (void)index; |
9040 | 0 | auto valueGroup0 = getODSResults(0); |
9041 | 0 | for (Value v : valueGroup0) { |
9042 | 0 | (void)v; |
9043 | 0 | if (!((true))) { |
9044 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
9045 | 0 | } |
9046 | 0 | ++index; |
9047 | 0 | } |
9048 | 0 | } |
9049 | 0 | return mlir::success(); |
9050 | 0 | } |
9051 | | |
9052 | | |
9053 | | |
9054 | 0 | void SignedRemIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9055 | 0 |
|
9056 | 0 | } |
9057 | | |
9058 | | |
9059 | | //===----------------------------------------------------------------------===// |
9060 | | // SignedShiftRightOp definitions |
9061 | | //===----------------------------------------------------------------------===// |
9062 | | |
9063 | 0 | SignedShiftRightOpOperandAdaptor::SignedShiftRightOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9064 | 0 |
|
9065 | 0 | } |
9066 | | |
9067 | 0 | SignedShiftRightOpOperandAdaptor::SignedShiftRightOpOperandAdaptor(SignedShiftRightOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9068 | 0 |
|
9069 | 0 | } |
9070 | | |
9071 | 0 | std::pair<unsigned, unsigned> SignedShiftRightOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9072 | 0 | return {index, 1}; |
9073 | 0 | } |
9074 | | |
9075 | 0 | ValueRange SignedShiftRightOpOperandAdaptor::getODSOperands(unsigned index) { |
9076 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9077 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9078 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9079 | 0 | } |
9080 | | |
9081 | 0 | Value SignedShiftRightOpOperandAdaptor::lhs() { |
9082 | 0 | return *getODSOperands(0).begin(); |
9083 | 0 | } |
9084 | | |
9085 | 0 | Value SignedShiftRightOpOperandAdaptor::rhs() { |
9086 | 0 | return *getODSOperands(1).begin(); |
9087 | 0 | } |
9088 | | |
9089 | 0 | StringRef SignedShiftRightOp::getOperationName() { |
9090 | 0 | return "std.shift_right_signed"; |
9091 | 0 | } |
9092 | | |
9093 | 0 | std::pair<unsigned, unsigned> SignedShiftRightOp::getODSOperandIndexAndLength(unsigned index) { |
9094 | 0 | return {index, 1}; |
9095 | 0 | } |
9096 | | |
9097 | 0 | Operation::operand_range SignedShiftRightOp::getODSOperands(unsigned index) { |
9098 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9099 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9100 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9101 | 0 | } |
9102 | | |
9103 | 0 | Value SignedShiftRightOp::lhs() { |
9104 | 0 | return *getODSOperands(0).begin(); |
9105 | 0 | } |
9106 | | |
9107 | 0 | Value SignedShiftRightOp::rhs() { |
9108 | 0 | return *getODSOperands(1).begin(); |
9109 | 0 | } |
9110 | | |
9111 | 0 | ::mlir::MutableOperandRange SignedShiftRightOp::lhsMutable() { |
9112 | 0 | auto range = getODSOperandIndexAndLength(0); |
9113 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9114 | 0 | } |
9115 | | |
9116 | 0 | ::mlir::MutableOperandRange SignedShiftRightOp::rhsMutable() { |
9117 | 0 | auto range = getODSOperandIndexAndLength(1); |
9118 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9119 | 0 | } |
9120 | | |
9121 | 0 | std::pair<unsigned, unsigned> SignedShiftRightOp::getODSResultIndexAndLength(unsigned index) { |
9122 | 0 | return {index, 1}; |
9123 | 0 | } |
9124 | | |
9125 | 0 | Operation::result_range SignedShiftRightOp::getODSResults(unsigned index) { |
9126 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9127 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9128 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9129 | 0 | } |
9130 | | |
9131 | 0 | void SignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
9132 | 0 | odsState.addOperands(lhs); |
9133 | 0 | odsState.addOperands(rhs); |
9134 | 0 | odsState.addTypes(resultType0); |
9135 | 0 | } |
9136 | | |
9137 | 0 | void SignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
9138 | 0 | odsState.addOperands(lhs); |
9139 | 0 | odsState.addOperands(rhs); |
9140 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
9141 | 0 | odsState.addTypes(resultTypes); |
9142 | 0 | } |
9143 | | |
9144 | 0 | void SignedShiftRightOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9145 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
9146 | 0 | odsState.addOperands(operands); |
9147 | 0 | odsState.addAttributes(attributes); |
9148 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
9149 | 0 | odsState.addTypes(resultTypes); |
9150 | 0 | } |
9151 | | |
9152 | 0 | void SignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
9153 | 0 | odsState.addOperands(lhs); |
9154 | 0 | odsState.addOperands(rhs); |
9155 | 0 | odsState.addTypes({lhs.getType()}); |
9156 | 0 |
|
9157 | 0 | } |
9158 | | |
9159 | 0 | void SignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9160 | 0 | odsState.addOperands(operands); |
9161 | 0 | odsState.addAttributes(attributes); |
9162 | 0 | odsState.addTypes({operands[0].getType()}); |
9163 | 0 |
|
9164 | 0 | } |
9165 | | |
9166 | 0 | ParseResult SignedShiftRightOp::parse(OpAsmParser &parser, OperationState &result) { |
9167 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
9168 | 0 | } |
9169 | | |
9170 | 0 | void SignedShiftRightOp::print(OpAsmPrinter &p) { |
9171 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
9172 | 0 | } |
9173 | | |
9174 | 0 | LogicalResult SignedShiftRightOp::verify() { |
9175 | 0 | { |
9176 | 0 | unsigned index = 0; (void)index; |
9177 | 0 | auto valueGroup0 = getODSOperands(0); |
9178 | 0 | for (Value v : valueGroup0) { |
9179 | 0 | (void)v; |
9180 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
9181 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
9182 | 0 | } |
9183 | 0 | ++index; |
9184 | 0 | } |
9185 | 0 | auto valueGroup1 = getODSOperands(1); |
9186 | 0 | for (Value v : valueGroup1) { |
9187 | 0 | (void)v; |
9188 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
9189 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
9190 | 0 | } |
9191 | 0 | ++index; |
9192 | 0 | } |
9193 | 0 | } |
9194 | 0 | { |
9195 | 0 | unsigned index = 0; (void)index; |
9196 | 0 | auto valueGroup0 = getODSResults(0); |
9197 | 0 | for (Value v : valueGroup0) { |
9198 | 0 | (void)v; |
9199 | 0 | if (!((true))) { |
9200 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
9201 | 0 | } |
9202 | 0 | ++index; |
9203 | 0 | } |
9204 | 0 | } |
9205 | 0 | return mlir::success(); |
9206 | 0 | } |
9207 | | |
9208 | 0 | void SignedShiftRightOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9209 | 0 |
|
9210 | 0 | } |
9211 | | |
9212 | | |
9213 | | //===----------------------------------------------------------------------===// |
9214 | | // SinOp definitions |
9215 | | //===----------------------------------------------------------------------===// |
9216 | | |
9217 | 0 | SinOpOperandAdaptor::SinOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9218 | 0 |
|
9219 | 0 | } |
9220 | | |
9221 | 0 | SinOpOperandAdaptor::SinOpOperandAdaptor(SinOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9222 | 0 |
|
9223 | 0 | } |
9224 | | |
9225 | 0 | std::pair<unsigned, unsigned> SinOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9226 | 0 | return {index, 1}; |
9227 | 0 | } |
9228 | | |
9229 | 0 | ValueRange SinOpOperandAdaptor::getODSOperands(unsigned index) { |
9230 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9231 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9232 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9233 | 0 | } |
9234 | | |
9235 | 0 | Value SinOpOperandAdaptor::operand() { |
9236 | 0 | return *getODSOperands(0).begin(); |
9237 | 0 | } |
9238 | | |
9239 | 0 | StringRef SinOp::getOperationName() { |
9240 | 0 | return "std.sin"; |
9241 | 0 | } |
9242 | | |
9243 | 0 | std::pair<unsigned, unsigned> SinOp::getODSOperandIndexAndLength(unsigned index) { |
9244 | 0 | return {index, 1}; |
9245 | 0 | } |
9246 | | |
9247 | 0 | Operation::operand_range SinOp::getODSOperands(unsigned index) { |
9248 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9249 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9250 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9251 | 0 | } |
9252 | | |
9253 | 0 | Value SinOp::operand() { |
9254 | 0 | return *getODSOperands(0).begin(); |
9255 | 0 | } |
9256 | | |
9257 | 0 | ::mlir::MutableOperandRange SinOp::operandMutable() { |
9258 | 0 | auto range = getODSOperandIndexAndLength(0); |
9259 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9260 | 0 | } |
9261 | | |
9262 | 0 | std::pair<unsigned, unsigned> SinOp::getODSResultIndexAndLength(unsigned index) { |
9263 | 0 | return {index, 1}; |
9264 | 0 | } |
9265 | | |
9266 | 0 | Operation::result_range SinOp::getODSResults(unsigned index) { |
9267 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9268 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9269 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9270 | 0 | } |
9271 | | |
9272 | 0 | void SinOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
9273 | 0 | odsState.addOperands(operand); |
9274 | 0 | odsState.addTypes(resultType0); |
9275 | 0 | } |
9276 | | |
9277 | 0 | void SinOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
9278 | 0 | odsState.addOperands(operand); |
9279 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
9280 | 0 | odsState.addTypes(resultTypes); |
9281 | 0 | } |
9282 | | |
9283 | 0 | void SinOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9284 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
9285 | 0 | odsState.addOperands(operands); |
9286 | 0 | odsState.addAttributes(attributes); |
9287 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
9288 | 0 | odsState.addTypes(resultTypes); |
9289 | 0 | } |
9290 | | |
9291 | 0 | void SinOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
9292 | 0 | odsState.addOperands(operand); |
9293 | 0 | odsState.addTypes({operand.getType()}); |
9294 | 0 |
|
9295 | 0 | } |
9296 | | |
9297 | 0 | void SinOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9298 | 0 | odsState.addOperands(operands); |
9299 | 0 | odsState.addAttributes(attributes); |
9300 | 0 | odsState.addTypes({operands[0].getType()}); |
9301 | 0 |
|
9302 | 0 | } |
9303 | | |
9304 | 0 | ParseResult SinOp::parse(OpAsmParser &parser, OperationState &result) { |
9305 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
9306 | 0 | } |
9307 | | |
9308 | 0 | void SinOp::print(OpAsmPrinter &p) { |
9309 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
9310 | 0 | } |
9311 | | |
9312 | 0 | LogicalResult SinOp::verify() { |
9313 | 0 | { |
9314 | 0 | unsigned index = 0; (void)index; |
9315 | 0 | auto valueGroup0 = getODSOperands(0); |
9316 | 0 | for (Value v : valueGroup0) { |
9317 | 0 | (void)v; |
9318 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
9319 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
9320 | 0 | } |
9321 | 0 | ++index; |
9322 | 0 | } |
9323 | 0 | } |
9324 | 0 | { |
9325 | 0 | unsigned index = 0; (void)index; |
9326 | 0 | auto valueGroup0 = getODSResults(0); |
9327 | 0 | for (Value v : valueGroup0) { |
9328 | 0 | (void)v; |
9329 | 0 | if (!((true))) { |
9330 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
9331 | 0 | } |
9332 | 0 | ++index; |
9333 | 0 | } |
9334 | 0 | } |
9335 | 0 | return mlir::success(); |
9336 | 0 | } |
9337 | | |
9338 | 0 | void SinOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9339 | 0 |
|
9340 | 0 | } |
9341 | | |
9342 | | |
9343 | | //===----------------------------------------------------------------------===// |
9344 | | // SplatOp definitions |
9345 | | //===----------------------------------------------------------------------===// |
9346 | | |
9347 | 0 | SplatOpOperandAdaptor::SplatOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9348 | 0 |
|
9349 | 0 | } |
9350 | | |
9351 | 0 | SplatOpOperandAdaptor::SplatOpOperandAdaptor(SplatOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9352 | 0 |
|
9353 | 0 | } |
9354 | | |
9355 | 0 | std::pair<unsigned, unsigned> SplatOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9356 | 0 | return {index, 1}; |
9357 | 0 | } |
9358 | | |
9359 | 0 | ValueRange SplatOpOperandAdaptor::getODSOperands(unsigned index) { |
9360 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9361 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9362 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9363 | 0 | } |
9364 | | |
9365 | 0 | Value SplatOpOperandAdaptor::input() { |
9366 | 0 | return *getODSOperands(0).begin(); |
9367 | 0 | } |
9368 | | |
9369 | 0 | StringRef SplatOp::getOperationName() { |
9370 | 0 | return "std.splat"; |
9371 | 0 | } |
9372 | | |
9373 | 0 | std::pair<unsigned, unsigned> SplatOp::getODSOperandIndexAndLength(unsigned index) { |
9374 | 0 | return {index, 1}; |
9375 | 0 | } |
9376 | | |
9377 | 0 | Operation::operand_range SplatOp::getODSOperands(unsigned index) { |
9378 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9379 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9380 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9381 | 0 | } |
9382 | | |
9383 | 0 | Value SplatOp::input() { |
9384 | 0 | return *getODSOperands(0).begin(); |
9385 | 0 | } |
9386 | | |
9387 | 0 | ::mlir::MutableOperandRange SplatOp::inputMutable() { |
9388 | 0 | auto range = getODSOperandIndexAndLength(0); |
9389 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9390 | 0 | } |
9391 | | |
9392 | 0 | std::pair<unsigned, unsigned> SplatOp::getODSResultIndexAndLength(unsigned index) { |
9393 | 0 | return {index, 1}; |
9394 | 0 | } |
9395 | | |
9396 | 0 | Operation::result_range SplatOp::getODSResults(unsigned index) { |
9397 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9398 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9399 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9400 | 0 | } |
9401 | | |
9402 | 0 | Value SplatOp::aggregate() { |
9403 | 0 | return *getODSResults(0).begin(); |
9404 | 0 | } |
9405 | | |
9406 | 0 | void SplatOp::build(OpBuilder &builder, OperationState &result, Value element, Type aggregateType) { |
9407 | 0 | build(builder, result, aggregateType, element); |
9408 | 0 | } |
9409 | | |
9410 | 0 | void SplatOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type aggregate, Value input) { |
9411 | 0 | odsState.addOperands(input); |
9412 | 0 | odsState.addTypes(aggregate); |
9413 | 0 | } |
9414 | | |
9415 | 0 | void SplatOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value input) { |
9416 | 0 | odsState.addOperands(input); |
9417 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
9418 | 0 | odsState.addTypes(resultTypes); |
9419 | 0 | } |
9420 | | |
9421 | 0 | void SplatOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9422 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
9423 | 0 | odsState.addOperands(operands); |
9424 | 0 | odsState.addAttributes(attributes); |
9425 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
9426 | 0 | odsState.addTypes(resultTypes); |
9427 | 0 | } |
9428 | | |
9429 | 0 | LogicalResult SplatOp::verify() { |
9430 | 0 | { |
9431 | 0 | unsigned index = 0; (void)index; |
9432 | 0 | auto valueGroup0 = getODSOperands(0); |
9433 | 0 | for (Value v : valueGroup0) { |
9434 | 0 | (void)v; |
9435 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<FloatType>())))) { |
9436 | 0 | return emitOpError("operand #") << index << " must be integer or float type, but got " << v.getType(); |
9437 | 0 | } |
9438 | 0 | ++index; |
9439 | 0 | } |
9440 | 0 | } |
9441 | 0 | { |
9442 | 0 | unsigned index = 0; (void)index; |
9443 | 0 | auto valueGroup0 = getODSResults(0); |
9444 | 0 | for (Value v : valueGroup0) { |
9445 | 0 | (void)v; |
9446 | 0 | if (!((((v.getType().isa<VectorType>())) && ((true))) || ((((v.getType().isa<TensorType>())) && ((true))) && ((v.getType().cast<ShapedType>().hasStaticShape()))))) { |
9447 | 0 | return emitOpError("result #") << index << " must be vector of any type values or statically shaped tensor of any type values, but got " << v.getType(); |
9448 | 0 | } |
9449 | 0 | ++index; |
9450 | 0 | } |
9451 | 0 | } |
9452 | 0 | if (!(((*this->getODSResults(0).begin()).getType().cast<ShapedType>().getElementType() == (*this->getODSOperands(0).begin()).getType()))) { |
9453 | 0 | return emitOpError("failed to verify that operand type matches element type of result"); |
9454 | 0 | } |
9455 | 0 | return ::verify(*this); |
9456 | 0 | } |
9457 | | |
9458 | | |
9459 | | |
9460 | 0 | ParseResult SplatOp::parse(OpAsmParser &parser, OperationState &result) { |
9461 | 0 | OpAsmParser::OperandType inputRawOperands[1]; |
9462 | 0 | ArrayRef<OpAsmParser::OperandType> inputOperands(inputRawOperands); llvm::SMLoc inputOperandsLoc = parser.getCurrentLocation(); |
9463 | 0 | (void)inputOperandsLoc; |
9464 | 0 | Type aggregateRawTypes[1]; |
9465 | 0 | ArrayRef<Type> aggregateTypes(aggregateRawTypes); |
9466 | 0 |
|
9467 | 0 | if (parser.parseOperand(inputRawOperands[0])) |
9468 | 0 | return failure(); |
9469 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
9470 | 0 | return failure(); |
9471 | 0 | if (parser.parseColon()) |
9472 | 0 | return failure(); |
9473 | 0 | |
9474 | 0 | if (parser.parseType(aggregateRawTypes[0])) |
9475 | 0 | return failure(); |
9476 | 0 | for (Type type : aggregateTypes) { |
9477 | 0 | (void)type; |
9478 | 0 | if (!((((type.isa<VectorType>())) && ((true))) || ((((type.isa<TensorType>())) && ((true))) && ((type.cast<ShapedType>().hasStaticShape()))))) { |
9479 | 0 | return parser.emitError(parser.getNameLoc()) << "'aggregate' must be vector of any type values or statically shaped tensor of any type values, but got " << type; |
9480 | 0 | } |
9481 | 0 | } |
9482 | 0 | result.addTypes(aggregateTypes); |
9483 | 0 | if (parser.resolveOperands(inputOperands, aggregateTypes[0].cast<ShapedType>().getElementType(), inputOperandsLoc, result.operands)) |
9484 | 0 | return failure(); |
9485 | 0 | return success(); |
9486 | 0 | } |
9487 | | |
9488 | 0 | void SplatOp::print(OpAsmPrinter &p) { |
9489 | 0 | p << "splat"; |
9490 | 0 | p << " "; |
9491 | 0 | p << input(); |
9492 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
9493 | 0 | p << " " << ":"; |
9494 | 0 | p << " "; |
9495 | 0 | p << ArrayRef<Type>(aggregate().getType()); |
9496 | 0 | } |
9497 | | |
9498 | 0 | void SplatOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9499 | 0 |
|
9500 | 0 | } |
9501 | | |
9502 | | |
9503 | | //===----------------------------------------------------------------------===// |
9504 | | // SqrtOp definitions |
9505 | | //===----------------------------------------------------------------------===// |
9506 | | |
9507 | 0 | SqrtOpOperandAdaptor::SqrtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9508 | 0 |
|
9509 | 0 | } |
9510 | | |
9511 | 0 | SqrtOpOperandAdaptor::SqrtOpOperandAdaptor(SqrtOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9512 | 0 |
|
9513 | 0 | } |
9514 | | |
9515 | 0 | std::pair<unsigned, unsigned> SqrtOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9516 | 0 | return {index, 1}; |
9517 | 0 | } |
9518 | | |
9519 | 0 | ValueRange SqrtOpOperandAdaptor::getODSOperands(unsigned index) { |
9520 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9521 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9522 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9523 | 0 | } |
9524 | | |
9525 | 0 | Value SqrtOpOperandAdaptor::operand() { |
9526 | 0 | return *getODSOperands(0).begin(); |
9527 | 0 | } |
9528 | | |
9529 | 0 | StringRef SqrtOp::getOperationName() { |
9530 | 0 | return "std.sqrt"; |
9531 | 0 | } |
9532 | | |
9533 | 0 | std::pair<unsigned, unsigned> SqrtOp::getODSOperandIndexAndLength(unsigned index) { |
9534 | 0 | return {index, 1}; |
9535 | 0 | } |
9536 | | |
9537 | 0 | Operation::operand_range SqrtOp::getODSOperands(unsigned index) { |
9538 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9539 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9540 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9541 | 0 | } |
9542 | | |
9543 | 0 | Value SqrtOp::operand() { |
9544 | 0 | return *getODSOperands(0).begin(); |
9545 | 0 | } |
9546 | | |
9547 | 0 | ::mlir::MutableOperandRange SqrtOp::operandMutable() { |
9548 | 0 | auto range = getODSOperandIndexAndLength(0); |
9549 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9550 | 0 | } |
9551 | | |
9552 | 0 | std::pair<unsigned, unsigned> SqrtOp::getODSResultIndexAndLength(unsigned index) { |
9553 | 0 | return {index, 1}; |
9554 | 0 | } |
9555 | | |
9556 | 0 | Operation::result_range SqrtOp::getODSResults(unsigned index) { |
9557 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9558 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9559 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9560 | 0 | } |
9561 | | |
9562 | 0 | void SqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
9563 | 0 | odsState.addOperands(operand); |
9564 | 0 | odsState.addTypes(resultType0); |
9565 | 0 | } |
9566 | | |
9567 | 0 | void SqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
9568 | 0 | odsState.addOperands(operand); |
9569 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
9570 | 0 | odsState.addTypes(resultTypes); |
9571 | 0 | } |
9572 | | |
9573 | 0 | void SqrtOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9574 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
9575 | 0 | odsState.addOperands(operands); |
9576 | 0 | odsState.addAttributes(attributes); |
9577 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
9578 | 0 | odsState.addTypes(resultTypes); |
9579 | 0 | } |
9580 | | |
9581 | 0 | void SqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
9582 | 0 | odsState.addOperands(operand); |
9583 | 0 | odsState.addTypes({operand.getType()}); |
9584 | 0 |
|
9585 | 0 | } |
9586 | | |
9587 | 0 | void SqrtOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9588 | 0 | odsState.addOperands(operands); |
9589 | 0 | odsState.addAttributes(attributes); |
9590 | 0 | odsState.addTypes({operands[0].getType()}); |
9591 | 0 |
|
9592 | 0 | } |
9593 | | |
9594 | 0 | ParseResult SqrtOp::parse(OpAsmParser &parser, OperationState &result) { |
9595 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
9596 | 0 | } |
9597 | | |
9598 | 0 | void SqrtOp::print(OpAsmPrinter &p) { |
9599 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
9600 | 0 | } |
9601 | | |
9602 | 0 | LogicalResult SqrtOp::verify() { |
9603 | 0 | { |
9604 | 0 | unsigned index = 0; (void)index; |
9605 | 0 | auto valueGroup0 = getODSOperands(0); |
9606 | 0 | for (Value v : valueGroup0) { |
9607 | 0 | (void)v; |
9608 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
9609 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
9610 | 0 | } |
9611 | 0 | ++index; |
9612 | 0 | } |
9613 | 0 | } |
9614 | 0 | { |
9615 | 0 | unsigned index = 0; (void)index; |
9616 | 0 | auto valueGroup0 = getODSResults(0); |
9617 | 0 | for (Value v : valueGroup0) { |
9618 | 0 | (void)v; |
9619 | 0 | if (!((true))) { |
9620 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
9621 | 0 | } |
9622 | 0 | ++index; |
9623 | 0 | } |
9624 | 0 | } |
9625 | 0 | return mlir::success(); |
9626 | 0 | } |
9627 | | |
9628 | 0 | void SqrtOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9629 | 0 |
|
9630 | 0 | } |
9631 | | |
9632 | | |
9633 | | //===----------------------------------------------------------------------===// |
9634 | | // StoreOp definitions |
9635 | | //===----------------------------------------------------------------------===// |
9636 | | |
9637 | 0 | StoreOpOperandAdaptor::StoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9638 | 0 |
|
9639 | 0 | } |
9640 | | |
9641 | 0 | StoreOpOperandAdaptor::StoreOpOperandAdaptor(StoreOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9642 | 0 |
|
9643 | 0 | } |
9644 | | |
9645 | 0 | std::pair<unsigned, unsigned> StoreOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9646 | 0 | bool isVariadic[] = {false, false, true}; |
9647 | 0 | int prevVariadicCount = 0; |
9648 | 0 | for (unsigned i = 0; i < index; ++i) |
9649 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
9650 | 0 |
|
9651 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
9652 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
9653 | 0 | int variadicSize = (odsOperands.size() - 2) / 1; |
9654 | 0 | // `index` passed in as the parameter is the static index which counts each |
9655 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
9656 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
9657 | 0 | // value pack for this static operand starts. |
9658 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
9659 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
9660 | 0 | return {start, size}; |
9661 | 0 | } |
9662 | | |
9663 | 0 | ValueRange StoreOpOperandAdaptor::getODSOperands(unsigned index) { |
9664 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9665 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9666 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9667 | 0 | } |
9668 | | |
9669 | 0 | Value StoreOpOperandAdaptor::value() { |
9670 | 0 | return *getODSOperands(0).begin(); |
9671 | 0 | } |
9672 | | |
9673 | 0 | Value StoreOpOperandAdaptor::memref() { |
9674 | 0 | return *getODSOperands(1).begin(); |
9675 | 0 | } |
9676 | | |
9677 | 0 | ValueRange StoreOpOperandAdaptor::indices() { |
9678 | 0 | return getODSOperands(2); |
9679 | 0 | } |
9680 | | |
9681 | 0 | StringRef StoreOp::getOperationName() { |
9682 | 0 | return "std.store"; |
9683 | 0 | } |
9684 | | |
9685 | 0 | std::pair<unsigned, unsigned> StoreOp::getODSOperandIndexAndLength(unsigned index) { |
9686 | 0 | bool isVariadic[] = {false, false, true}; |
9687 | 0 | int prevVariadicCount = 0; |
9688 | 0 | for (unsigned i = 0; i < index; ++i) |
9689 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
9690 | 0 |
|
9691 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
9692 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
9693 | 0 | int variadicSize = (getOperation()->getNumOperands() - 2) / 1; |
9694 | 0 | // `index` passed in as the parameter is the static index which counts each |
9695 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
9696 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
9697 | 0 | // value pack for this static operand starts. |
9698 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
9699 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
9700 | 0 | return {start, size}; |
9701 | 0 | } |
9702 | | |
9703 | 0 | Operation::operand_range StoreOp::getODSOperands(unsigned index) { |
9704 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9705 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9706 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9707 | 0 | } |
9708 | | |
9709 | 0 | Value StoreOp::value() { |
9710 | 0 | return *getODSOperands(0).begin(); |
9711 | 0 | } |
9712 | | |
9713 | 0 | Value StoreOp::memref() { |
9714 | 0 | return *getODSOperands(1).begin(); |
9715 | 0 | } |
9716 | | |
9717 | 0 | Operation::operand_range StoreOp::indices() { |
9718 | 0 | return getODSOperands(2); |
9719 | 0 | } |
9720 | | |
9721 | 0 | ::mlir::MutableOperandRange StoreOp::valueMutable() { |
9722 | 0 | auto range = getODSOperandIndexAndLength(0); |
9723 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9724 | 0 | } |
9725 | | |
9726 | 0 | ::mlir::MutableOperandRange StoreOp::memrefMutable() { |
9727 | 0 | auto range = getODSOperandIndexAndLength(1); |
9728 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9729 | 0 | } |
9730 | | |
9731 | 0 | ::mlir::MutableOperandRange StoreOp::indicesMutable() { |
9732 | 0 | auto range = getODSOperandIndexAndLength(2); |
9733 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9734 | 0 | } |
9735 | | |
9736 | 0 | std::pair<unsigned, unsigned> StoreOp::getODSResultIndexAndLength(unsigned index) { |
9737 | 0 | return {index, 1}; |
9738 | 0 | } |
9739 | | |
9740 | 0 | Operation::result_range StoreOp::getODSResults(unsigned index) { |
9741 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9742 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9743 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9744 | 0 | } |
9745 | | |
9746 | 0 | void StoreOp::build(OpBuilder &, OperationState &result, Value valueToStore, Value memref) { |
9747 | 0 | result.addOperands(valueToStore); |
9748 | 0 | result.addOperands(memref); |
9749 | 0 | |
9750 | 0 | } |
9751 | | |
9752 | 0 | void StoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value value, Value memref, ValueRange indices) { |
9753 | 0 | odsState.addOperands(value); |
9754 | 0 | odsState.addOperands(memref); |
9755 | 0 | odsState.addOperands(indices); |
9756 | 0 | } |
9757 | | |
9758 | 0 | void StoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value, Value memref, ValueRange indices) { |
9759 | 0 | odsState.addOperands(value); |
9760 | 0 | odsState.addOperands(memref); |
9761 | 0 | odsState.addOperands(indices); |
9762 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
9763 | 0 | odsState.addTypes(resultTypes); |
9764 | 0 | } |
9765 | | |
9766 | 0 | void StoreOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9767 | 0 | assert(operands.size() >= 2u && "mismatched number of parameters"); |
9768 | 0 | odsState.addOperands(operands); |
9769 | 0 | odsState.addAttributes(attributes); |
9770 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
9771 | 0 | odsState.addTypes(resultTypes); |
9772 | 0 | } |
9773 | | |
9774 | 0 | LogicalResult StoreOp::verify() { |
9775 | 0 | { |
9776 | 0 | unsigned index = 0; (void)index; |
9777 | 0 | auto valueGroup0 = getODSOperands(0); |
9778 | 0 | for (Value v : valueGroup0) { |
9779 | 0 | (void)v; |
9780 | 0 | if (!((true))) { |
9781 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
9782 | 0 | } |
9783 | 0 | ++index; |
9784 | 0 | } |
9785 | 0 | auto valueGroup1 = getODSOperands(1); |
9786 | 0 | for (Value v : valueGroup1) { |
9787 | 0 | (void)v; |
9788 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
9789 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
9790 | 0 | } |
9791 | 0 | ++index; |
9792 | 0 | } |
9793 | 0 | auto valueGroup2 = getODSOperands(2); |
9794 | 0 | for (Value v : valueGroup2) { |
9795 | 0 | (void)v; |
9796 | 0 | if (!((v.getType().isa<IndexType>()))) { |
9797 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
9798 | 0 | } |
9799 | 0 | ++index; |
9800 | 0 | } |
9801 | 0 | } |
9802 | 0 | { |
9803 | 0 | unsigned index = 0; (void)index; |
9804 | 0 | } |
9805 | 0 | if (!(((*this->getODSOperands(1).begin()).getType().cast<MemRefType>().getElementType() == (*this->getODSOperands(0).begin()).getType()))) { |
9806 | 0 | return emitOpError("failed to verify that type of 'value' matches element type of 'memref'"); |
9807 | 0 | } |
9808 | 0 | return ::verify(*this); |
9809 | 0 | } |
9810 | | |
9811 | | |
9812 | | |
9813 | 0 | ParseResult StoreOp::parse(OpAsmParser &parser, OperationState &result) { |
9814 | 0 | OpAsmParser::OperandType valueRawOperands[1]; |
9815 | 0 | ArrayRef<OpAsmParser::OperandType> valueOperands(valueRawOperands); llvm::SMLoc valueOperandsLoc = parser.getCurrentLocation(); |
9816 | 0 | (void)valueOperandsLoc; |
9817 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
9818 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
9819 | 0 | (void)memrefOperandsLoc; |
9820 | 0 | SmallVector<OpAsmParser::OperandType, 4> indicesOperands; |
9821 | 0 | llvm::SMLoc indicesOperandsLoc = parser.getCurrentLocation(); |
9822 | 0 | (void)indicesOperandsLoc; |
9823 | 0 | Type memrefRawTypes[1]; |
9824 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
9825 | 0 |
|
9826 | 0 | if (parser.parseOperand(valueRawOperands[0])) |
9827 | 0 | return failure(); |
9828 | 0 | if (parser.parseComma()) |
9829 | 0 | return failure(); |
9830 | 0 | |
9831 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
9832 | 0 | return failure(); |
9833 | 0 | if (parser.parseLSquare()) |
9834 | 0 | return failure(); |
9835 | 0 | |
9836 | 0 | if (parser.parseOperandList(indicesOperands)) |
9837 | 0 | return failure(); |
9838 | 0 | if (parser.parseRSquare()) |
9839 | 0 | return failure(); |
9840 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
9841 | 0 | return failure(); |
9842 | 0 | if (parser.parseColon()) |
9843 | 0 | return failure(); |
9844 | 0 | |
9845 | 0 | if (parser.parseType(memrefRawTypes[0])) |
9846 | 0 | return failure(); |
9847 | 0 | for (Type type : memrefTypes) { |
9848 | 0 | (void)type; |
9849 | 0 | if (!(((type.isa<MemRefType>())) && ((true)))) { |
9850 | 0 | return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; |
9851 | 0 | } |
9852 | 0 | } |
9853 | 0 | Type odsBuildableType0 = parser.getBuilder().getIndexType(); |
9854 | 0 | if (parser.resolveOperands(valueOperands, memrefTypes[0].cast<MemRefType>().getElementType(), valueOperandsLoc, result.operands)) |
9855 | 0 | return failure(); |
9856 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
9857 | 0 | return failure(); |
9858 | 0 | if (parser.resolveOperands(indicesOperands, odsBuildableType0, result.operands)) |
9859 | 0 | return failure(); |
9860 | 0 | return success(); |
9861 | 0 | } |
9862 | | |
9863 | 0 | void StoreOp::print(OpAsmPrinter &p) { |
9864 | 0 | p << "store"; |
9865 | 0 | p << " "; |
9866 | 0 | p << value(); |
9867 | 0 | p << ","; |
9868 | 0 | p << " "; |
9869 | 0 | p << memref(); |
9870 | 0 | p << "["; |
9871 | 0 | p << indices(); |
9872 | 0 | p << "]"; |
9873 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
9874 | 0 | p << " " << ":"; |
9875 | 0 | p << " "; |
9876 | 0 | p << ArrayRef<Type>(memref().getType()); |
9877 | 0 | } |
9878 | | |
9879 | 0 | void StoreOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
9880 | 0 | for (Value value : getODSOperands(1)) |
9881 | 0 | effects.emplace_back(MemoryEffects::Write::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
9882 | 0 | } |
9883 | | |
9884 | | |
9885 | | //===----------------------------------------------------------------------===// |
9886 | | // SubCFOp definitions |
9887 | | //===----------------------------------------------------------------------===// |
9888 | | |
9889 | 0 | SubCFOpOperandAdaptor::SubCFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
9890 | 0 |
|
9891 | 0 | } |
9892 | | |
9893 | 0 | SubCFOpOperandAdaptor::SubCFOpOperandAdaptor(SubCFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
9894 | 0 |
|
9895 | 0 | } |
9896 | | |
9897 | 0 | std::pair<unsigned, unsigned> SubCFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
9898 | 0 | return {index, 1}; |
9899 | 0 | } |
9900 | | |
9901 | 0 | ValueRange SubCFOpOperandAdaptor::getODSOperands(unsigned index) { |
9902 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9903 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
9904 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
9905 | 0 | } |
9906 | | |
9907 | 0 | Value SubCFOpOperandAdaptor::lhs() { |
9908 | 0 | return *getODSOperands(0).begin(); |
9909 | 0 | } |
9910 | | |
9911 | 0 | Value SubCFOpOperandAdaptor::rhs() { |
9912 | 0 | return *getODSOperands(1).begin(); |
9913 | 0 | } |
9914 | | |
9915 | 0 | StringRef SubCFOp::getOperationName() { |
9916 | 0 | return "std.subcf"; |
9917 | 0 | } |
9918 | | |
9919 | 0 | std::pair<unsigned, unsigned> SubCFOp::getODSOperandIndexAndLength(unsigned index) { |
9920 | 0 | return {index, 1}; |
9921 | 0 | } |
9922 | | |
9923 | 0 | Operation::operand_range SubCFOp::getODSOperands(unsigned index) { |
9924 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
9925 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
9926 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
9927 | 0 | } |
9928 | | |
9929 | 0 | Value SubCFOp::lhs() { |
9930 | 0 | return *getODSOperands(0).begin(); |
9931 | 0 | } |
9932 | | |
9933 | 0 | Value SubCFOp::rhs() { |
9934 | 0 | return *getODSOperands(1).begin(); |
9935 | 0 | } |
9936 | | |
9937 | 0 | ::mlir::MutableOperandRange SubCFOp::lhsMutable() { |
9938 | 0 | auto range = getODSOperandIndexAndLength(0); |
9939 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9940 | 0 | } |
9941 | | |
9942 | 0 | ::mlir::MutableOperandRange SubCFOp::rhsMutable() { |
9943 | 0 | auto range = getODSOperandIndexAndLength(1); |
9944 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
9945 | 0 | } |
9946 | | |
9947 | 0 | std::pair<unsigned, unsigned> SubCFOp::getODSResultIndexAndLength(unsigned index) { |
9948 | 0 | return {index, 1}; |
9949 | 0 | } |
9950 | | |
9951 | 0 | Operation::result_range SubCFOp::getODSResults(unsigned index) { |
9952 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
9953 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
9954 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
9955 | 0 | } |
9956 | | |
9957 | 0 | void SubCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
9958 | 0 | odsState.addOperands(lhs); |
9959 | 0 | odsState.addOperands(rhs); |
9960 | 0 | odsState.addTypes(resultType0); |
9961 | 0 | } |
9962 | | |
9963 | 0 | void SubCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
9964 | 0 | odsState.addOperands(lhs); |
9965 | 0 | odsState.addOperands(rhs); |
9966 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
9967 | 0 | odsState.addTypes(resultTypes); |
9968 | 0 | } |
9969 | | |
9970 | 0 | void SubCFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9971 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
9972 | 0 | odsState.addOperands(operands); |
9973 | 0 | odsState.addAttributes(attributes); |
9974 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
9975 | 0 | odsState.addTypes(resultTypes); |
9976 | 0 | } |
9977 | | |
9978 | 0 | void SubCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
9979 | 0 | odsState.addOperands(lhs); |
9980 | 0 | odsState.addOperands(rhs); |
9981 | 0 | odsState.addTypes({lhs.getType()}); |
9982 | 0 |
|
9983 | 0 | } |
9984 | | |
9985 | 0 | void SubCFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
9986 | 0 | odsState.addOperands(operands); |
9987 | 0 | odsState.addAttributes(attributes); |
9988 | 0 | odsState.addTypes({operands[0].getType()}); |
9989 | 0 |
|
9990 | 0 | } |
9991 | | |
9992 | 0 | ParseResult SubCFOp::parse(OpAsmParser &parser, OperationState &result) { |
9993 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
9994 | 0 | } |
9995 | | |
9996 | 0 | void SubCFOp::print(OpAsmPrinter &p) { |
9997 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
9998 | 0 | } |
9999 | | |
10000 | 0 | LogicalResult SubCFOp::verify() { |
10001 | 0 | { |
10002 | 0 | unsigned index = 0; (void)index; |
10003 | 0 | auto valueGroup0 = getODSOperands(0); |
10004 | 0 | for (Value v : valueGroup0) { |
10005 | 0 | (void)v; |
10006 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
10007 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
10008 | 0 | } |
10009 | 0 | ++index; |
10010 | 0 | } |
10011 | 0 | auto valueGroup1 = getODSOperands(1); |
10012 | 0 | for (Value v : valueGroup1) { |
10013 | 0 | (void)v; |
10014 | 0 | if (!(((v.getType().isa<ComplexType>())) && ((v.getType().cast<ComplexType>().getElementType().isa<FloatType>())))) { |
10015 | 0 | return emitOpError("operand #") << index << " must be complex type with floating-point elements, but got " << v.getType(); |
10016 | 0 | } |
10017 | 0 | ++index; |
10018 | 0 | } |
10019 | 0 | } |
10020 | 0 | { |
10021 | 0 | unsigned index = 0; (void)index; |
10022 | 0 | auto valueGroup0 = getODSResults(0); |
10023 | 0 | for (Value v : valueGroup0) { |
10024 | 0 | (void)v; |
10025 | 0 | if (!((true))) { |
10026 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
10027 | 0 | } |
10028 | 0 | ++index; |
10029 | 0 | } |
10030 | 0 | } |
10031 | 0 | return mlir::success(); |
10032 | 0 | } |
10033 | | |
10034 | 0 | void SubCFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10035 | 0 |
|
10036 | 0 | } |
10037 | | |
10038 | | |
10039 | | //===----------------------------------------------------------------------===// |
10040 | | // SubFOp definitions |
10041 | | //===----------------------------------------------------------------------===// |
10042 | | |
10043 | 0 | SubFOpOperandAdaptor::SubFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
10044 | 0 |
|
10045 | 0 | } |
10046 | | |
10047 | 0 | SubFOpOperandAdaptor::SubFOpOperandAdaptor(SubFOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10048 | 0 |
|
10049 | 0 | } |
10050 | | |
10051 | 0 | std::pair<unsigned, unsigned> SubFOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10052 | 0 | return {index, 1}; |
10053 | 0 | } |
10054 | | |
10055 | 0 | ValueRange SubFOpOperandAdaptor::getODSOperands(unsigned index) { |
10056 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10057 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10058 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10059 | 0 | } |
10060 | | |
10061 | 0 | Value SubFOpOperandAdaptor::lhs() { |
10062 | 0 | return *getODSOperands(0).begin(); |
10063 | 0 | } |
10064 | | |
10065 | 0 | Value SubFOpOperandAdaptor::rhs() { |
10066 | 0 | return *getODSOperands(1).begin(); |
10067 | 0 | } |
10068 | | |
10069 | 0 | StringRef SubFOp::getOperationName() { |
10070 | 0 | return "std.subf"; |
10071 | 0 | } |
10072 | | |
10073 | 0 | std::pair<unsigned, unsigned> SubFOp::getODSOperandIndexAndLength(unsigned index) { |
10074 | 0 | return {index, 1}; |
10075 | 0 | } |
10076 | | |
10077 | 0 | Operation::operand_range SubFOp::getODSOperands(unsigned index) { |
10078 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10079 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10080 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10081 | 0 | } |
10082 | | |
10083 | 0 | Value SubFOp::lhs() { |
10084 | 0 | return *getODSOperands(0).begin(); |
10085 | 0 | } |
10086 | | |
10087 | 0 | Value SubFOp::rhs() { |
10088 | 0 | return *getODSOperands(1).begin(); |
10089 | 0 | } |
10090 | | |
10091 | 0 | ::mlir::MutableOperandRange SubFOp::lhsMutable() { |
10092 | 0 | auto range = getODSOperandIndexAndLength(0); |
10093 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10094 | 0 | } |
10095 | | |
10096 | 0 | ::mlir::MutableOperandRange SubFOp::rhsMutable() { |
10097 | 0 | auto range = getODSOperandIndexAndLength(1); |
10098 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10099 | 0 | } |
10100 | | |
10101 | 0 | std::pair<unsigned, unsigned> SubFOp::getODSResultIndexAndLength(unsigned index) { |
10102 | 0 | return {index, 1}; |
10103 | 0 | } |
10104 | | |
10105 | 0 | Operation::result_range SubFOp::getODSResults(unsigned index) { |
10106 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10107 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10108 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10109 | 0 | } |
10110 | | |
10111 | 0 | void SubFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
10112 | 0 | odsState.addOperands(lhs); |
10113 | 0 | odsState.addOperands(rhs); |
10114 | 0 | odsState.addTypes(resultType0); |
10115 | 0 | } |
10116 | | |
10117 | 0 | void SubFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
10118 | 0 | odsState.addOperands(lhs); |
10119 | 0 | odsState.addOperands(rhs); |
10120 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
10121 | 0 | odsState.addTypes(resultTypes); |
10122 | 0 | } |
10123 | | |
10124 | 0 | void SubFOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10125 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
10126 | 0 | odsState.addOperands(operands); |
10127 | 0 | odsState.addAttributes(attributes); |
10128 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
10129 | 0 | odsState.addTypes(resultTypes); |
10130 | 0 | } |
10131 | | |
10132 | 0 | void SubFOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
10133 | 0 | odsState.addOperands(lhs); |
10134 | 0 | odsState.addOperands(rhs); |
10135 | 0 | odsState.addTypes({lhs.getType()}); |
10136 | 0 |
|
10137 | 0 | } |
10138 | | |
10139 | 0 | void SubFOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10140 | 0 | odsState.addOperands(operands); |
10141 | 0 | odsState.addAttributes(attributes); |
10142 | 0 | odsState.addTypes({operands[0].getType()}); |
10143 | 0 |
|
10144 | 0 | } |
10145 | | |
10146 | 0 | ParseResult SubFOp::parse(OpAsmParser &parser, OperationState &result) { |
10147 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
10148 | 0 | } |
10149 | | |
10150 | 0 | void SubFOp::print(OpAsmPrinter &p) { |
10151 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
10152 | 0 | } |
10153 | | |
10154 | 0 | LogicalResult SubFOp::verify() { |
10155 | 0 | { |
10156 | 0 | unsigned index = 0; (void)index; |
10157 | 0 | auto valueGroup0 = getODSOperands(0); |
10158 | 0 | for (Value v : valueGroup0) { |
10159 | 0 | (void)v; |
10160 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
10161 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
10162 | 0 | } |
10163 | 0 | ++index; |
10164 | 0 | } |
10165 | 0 | auto valueGroup1 = getODSOperands(1); |
10166 | 0 | for (Value v : valueGroup1) { |
10167 | 0 | (void)v; |
10168 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
10169 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
10170 | 0 | } |
10171 | 0 | ++index; |
10172 | 0 | } |
10173 | 0 | } |
10174 | 0 | { |
10175 | 0 | unsigned index = 0; (void)index; |
10176 | 0 | auto valueGroup0 = getODSResults(0); |
10177 | 0 | for (Value v : valueGroup0) { |
10178 | 0 | (void)v; |
10179 | 0 | if (!((true))) { |
10180 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
10181 | 0 | } |
10182 | 0 | ++index; |
10183 | 0 | } |
10184 | 0 | } |
10185 | 0 | return mlir::success(); |
10186 | 0 | } |
10187 | | |
10188 | | |
10189 | | |
10190 | 0 | void SubFOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10191 | 0 |
|
10192 | 0 | } |
10193 | | |
10194 | | |
10195 | | //===----------------------------------------------------------------------===// |
10196 | | // SubIOp definitions |
10197 | | //===----------------------------------------------------------------------===// |
10198 | | |
10199 | 0 | SubIOpOperandAdaptor::SubIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
10200 | 0 |
|
10201 | 0 | } |
10202 | | |
10203 | 0 | SubIOpOperandAdaptor::SubIOpOperandAdaptor(SubIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10204 | 0 |
|
10205 | 0 | } |
10206 | | |
10207 | 0 | std::pair<unsigned, unsigned> SubIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10208 | 0 | return {index, 1}; |
10209 | 0 | } |
10210 | | |
10211 | 0 | ValueRange SubIOpOperandAdaptor::getODSOperands(unsigned index) { |
10212 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10213 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10214 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10215 | 0 | } |
10216 | | |
10217 | 0 | Value SubIOpOperandAdaptor::lhs() { |
10218 | 0 | return *getODSOperands(0).begin(); |
10219 | 0 | } |
10220 | | |
10221 | 0 | Value SubIOpOperandAdaptor::rhs() { |
10222 | 0 | return *getODSOperands(1).begin(); |
10223 | 0 | } |
10224 | | |
10225 | 0 | StringRef SubIOp::getOperationName() { |
10226 | 0 | return "std.subi"; |
10227 | 0 | } |
10228 | | |
10229 | 0 | std::pair<unsigned, unsigned> SubIOp::getODSOperandIndexAndLength(unsigned index) { |
10230 | 0 | return {index, 1}; |
10231 | 0 | } |
10232 | | |
10233 | 0 | Operation::operand_range SubIOp::getODSOperands(unsigned index) { |
10234 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10235 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10236 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10237 | 0 | } |
10238 | | |
10239 | 0 | Value SubIOp::lhs() { |
10240 | 0 | return *getODSOperands(0).begin(); |
10241 | 0 | } |
10242 | | |
10243 | 0 | Value SubIOp::rhs() { |
10244 | 0 | return *getODSOperands(1).begin(); |
10245 | 0 | } |
10246 | | |
10247 | 0 | ::mlir::MutableOperandRange SubIOp::lhsMutable() { |
10248 | 0 | auto range = getODSOperandIndexAndLength(0); |
10249 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10250 | 0 | } |
10251 | | |
10252 | 0 | ::mlir::MutableOperandRange SubIOp::rhsMutable() { |
10253 | 0 | auto range = getODSOperandIndexAndLength(1); |
10254 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10255 | 0 | } |
10256 | | |
10257 | 0 | std::pair<unsigned, unsigned> SubIOp::getODSResultIndexAndLength(unsigned index) { |
10258 | 0 | return {index, 1}; |
10259 | 0 | } |
10260 | | |
10261 | 0 | Operation::result_range SubIOp::getODSResults(unsigned index) { |
10262 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10263 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10264 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10265 | 0 | } |
10266 | | |
10267 | 0 | void SubIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
10268 | 0 | odsState.addOperands(lhs); |
10269 | 0 | odsState.addOperands(rhs); |
10270 | 0 | odsState.addTypes(resultType0); |
10271 | 0 | } |
10272 | | |
10273 | 0 | void SubIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
10274 | 0 | odsState.addOperands(lhs); |
10275 | 0 | odsState.addOperands(rhs); |
10276 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
10277 | 0 | odsState.addTypes(resultTypes); |
10278 | 0 | } |
10279 | | |
10280 | 0 | void SubIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10281 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
10282 | 0 | odsState.addOperands(operands); |
10283 | 0 | odsState.addAttributes(attributes); |
10284 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
10285 | 0 | odsState.addTypes(resultTypes); |
10286 | 0 | } |
10287 | | |
10288 | 0 | void SubIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
10289 | 0 | odsState.addOperands(lhs); |
10290 | 0 | odsState.addOperands(rhs); |
10291 | 0 | odsState.addTypes({lhs.getType()}); |
10292 | 0 |
|
10293 | 0 | } |
10294 | | |
10295 | 0 | void SubIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10296 | 0 | odsState.addOperands(operands); |
10297 | 0 | odsState.addAttributes(attributes); |
10298 | 0 | odsState.addTypes({operands[0].getType()}); |
10299 | 0 |
|
10300 | 0 | } |
10301 | | |
10302 | 0 | ParseResult SubIOp::parse(OpAsmParser &parser, OperationState &result) { |
10303 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
10304 | 0 | } |
10305 | | |
10306 | 0 | void SubIOp::print(OpAsmPrinter &p) { |
10307 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
10308 | 0 | } |
10309 | | |
10310 | 0 | LogicalResult SubIOp::verify() { |
10311 | 0 | { |
10312 | 0 | unsigned index = 0; (void)index; |
10313 | 0 | auto valueGroup0 = getODSOperands(0); |
10314 | 0 | for (Value v : valueGroup0) { |
10315 | 0 | (void)v; |
10316 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
10317 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
10318 | 0 | } |
10319 | 0 | ++index; |
10320 | 0 | } |
10321 | 0 | auto valueGroup1 = getODSOperands(1); |
10322 | 0 | for (Value v : valueGroup1) { |
10323 | 0 | (void)v; |
10324 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
10325 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
10326 | 0 | } |
10327 | 0 | ++index; |
10328 | 0 | } |
10329 | 0 | } |
10330 | 0 | { |
10331 | 0 | unsigned index = 0; (void)index; |
10332 | 0 | auto valueGroup0 = getODSResults(0); |
10333 | 0 | for (Value v : valueGroup0) { |
10334 | 0 | (void)v; |
10335 | 0 | if (!((true))) { |
10336 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
10337 | 0 | } |
10338 | 0 | ++index; |
10339 | 0 | } |
10340 | 0 | } |
10341 | 0 | return mlir::success(); |
10342 | 0 | } |
10343 | | |
10344 | | |
10345 | | |
10346 | 0 | void SubIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10347 | 0 |
|
10348 | 0 | } |
10349 | | |
10350 | | |
10351 | | //===----------------------------------------------------------------------===// |
10352 | | // SubViewOp definitions |
10353 | | //===----------------------------------------------------------------------===// |
10354 | | |
10355 | 0 | SubViewOpOperandAdaptor::SubViewOpOperandAdaptor(ValueRange values, DictionaryAttr attrs) : odsOperands(values), odsAttrs(attrs) { |
10356 | 0 |
|
10357 | 0 | } |
10358 | | |
10359 | 0 | SubViewOpOperandAdaptor::SubViewOpOperandAdaptor(SubViewOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10360 | 0 |
|
10361 | 0 | } |
10362 | | |
10363 | 0 | std::pair<unsigned, unsigned> SubViewOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10364 | 0 | assert(odsAttrs && "missing segment size attribute for op"); |
10365 | 0 | auto sizeAttr = odsAttrs.get("operand_segment_sizes").cast<DenseIntElementsAttr>(); |
10366 | 0 |
|
10367 | 0 | unsigned start = 0; |
10368 | 0 | for (unsigned i = 0; i < index; ++i) |
10369 | 0 | start += (*(sizeAttr.begin() + i)).getZExtValue(); |
10370 | 0 | unsigned size = (*(sizeAttr.begin() + index)).getZExtValue(); |
10371 | 0 | return {start, size}; |
10372 | 0 | } |
10373 | | |
10374 | 0 | ValueRange SubViewOpOperandAdaptor::getODSOperands(unsigned index) { |
10375 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10376 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10377 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10378 | 0 | } |
10379 | | |
10380 | 0 | Value SubViewOpOperandAdaptor::source() { |
10381 | 0 | return *getODSOperands(0).begin(); |
10382 | 0 | } |
10383 | | |
10384 | 0 | ValueRange SubViewOpOperandAdaptor::offsets() { |
10385 | 0 | return getODSOperands(1); |
10386 | 0 | } |
10387 | | |
10388 | 0 | ValueRange SubViewOpOperandAdaptor::sizes() { |
10389 | 0 | return getODSOperands(2); |
10390 | 0 | } |
10391 | | |
10392 | 0 | ValueRange SubViewOpOperandAdaptor::strides() { |
10393 | 0 | return getODSOperands(3); |
10394 | 0 | } |
10395 | | |
10396 | 0 | ArrayAttr SubViewOpOperandAdaptor::static_offsets() { |
10397 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
10398 | 0 | ArrayAttr attr = odsAttrs.get("static_offsets").cast<ArrayAttr>(); |
10399 | 0 | return attr; |
10400 | 0 | } |
10401 | | |
10402 | 0 | ArrayAttr SubViewOpOperandAdaptor::static_sizes() { |
10403 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
10404 | 0 | ArrayAttr attr = odsAttrs.get("static_sizes").cast<ArrayAttr>(); |
10405 | 0 | return attr; |
10406 | 0 | } |
10407 | | |
10408 | 0 | ArrayAttr SubViewOpOperandAdaptor::static_strides() { |
10409 | 0 | assert(odsAttrs && "no attributes when constructing adapter"); |
10410 | 0 | ArrayAttr attr = odsAttrs.get("static_strides").cast<ArrayAttr>(); |
10411 | 0 | return attr; |
10412 | 0 | } |
10413 | | |
10414 | 0 | StringRef SubViewOp::getOperationName() { |
10415 | 0 | return "std.subview"; |
10416 | 0 | } |
10417 | | |
10418 | 0 | std::pair<unsigned, unsigned> SubViewOp::getODSOperandIndexAndLength(unsigned index) { |
10419 | 0 | auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("operand_segment_sizes"); |
10420 | 0 |
|
10421 | 0 | unsigned start = 0; |
10422 | 0 | for (unsigned i = 0; i < index; ++i) |
10423 | 0 | start += (*(sizeAttr.begin() + i)).getZExtValue(); |
10424 | 0 | unsigned size = (*(sizeAttr.begin() + index)).getZExtValue(); |
10425 | 0 | return {start, size}; |
10426 | 0 | } |
10427 | | |
10428 | 0 | Operation::operand_range SubViewOp::getODSOperands(unsigned index) { |
10429 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10430 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10431 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10432 | 0 | } |
10433 | | |
10434 | 0 | Value SubViewOp::source() { |
10435 | 0 | return *getODSOperands(0).begin(); |
10436 | 0 | } |
10437 | | |
10438 | 0 | Operation::operand_range SubViewOp::offsets() { |
10439 | 0 | return getODSOperands(1); |
10440 | 0 | } |
10441 | | |
10442 | 0 | Operation::operand_range SubViewOp::sizes() { |
10443 | 0 | return getODSOperands(2); |
10444 | 0 | } |
10445 | | |
10446 | 0 | Operation::operand_range SubViewOp::strides() { |
10447 | 0 | return getODSOperands(3); |
10448 | 0 | } |
10449 | | |
10450 | 0 | ::mlir::MutableOperandRange SubViewOp::sourceMutable() { |
10451 | 0 | auto range = getODSOperandIndexAndLength(0); |
10452 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
10453 | 0 | } |
10454 | | |
10455 | 0 | ::mlir::MutableOperandRange SubViewOp::offsetsMutable() { |
10456 | 0 | auto range = getODSOperandIndexAndLength(1); |
10457 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
10458 | 0 | } |
10459 | | |
10460 | 0 | ::mlir::MutableOperandRange SubViewOp::sizesMutable() { |
10461 | 0 | auto range = getODSOperandIndexAndLength(2); |
10462 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(2u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
10463 | 0 | } |
10464 | | |
10465 | 0 | ::mlir::MutableOperandRange SubViewOp::stridesMutable() { |
10466 | 0 | auto range = getODSOperandIndexAndLength(3); |
10467 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, *getOperation()->getMutableAttrDict().getNamed("operand_segment_sizes"))); |
10468 | 0 | } |
10469 | | |
10470 | 0 | std::pair<unsigned, unsigned> SubViewOp::getODSResultIndexAndLength(unsigned index) { |
10471 | 0 | return {index, 1}; |
10472 | 0 | } |
10473 | | |
10474 | 0 | Operation::result_range SubViewOp::getODSResults(unsigned index) { |
10475 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10476 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10477 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10478 | 0 | } |
10479 | | |
10480 | 0 | Value SubViewOp::result() { |
10481 | 0 | return *getODSResults(0).begin(); |
10482 | 0 | } |
10483 | | |
10484 | 0 | ArrayAttr SubViewOp::static_offsetsAttr() { |
10485 | 0 | return this->getAttr("static_offsets").cast<ArrayAttr>(); |
10486 | 0 | } |
10487 | | |
10488 | 0 | ArrayAttr SubViewOp::static_offsets() { |
10489 | 0 | auto attr = static_offsetsAttr(); |
10490 | 0 | return attr; |
10491 | 0 | } |
10492 | | |
10493 | 0 | ArrayAttr SubViewOp::static_sizesAttr() { |
10494 | 0 | return this->getAttr("static_sizes").cast<ArrayAttr>(); |
10495 | 0 | } |
10496 | | |
10497 | 0 | ArrayAttr SubViewOp::static_sizes() { |
10498 | 0 | auto attr = static_sizesAttr(); |
10499 | 0 | return attr; |
10500 | 0 | } |
10501 | | |
10502 | 0 | ArrayAttr SubViewOp::static_stridesAttr() { |
10503 | 0 | return this->getAttr("static_strides").cast<ArrayAttr>(); |
10504 | 0 | } |
10505 | | |
10506 | 0 | ArrayAttr SubViewOp::static_strides() { |
10507 | 0 | auto attr = static_stridesAttr(); |
10508 | 0 | return attr; |
10509 | 0 | } |
10510 | | |
10511 | 0 | void SubViewOp::static_offsetsAttr(ArrayAttr attr) { |
10512 | 0 | this->getOperation()->setAttr("static_offsets", attr); |
10513 | 0 | } |
10514 | | |
10515 | 0 | void SubViewOp::static_sizesAttr(ArrayAttr attr) { |
10516 | 0 | this->getOperation()->setAttr("static_sizes", attr); |
10517 | 0 | } |
10518 | | |
10519 | 0 | void SubViewOp::static_stridesAttr(ArrayAttr attr) { |
10520 | 0 | this->getOperation()->setAttr("static_strides", attr); |
10521 | 0 | } |
10522 | | |
10523 | | |
10524 | | |
10525 | | |
10526 | | |
10527 | 0 | void SubViewOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayAttr static_offsets, ArrayAttr static_sizes, ArrayAttr static_strides) { |
10528 | 0 | odsState.addOperands(source); |
10529 | 0 | odsState.addOperands(offsets); |
10530 | 0 | odsState.addOperands(sizes); |
10531 | 0 | odsState.addOperands(strides); |
10532 | 0 | odsState.addAttribute("operand_segment_sizes", odsBuilder.getI32VectorAttr({1, static_cast<int32_t>(offsets.size()), static_cast<int32_t>(sizes.size()), static_cast<int32_t>(strides.size())})); |
10533 | 0 | odsState.addAttribute("static_offsets", static_offsets); |
10534 | 0 | odsState.addAttribute("static_sizes", static_sizes); |
10535 | 0 | odsState.addAttribute("static_strides", static_strides); |
10536 | 0 | odsState.addTypes(result); |
10537 | 0 | } |
10538 | | |
10539 | 0 | void SubViewOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayAttr static_offsets, ArrayAttr static_sizes, ArrayAttr static_strides) { |
10540 | 0 | odsState.addOperands(source); |
10541 | 0 | odsState.addOperands(offsets); |
10542 | 0 | odsState.addOperands(sizes); |
10543 | 0 | odsState.addOperands(strides); |
10544 | 0 | odsState.addAttribute("operand_segment_sizes", odsBuilder.getI32VectorAttr({1, static_cast<int32_t>(offsets.size()), static_cast<int32_t>(sizes.size()), static_cast<int32_t>(strides.size())})); |
10545 | 0 | odsState.addAttribute("static_offsets", static_offsets); |
10546 | 0 | odsState.addAttribute("static_sizes", static_sizes); |
10547 | 0 | odsState.addAttribute("static_strides", static_strides); |
10548 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
10549 | 0 | odsState.addTypes(resultTypes); |
10550 | 0 | } |
10551 | | |
10552 | 0 | void SubViewOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10553 | 0 | assert(operands.size() >= 1u && "mismatched number of parameters"); |
10554 | 0 | odsState.addOperands(operands); |
10555 | 0 | odsState.addAttributes(attributes); |
10556 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
10557 | 0 | odsState.addTypes(resultTypes); |
10558 | 0 | } |
10559 | | |
10560 | 0 | ParseResult SubViewOp::parse(OpAsmParser &parser, OperationState &result) { |
10561 | 0 | return ::parseSubViewOp(parser, result); |
10562 | 0 | } |
10563 | | |
10564 | 0 | void SubViewOp::print(OpAsmPrinter &p) { |
10565 | 0 | return ::print(p, *this); |
10566 | 0 | } |
10567 | | |
10568 | 0 | LogicalResult SubViewOp::verify() { |
10569 | 0 | { |
10570 | 0 | auto sizeAttr = getAttrOfType<DenseIntElementsAttr>("operand_segment_sizes"); |
10571 | 0 | auto numElements = sizeAttr.getType().cast<ShapedType>().getNumElements(); |
10572 | 0 | if (numElements != 4) { |
10573 | 0 | return emitOpError("'operand_segment_sizes' attribute for specifying operand segments " |
10574 | 0 | "must have 4 elements"); |
10575 | 0 | } |
10576 | 0 | } |
10577 | 0 | auto tblgen_static_offsets = this->getAttr("static_offsets"); |
10578 | 0 | if (!tblgen_static_offsets) return emitOpError("requires attribute 'static_offsets'"); |
10579 | 0 | { |
10580 | 0 | if (!(((tblgen_static_offsets.isa<ArrayAttr>())) && (llvm::all_of(tblgen_static_offsets.cast<ArrayAttr>(), [](Attribute attr) { return ((attr.isa<IntegerAttr>())) && ((attr.cast<IntegerAttr>().getType().isSignlessInteger(64))); })))) return emitOpError("attribute 'static_offsets' failed to satisfy constraint: 64-bit integer array attribute"); |
10581 | 0 | } |
10582 | 0 | auto tblgen_static_sizes = this->getAttr("static_sizes"); |
10583 | 0 | if (!tblgen_static_sizes) return emitOpError("requires attribute 'static_sizes'"); |
10584 | 0 | { |
10585 | 0 | if (!(((tblgen_static_sizes.isa<ArrayAttr>())) && (llvm::all_of(tblgen_static_sizes.cast<ArrayAttr>(), [](Attribute attr) { return ((attr.isa<IntegerAttr>())) && ((attr.cast<IntegerAttr>().getType().isSignlessInteger(64))); })))) return emitOpError("attribute 'static_sizes' failed to satisfy constraint: 64-bit integer array attribute"); |
10586 | 0 | } |
10587 | 0 | auto tblgen_static_strides = this->getAttr("static_strides"); |
10588 | 0 | if (!tblgen_static_strides) return emitOpError("requires attribute 'static_strides'"); |
10589 | 0 | { |
10590 | 0 | if (!(((tblgen_static_strides.isa<ArrayAttr>())) && (llvm::all_of(tblgen_static_strides.cast<ArrayAttr>(), [](Attribute attr) { return ((attr.isa<IntegerAttr>())) && ((attr.cast<IntegerAttr>().getType().isSignlessInteger(64))); })))) return emitOpError("attribute 'static_strides' failed to satisfy constraint: 64-bit integer array attribute"); |
10591 | 0 | } |
10592 | 0 | { |
10593 | 0 | unsigned index = 0; (void)index; |
10594 | 0 | auto valueGroup0 = getODSOperands(0); |
10595 | 0 | for (Value v : valueGroup0) { |
10596 | 0 | (void)v; |
10597 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
10598 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
10599 | 0 | } |
10600 | 0 | ++index; |
10601 | 0 | } |
10602 | 0 | auto valueGroup1 = getODSOperands(1); |
10603 | 0 | for (Value v : valueGroup1) { |
10604 | 0 | (void)v; |
10605 | 0 | if (!((v.getType().isa<IndexType>()))) { |
10606 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
10607 | 0 | } |
10608 | 0 | ++index; |
10609 | 0 | } |
10610 | 0 | auto valueGroup2 = getODSOperands(2); |
10611 | 0 | for (Value v : valueGroup2) { |
10612 | 0 | (void)v; |
10613 | 0 | if (!((v.getType().isa<IndexType>()))) { |
10614 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
10615 | 0 | } |
10616 | 0 | ++index; |
10617 | 0 | } |
10618 | 0 | auto valueGroup3 = getODSOperands(3); |
10619 | 0 | for (Value v : valueGroup3) { |
10620 | 0 | (void)v; |
10621 | 0 | if (!((v.getType().isa<IndexType>()))) { |
10622 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
10623 | 0 | } |
10624 | 0 | ++index; |
10625 | 0 | } |
10626 | 0 | } |
10627 | 0 | { |
10628 | 0 | unsigned index = 0; (void)index; |
10629 | 0 | auto valueGroup0 = getODSResults(0); |
10630 | 0 | for (Value v : valueGroup0) { |
10631 | 0 | (void)v; |
10632 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
10633 | 0 | return emitOpError("result #") << index << " must be memref of any type values, but got " << v.getType(); |
10634 | 0 | } |
10635 | 0 | ++index; |
10636 | 0 | } |
10637 | 0 | } |
10638 | 0 | return ::verify(*this); |
10639 | 0 | } |
10640 | | |
10641 | | |
10642 | | |
10643 | | |
10644 | | |
10645 | 0 | void SubViewOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10646 | 0 |
|
10647 | 0 | } |
10648 | | |
10649 | | |
10650 | | //===----------------------------------------------------------------------===// |
10651 | | // TanhOp definitions |
10652 | | //===----------------------------------------------------------------------===// |
10653 | | |
10654 | 0 | TanhOpOperandAdaptor::TanhOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
10655 | 0 |
|
10656 | 0 | } |
10657 | | |
10658 | 0 | TanhOpOperandAdaptor::TanhOpOperandAdaptor(TanhOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10659 | 0 |
|
10660 | 0 | } |
10661 | | |
10662 | 0 | std::pair<unsigned, unsigned> TanhOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10663 | 0 | return {index, 1}; |
10664 | 0 | } |
10665 | | |
10666 | 0 | ValueRange TanhOpOperandAdaptor::getODSOperands(unsigned index) { |
10667 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10668 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10669 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10670 | 0 | } |
10671 | | |
10672 | 0 | Value TanhOpOperandAdaptor::operand() { |
10673 | 0 | return *getODSOperands(0).begin(); |
10674 | 0 | } |
10675 | | |
10676 | 0 | StringRef TanhOp::getOperationName() { |
10677 | 0 | return "std.tanh"; |
10678 | 0 | } |
10679 | | |
10680 | 0 | std::pair<unsigned, unsigned> TanhOp::getODSOperandIndexAndLength(unsigned index) { |
10681 | 0 | return {index, 1}; |
10682 | 0 | } |
10683 | | |
10684 | 0 | Operation::operand_range TanhOp::getODSOperands(unsigned index) { |
10685 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10686 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10687 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10688 | 0 | } |
10689 | | |
10690 | 0 | Value TanhOp::operand() { |
10691 | 0 | return *getODSOperands(0).begin(); |
10692 | 0 | } |
10693 | | |
10694 | 0 | ::mlir::MutableOperandRange TanhOp::operandMutable() { |
10695 | 0 | auto range = getODSOperandIndexAndLength(0); |
10696 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10697 | 0 | } |
10698 | | |
10699 | 0 | std::pair<unsigned, unsigned> TanhOp::getODSResultIndexAndLength(unsigned index) { |
10700 | 0 | return {index, 1}; |
10701 | 0 | } |
10702 | | |
10703 | 0 | Operation::result_range TanhOp::getODSResults(unsigned index) { |
10704 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10705 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10706 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10707 | 0 | } |
10708 | | |
10709 | 0 | void TanhOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand) { |
10710 | 0 | odsState.addOperands(operand); |
10711 | 0 | odsState.addTypes(resultType0); |
10712 | 0 | } |
10713 | | |
10714 | 0 | void TanhOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand) { |
10715 | 0 | odsState.addOperands(operand); |
10716 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
10717 | 0 | odsState.addTypes(resultTypes); |
10718 | 0 | } |
10719 | | |
10720 | 0 | void TanhOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10721 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
10722 | 0 | odsState.addOperands(operands); |
10723 | 0 | odsState.addAttributes(attributes); |
10724 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
10725 | 0 | odsState.addTypes(resultTypes); |
10726 | 0 | } |
10727 | | |
10728 | 0 | void TanhOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value operand) { |
10729 | 0 | odsState.addOperands(operand); |
10730 | 0 | odsState.addTypes({operand.getType()}); |
10731 | 0 |
|
10732 | 0 | } |
10733 | | |
10734 | 0 | void TanhOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10735 | 0 | odsState.addOperands(operands); |
10736 | 0 | odsState.addAttributes(attributes); |
10737 | 0 | odsState.addTypes({operands[0].getType()}); |
10738 | 0 |
|
10739 | 0 | } |
10740 | | |
10741 | 0 | ParseResult TanhOp::parse(OpAsmParser &parser, OperationState &result) { |
10742 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
10743 | 0 | } |
10744 | | |
10745 | 0 | void TanhOp::print(OpAsmPrinter &p) { |
10746 | 0 | return printStandardUnaryOp(this->getOperation(), p); |
10747 | 0 | } |
10748 | | |
10749 | 0 | LogicalResult TanhOp::verify() { |
10750 | 0 | { |
10751 | 0 | unsigned index = 0; (void)index; |
10752 | 0 | auto valueGroup0 = getODSOperands(0); |
10753 | 0 | for (Value v : valueGroup0) { |
10754 | 0 | (void)v; |
10755 | 0 | if (!(((v.getType().isa<FloatType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isa<FloatType>()))))) { |
10756 | 0 | return emitOpError("operand #") << index << " must be floating-point-like, but got " << v.getType(); |
10757 | 0 | } |
10758 | 0 | ++index; |
10759 | 0 | } |
10760 | 0 | } |
10761 | 0 | { |
10762 | 0 | unsigned index = 0; (void)index; |
10763 | 0 | auto valueGroup0 = getODSResults(0); |
10764 | 0 | for (Value v : valueGroup0) { |
10765 | 0 | (void)v; |
10766 | 0 | if (!((true))) { |
10767 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
10768 | 0 | } |
10769 | 0 | ++index; |
10770 | 0 | } |
10771 | 0 | } |
10772 | 0 | return mlir::success(); |
10773 | 0 | } |
10774 | | |
10775 | 0 | void TanhOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10776 | 0 |
|
10777 | 0 | } |
10778 | | |
10779 | | |
10780 | | //===----------------------------------------------------------------------===// |
10781 | | // TensorCastOp definitions |
10782 | | //===----------------------------------------------------------------------===// |
10783 | | |
10784 | 0 | TensorCastOpOperandAdaptor::TensorCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
10785 | 0 |
|
10786 | 0 | } |
10787 | | |
10788 | 0 | TensorCastOpOperandAdaptor::TensorCastOpOperandAdaptor(TensorCastOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10789 | 0 |
|
10790 | 0 | } |
10791 | | |
10792 | 0 | std::pair<unsigned, unsigned> TensorCastOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10793 | 0 | return {index, 1}; |
10794 | 0 | } |
10795 | | |
10796 | 0 | ValueRange TensorCastOpOperandAdaptor::getODSOperands(unsigned index) { |
10797 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10798 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10799 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10800 | 0 | } |
10801 | | |
10802 | 0 | StringRef TensorCastOp::getOperationName() { |
10803 | 0 | return "std.tensor_cast"; |
10804 | 0 | } |
10805 | | |
10806 | 0 | std::pair<unsigned, unsigned> TensorCastOp::getODSOperandIndexAndLength(unsigned index) { |
10807 | 0 | return {index, 1}; |
10808 | 0 | } |
10809 | | |
10810 | 0 | Operation::operand_range TensorCastOp::getODSOperands(unsigned index) { |
10811 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10812 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10813 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10814 | 0 | } |
10815 | | |
10816 | 0 | std::pair<unsigned, unsigned> TensorCastOp::getODSResultIndexAndLength(unsigned index) { |
10817 | 0 | return {index, 1}; |
10818 | 0 | } |
10819 | | |
10820 | 0 | Operation::result_range TensorCastOp::getODSResults(unsigned index) { |
10821 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10822 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10823 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10824 | 0 | } |
10825 | | |
10826 | 0 | void TensorCastOp::build(OpBuilder &builder, OperationState &result, Value source, Type destType) { |
10827 | 0 | impl::buildCastOp(builder, result, source, destType); |
10828 | 0 | |
10829 | 0 | } |
10830 | | |
10831 | 0 | void TensorCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value odsArg_0) { |
10832 | 0 | odsState.addOperands(odsArg_0); |
10833 | 0 | odsState.addTypes(resultType0); |
10834 | 0 | } |
10835 | | |
10836 | 0 | void TensorCastOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value odsArg_0) { |
10837 | 0 | odsState.addOperands(odsArg_0); |
10838 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
10839 | 0 | odsState.addTypes(resultTypes); |
10840 | 0 | } |
10841 | | |
10842 | 0 | void TensorCastOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
10843 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
10844 | 0 | odsState.addOperands(operands); |
10845 | 0 | odsState.addAttributes(attributes); |
10846 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
10847 | 0 | odsState.addTypes(resultTypes); |
10848 | 0 | } |
10849 | | |
10850 | 0 | ParseResult TensorCastOp::parse(OpAsmParser &parser, OperationState &result) { |
10851 | 0 | return impl::parseCastOp(parser, result); |
10852 | 0 | } |
10853 | | |
10854 | 0 | void TensorCastOp::print(OpAsmPrinter &p) { |
10855 | 0 | return printStandardCastOp(this->getOperation(), p); |
10856 | 0 | } |
10857 | | |
10858 | 0 | LogicalResult TensorCastOp::verify() { |
10859 | 0 | { |
10860 | 0 | unsigned index = 0; (void)index; |
10861 | 0 | auto valueGroup0 = getODSOperands(0); |
10862 | 0 | for (Value v : valueGroup0) { |
10863 | 0 | (void)v; |
10864 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
10865 | 0 | return emitOpError("operand #") << index << " must be tensor of any type values, but got " << v.getType(); |
10866 | 0 | } |
10867 | 0 | ++index; |
10868 | 0 | } |
10869 | 0 | } |
10870 | 0 | { |
10871 | 0 | unsigned index = 0; (void)index; |
10872 | 0 | auto valueGroup0 = getODSResults(0); |
10873 | 0 | for (Value v : valueGroup0) { |
10874 | 0 | (void)v; |
10875 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
10876 | 0 | return emitOpError("result #") << index << " must be tensor of any type values, but got " << v.getType(); |
10877 | 0 | } |
10878 | 0 | ++index; |
10879 | 0 | } |
10880 | 0 | } |
10881 | 0 | return ::verifyCastOp(*this); |
10882 | 0 | } |
10883 | | |
10884 | | |
10885 | | |
10886 | 0 | void TensorCastOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
10887 | 0 |
|
10888 | 0 | } |
10889 | | |
10890 | | |
10891 | | //===----------------------------------------------------------------------===// |
10892 | | // TensorFromElementsOp definitions |
10893 | | //===----------------------------------------------------------------------===// |
10894 | | |
10895 | 0 | TensorFromElementsOpOperandAdaptor::TensorFromElementsOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
10896 | 0 |
|
10897 | 0 | } |
10898 | | |
10899 | 0 | TensorFromElementsOpOperandAdaptor::TensorFromElementsOpOperandAdaptor(TensorFromElementsOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
10900 | 0 |
|
10901 | 0 | } |
10902 | | |
10903 | 0 | std::pair<unsigned, unsigned> TensorFromElementsOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
10904 | 0 | bool isVariadic[] = {true}; |
10905 | 0 | int prevVariadicCount = 0; |
10906 | 0 | for (unsigned i = 0; i < index; ++i) |
10907 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
10908 | 0 |
|
10909 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
10910 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
10911 | 0 | int variadicSize = (odsOperands.size() - 0) / 1; |
10912 | 0 | // `index` passed in as the parameter is the static index which counts each |
10913 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
10914 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
10915 | 0 | // value pack for this static operand starts. |
10916 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
10917 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
10918 | 0 | return {start, size}; |
10919 | 0 | } |
10920 | | |
10921 | 0 | ValueRange TensorFromElementsOpOperandAdaptor::getODSOperands(unsigned index) { |
10922 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10923 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
10924 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
10925 | 0 | } |
10926 | | |
10927 | 0 | ValueRange TensorFromElementsOpOperandAdaptor::elements() { |
10928 | 0 | return getODSOperands(0); |
10929 | 0 | } |
10930 | | |
10931 | 0 | StringRef TensorFromElementsOp::getOperationName() { |
10932 | 0 | return "std.tensor_from_elements"; |
10933 | 0 | } |
10934 | | |
10935 | 0 | std::pair<unsigned, unsigned> TensorFromElementsOp::getODSOperandIndexAndLength(unsigned index) { |
10936 | 0 | bool isVariadic[] = {true}; |
10937 | 0 | int prevVariadicCount = 0; |
10938 | 0 | for (unsigned i = 0; i < index; ++i) |
10939 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
10940 | 0 |
|
10941 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
10942 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
10943 | 0 | int variadicSize = (getOperation()->getNumOperands() - 0) / 1; |
10944 | 0 | // `index` passed in as the parameter is the static index which counts each |
10945 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
10946 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
10947 | 0 | // value pack for this static operand starts. |
10948 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
10949 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
10950 | 0 | return {start, size}; |
10951 | 0 | } |
10952 | | |
10953 | 0 | Operation::operand_range TensorFromElementsOp::getODSOperands(unsigned index) { |
10954 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
10955 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
10956 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
10957 | 0 | } |
10958 | | |
10959 | 0 | Operation::operand_range TensorFromElementsOp::elements() { |
10960 | 0 | return getODSOperands(0); |
10961 | 0 | } |
10962 | | |
10963 | 0 | ::mlir::MutableOperandRange TensorFromElementsOp::elementsMutable() { |
10964 | 0 | auto range = getODSOperandIndexAndLength(0); |
10965 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
10966 | 0 | } |
10967 | | |
10968 | 0 | std::pair<unsigned, unsigned> TensorFromElementsOp::getODSResultIndexAndLength(unsigned index) { |
10969 | 0 | return {index, 1}; |
10970 | 0 | } |
10971 | | |
10972 | 0 | Operation::result_range TensorFromElementsOp::getODSResults(unsigned index) { |
10973 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
10974 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
10975 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
10976 | 0 | } |
10977 | | |
10978 | 0 | Value TensorFromElementsOp::result() { |
10979 | 0 | return *getODSResults(0).begin(); |
10980 | 0 | } |
10981 | | |
10982 | 0 | void TensorFromElementsOp::build(OpBuilder &builder, OperationState &result, ValueRange elements) { |
10983 | 0 | assert(!elements.empty() && "expected at least one element"); |
10984 | 0 | result.addOperands(elements); |
10985 | 0 | result.addTypes( |
10986 | 0 | RankedTensorType::get({static_cast<int64_t>(elements.size())}, |
10987 | 0 | *elements.getTypes().begin())); |
10988 | 0 | |
10989 | 0 | } |
10990 | | |
10991 | 0 | ParseResult TensorFromElementsOp::parse(OpAsmParser &parser, OperationState &result) { |
10992 | 0 | return ::parseTensorFromElementsOp(parser, result); |
10993 | 0 | } |
10994 | | |
10995 | 0 | void TensorFromElementsOp::print(OpAsmPrinter &p) { |
10996 | 0 | return ::print(p, *this); |
10997 | 0 | } |
10998 | | |
10999 | 0 | LogicalResult TensorFromElementsOp::verify() { |
11000 | 0 | { |
11001 | 0 | unsigned index = 0; (void)index; |
11002 | 0 | auto valueGroup0 = getODSOperands(0); |
11003 | 0 | for (Value v : valueGroup0) { |
11004 | 0 | (void)v; |
11005 | 0 | if (!((true))) { |
11006 | 0 | return emitOpError("operand #") << index << " must be any type, but got " << v.getType(); |
11007 | 0 | } |
11008 | 0 | ++index; |
11009 | 0 | } |
11010 | 0 | } |
11011 | 0 | { |
11012 | 0 | unsigned index = 0; (void)index; |
11013 | 0 | auto valueGroup0 = getODSResults(0); |
11014 | 0 | for (Value v : valueGroup0) { |
11015 | 0 | (void)v; |
11016 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
11017 | 0 | return emitOpError("result #") << index << " must be tensor of any type values, but got " << v.getType(); |
11018 | 0 | } |
11019 | 0 | ++index; |
11020 | 0 | } |
11021 | 0 | } |
11022 | 0 | return ::verify(*this); |
11023 | 0 | } |
11024 | | |
11025 | | |
11026 | | |
11027 | 0 | void TensorFromElementsOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11028 | 0 |
|
11029 | 0 | } |
11030 | | |
11031 | | |
11032 | | //===----------------------------------------------------------------------===// |
11033 | | // TensorLoadOp definitions |
11034 | | //===----------------------------------------------------------------------===// |
11035 | | |
11036 | 0 | TensorLoadOpOperandAdaptor::TensorLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11037 | 0 |
|
11038 | 0 | } |
11039 | | |
11040 | 0 | TensorLoadOpOperandAdaptor::TensorLoadOpOperandAdaptor(TensorLoadOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11041 | 0 |
|
11042 | 0 | } |
11043 | | |
11044 | 0 | std::pair<unsigned, unsigned> TensorLoadOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11045 | 0 | return {index, 1}; |
11046 | 0 | } |
11047 | | |
11048 | 0 | ValueRange TensorLoadOpOperandAdaptor::getODSOperands(unsigned index) { |
11049 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11050 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11051 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11052 | 0 | } |
11053 | | |
11054 | 0 | Value TensorLoadOpOperandAdaptor::memref() { |
11055 | 0 | return *getODSOperands(0).begin(); |
11056 | 0 | } |
11057 | | |
11058 | 0 | StringRef TensorLoadOp::getOperationName() { |
11059 | 0 | return "std.tensor_load"; |
11060 | 0 | } |
11061 | | |
11062 | 0 | std::pair<unsigned, unsigned> TensorLoadOp::getODSOperandIndexAndLength(unsigned index) { |
11063 | 0 | return {index, 1}; |
11064 | 0 | } |
11065 | | |
11066 | 0 | Operation::operand_range TensorLoadOp::getODSOperands(unsigned index) { |
11067 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11068 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11069 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11070 | 0 | } |
11071 | | |
11072 | 0 | Value TensorLoadOp::memref() { |
11073 | 0 | return *getODSOperands(0).begin(); |
11074 | 0 | } |
11075 | | |
11076 | 0 | ::mlir::MutableOperandRange TensorLoadOp::memrefMutable() { |
11077 | 0 | auto range = getODSOperandIndexAndLength(0); |
11078 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11079 | 0 | } |
11080 | | |
11081 | 0 | std::pair<unsigned, unsigned> TensorLoadOp::getODSResultIndexAndLength(unsigned index) { |
11082 | 0 | return {index, 1}; |
11083 | 0 | } |
11084 | | |
11085 | 0 | Operation::result_range TensorLoadOp::getODSResults(unsigned index) { |
11086 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11087 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11088 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11089 | 0 | } |
11090 | | |
11091 | 0 | Value TensorLoadOp::result() { |
11092 | 0 | return *getODSResults(0).begin(); |
11093 | 0 | } |
11094 | | |
11095 | 0 | void TensorLoadOp::build(OpBuilder &builder, OperationState &result, Value memref) { |
11096 | 0 | auto memrefType = memref.getType().cast<MemRefType>(); |
11097 | 0 | auto resultType = RankedTensorType::get(memrefType.getShape(), |
11098 | 0 | memrefType.getElementType()); |
11099 | 0 | result.addOperands(memref); |
11100 | 0 | result.addTypes(resultType); |
11101 | 0 | |
11102 | 0 | } |
11103 | | |
11104 | 0 | void TensorLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref) { |
11105 | 0 | odsState.addOperands(memref); |
11106 | 0 | odsState.addTypes(result); |
11107 | 0 | } |
11108 | | |
11109 | 0 | void TensorLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref) { |
11110 | 0 | odsState.addOperands(memref); |
11111 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
11112 | 0 | odsState.addTypes(resultTypes); |
11113 | 0 | } |
11114 | | |
11115 | 0 | void TensorLoadOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11116 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
11117 | 0 | odsState.addOperands(operands); |
11118 | 0 | odsState.addAttributes(attributes); |
11119 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
11120 | 0 | odsState.addTypes(resultTypes); |
11121 | 0 | } |
11122 | | |
11123 | 0 | LogicalResult TensorLoadOp::verify() { |
11124 | 0 | { |
11125 | 0 | unsigned index = 0; (void)index; |
11126 | 0 | auto valueGroup0 = getODSOperands(0); |
11127 | 0 | for (Value v : valueGroup0) { |
11128 | 0 | (void)v; |
11129 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
11130 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
11131 | 0 | } |
11132 | 0 | ++index; |
11133 | 0 | } |
11134 | 0 | } |
11135 | 0 | { |
11136 | 0 | unsigned index = 0; (void)index; |
11137 | 0 | auto valueGroup0 = getODSResults(0); |
11138 | 0 | for (Value v : valueGroup0) { |
11139 | 0 | (void)v; |
11140 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
11141 | 0 | return emitOpError("result #") << index << " must be tensor of any type values, but got " << v.getType(); |
11142 | 0 | } |
11143 | 0 | ++index; |
11144 | 0 | } |
11145 | 0 | } |
11146 | 0 | if (!((getTensorTypeFromMemRefType((*this->getODSOperands(0).begin()).getType()) == (*this->getODSResults(0).begin()).getType()))) { |
11147 | 0 | return emitOpError("failed to verify that result type matches tensor equivalent of 'memref'"); |
11148 | 0 | } |
11149 | 0 | return mlir::success(); |
11150 | 0 | } |
11151 | | |
11152 | 0 | ParseResult TensorLoadOp::parse(OpAsmParser &parser, OperationState &result) { |
11153 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
11154 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
11155 | 0 | (void)memrefOperandsLoc; |
11156 | 0 | Type memrefRawTypes[1]; |
11157 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
11158 | 0 |
|
11159 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
11160 | 0 | return failure(); |
11161 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
11162 | 0 | return failure(); |
11163 | 0 | if (parser.parseColon()) |
11164 | 0 | return failure(); |
11165 | 0 | |
11166 | 0 | if (parser.parseType(memrefRawTypes[0])) |
11167 | 0 | return failure(); |
11168 | 0 | for (Type type : memrefTypes) { |
11169 | 0 | (void)type; |
11170 | 0 | if (!(((type.isa<MemRefType>())) && ((true)))) { |
11171 | 0 | return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; |
11172 | 0 | } |
11173 | 0 | } |
11174 | 0 | result.addTypes(getTensorTypeFromMemRefType(memrefTypes[0])); |
11175 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
11176 | 0 | return failure(); |
11177 | 0 | return success(); |
11178 | 0 | } |
11179 | | |
11180 | 0 | void TensorLoadOp::print(OpAsmPrinter &p) { |
11181 | 0 | p << "tensor_load"; |
11182 | 0 | p << " "; |
11183 | 0 | p << memref(); |
11184 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
11185 | 0 | p << " " << ":"; |
11186 | 0 | p << " "; |
11187 | 0 | p << ArrayRef<Type>(memref().getType()); |
11188 | 0 | } |
11189 | | |
11190 | 0 | void TensorLoadOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11191 | 0 | for (Value value : getODSOperands(0)) |
11192 | 0 | effects.emplace_back(MemoryEffects::Read::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
11193 | 0 | } |
11194 | | |
11195 | | |
11196 | | //===----------------------------------------------------------------------===// |
11197 | | // TensorStoreOp definitions |
11198 | | //===----------------------------------------------------------------------===// |
11199 | | |
11200 | 0 | TensorStoreOpOperandAdaptor::TensorStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11201 | 0 |
|
11202 | 0 | } |
11203 | | |
11204 | 0 | TensorStoreOpOperandAdaptor::TensorStoreOpOperandAdaptor(TensorStoreOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11205 | 0 |
|
11206 | 0 | } |
11207 | | |
11208 | 0 | std::pair<unsigned, unsigned> TensorStoreOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11209 | 0 | return {index, 1}; |
11210 | 0 | } |
11211 | | |
11212 | 0 | ValueRange TensorStoreOpOperandAdaptor::getODSOperands(unsigned index) { |
11213 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11214 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11215 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11216 | 0 | } |
11217 | | |
11218 | 0 | Value TensorStoreOpOperandAdaptor::tensor() { |
11219 | 0 | return *getODSOperands(0).begin(); |
11220 | 0 | } |
11221 | | |
11222 | 0 | Value TensorStoreOpOperandAdaptor::memref() { |
11223 | 0 | return *getODSOperands(1).begin(); |
11224 | 0 | } |
11225 | | |
11226 | 0 | StringRef TensorStoreOp::getOperationName() { |
11227 | 0 | return "std.tensor_store"; |
11228 | 0 | } |
11229 | | |
11230 | 0 | std::pair<unsigned, unsigned> TensorStoreOp::getODSOperandIndexAndLength(unsigned index) { |
11231 | 0 | return {index, 1}; |
11232 | 0 | } |
11233 | | |
11234 | 0 | Operation::operand_range TensorStoreOp::getODSOperands(unsigned index) { |
11235 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11236 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11237 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11238 | 0 | } |
11239 | | |
11240 | 0 | Value TensorStoreOp::tensor() { |
11241 | 0 | return *getODSOperands(0).begin(); |
11242 | 0 | } |
11243 | | |
11244 | 0 | Value TensorStoreOp::memref() { |
11245 | 0 | return *getODSOperands(1).begin(); |
11246 | 0 | } |
11247 | | |
11248 | 0 | ::mlir::MutableOperandRange TensorStoreOp::tensorMutable() { |
11249 | 0 | auto range = getODSOperandIndexAndLength(0); |
11250 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11251 | 0 | } |
11252 | | |
11253 | 0 | ::mlir::MutableOperandRange TensorStoreOp::memrefMutable() { |
11254 | 0 | auto range = getODSOperandIndexAndLength(1); |
11255 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11256 | 0 | } |
11257 | | |
11258 | 0 | std::pair<unsigned, unsigned> TensorStoreOp::getODSResultIndexAndLength(unsigned index) { |
11259 | 0 | return {index, 1}; |
11260 | 0 | } |
11261 | | |
11262 | 0 | Operation::result_range TensorStoreOp::getODSResults(unsigned index) { |
11263 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11264 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11265 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11266 | 0 | } |
11267 | | |
11268 | 0 | void TensorStoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value tensor, Value memref) { |
11269 | 0 | odsState.addOperands(tensor); |
11270 | 0 | odsState.addOperands(memref); |
11271 | 0 | } |
11272 | | |
11273 | 0 | void TensorStoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value tensor, Value memref) { |
11274 | 0 | odsState.addOperands(tensor); |
11275 | 0 | odsState.addOperands(memref); |
11276 | 0 | assert(resultTypes.size() == 0u && "mismatched number of results"); |
11277 | 0 | odsState.addTypes(resultTypes); |
11278 | 0 | } |
11279 | | |
11280 | 0 | void TensorStoreOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11281 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
11282 | 0 | odsState.addOperands(operands); |
11283 | 0 | odsState.addAttributes(attributes); |
11284 | 0 | assert(resultTypes.size() == 0u && "mismatched number of return types"); |
11285 | 0 | odsState.addTypes(resultTypes); |
11286 | 0 | } |
11287 | | |
11288 | 0 | LogicalResult TensorStoreOp::verify() { |
11289 | 0 | { |
11290 | 0 | unsigned index = 0; (void)index; |
11291 | 0 | auto valueGroup0 = getODSOperands(0); |
11292 | 0 | for (Value v : valueGroup0) { |
11293 | 0 | (void)v; |
11294 | 0 | if (!(((v.getType().isa<TensorType>())) && ((true)))) { |
11295 | 0 | return emitOpError("operand #") << index << " must be tensor of any type values, but got " << v.getType(); |
11296 | 0 | } |
11297 | 0 | ++index; |
11298 | 0 | } |
11299 | 0 | auto valueGroup1 = getODSOperands(1); |
11300 | 0 | for (Value v : valueGroup1) { |
11301 | 0 | (void)v; |
11302 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
11303 | 0 | return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType(); |
11304 | 0 | } |
11305 | 0 | ++index; |
11306 | 0 | } |
11307 | 0 | } |
11308 | 0 | { |
11309 | 0 | unsigned index = 0; (void)index; |
11310 | 0 | } |
11311 | 0 | if (!((getTensorTypeFromMemRefType((*this->getODSOperands(1).begin()).getType()) == (*this->getODSOperands(0).begin()).getType()))) { |
11312 | 0 | return emitOpError("failed to verify that type of 'value' matches tensor equivalent of 'memref'"); |
11313 | 0 | } |
11314 | 0 | return mlir::success(); |
11315 | 0 | } |
11316 | | |
11317 | 0 | ParseResult TensorStoreOp::parse(OpAsmParser &parser, OperationState &result) { |
11318 | 0 | OpAsmParser::OperandType tensorRawOperands[1]; |
11319 | 0 | ArrayRef<OpAsmParser::OperandType> tensorOperands(tensorRawOperands); llvm::SMLoc tensorOperandsLoc = parser.getCurrentLocation(); |
11320 | 0 | (void)tensorOperandsLoc; |
11321 | 0 | OpAsmParser::OperandType memrefRawOperands[1]; |
11322 | 0 | ArrayRef<OpAsmParser::OperandType> memrefOperands(memrefRawOperands); llvm::SMLoc memrefOperandsLoc = parser.getCurrentLocation(); |
11323 | 0 | (void)memrefOperandsLoc; |
11324 | 0 | Type memrefRawTypes[1]; |
11325 | 0 | ArrayRef<Type> memrefTypes(memrefRawTypes); |
11326 | 0 |
|
11327 | 0 | if (parser.parseOperand(tensorRawOperands[0])) |
11328 | 0 | return failure(); |
11329 | 0 | if (parser.parseComma()) |
11330 | 0 | return failure(); |
11331 | 0 | |
11332 | 0 | if (parser.parseOperand(memrefRawOperands[0])) |
11333 | 0 | return failure(); |
11334 | 0 | if (parser.parseOptionalAttrDict(result.attributes)) |
11335 | 0 | return failure(); |
11336 | 0 | if (parser.parseColon()) |
11337 | 0 | return failure(); |
11338 | 0 | |
11339 | 0 | if (parser.parseType(memrefRawTypes[0])) |
11340 | 0 | return failure(); |
11341 | 0 | for (Type type : memrefTypes) { |
11342 | 0 | (void)type; |
11343 | 0 | if (!(((type.isa<MemRefType>())) && ((true)))) { |
11344 | 0 | return parser.emitError(parser.getNameLoc()) << "'memref' must be memref of any type values, but got " << type; |
11345 | 0 | } |
11346 | 0 | } |
11347 | 0 | if (parser.resolveOperands(tensorOperands, getTensorTypeFromMemRefType(memrefTypes[0]), tensorOperandsLoc, result.operands)) |
11348 | 0 | return failure(); |
11349 | 0 | if (parser.resolveOperands(memrefOperands, memrefTypes, memrefOperandsLoc, result.operands)) |
11350 | 0 | return failure(); |
11351 | 0 | return success(); |
11352 | 0 | } |
11353 | | |
11354 | 0 | void TensorStoreOp::print(OpAsmPrinter &p) { |
11355 | 0 | p << "tensor_store"; |
11356 | 0 | p << " "; |
11357 | 0 | p << tensor(); |
11358 | 0 | p << ","; |
11359 | 0 | p << " "; |
11360 | 0 | p << memref(); |
11361 | 0 | p.printOptionalAttrDict(getAttrs(), /*elidedAttrs=*/{}); |
11362 | 0 | p << " " << ":"; |
11363 | 0 | p << " "; |
11364 | 0 | p << ArrayRef<Type>(memref().getType()); |
11365 | 0 | } |
11366 | | |
11367 | 0 | void TensorStoreOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11368 | 0 | for (Value value : getODSOperands(1)) |
11369 | 0 | effects.emplace_back(MemoryEffects::Write::get(), value, ::mlir::SideEffects::DefaultResource::get()); |
11370 | 0 | } |
11371 | | |
11372 | | |
11373 | | //===----------------------------------------------------------------------===// |
11374 | | // TruncateIOp definitions |
11375 | | //===----------------------------------------------------------------------===// |
11376 | | |
11377 | 0 | TruncateIOpOperandAdaptor::TruncateIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11378 | 0 |
|
11379 | 0 | } |
11380 | | |
11381 | 0 | TruncateIOpOperandAdaptor::TruncateIOpOperandAdaptor(TruncateIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11382 | 0 |
|
11383 | 0 | } |
11384 | | |
11385 | 0 | std::pair<unsigned, unsigned> TruncateIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11386 | 0 | return {index, 1}; |
11387 | 0 | } |
11388 | | |
11389 | 0 | ValueRange TruncateIOpOperandAdaptor::getODSOperands(unsigned index) { |
11390 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11391 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11392 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11393 | 0 | } |
11394 | | |
11395 | 0 | Value TruncateIOpOperandAdaptor::value() { |
11396 | 0 | return *getODSOperands(0).begin(); |
11397 | 0 | } |
11398 | | |
11399 | 0 | StringRef TruncateIOp::getOperationName() { |
11400 | 0 | return "std.trunci"; |
11401 | 0 | } |
11402 | | |
11403 | 0 | std::pair<unsigned, unsigned> TruncateIOp::getODSOperandIndexAndLength(unsigned index) { |
11404 | 0 | return {index, 1}; |
11405 | 0 | } |
11406 | | |
11407 | 0 | Operation::operand_range TruncateIOp::getODSOperands(unsigned index) { |
11408 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11409 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11410 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11411 | 0 | } |
11412 | | |
11413 | 0 | Value TruncateIOp::value() { |
11414 | 0 | return *getODSOperands(0).begin(); |
11415 | 0 | } |
11416 | | |
11417 | 0 | ::mlir::MutableOperandRange TruncateIOp::valueMutable() { |
11418 | 0 | auto range = getODSOperandIndexAndLength(0); |
11419 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11420 | 0 | } |
11421 | | |
11422 | 0 | std::pair<unsigned, unsigned> TruncateIOp::getODSResultIndexAndLength(unsigned index) { |
11423 | 0 | return {index, 1}; |
11424 | 0 | } |
11425 | | |
11426 | 0 | Operation::result_range TruncateIOp::getODSResults(unsigned index) { |
11427 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11428 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11429 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11430 | 0 | } |
11431 | | |
11432 | 0 | void TruncateIOp::build(OpBuilder &builder, OperationState &result, Value value, Type destType) { |
11433 | 0 | result.addOperands(value); |
11434 | 0 | result.addTypes(destType); |
11435 | 0 | |
11436 | 0 | } |
11437 | | |
11438 | 0 | void TruncateIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value) { |
11439 | 0 | odsState.addOperands(value); |
11440 | 0 | odsState.addTypes(resultType0); |
11441 | 0 | } |
11442 | | |
11443 | 0 | void TruncateIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value) { |
11444 | 0 | odsState.addOperands(value); |
11445 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
11446 | 0 | odsState.addTypes(resultTypes); |
11447 | 0 | } |
11448 | | |
11449 | 0 | void TruncateIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11450 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
11451 | 0 | odsState.addOperands(operands); |
11452 | 0 | odsState.addAttributes(attributes); |
11453 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
11454 | 0 | odsState.addTypes(resultTypes); |
11455 | 0 | } |
11456 | | |
11457 | 0 | ParseResult TruncateIOp::parse(OpAsmParser &parser, OperationState &result) { |
11458 | 0 | return impl::parseCastOp(parser, result); |
11459 | 0 | } |
11460 | | |
11461 | 0 | void TruncateIOp::print(OpAsmPrinter &p) { |
11462 | 0 | return printStandardCastOp(this->getOperation(), p); |
11463 | 0 | } |
11464 | | |
11465 | 0 | LogicalResult TruncateIOp::verify() { |
11466 | 0 | { |
11467 | 0 | unsigned index = 0; (void)index; |
11468 | 0 | auto valueGroup0 = getODSOperands(0); |
11469 | 0 | for (Value v : valueGroup0) { |
11470 | 0 | (void)v; |
11471 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11472 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11473 | 0 | } |
11474 | 0 | ++index; |
11475 | 0 | } |
11476 | 0 | } |
11477 | 0 | { |
11478 | 0 | unsigned index = 0; (void)index; |
11479 | 0 | auto valueGroup0 = getODSResults(0); |
11480 | 0 | for (Value v : valueGroup0) { |
11481 | 0 | (void)v; |
11482 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11483 | 0 | return emitOpError("result #") << index << " must be signless-integer-like, but got " << v.getType(); |
11484 | 0 | } |
11485 | 0 | ++index; |
11486 | 0 | } |
11487 | 0 | } |
11488 | 0 | return ::verify(*this); |
11489 | 0 | } |
11490 | | |
11491 | 0 | void TruncateIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11492 | 0 |
|
11493 | 0 | } |
11494 | | |
11495 | | |
11496 | | //===----------------------------------------------------------------------===// |
11497 | | // UnsignedDivIOp definitions |
11498 | | //===----------------------------------------------------------------------===// |
11499 | | |
11500 | 0 | UnsignedDivIOpOperandAdaptor::UnsignedDivIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11501 | 0 |
|
11502 | 0 | } |
11503 | | |
11504 | 0 | UnsignedDivIOpOperandAdaptor::UnsignedDivIOpOperandAdaptor(UnsignedDivIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11505 | 0 |
|
11506 | 0 | } |
11507 | | |
11508 | 0 | std::pair<unsigned, unsigned> UnsignedDivIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11509 | 0 | return {index, 1}; |
11510 | 0 | } |
11511 | | |
11512 | 0 | ValueRange UnsignedDivIOpOperandAdaptor::getODSOperands(unsigned index) { |
11513 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11514 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11515 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11516 | 0 | } |
11517 | | |
11518 | 0 | Value UnsignedDivIOpOperandAdaptor::lhs() { |
11519 | 0 | return *getODSOperands(0).begin(); |
11520 | 0 | } |
11521 | | |
11522 | 0 | Value UnsignedDivIOpOperandAdaptor::rhs() { |
11523 | 0 | return *getODSOperands(1).begin(); |
11524 | 0 | } |
11525 | | |
11526 | 0 | StringRef UnsignedDivIOp::getOperationName() { |
11527 | 0 | return "std.divi_unsigned"; |
11528 | 0 | } |
11529 | | |
11530 | 0 | std::pair<unsigned, unsigned> UnsignedDivIOp::getODSOperandIndexAndLength(unsigned index) { |
11531 | 0 | return {index, 1}; |
11532 | 0 | } |
11533 | | |
11534 | 0 | Operation::operand_range UnsignedDivIOp::getODSOperands(unsigned index) { |
11535 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11536 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11537 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11538 | 0 | } |
11539 | | |
11540 | 0 | Value UnsignedDivIOp::lhs() { |
11541 | 0 | return *getODSOperands(0).begin(); |
11542 | 0 | } |
11543 | | |
11544 | 0 | Value UnsignedDivIOp::rhs() { |
11545 | 0 | return *getODSOperands(1).begin(); |
11546 | 0 | } |
11547 | | |
11548 | 0 | ::mlir::MutableOperandRange UnsignedDivIOp::lhsMutable() { |
11549 | 0 | auto range = getODSOperandIndexAndLength(0); |
11550 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11551 | 0 | } |
11552 | | |
11553 | 0 | ::mlir::MutableOperandRange UnsignedDivIOp::rhsMutable() { |
11554 | 0 | auto range = getODSOperandIndexAndLength(1); |
11555 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11556 | 0 | } |
11557 | | |
11558 | 0 | std::pair<unsigned, unsigned> UnsignedDivIOp::getODSResultIndexAndLength(unsigned index) { |
11559 | 0 | return {index, 1}; |
11560 | 0 | } |
11561 | | |
11562 | 0 | Operation::result_range UnsignedDivIOp::getODSResults(unsigned index) { |
11563 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11564 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11565 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11566 | 0 | } |
11567 | | |
11568 | 0 | void UnsignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
11569 | 0 | odsState.addOperands(lhs); |
11570 | 0 | odsState.addOperands(rhs); |
11571 | 0 | odsState.addTypes(resultType0); |
11572 | 0 | } |
11573 | | |
11574 | 0 | void UnsignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
11575 | 0 | odsState.addOperands(lhs); |
11576 | 0 | odsState.addOperands(rhs); |
11577 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
11578 | 0 | odsState.addTypes(resultTypes); |
11579 | 0 | } |
11580 | | |
11581 | 0 | void UnsignedDivIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11582 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
11583 | 0 | odsState.addOperands(operands); |
11584 | 0 | odsState.addAttributes(attributes); |
11585 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
11586 | 0 | odsState.addTypes(resultTypes); |
11587 | 0 | } |
11588 | | |
11589 | 0 | void UnsignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
11590 | 0 | odsState.addOperands(lhs); |
11591 | 0 | odsState.addOperands(rhs); |
11592 | 0 | odsState.addTypes({lhs.getType()}); |
11593 | 0 |
|
11594 | 0 | } |
11595 | | |
11596 | 0 | void UnsignedDivIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11597 | 0 | odsState.addOperands(operands); |
11598 | 0 | odsState.addAttributes(attributes); |
11599 | 0 | odsState.addTypes({operands[0].getType()}); |
11600 | 0 |
|
11601 | 0 | } |
11602 | | |
11603 | 0 | ParseResult UnsignedDivIOp::parse(OpAsmParser &parser, OperationState &result) { |
11604 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
11605 | 0 | } |
11606 | | |
11607 | 0 | void UnsignedDivIOp::print(OpAsmPrinter &p) { |
11608 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
11609 | 0 | } |
11610 | | |
11611 | 0 | LogicalResult UnsignedDivIOp::verify() { |
11612 | 0 | { |
11613 | 0 | unsigned index = 0; (void)index; |
11614 | 0 | auto valueGroup0 = getODSOperands(0); |
11615 | 0 | for (Value v : valueGroup0) { |
11616 | 0 | (void)v; |
11617 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11618 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11619 | 0 | } |
11620 | 0 | ++index; |
11621 | 0 | } |
11622 | 0 | auto valueGroup1 = getODSOperands(1); |
11623 | 0 | for (Value v : valueGroup1) { |
11624 | 0 | (void)v; |
11625 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11626 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11627 | 0 | } |
11628 | 0 | ++index; |
11629 | 0 | } |
11630 | 0 | } |
11631 | 0 | { |
11632 | 0 | unsigned index = 0; (void)index; |
11633 | 0 | auto valueGroup0 = getODSResults(0); |
11634 | 0 | for (Value v : valueGroup0) { |
11635 | 0 | (void)v; |
11636 | 0 | if (!((true))) { |
11637 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
11638 | 0 | } |
11639 | 0 | ++index; |
11640 | 0 | } |
11641 | 0 | } |
11642 | 0 | return mlir::success(); |
11643 | 0 | } |
11644 | | |
11645 | | |
11646 | | |
11647 | 0 | void UnsignedDivIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11648 | 0 |
|
11649 | 0 | } |
11650 | | |
11651 | | |
11652 | | //===----------------------------------------------------------------------===// |
11653 | | // UnsignedRemIOp definitions |
11654 | | //===----------------------------------------------------------------------===// |
11655 | | |
11656 | 0 | UnsignedRemIOpOperandAdaptor::UnsignedRemIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11657 | 0 |
|
11658 | 0 | } |
11659 | | |
11660 | 0 | UnsignedRemIOpOperandAdaptor::UnsignedRemIOpOperandAdaptor(UnsignedRemIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11661 | 0 |
|
11662 | 0 | } |
11663 | | |
11664 | 0 | std::pair<unsigned, unsigned> UnsignedRemIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11665 | 0 | return {index, 1}; |
11666 | 0 | } |
11667 | | |
11668 | 0 | ValueRange UnsignedRemIOpOperandAdaptor::getODSOperands(unsigned index) { |
11669 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11670 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11671 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11672 | 0 | } |
11673 | | |
11674 | 0 | Value UnsignedRemIOpOperandAdaptor::lhs() { |
11675 | 0 | return *getODSOperands(0).begin(); |
11676 | 0 | } |
11677 | | |
11678 | 0 | Value UnsignedRemIOpOperandAdaptor::rhs() { |
11679 | 0 | return *getODSOperands(1).begin(); |
11680 | 0 | } |
11681 | | |
11682 | 0 | StringRef UnsignedRemIOp::getOperationName() { |
11683 | 0 | return "std.remi_unsigned"; |
11684 | 0 | } |
11685 | | |
11686 | 0 | std::pair<unsigned, unsigned> UnsignedRemIOp::getODSOperandIndexAndLength(unsigned index) { |
11687 | 0 | return {index, 1}; |
11688 | 0 | } |
11689 | | |
11690 | 0 | Operation::operand_range UnsignedRemIOp::getODSOperands(unsigned index) { |
11691 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11692 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11693 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11694 | 0 | } |
11695 | | |
11696 | 0 | Value UnsignedRemIOp::lhs() { |
11697 | 0 | return *getODSOperands(0).begin(); |
11698 | 0 | } |
11699 | | |
11700 | 0 | Value UnsignedRemIOp::rhs() { |
11701 | 0 | return *getODSOperands(1).begin(); |
11702 | 0 | } |
11703 | | |
11704 | 0 | ::mlir::MutableOperandRange UnsignedRemIOp::lhsMutable() { |
11705 | 0 | auto range = getODSOperandIndexAndLength(0); |
11706 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11707 | 0 | } |
11708 | | |
11709 | 0 | ::mlir::MutableOperandRange UnsignedRemIOp::rhsMutable() { |
11710 | 0 | auto range = getODSOperandIndexAndLength(1); |
11711 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11712 | 0 | } |
11713 | | |
11714 | 0 | std::pair<unsigned, unsigned> UnsignedRemIOp::getODSResultIndexAndLength(unsigned index) { |
11715 | 0 | return {index, 1}; |
11716 | 0 | } |
11717 | | |
11718 | 0 | Operation::result_range UnsignedRemIOp::getODSResults(unsigned index) { |
11719 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11720 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11721 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11722 | 0 | } |
11723 | | |
11724 | 0 | void UnsignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
11725 | 0 | odsState.addOperands(lhs); |
11726 | 0 | odsState.addOperands(rhs); |
11727 | 0 | odsState.addTypes(resultType0); |
11728 | 0 | } |
11729 | | |
11730 | 0 | void UnsignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
11731 | 0 | odsState.addOperands(lhs); |
11732 | 0 | odsState.addOperands(rhs); |
11733 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
11734 | 0 | odsState.addTypes(resultTypes); |
11735 | 0 | } |
11736 | | |
11737 | 0 | void UnsignedRemIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11738 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
11739 | 0 | odsState.addOperands(operands); |
11740 | 0 | odsState.addAttributes(attributes); |
11741 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
11742 | 0 | odsState.addTypes(resultTypes); |
11743 | 0 | } |
11744 | | |
11745 | 0 | void UnsignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
11746 | 0 | odsState.addOperands(lhs); |
11747 | 0 | odsState.addOperands(rhs); |
11748 | 0 | odsState.addTypes({lhs.getType()}); |
11749 | 0 |
|
11750 | 0 | } |
11751 | | |
11752 | 0 | void UnsignedRemIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11753 | 0 | odsState.addOperands(operands); |
11754 | 0 | odsState.addAttributes(attributes); |
11755 | 0 | odsState.addTypes({operands[0].getType()}); |
11756 | 0 |
|
11757 | 0 | } |
11758 | | |
11759 | 0 | ParseResult UnsignedRemIOp::parse(OpAsmParser &parser, OperationState &result) { |
11760 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
11761 | 0 | } |
11762 | | |
11763 | 0 | void UnsignedRemIOp::print(OpAsmPrinter &p) { |
11764 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
11765 | 0 | } |
11766 | | |
11767 | 0 | LogicalResult UnsignedRemIOp::verify() { |
11768 | 0 | { |
11769 | 0 | unsigned index = 0; (void)index; |
11770 | 0 | auto valueGroup0 = getODSOperands(0); |
11771 | 0 | for (Value v : valueGroup0) { |
11772 | 0 | (void)v; |
11773 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11774 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11775 | 0 | } |
11776 | 0 | ++index; |
11777 | 0 | } |
11778 | 0 | auto valueGroup1 = getODSOperands(1); |
11779 | 0 | for (Value v : valueGroup1) { |
11780 | 0 | (void)v; |
11781 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11782 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11783 | 0 | } |
11784 | 0 | ++index; |
11785 | 0 | } |
11786 | 0 | } |
11787 | 0 | { |
11788 | 0 | unsigned index = 0; (void)index; |
11789 | 0 | auto valueGroup0 = getODSResults(0); |
11790 | 0 | for (Value v : valueGroup0) { |
11791 | 0 | (void)v; |
11792 | 0 | if (!((true))) { |
11793 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
11794 | 0 | } |
11795 | 0 | ++index; |
11796 | 0 | } |
11797 | 0 | } |
11798 | 0 | return mlir::success(); |
11799 | 0 | } |
11800 | | |
11801 | | |
11802 | | |
11803 | 0 | void UnsignedRemIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11804 | 0 |
|
11805 | 0 | } |
11806 | | |
11807 | | |
11808 | | //===----------------------------------------------------------------------===// |
11809 | | // UnsignedShiftRightOp definitions |
11810 | | //===----------------------------------------------------------------------===// |
11811 | | |
11812 | 0 | UnsignedShiftRightOpOperandAdaptor::UnsignedShiftRightOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11813 | 0 |
|
11814 | 0 | } |
11815 | | |
11816 | 0 | UnsignedShiftRightOpOperandAdaptor::UnsignedShiftRightOpOperandAdaptor(UnsignedShiftRightOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11817 | 0 |
|
11818 | 0 | } |
11819 | | |
11820 | 0 | std::pair<unsigned, unsigned> UnsignedShiftRightOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11821 | 0 | return {index, 1}; |
11822 | 0 | } |
11823 | | |
11824 | 0 | ValueRange UnsignedShiftRightOpOperandAdaptor::getODSOperands(unsigned index) { |
11825 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11826 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11827 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11828 | 0 | } |
11829 | | |
11830 | 0 | Value UnsignedShiftRightOpOperandAdaptor::lhs() { |
11831 | 0 | return *getODSOperands(0).begin(); |
11832 | 0 | } |
11833 | | |
11834 | 0 | Value UnsignedShiftRightOpOperandAdaptor::rhs() { |
11835 | 0 | return *getODSOperands(1).begin(); |
11836 | 0 | } |
11837 | | |
11838 | 0 | StringRef UnsignedShiftRightOp::getOperationName() { |
11839 | 0 | return "std.shift_right_unsigned"; |
11840 | 0 | } |
11841 | | |
11842 | 0 | std::pair<unsigned, unsigned> UnsignedShiftRightOp::getODSOperandIndexAndLength(unsigned index) { |
11843 | 0 | return {index, 1}; |
11844 | 0 | } |
11845 | | |
11846 | 0 | Operation::operand_range UnsignedShiftRightOp::getODSOperands(unsigned index) { |
11847 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11848 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
11849 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
11850 | 0 | } |
11851 | | |
11852 | 0 | Value UnsignedShiftRightOp::lhs() { |
11853 | 0 | return *getODSOperands(0).begin(); |
11854 | 0 | } |
11855 | | |
11856 | 0 | Value UnsignedShiftRightOp::rhs() { |
11857 | 0 | return *getODSOperands(1).begin(); |
11858 | 0 | } |
11859 | | |
11860 | 0 | ::mlir::MutableOperandRange UnsignedShiftRightOp::lhsMutable() { |
11861 | 0 | auto range = getODSOperandIndexAndLength(0); |
11862 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11863 | 0 | } |
11864 | | |
11865 | 0 | ::mlir::MutableOperandRange UnsignedShiftRightOp::rhsMutable() { |
11866 | 0 | auto range = getODSOperandIndexAndLength(1); |
11867 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
11868 | 0 | } |
11869 | | |
11870 | 0 | std::pair<unsigned, unsigned> UnsignedShiftRightOp::getODSResultIndexAndLength(unsigned index) { |
11871 | 0 | return {index, 1}; |
11872 | 0 | } |
11873 | | |
11874 | 0 | Operation::result_range UnsignedShiftRightOp::getODSResults(unsigned index) { |
11875 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
11876 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
11877 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
11878 | 0 | } |
11879 | | |
11880 | 0 | void UnsignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
11881 | 0 | odsState.addOperands(lhs); |
11882 | 0 | odsState.addOperands(rhs); |
11883 | 0 | odsState.addTypes(resultType0); |
11884 | 0 | } |
11885 | | |
11886 | 0 | void UnsignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
11887 | 0 | odsState.addOperands(lhs); |
11888 | 0 | odsState.addOperands(rhs); |
11889 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
11890 | 0 | odsState.addTypes(resultTypes); |
11891 | 0 | } |
11892 | | |
11893 | 0 | void UnsignedShiftRightOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11894 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
11895 | 0 | odsState.addOperands(operands); |
11896 | 0 | odsState.addAttributes(attributes); |
11897 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
11898 | 0 | odsState.addTypes(resultTypes); |
11899 | 0 | } |
11900 | | |
11901 | 0 | void UnsignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
11902 | 0 | odsState.addOperands(lhs); |
11903 | 0 | odsState.addOperands(rhs); |
11904 | 0 | odsState.addTypes({lhs.getType()}); |
11905 | 0 |
|
11906 | 0 | } |
11907 | | |
11908 | 0 | void UnsignedShiftRightOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
11909 | 0 | odsState.addOperands(operands); |
11910 | 0 | odsState.addAttributes(attributes); |
11911 | 0 | odsState.addTypes({operands[0].getType()}); |
11912 | 0 |
|
11913 | 0 | } |
11914 | | |
11915 | 0 | ParseResult UnsignedShiftRightOp::parse(OpAsmParser &parser, OperationState &result) { |
11916 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
11917 | 0 | } |
11918 | | |
11919 | 0 | void UnsignedShiftRightOp::print(OpAsmPrinter &p) { |
11920 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
11921 | 0 | } |
11922 | | |
11923 | 0 | LogicalResult UnsignedShiftRightOp::verify() { |
11924 | 0 | { |
11925 | 0 | unsigned index = 0; (void)index; |
11926 | 0 | auto valueGroup0 = getODSOperands(0); |
11927 | 0 | for (Value v : valueGroup0) { |
11928 | 0 | (void)v; |
11929 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11930 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11931 | 0 | } |
11932 | 0 | ++index; |
11933 | 0 | } |
11934 | 0 | auto valueGroup1 = getODSOperands(1); |
11935 | 0 | for (Value v : valueGroup1) { |
11936 | 0 | (void)v; |
11937 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
11938 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
11939 | 0 | } |
11940 | 0 | ++index; |
11941 | 0 | } |
11942 | 0 | } |
11943 | 0 | { |
11944 | 0 | unsigned index = 0; (void)index; |
11945 | 0 | auto valueGroup0 = getODSResults(0); |
11946 | 0 | for (Value v : valueGroup0) { |
11947 | 0 | (void)v; |
11948 | 0 | if (!((true))) { |
11949 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
11950 | 0 | } |
11951 | 0 | ++index; |
11952 | 0 | } |
11953 | 0 | } |
11954 | 0 | return mlir::success(); |
11955 | 0 | } |
11956 | | |
11957 | 0 | void UnsignedShiftRightOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
11958 | 0 |
|
11959 | 0 | } |
11960 | | |
11961 | | |
11962 | | //===----------------------------------------------------------------------===// |
11963 | | // ViewOp definitions |
11964 | | //===----------------------------------------------------------------------===// |
11965 | | |
11966 | 0 | ViewOpOperandAdaptor::ViewOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
11967 | 0 |
|
11968 | 0 | } |
11969 | | |
11970 | 0 | ViewOpOperandAdaptor::ViewOpOperandAdaptor(ViewOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
11971 | 0 |
|
11972 | 0 | } |
11973 | | |
11974 | 0 | std::pair<unsigned, unsigned> ViewOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
11975 | 0 | bool isVariadic[] = {false, false, true}; |
11976 | 0 | int prevVariadicCount = 0; |
11977 | 0 | for (unsigned i = 0; i < index; ++i) |
11978 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
11979 | 0 |
|
11980 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
11981 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
11982 | 0 | int variadicSize = (odsOperands.size() - 2) / 1; |
11983 | 0 | // `index` passed in as the parameter is the static index which counts each |
11984 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
11985 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
11986 | 0 | // value pack for this static operand starts. |
11987 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
11988 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
11989 | 0 | return {start, size}; |
11990 | 0 | } |
11991 | | |
11992 | 0 | ValueRange ViewOpOperandAdaptor::getODSOperands(unsigned index) { |
11993 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
11994 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
11995 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
11996 | 0 | } |
11997 | | |
11998 | 0 | Value ViewOpOperandAdaptor::source() { |
11999 | 0 | return *getODSOperands(0).begin(); |
12000 | 0 | } |
12001 | | |
12002 | 0 | Value ViewOpOperandAdaptor::byte_shift() { |
12003 | 0 | return *getODSOperands(1).begin(); |
12004 | 0 | } |
12005 | | |
12006 | 0 | ValueRange ViewOpOperandAdaptor::sizes() { |
12007 | 0 | return getODSOperands(2); |
12008 | 0 | } |
12009 | | |
12010 | 0 | StringRef ViewOp::getOperationName() { |
12011 | 0 | return "std.view"; |
12012 | 0 | } |
12013 | | |
12014 | 0 | std::pair<unsigned, unsigned> ViewOp::getODSOperandIndexAndLength(unsigned index) { |
12015 | 0 | bool isVariadic[] = {false, false, true}; |
12016 | 0 | int prevVariadicCount = 0; |
12017 | 0 | for (unsigned i = 0; i < index; ++i) |
12018 | 0 | if (isVariadic[i]) ++prevVariadicCount; |
12019 | 0 |
|
12020 | 0 | // Calculate how many dynamic values a static variadic operand corresponds to. |
12021 | 0 | // This assumes all static variadic operands have the same dynamic value count. |
12022 | 0 | int variadicSize = (getOperation()->getNumOperands() - 2) / 1; |
12023 | 0 | // `index` passed in as the parameter is the static index which counts each |
12024 | 0 | // operand (variadic or not) as size 1. So here for each previous static variadic |
12025 | 0 | // operand, we need to offset by (variadicSize - 1) to get where the dynamic |
12026 | 0 | // value pack for this static operand starts. |
12027 | 0 | int start = index + (variadicSize - 1) * prevVariadicCount; |
12028 | 0 | int size = isVariadic[index] ? variadicSize : 1; |
12029 | 0 | return {start, size}; |
12030 | 0 | } |
12031 | | |
12032 | 0 | Operation::operand_range ViewOp::getODSOperands(unsigned index) { |
12033 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
12034 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
12035 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
12036 | 0 | } |
12037 | | |
12038 | 0 | Value ViewOp::source() { |
12039 | 0 | return *getODSOperands(0).begin(); |
12040 | 0 | } |
12041 | | |
12042 | 0 | Value ViewOp::byte_shift() { |
12043 | 0 | return *getODSOperands(1).begin(); |
12044 | 0 | } |
12045 | | |
12046 | 0 | Operation::operand_range ViewOp::sizes() { |
12047 | 0 | return getODSOperands(2); |
12048 | 0 | } |
12049 | | |
12050 | 0 | ::mlir::MutableOperandRange ViewOp::sourceMutable() { |
12051 | 0 | auto range = getODSOperandIndexAndLength(0); |
12052 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12053 | 0 | } |
12054 | | |
12055 | 0 | ::mlir::MutableOperandRange ViewOp::byte_shiftMutable() { |
12056 | 0 | auto range = getODSOperandIndexAndLength(1); |
12057 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12058 | 0 | } |
12059 | | |
12060 | 0 | ::mlir::MutableOperandRange ViewOp::sizesMutable() { |
12061 | 0 | auto range = getODSOperandIndexAndLength(2); |
12062 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12063 | 0 | } |
12064 | | |
12065 | 0 | std::pair<unsigned, unsigned> ViewOp::getODSResultIndexAndLength(unsigned index) { |
12066 | 0 | return {index, 1}; |
12067 | 0 | } |
12068 | | |
12069 | 0 | Operation::result_range ViewOp::getODSResults(unsigned index) { |
12070 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
12071 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
12072 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
12073 | 0 | } |
12074 | | |
12075 | 0 | void ViewOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value source, Value byte_shift, ValueRange sizes) { |
12076 | 0 | odsState.addOperands(source); |
12077 | 0 | odsState.addOperands(byte_shift); |
12078 | 0 | odsState.addOperands(sizes); |
12079 | 0 | odsState.addTypes(resultType0); |
12080 | 0 | } |
12081 | | |
12082 | 0 | void ViewOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source, Value byte_shift, ValueRange sizes) { |
12083 | 0 | odsState.addOperands(source); |
12084 | 0 | odsState.addOperands(byte_shift); |
12085 | 0 | odsState.addOperands(sizes); |
12086 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
12087 | 0 | odsState.addTypes(resultTypes); |
12088 | 0 | } |
12089 | | |
12090 | 0 | void ViewOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
12091 | 0 | assert(operands.size() >= 2u && "mismatched number of parameters"); |
12092 | 0 | odsState.addOperands(operands); |
12093 | 0 | odsState.addAttributes(attributes); |
12094 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
12095 | 0 | odsState.addTypes(resultTypes); |
12096 | 0 | } |
12097 | | |
12098 | 0 | ParseResult ViewOp::parse(OpAsmParser &parser, OperationState &result) { |
12099 | 0 | return ::parseViewOp(parser, result); |
12100 | 0 | } |
12101 | | |
12102 | 0 | void ViewOp::print(OpAsmPrinter &p) { |
12103 | 0 | return ::print(p, *this); |
12104 | 0 | } |
12105 | | |
12106 | 0 | LogicalResult ViewOp::verify() { |
12107 | 0 | { |
12108 | 0 | unsigned index = 0; (void)index; |
12109 | 0 | auto valueGroup0 = getODSOperands(0); |
12110 | 0 | for (Value v : valueGroup0) { |
12111 | 0 | (void)v; |
12112 | 0 | if (!((((v.getType().isa<MemRefType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger(8)))) && (((v.getType().cast<ShapedType>().hasRank())) && ((v.getType().cast<ShapedType>().getRank() == 1))))) { |
12113 | 0 | return emitOpError("operand #") << index << " must be 1D memref of 8-bit signless integer values, but got " << v.getType(); |
12114 | 0 | } |
12115 | 0 | ++index; |
12116 | 0 | } |
12117 | 0 | auto valueGroup1 = getODSOperands(1); |
12118 | 0 | for (Value v : valueGroup1) { |
12119 | 0 | (void)v; |
12120 | 0 | if (!((v.getType().isa<IndexType>()))) { |
12121 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
12122 | 0 | } |
12123 | 0 | ++index; |
12124 | 0 | } |
12125 | 0 | auto valueGroup2 = getODSOperands(2); |
12126 | 0 | for (Value v : valueGroup2) { |
12127 | 0 | (void)v; |
12128 | 0 | if (!((v.getType().isa<IndexType>()))) { |
12129 | 0 | return emitOpError("operand #") << index << " must be index, but got " << v.getType(); |
12130 | 0 | } |
12131 | 0 | ++index; |
12132 | 0 | } |
12133 | 0 | } |
12134 | 0 | { |
12135 | 0 | unsigned index = 0; (void)index; |
12136 | 0 | auto valueGroup0 = getODSResults(0); |
12137 | 0 | for (Value v : valueGroup0) { |
12138 | 0 | (void)v; |
12139 | 0 | if (!(((v.getType().isa<MemRefType>())) && ((true)))) { |
12140 | 0 | return emitOpError("result #") << index << " must be memref of any type values, but got " << v.getType(); |
12141 | 0 | } |
12142 | 0 | ++index; |
12143 | 0 | } |
12144 | 0 | } |
12145 | 0 | return ::verify(*this); |
12146 | 0 | } |
12147 | | |
12148 | | |
12149 | | |
12150 | | |
12151 | | |
12152 | 0 | void ViewOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
12153 | 0 |
|
12154 | 0 | } |
12155 | | |
12156 | | |
12157 | | //===----------------------------------------------------------------------===// |
12158 | | // XOrOp definitions |
12159 | | //===----------------------------------------------------------------------===// |
12160 | | |
12161 | 0 | XOrOpOperandAdaptor::XOrOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
12162 | 0 |
|
12163 | 0 | } |
12164 | | |
12165 | 0 | XOrOpOperandAdaptor::XOrOpOperandAdaptor(XOrOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
12166 | 0 |
|
12167 | 0 | } |
12168 | | |
12169 | 0 | std::pair<unsigned, unsigned> XOrOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
12170 | 0 | return {index, 1}; |
12171 | 0 | } |
12172 | | |
12173 | 0 | ValueRange XOrOpOperandAdaptor::getODSOperands(unsigned index) { |
12174 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
12175 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
12176 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
12177 | 0 | } |
12178 | | |
12179 | 0 | Value XOrOpOperandAdaptor::lhs() { |
12180 | 0 | return *getODSOperands(0).begin(); |
12181 | 0 | } |
12182 | | |
12183 | 0 | Value XOrOpOperandAdaptor::rhs() { |
12184 | 0 | return *getODSOperands(1).begin(); |
12185 | 0 | } |
12186 | | |
12187 | 0 | StringRef XOrOp::getOperationName() { |
12188 | 0 | return "std.xor"; |
12189 | 0 | } |
12190 | | |
12191 | 0 | std::pair<unsigned, unsigned> XOrOp::getODSOperandIndexAndLength(unsigned index) { |
12192 | 0 | return {index, 1}; |
12193 | 0 | } |
12194 | | |
12195 | 0 | Operation::operand_range XOrOp::getODSOperands(unsigned index) { |
12196 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
12197 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
12198 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
12199 | 0 | } |
12200 | | |
12201 | 0 | Value XOrOp::lhs() { |
12202 | 0 | return *getODSOperands(0).begin(); |
12203 | 0 | } |
12204 | | |
12205 | 0 | Value XOrOp::rhs() { |
12206 | 0 | return *getODSOperands(1).begin(); |
12207 | 0 | } |
12208 | | |
12209 | 0 | ::mlir::MutableOperandRange XOrOp::lhsMutable() { |
12210 | 0 | auto range = getODSOperandIndexAndLength(0); |
12211 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12212 | 0 | } |
12213 | | |
12214 | 0 | ::mlir::MutableOperandRange XOrOp::rhsMutable() { |
12215 | 0 | auto range = getODSOperandIndexAndLength(1); |
12216 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12217 | 0 | } |
12218 | | |
12219 | 0 | std::pair<unsigned, unsigned> XOrOp::getODSResultIndexAndLength(unsigned index) { |
12220 | 0 | return {index, 1}; |
12221 | 0 | } |
12222 | | |
12223 | 0 | Operation::result_range XOrOp::getODSResults(unsigned index) { |
12224 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
12225 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
12226 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
12227 | 0 | } |
12228 | | |
12229 | 0 | void XOrOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs) { |
12230 | 0 | odsState.addOperands(lhs); |
12231 | 0 | odsState.addOperands(rhs); |
12232 | 0 | odsState.addTypes(resultType0); |
12233 | 0 | } |
12234 | | |
12235 | 0 | void XOrOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs) { |
12236 | 0 | odsState.addOperands(lhs); |
12237 | 0 | odsState.addOperands(rhs); |
12238 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
12239 | 0 | odsState.addTypes(resultTypes); |
12240 | 0 | } |
12241 | | |
12242 | 0 | void XOrOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
12243 | 0 | assert(operands.size() == 2u && "mismatched number of parameters"); |
12244 | 0 | odsState.addOperands(operands); |
12245 | 0 | odsState.addAttributes(attributes); |
12246 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
12247 | 0 | odsState.addTypes(resultTypes); |
12248 | 0 | } |
12249 | | |
12250 | 0 | void XOrOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs) { |
12251 | 0 | odsState.addOperands(lhs); |
12252 | 0 | odsState.addOperands(rhs); |
12253 | 0 | odsState.addTypes({lhs.getType()}); |
12254 | 0 |
|
12255 | 0 | } |
12256 | | |
12257 | 0 | void XOrOp::build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
12258 | 0 | odsState.addOperands(operands); |
12259 | 0 | odsState.addAttributes(attributes); |
12260 | 0 | odsState.addTypes({operands[0].getType()}); |
12261 | 0 |
|
12262 | 0 | } |
12263 | | |
12264 | 0 | ParseResult XOrOp::parse(OpAsmParser &parser, OperationState &result) { |
12265 | 0 | return impl::parseOneResultSameOperandTypeOp(parser, result); |
12266 | 0 | } |
12267 | | |
12268 | 0 | void XOrOp::print(OpAsmPrinter &p) { |
12269 | 0 | return printStandardBinaryOp(this->getOperation(), p); |
12270 | 0 | } |
12271 | | |
12272 | 0 | LogicalResult XOrOp::verify() { |
12273 | 0 | { |
12274 | 0 | unsigned index = 0; (void)index; |
12275 | 0 | auto valueGroup0 = getODSOperands(0); |
12276 | 0 | for (Value v : valueGroup0) { |
12277 | 0 | (void)v; |
12278 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
12279 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
12280 | 0 | } |
12281 | 0 | ++index; |
12282 | 0 | } |
12283 | 0 | auto valueGroup1 = getODSOperands(1); |
12284 | 0 | for (Value v : valueGroup1) { |
12285 | 0 | (void)v; |
12286 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
12287 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
12288 | 0 | } |
12289 | 0 | ++index; |
12290 | 0 | } |
12291 | 0 | } |
12292 | 0 | { |
12293 | 0 | unsigned index = 0; (void)index; |
12294 | 0 | auto valueGroup0 = getODSResults(0); |
12295 | 0 | for (Value v : valueGroup0) { |
12296 | 0 | (void)v; |
12297 | 0 | if (!((true))) { |
12298 | 0 | return emitOpError("result #") << index << " must be any type, but got " << v.getType(); |
12299 | 0 | } |
12300 | 0 | ++index; |
12301 | 0 | } |
12302 | 0 | } |
12303 | 0 | return mlir::success(); |
12304 | 0 | } |
12305 | | |
12306 | | |
12307 | | |
12308 | 0 | void XOrOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
12309 | 0 |
|
12310 | 0 | } |
12311 | | |
12312 | | |
12313 | | //===----------------------------------------------------------------------===// |
12314 | | // ZeroExtendIOp definitions |
12315 | | //===----------------------------------------------------------------------===// |
12316 | | |
12317 | 0 | ZeroExtendIOpOperandAdaptor::ZeroExtendIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs ) : odsOperands(values), odsAttrs(attrs) { |
12318 | 0 |
|
12319 | 0 | } |
12320 | | |
12321 | 0 | ZeroExtendIOpOperandAdaptor::ZeroExtendIOpOperandAdaptor(ZeroExtendIOp& op) : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) { |
12322 | 0 |
|
12323 | 0 | } |
12324 | | |
12325 | 0 | std::pair<unsigned, unsigned> ZeroExtendIOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) { |
12326 | 0 | return {index, 1}; |
12327 | 0 | } |
12328 | | |
12329 | 0 | ValueRange ZeroExtendIOpOperandAdaptor::getODSOperands(unsigned index) { |
12330 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
12331 | 0 | return {std::next(odsOperands.begin(), valueRange.first), |
12332 | 0 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
12333 | 0 | } |
12334 | | |
12335 | 0 | Value ZeroExtendIOpOperandAdaptor::value() { |
12336 | 0 | return *getODSOperands(0).begin(); |
12337 | 0 | } |
12338 | | |
12339 | 0 | StringRef ZeroExtendIOp::getOperationName() { |
12340 | 0 | return "std.zexti"; |
12341 | 0 | } |
12342 | | |
12343 | 0 | std::pair<unsigned, unsigned> ZeroExtendIOp::getODSOperandIndexAndLength(unsigned index) { |
12344 | 0 | return {index, 1}; |
12345 | 0 | } |
12346 | | |
12347 | 0 | Operation::operand_range ZeroExtendIOp::getODSOperands(unsigned index) { |
12348 | 0 | auto valueRange = getODSOperandIndexAndLength(index); |
12349 | 0 | return {std::next(getOperation()->operand_begin(), valueRange.first), |
12350 | 0 | std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; |
12351 | 0 | } |
12352 | | |
12353 | 0 | Value ZeroExtendIOp::value() { |
12354 | 0 | return *getODSOperands(0).begin(); |
12355 | 0 | } |
12356 | | |
12357 | 0 | ::mlir::MutableOperandRange ZeroExtendIOp::valueMutable() { |
12358 | 0 | auto range = getODSOperandIndexAndLength(0); |
12359 | 0 | return ::mlir::MutableOperandRange(getOperation(), range.first, range.second); |
12360 | 0 | } |
12361 | | |
12362 | 0 | std::pair<unsigned, unsigned> ZeroExtendIOp::getODSResultIndexAndLength(unsigned index) { |
12363 | 0 | return {index, 1}; |
12364 | 0 | } |
12365 | | |
12366 | 0 | Operation::result_range ZeroExtendIOp::getODSResults(unsigned index) { |
12367 | 0 | auto valueRange = getODSResultIndexAndLength(index); |
12368 | 0 | return {std::next(getOperation()->result_begin(), valueRange.first), |
12369 | 0 | std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; |
12370 | 0 | } |
12371 | | |
12372 | 0 | void ZeroExtendIOp::build(OpBuilder &builder, OperationState &result, Value value, Type destType) { |
12373 | 0 | result.addOperands(value); |
12374 | 0 | result.addTypes(destType); |
12375 | 0 | |
12376 | 0 | } |
12377 | | |
12378 | 0 | void ZeroExtendIOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value) { |
12379 | 0 | odsState.addOperands(value); |
12380 | 0 | odsState.addTypes(resultType0); |
12381 | 0 | } |
12382 | | |
12383 | 0 | void ZeroExtendIOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value) { |
12384 | 0 | odsState.addOperands(value); |
12385 | 0 | assert(resultTypes.size() == 1u && "mismatched number of results"); |
12386 | 0 | odsState.addTypes(resultTypes); |
12387 | 0 | } |
12388 | | |
12389 | 0 | void ZeroExtendIOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) { |
12390 | 0 | assert(operands.size() == 1u && "mismatched number of parameters"); |
12391 | 0 | odsState.addOperands(operands); |
12392 | 0 | odsState.addAttributes(attributes); |
12393 | 0 | assert(resultTypes.size() == 1u && "mismatched number of return types"); |
12394 | 0 | odsState.addTypes(resultTypes); |
12395 | 0 | } |
12396 | | |
12397 | 0 | ParseResult ZeroExtendIOp::parse(OpAsmParser &parser, OperationState &result) { |
12398 | 0 | return impl::parseCastOp(parser, result); |
12399 | 0 | } |
12400 | | |
12401 | 0 | void ZeroExtendIOp::print(OpAsmPrinter &p) { |
12402 | 0 | return printStandardCastOp(this->getOperation(), p); |
12403 | 0 | } |
12404 | | |
12405 | 0 | LogicalResult ZeroExtendIOp::verify() { |
12406 | 0 | { |
12407 | 0 | unsigned index = 0; (void)index; |
12408 | 0 | auto valueGroup0 = getODSOperands(0); |
12409 | 0 | for (Value v : valueGroup0) { |
12410 | 0 | (void)v; |
12411 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
12412 | 0 | return emitOpError("operand #") << index << " must be signless-integer-like, but got " << v.getType(); |
12413 | 0 | } |
12414 | 0 | ++index; |
12415 | 0 | } |
12416 | 0 | } |
12417 | 0 | { |
12418 | 0 | unsigned index = 0; (void)index; |
12419 | 0 | auto valueGroup0 = getODSResults(0); |
12420 | 0 | for (Value v : valueGroup0) { |
12421 | 0 | (void)v; |
12422 | 0 | if (!(((v.getType().isSignlessInteger())) || ((v.getType().isa<IndexType>())) || (((v.getType().isa<VectorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))) || (((v.getType().isa<TensorType>())) && ((v.getType().cast<ShapedType>().getElementType().isSignlessInteger()))))) { |
12423 | 0 | return emitOpError("result #") << index << " must be signless-integer-like, but got " << v.getType(); |
12424 | 0 | } |
12425 | 0 | ++index; |
12426 | 0 | } |
12427 | 0 | } |
12428 | 0 | return ::verify(*this); |
12429 | 0 | } |
12430 | | |
12431 | 0 | void ZeroExtendIOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) { |
12432 | 0 |
|
12433 | 0 | } |
12434 | | |
12435 | | |
12436 | | #endif // GET_OP_CLASSES |
12437 | | |