Bug Summary

File:build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/include/mlir/IR/Attributes.h
Warning:line 66, column 33
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ArithmeticOps.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -ffunction-sections -fdata-sections -fcoverage-compilation-dir=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/build-llvm/tools/clang/stage2-bins -resource-dir /usr/lib/llvm-15/lib/clang/15.0.0 -D MLIR_CUDA_CONVERSIONS_ENABLED=1 -D MLIR_ROCM_CONVERSIONS_ENABLED=1 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I tools/mlir/lib/Dialect/Arithmetic/IR -I /build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/lib/Dialect/Arithmetic/IR -I include -I /build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/llvm/include -I /build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/include -I tools/mlir/include -D _FORTIFY_SOURCE=2 -D NDEBUG -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward -internal-isystem /usr/lib/llvm-15/lib/clang/15.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fmacro-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/= -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fcoverage-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/= -O3 -Wno-unused-command-line-argument -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-comment -std=c++14 -fdeprecated-macro -fdebug-compilation-dir=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -fdebug-prefix-map=/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/= -ferror-limit 19 -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-04-20-140412-16051-1 -x c++ /build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp

/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp

1//===- ArithmeticOps.cpp - MLIR Arithmetic dialect ops implementation -----===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include <utility>
10
11#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
12#include "mlir/Dialect/CommonFolders.h"
13#include "mlir/IR/Builders.h"
14#include "mlir/IR/Matchers.h"
15#include "mlir/IR/OpImplementation.h"
16#include "mlir/IR/PatternMatch.h"
17#include "mlir/IR/TypeUtilities.h"
18#include "llvm/ADT/SmallString.h"
19
20#include "llvm/ADT/APSInt.h"
21
22using namespace mlir;
23using namespace mlir::arith;
24
25//===----------------------------------------------------------------------===//
26// Pattern helpers
27//===----------------------------------------------------------------------===//
28
29static IntegerAttr addIntegerAttrs(PatternRewriter &builder, Value res,
30 Attribute lhs, Attribute rhs) {
31 return builder.getIntegerAttr(res.getType(),
32 lhs.cast<IntegerAttr>().getInt() +
33 rhs.cast<IntegerAttr>().getInt());
34}
35
36static IntegerAttr subIntegerAttrs(PatternRewriter &builder, Value res,
37 Attribute lhs, Attribute rhs) {
38 return builder.getIntegerAttr(res.getType(),
39 lhs.cast<IntegerAttr>().getInt() -
40 rhs.cast<IntegerAttr>().getInt());
41}
42
43/// Invert an integer comparison predicate.
44arith::CmpIPredicate arith::invertPredicate(arith::CmpIPredicate pred) {
45 switch (pred) {
46 case arith::CmpIPredicate::eq:
47 return arith::CmpIPredicate::ne;
48 case arith::CmpIPredicate::ne:
49 return arith::CmpIPredicate::eq;
50 case arith::CmpIPredicate::slt:
51 return arith::CmpIPredicate::sge;
52 case arith::CmpIPredicate::sle:
53 return arith::CmpIPredicate::sgt;
54 case arith::CmpIPredicate::sgt:
55 return arith::CmpIPredicate::sle;
56 case arith::CmpIPredicate::sge:
57 return arith::CmpIPredicate::slt;
58 case arith::CmpIPredicate::ult:
59 return arith::CmpIPredicate::uge;
60 case arith::CmpIPredicate::ule:
61 return arith::CmpIPredicate::ugt;
62 case arith::CmpIPredicate::ugt:
63 return arith::CmpIPredicate::ule;
64 case arith::CmpIPredicate::uge:
65 return arith::CmpIPredicate::ult;
66 }
67 llvm_unreachable("unknown cmpi predicate kind")::llvm::llvm_unreachable_internal("unknown cmpi predicate kind"
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 67)
;
68}
69
70static arith::CmpIPredicateAttr invertPredicate(arith::CmpIPredicateAttr pred) {
71 return arith::CmpIPredicateAttr::get(pred.getContext(),
72 invertPredicate(pred.getValue()));
73}
74
75//===----------------------------------------------------------------------===//
76// TableGen'd canonicalization patterns
77//===----------------------------------------------------------------------===//
78
79namespace {
80#include "ArithmeticCanonicalization.inc"
81} // namespace
82
83//===----------------------------------------------------------------------===//
84// ConstantOp
85//===----------------------------------------------------------------------===//
86
87void arith::ConstantOp::getAsmResultNames(
88 function_ref<void(Value, StringRef)> setNameFn) {
89 auto type = getType();
90 if (auto intCst = getValue().dyn_cast<IntegerAttr>()) {
91 auto intType = type.dyn_cast<IntegerType>();
92
93 // Sugar i1 constants with 'true' and 'false'.
94 if (intType && intType.getWidth() == 1)
95 return setNameFn(getResult(), (intCst.getInt() ? "true" : "false"));
96
97 // Otherwise, build a compex name with the value and type.
98 SmallString<32> specialNameBuffer;
99 llvm::raw_svector_ostream specialName(specialNameBuffer);
100 specialName << 'c' << intCst.getInt();
101 if (intType)
102 specialName << '_' << type;
103 setNameFn(getResult(), specialName.str());
104 } else {
105 setNameFn(getResult(), "cst");
106 }
107}
108
109/// TODO: disallow arith.constant to return anything other than signless integer
110/// or float like.
111LogicalResult arith::ConstantOp::verify() {
112 auto type = getType();
113 // The value's type must match the return type.
114 if (getValue().getType() != type) {
115 return emitOpError() << "value type " << getValue().getType()
116 << " must match return type: " << type;
117 }
118 // Integer values must be signless.
119 if (type.isa<IntegerType>() && !type.cast<IntegerType>().isSignless())
120 return emitOpError("integer return type must be signless");
121 // Any float or elements attribute are acceptable.
122 if (!getValue().isa<IntegerAttr, FloatAttr, ElementsAttr>()) {
123 return emitOpError(
124 "value must be an integer, float, or elements attribute");
125 }
126 return success();
127}
128
129bool arith::ConstantOp::isBuildableWith(Attribute value, Type type) {
130 // The value's type must be the same as the provided type.
131 if (value.getType() != type)
132 return false;
133 // Integer values must be signless.
134 if (type.isa<IntegerType>() && !type.cast<IntegerType>().isSignless())
135 return false;
136 // Integer, float, and element attributes are buildable.
137 return value.isa<IntegerAttr, FloatAttr, ElementsAttr>();
138}
139
140OpFoldResult arith::ConstantOp::fold(ArrayRef<Attribute> operands) {
141 return getValue();
142}
143
144void arith::ConstantIntOp::build(OpBuilder &builder, OperationState &result,
145 int64_t value, unsigned width) {
146 auto type = builder.getIntegerType(width);
147 arith::ConstantOp::build(builder, result, type,
148 builder.getIntegerAttr(type, value));
149}
150
151void arith::ConstantIntOp::build(OpBuilder &builder, OperationState &result,
152 int64_t value, Type type) {
153 assert(type.isSignlessInteger() &&(static_cast <bool> (type.isSignlessInteger() &&
"ConstantIntOp can only have signless integer type values") ?
void (0) : __assert_fail ("type.isSignlessInteger() && \"ConstantIntOp can only have signless integer type values\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 154, __extension__
__PRETTY_FUNCTION__))
154 "ConstantIntOp can only have signless integer type values")(static_cast <bool> (type.isSignlessInteger() &&
"ConstantIntOp can only have signless integer type values") ?
void (0) : __assert_fail ("type.isSignlessInteger() && \"ConstantIntOp can only have signless integer type values\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 154, __extension__
__PRETTY_FUNCTION__))
;
155 arith::ConstantOp::build(builder, result, type,
156 builder.getIntegerAttr(type, value));
157}
158
159bool arith::ConstantIntOp::classof(Operation *op) {
160 if (auto constOp = dyn_cast_or_null<arith::ConstantOp>(op))
161 return constOp.getType().isSignlessInteger();
162 return false;
163}
164
165void arith::ConstantFloatOp::build(OpBuilder &builder, OperationState &result,
166 const APFloat &value, FloatType type) {
167 arith::ConstantOp::build(builder, result, type,
168 builder.getFloatAttr(type, value));
169}
170
171bool arith::ConstantFloatOp::classof(Operation *op) {
172 if (auto constOp = dyn_cast_or_null<arith::ConstantOp>(op))
173 return constOp.getType().isa<FloatType>();
174 return false;
175}
176
177void arith::ConstantIndexOp::build(OpBuilder &builder, OperationState &result,
178 int64_t value) {
179 arith::ConstantOp::build(builder, result, builder.getIndexType(),
180 builder.getIndexAttr(value));
181}
182
183bool arith::ConstantIndexOp::classof(Operation *op) {
184 if (auto constOp = dyn_cast_or_null<arith::ConstantOp>(op))
185 return constOp.getType().isIndex();
186 return false;
187}
188
189//===----------------------------------------------------------------------===//
190// AddIOp
191//===----------------------------------------------------------------------===//
192
193OpFoldResult arith::AddIOp::fold(ArrayRef<Attribute> operands) {
194 // addi(x, 0) -> x
195 if (matchPattern(getRhs(), m_Zero()))
196 return getLhs();
197
198 // addi(subi(a, b), b) -> a
199 if (auto sub = getLhs().getDefiningOp<SubIOp>())
200 if (getRhs() == sub.getRhs())
201 return sub.getLhs();
202
203 // addi(b, subi(a, b)) -> a
204 if (auto sub = getRhs().getDefiningOp<SubIOp>())
205 if (getLhs() == sub.getRhs())
206 return sub.getLhs();
207
208 return constFoldBinaryOp<IntegerAttr>(
209 operands, [](APInt a, const APInt &b) { return std::move(a) + b; });
210}
211
212void arith::AddIOp::getCanonicalizationPatterns(
213 RewritePatternSet &patterns, MLIRContext *context) {
214 patterns.add<AddIAddConstant, AddISubConstantRHS, AddISubConstantLHS>(
215 context);
216}
217
218//===----------------------------------------------------------------------===//
219// SubIOp
220//===----------------------------------------------------------------------===//
221
222OpFoldResult arith::SubIOp::fold(ArrayRef<Attribute> operands) {
223 // subi(x,x) -> 0
224 if (getOperand(0) == getOperand(1))
225 return Builder(getContext()).getZeroAttr(getType());
226 // subi(x,0) -> x
227 if (matchPattern(getRhs(), m_Zero()))
228 return getLhs();
229
230 return constFoldBinaryOp<IntegerAttr>(
231 operands, [](APInt a, const APInt &b) { return std::move(a) - b; });
232}
233
234void arith::SubIOp::getCanonicalizationPatterns(
235 RewritePatternSet &patterns, MLIRContext *context) {
236 patterns
237 .add<SubIRHSAddConstant, SubILHSAddConstant, SubIRHSSubConstantRHS,
238 SubIRHSSubConstantLHS, SubILHSSubConstantRHS, SubILHSSubConstantLHS>(
239 context);
240}
241
242//===----------------------------------------------------------------------===//
243// MulIOp
244//===----------------------------------------------------------------------===//
245
246OpFoldResult arith::MulIOp::fold(ArrayRef<Attribute> operands) {
247 // muli(x, 0) -> 0
248 if (matchPattern(getRhs(), m_Zero()))
249 return getRhs();
250 // muli(x, 1) -> x
251 if (matchPattern(getRhs(), m_One()))
252 return getOperand(0);
253 // TODO: Handle the overflow case.
254
255 // default folder
256 return constFoldBinaryOp<IntegerAttr>(
257 operands, [](const APInt &a, const APInt &b) { return a * b; });
258}
259
260//===----------------------------------------------------------------------===//
261// DivUIOp
262//===----------------------------------------------------------------------===//
263
264OpFoldResult arith::DivUIOp::fold(ArrayRef<Attribute> operands) {
265 // Don't fold if it would require a division by zero.
266 bool div0 = false;
267 auto result =
268 constFoldBinaryOp<IntegerAttr>(operands, [&](APInt a, const APInt &b) {
269 if (div0 || !b) {
270 div0 = true;
271 return a;
272 }
273 return a.udiv(b);
274 });
275
276 // Fold out division by one. Assumes all tensors of all ones are splats.
277 if (auto rhs = operands[1].dyn_cast_or_null<IntegerAttr>()) {
278 if (rhs.getValue() == 1)
279 return getLhs();
280 } else if (auto rhs = operands[1].dyn_cast_or_null<SplatElementsAttr>()) {
281 if (rhs.getSplatValue<IntegerAttr>().getValue() == 1)
282 return getLhs();
283 }
284
285 return div0 ? Attribute() : result;
286}
287
288//===----------------------------------------------------------------------===//
289// DivSIOp
290//===----------------------------------------------------------------------===//
291
292OpFoldResult arith::DivSIOp::fold(ArrayRef<Attribute> operands) {
293 // Don't fold if it would overflow or if it requires a division by zero.
294 bool overflowOrDiv0 = false;
295 auto result =
296 constFoldBinaryOp<IntegerAttr>(operands, [&](APInt a, const APInt &b) {
297 if (overflowOrDiv0 || !b) {
298 overflowOrDiv0 = true;
299 return a;
300 }
301 return a.sdiv_ov(b, overflowOrDiv0);
302 });
303
304 // Fold out division by one. Assumes all tensors of all ones are splats.
305 if (auto rhs = operands[1].dyn_cast_or_null<IntegerAttr>()) {
306 if (rhs.getValue() == 1)
307 return getLhs();
308 } else if (auto rhs = operands[1].dyn_cast_or_null<SplatElementsAttr>()) {
309 if (rhs.getSplatValue<IntegerAttr>().getValue() == 1)
310 return getLhs();
311 }
312
313 return overflowOrDiv0 ? Attribute() : result;
314}
315
316//===----------------------------------------------------------------------===//
317// Ceil and floor division folding helpers
318//===----------------------------------------------------------------------===//
319
320static APInt signedCeilNonnegInputs(const APInt &a, const APInt &b,
321 bool &overflow) {
322 // Returns (a-1)/b + 1
323 APInt one(a.getBitWidth(), 1, true); // Signed value 1.
324 APInt val = a.ssub_ov(one, overflow).sdiv_ov(b, overflow);
325 return val.sadd_ov(one, overflow);
326}
327
328//===----------------------------------------------------------------------===//
329// CeilDivUIOp
330//===----------------------------------------------------------------------===//
331
332OpFoldResult arith::CeilDivUIOp::fold(ArrayRef<Attribute> operands) {
333 bool overflowOrDiv0 = false;
334 auto result =
335 constFoldBinaryOp<IntegerAttr>(operands, [&](APInt a, const APInt &b) {
336 if (overflowOrDiv0 || !b) {
337 overflowOrDiv0 = true;
338 return a;
339 }
340 APInt quotient = a.udiv(b);
341 if (!a.urem(b))
342 return quotient;
343 APInt one(a.getBitWidth(), 1, true);
344 return quotient.uadd_ov(one, overflowOrDiv0);
345 });
346 // Fold out ceil division by one. Assumes all tensors of all ones are
347 // splats.
348 if (auto rhs = operands[1].dyn_cast_or_null<IntegerAttr>()) {
349 if (rhs.getValue() == 1)
350 return getLhs();
351 } else if (auto rhs = operands[1].dyn_cast_or_null<SplatElementsAttr>()) {
352 if (rhs.getSplatValue<IntegerAttr>().getValue() == 1)
353 return getLhs();
354 }
355
356 return overflowOrDiv0 ? Attribute() : result;
357}
358
359//===----------------------------------------------------------------------===//
360// CeilDivSIOp
361//===----------------------------------------------------------------------===//
362
363OpFoldResult arith::CeilDivSIOp::fold(ArrayRef<Attribute> operands) {
364 // Don't fold if it would overflow or if it requires a division by zero.
365 bool overflowOrDiv0 = false;
366 auto result =
367 constFoldBinaryOp<IntegerAttr>(operands, [&](APInt a, const APInt &b) {
368 if (overflowOrDiv0 || !b) {
369 overflowOrDiv0 = true;
370 return a;
371 }
372 if (!a)
373 return a;
374 // After this point we know that neither a or b are zero.
375 unsigned bits = a.getBitWidth();
376 APInt zero = APInt::getZero(bits);
377 bool aGtZero = a.sgt(zero);
378 bool bGtZero = b.sgt(zero);
379 if (aGtZero && bGtZero) {
380 // Both positive, return ceil(a, b).
381 return signedCeilNonnegInputs(a, b, overflowOrDiv0);
382 }
383 if (!aGtZero && !bGtZero) {
384 // Both negative, return ceil(-a, -b).
385 APInt posA = zero.ssub_ov(a, overflowOrDiv0);
386 APInt posB = zero.ssub_ov(b, overflowOrDiv0);
387 return signedCeilNonnegInputs(posA, posB, overflowOrDiv0);
388 }
389 if (!aGtZero && bGtZero) {
390 // A is negative, b is positive, return - ( -a / b).
391 APInt posA = zero.ssub_ov(a, overflowOrDiv0);
392 APInt div = posA.sdiv_ov(b, overflowOrDiv0);
393 return zero.ssub_ov(div, overflowOrDiv0);
394 }
395 // A is positive, b is negative, return - (a / -b).
396 APInt posB = zero.ssub_ov(b, overflowOrDiv0);
397 APInt div = a.sdiv_ov(posB, overflowOrDiv0);
398 return zero.ssub_ov(div, overflowOrDiv0);
399 });
400
401 // Fold out ceil division by one. Assumes all tensors of all ones are
402 // splats.
403 if (auto rhs = operands[1].dyn_cast_or_null<IntegerAttr>()) {
404 if (rhs.getValue() == 1)
405 return getLhs();
406 } else if (auto rhs = operands[1].dyn_cast_or_null<SplatElementsAttr>()) {
407 if (rhs.getSplatValue<IntegerAttr>().getValue() == 1)
408 return getLhs();
409 }
410
411 return overflowOrDiv0 ? Attribute() : result;
412}
413
414//===----------------------------------------------------------------------===//
415// FloorDivSIOp
416//===----------------------------------------------------------------------===//
417
418OpFoldResult arith::FloorDivSIOp::fold(ArrayRef<Attribute> operands) {
419 // Don't fold if it would overflow or if it requires a division by zero.
420 bool overflowOrDiv0 = false;
421 auto result =
422 constFoldBinaryOp<IntegerAttr>(operands, [&](APInt a, const APInt &b) {
423 if (overflowOrDiv0 || !b) {
424 overflowOrDiv0 = true;
425 return a;
426 }
427 if (!a)
428 return a;
429 // After this point we know that neither a or b are zero.
430 unsigned bits = a.getBitWidth();
431 APInt zero = APInt::getZero(bits);
432 bool aGtZero = a.sgt(zero);
433 bool bGtZero = b.sgt(zero);
434 if (aGtZero && bGtZero) {
435 // Both positive, return a / b.
436 return a.sdiv_ov(b, overflowOrDiv0);
437 }
438 if (!aGtZero && !bGtZero) {
439 // Both negative, return -a / -b.
440 APInt posA = zero.ssub_ov(a, overflowOrDiv0);
441 APInt posB = zero.ssub_ov(b, overflowOrDiv0);
442 return posA.sdiv_ov(posB, overflowOrDiv0);
443 }
444 if (!aGtZero && bGtZero) {
445 // A is negative, b is positive, return - ceil(-a, b).
446 APInt posA = zero.ssub_ov(a, overflowOrDiv0);
447 APInt ceil = signedCeilNonnegInputs(posA, b, overflowOrDiv0);
448 return zero.ssub_ov(ceil, overflowOrDiv0);
449 }
450 // A is positive, b is negative, return - ceil(a, -b).
451 APInt posB = zero.ssub_ov(b, overflowOrDiv0);
452 APInt ceil = signedCeilNonnegInputs(a, posB, overflowOrDiv0);
453 return zero.ssub_ov(ceil, overflowOrDiv0);
454 });
455
456 // Fold out floor division by one. Assumes all tensors of all ones are
457 // splats.
458 if (auto rhs = operands[1].dyn_cast_or_null<IntegerAttr>()) {
459 if (rhs.getValue() == 1)
460 return getLhs();
461 } else if (auto rhs = operands[1].dyn_cast_or_null<SplatElementsAttr>()) {
462 if (rhs.getSplatValue<IntegerAttr>().getValue() == 1)
463 return getLhs();
464 }
465
466 return overflowOrDiv0 ? Attribute() : result;
467}
468
469//===----------------------------------------------------------------------===//
470// RemUIOp
471//===----------------------------------------------------------------------===//
472
473OpFoldResult arith::RemUIOp::fold(ArrayRef<Attribute> operands) {
474 auto rhs = operands.back().dyn_cast_or_null<IntegerAttr>();
475 if (!rhs)
476 return {};
477 auto rhsValue = rhs.getValue();
478
479 // x % 1 = 0
480 if (rhsValue.isOneValue())
481 return IntegerAttr::get(rhs.getType(), APInt(rhsValue.getBitWidth(), 0));
482
483 // Don't fold if it requires division by zero.
484 if (rhsValue.isNullValue())
485 return {};
486
487 auto lhs = operands.front().dyn_cast_or_null<IntegerAttr>();
488 if (!lhs)
489 return {};
490 return IntegerAttr::get(lhs.getType(), lhs.getValue().urem(rhsValue));
491}
492
493//===----------------------------------------------------------------------===//
494// RemSIOp
495//===----------------------------------------------------------------------===//
496
497OpFoldResult arith::RemSIOp::fold(ArrayRef<Attribute> operands) {
498 auto rhs = operands.back().dyn_cast_or_null<IntegerAttr>();
499 if (!rhs)
500 return {};
501 auto rhsValue = rhs.getValue();
502
503 // x % 1 = 0
504 if (rhsValue.isOneValue())
505 return IntegerAttr::get(rhs.getType(), APInt(rhsValue.getBitWidth(), 0));
506
507 // Don't fold if it requires division by zero.
508 if (rhsValue.isNullValue())
509 return {};
510
511 auto lhs = operands.front().dyn_cast_or_null<IntegerAttr>();
512 if (!lhs)
513 return {};
514 return IntegerAttr::get(lhs.getType(), lhs.getValue().srem(rhsValue));
515}
516
517//===----------------------------------------------------------------------===//
518// AndIOp
519//===----------------------------------------------------------------------===//
520
521OpFoldResult arith::AndIOp::fold(ArrayRef<Attribute> operands) {
522 /// and(x, 0) -> 0
523 if (matchPattern(getRhs(), m_Zero()))
524 return getRhs();
525 /// and(x, allOnes) -> x
526 APInt intValue;
527 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) && intValue.isAllOnes())
528 return getLhs();
529
530 return constFoldBinaryOp<IntegerAttr>(
531 operands, [](APInt a, const APInt &b) { return std::move(a) & b; });
532}
533
534//===----------------------------------------------------------------------===//
535// OrIOp
536//===----------------------------------------------------------------------===//
537
538OpFoldResult arith::OrIOp::fold(ArrayRef<Attribute> operands) {
539 /// or(x, 0) -> x
540 if (matchPattern(getRhs(), m_Zero()))
541 return getLhs();
542 /// or(x, <all ones>) -> <all ones>
543 if (auto rhsAttr = operands[1].dyn_cast_or_null<IntegerAttr>())
544 if (rhsAttr.getValue().isAllOnes())
545 return rhsAttr;
546
547 return constFoldBinaryOp<IntegerAttr>(
548 operands, [](APInt a, const APInt &b) { return std::move(a) | b; });
549}
550
551//===----------------------------------------------------------------------===//
552// XOrIOp
553//===----------------------------------------------------------------------===//
554
555OpFoldResult arith::XOrIOp::fold(ArrayRef<Attribute> operands) {
556 /// xor(x, 0) -> x
557 if (matchPattern(getRhs(), m_Zero()))
558 return getLhs();
559 /// xor(x, x) -> 0
560 if (getLhs() == getRhs())
561 return Builder(getContext()).getZeroAttr(getType());
562 /// xor(xor(x, a), a) -> x
563 if (arith::XOrIOp prev = getLhs().getDefiningOp<arith::XOrIOp>())
564 if (prev.getRhs() == getRhs())
565 return prev.getLhs();
566
567 return constFoldBinaryOp<IntegerAttr>(
568 operands, [](APInt a, const APInt &b) { return std::move(a) ^ b; });
569}
570
571void arith::XOrIOp::getCanonicalizationPatterns(
572 RewritePatternSet &patterns, MLIRContext *context) {
573 patterns.add<XOrINotCmpI>(context);
574}
575
576//===----------------------------------------------------------------------===//
577// NegFOp
578//===----------------------------------------------------------------------===//
579
580OpFoldResult arith::NegFOp::fold(ArrayRef<Attribute> operands) {
581 return constFoldUnaryOp<FloatAttr>(operands,
582 [](const APFloat &a) { return -a; });
583}
584
585//===----------------------------------------------------------------------===//
586// AddFOp
587//===----------------------------------------------------------------------===//
588
589OpFoldResult arith::AddFOp::fold(ArrayRef<Attribute> operands) {
590 // addf(x, -0) -> x
591 if (matchPattern(getRhs(), m_NegZeroFloat()))
592 return getLhs();
593
594 return constFoldBinaryOp<FloatAttr>(
595 operands, [](const APFloat &a, const APFloat &b) { return a + b; });
596}
597
598//===----------------------------------------------------------------------===//
599// SubFOp
600//===----------------------------------------------------------------------===//
601
602OpFoldResult arith::SubFOp::fold(ArrayRef<Attribute> operands) {
603 // subf(x, +0) -> x
604 if (matchPattern(getRhs(), m_PosZeroFloat()))
605 return getLhs();
606
607 return constFoldBinaryOp<FloatAttr>(
608 operands, [](const APFloat &a, const APFloat &b) { return a - b; });
609}
610
611//===----------------------------------------------------------------------===//
612// MaxFOp
613//===----------------------------------------------------------------------===//
614
615OpFoldResult arith::MaxFOp::fold(ArrayRef<Attribute> operands) {
616 assert(operands.size() == 2 && "maxf takes two operands")(static_cast <bool> (operands.size() == 2 && "maxf takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"maxf takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 616, __extension__
__PRETTY_FUNCTION__))
;
617
618 // maxf(x,x) -> x
619 if (getLhs() == getRhs())
620 return getRhs();
621
622 // maxf(x, -inf) -> x
623 if (matchPattern(getRhs(), m_NegInfFloat()))
624 return getLhs();
625
626 return constFoldBinaryOp<FloatAttr>(
627 operands,
628 [](const APFloat &a, const APFloat &b) { return llvm::maximum(a, b); });
629}
630
631//===----------------------------------------------------------------------===//
632// MaxSIOp
633//===----------------------------------------------------------------------===//
634
635OpFoldResult MaxSIOp::fold(ArrayRef<Attribute> operands) {
636 assert(operands.size() == 2 && "binary operation takes two operands")(static_cast <bool> (operands.size() == 2 && "binary operation takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"binary operation takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 636, __extension__
__PRETTY_FUNCTION__))
;
637
638 // maxsi(x,x) -> x
639 if (getLhs() == getRhs())
640 return getRhs();
641
642 APInt intValue;
643 // maxsi(x,MAX_INT) -> MAX_INT
644 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) &&
645 intValue.isMaxSignedValue())
646 return getRhs();
647
648 // maxsi(x, MIN_INT) -> x
649 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) &&
650 intValue.isMinSignedValue())
651 return getLhs();
652
653 return constFoldBinaryOp<IntegerAttr>(operands,
654 [](const APInt &a, const APInt &b) {
655 return llvm::APIntOps::smax(a, b);
656 });
657}
658
659//===----------------------------------------------------------------------===//
660// MaxUIOp
661//===----------------------------------------------------------------------===//
662
663OpFoldResult MaxUIOp::fold(ArrayRef<Attribute> operands) {
664 assert(operands.size() == 2 && "binary operation takes two operands")(static_cast <bool> (operands.size() == 2 && "binary operation takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"binary operation takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 664, __extension__
__PRETTY_FUNCTION__))
;
665
666 // maxui(x,x) -> x
667 if (getLhs() == getRhs())
668 return getRhs();
669
670 APInt intValue;
671 // maxui(x,MAX_INT) -> MAX_INT
672 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) && intValue.isMaxValue())
673 return getRhs();
674
675 // maxui(x, MIN_INT) -> x
676 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) && intValue.isMinValue())
677 return getLhs();
678
679 return constFoldBinaryOp<IntegerAttr>(operands,
680 [](const APInt &a, const APInt &b) {
681 return llvm::APIntOps::umax(a, b);
682 });
683}
684
685//===----------------------------------------------------------------------===//
686// MinFOp
687//===----------------------------------------------------------------------===//
688
689OpFoldResult arith::MinFOp::fold(ArrayRef<Attribute> operands) {
690 assert(operands.size() == 2 && "minf takes two operands")(static_cast <bool> (operands.size() == 2 && "minf takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"minf takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 690, __extension__
__PRETTY_FUNCTION__))
;
691
692 // minf(x,x) -> x
693 if (getLhs() == getRhs())
694 return getRhs();
695
696 // minf(x, +inf) -> x
697 if (matchPattern(getRhs(), m_PosInfFloat()))
698 return getLhs();
699
700 return constFoldBinaryOp<FloatAttr>(
701 operands,
702 [](const APFloat &a, const APFloat &b) { return llvm::minimum(a, b); });
703}
704
705//===----------------------------------------------------------------------===//
706// MinSIOp
707//===----------------------------------------------------------------------===//
708
709OpFoldResult MinSIOp::fold(ArrayRef<Attribute> operands) {
710 assert(operands.size() == 2 && "binary operation takes two operands")(static_cast <bool> (operands.size() == 2 && "binary operation takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"binary operation takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 710, __extension__
__PRETTY_FUNCTION__))
;
711
712 // minsi(x,x) -> x
713 if (getLhs() == getRhs())
714 return getRhs();
715
716 APInt intValue;
717 // minsi(x,MIN_INT) -> MIN_INT
718 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) &&
719 intValue.isMinSignedValue())
720 return getRhs();
721
722 // minsi(x, MAX_INT) -> x
723 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) &&
724 intValue.isMaxSignedValue())
725 return getLhs();
726
727 return constFoldBinaryOp<IntegerAttr>(operands,
728 [](const APInt &a, const APInt &b) {
729 return llvm::APIntOps::smin(a, b);
730 });
731}
732
733//===----------------------------------------------------------------------===//
734// MinUIOp
735//===----------------------------------------------------------------------===//
736
737OpFoldResult MinUIOp::fold(ArrayRef<Attribute> operands) {
738 assert(operands.size() == 2 && "binary operation takes two operands")(static_cast <bool> (operands.size() == 2 && "binary operation takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"binary operation takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 738, __extension__
__PRETTY_FUNCTION__))
;
739
740 // minui(x,x) -> x
741 if (getLhs() == getRhs())
742 return getRhs();
743
744 APInt intValue;
745 // minui(x,MIN_INT) -> MIN_INT
746 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) && intValue.isMinValue())
747 return getRhs();
748
749 // minui(x, MAX_INT) -> x
750 if (matchPattern(getRhs(), m_ConstantInt(&intValue)) && intValue.isMaxValue())
751 return getLhs();
752
753 return constFoldBinaryOp<IntegerAttr>(operands,
754 [](const APInt &a, const APInt &b) {
755 return llvm::APIntOps::umin(a, b);
756 });
757}
758
759//===----------------------------------------------------------------------===//
760// MulFOp
761//===----------------------------------------------------------------------===//
762
763OpFoldResult arith::MulFOp::fold(ArrayRef<Attribute> operands) {
764 // mulf(x, 1) -> x
765 if (matchPattern(getRhs(), m_OneFloat()))
766 return getLhs();
767
768 return constFoldBinaryOp<FloatAttr>(
769 operands, [](const APFloat &a, const APFloat &b) { return a * b; });
770}
771
772//===----------------------------------------------------------------------===//
773// DivFOp
774//===----------------------------------------------------------------------===//
775
776OpFoldResult arith::DivFOp::fold(ArrayRef<Attribute> operands) {
777 // divf(x, 1) -> x
778 if (matchPattern(getRhs(), m_OneFloat()))
779 return getLhs();
780
781 return constFoldBinaryOp<FloatAttr>(
782 operands, [](const APFloat &a, const APFloat &b) { return a / b; });
783}
784
785//===----------------------------------------------------------------------===//
786// Utility functions for verifying cast ops
787//===----------------------------------------------------------------------===//
788
789template <typename... Types>
790using type_list = std::tuple<Types...> *;
791
792/// Returns a non-null type only if the provided type is one of the allowed
793/// types or one of the allowed shaped types of the allowed types. Returns the
794/// element type if a valid shaped type is provided.
795template <typename... ShapedTypes, typename... ElementTypes>
796static Type getUnderlyingType(Type type, type_list<ShapedTypes...>,
797 type_list<ElementTypes...>) {
798 if (type.isa<ShapedType>() && !type.isa<ShapedTypes...>())
799 return {};
800
801 auto underlyingType = getElementTypeOrSelf(type);
802 if (!underlyingType.isa<ElementTypes...>())
803 return {};
804
805 return underlyingType;
806}
807
808/// Get allowed underlying types for vectors and tensors.
809template <typename... ElementTypes>
810static Type getTypeIfLike(Type type) {
811 return getUnderlyingType(type, type_list<VectorType, TensorType>(),
812 type_list<ElementTypes...>());
813}
814
815/// Get allowed underlying types for vectors, tensors, and memrefs.
816template <typename... ElementTypes>
817static Type getTypeIfLikeOrMemRef(Type type) {
818 return getUnderlyingType(type,
819 type_list<VectorType, TensorType, MemRefType>(),
820 type_list<ElementTypes...>());
821}
822
823static bool areValidCastInputsAndOutputs(TypeRange inputs, TypeRange outputs) {
824 return inputs.size() == 1 && outputs.size() == 1 &&
825 succeeded(verifyCompatibleShapes(inputs.front(), outputs.front()));
826}
827
828//===----------------------------------------------------------------------===//
829// Verifiers for integer and floating point extension/truncation ops
830//===----------------------------------------------------------------------===//
831
832// Extend ops can only extend to a wider type.
833template <typename ValType, typename Op>
834static LogicalResult verifyExtOp(Op op) {
835 Type srcType = getElementTypeOrSelf(op.getIn().getType());
836 Type dstType = getElementTypeOrSelf(op.getType());
837
838 if (srcType.cast<ValType>().getWidth() >= dstType.cast<ValType>().getWidth())
839 return op.emitError("result type ")
840 << dstType << " must be wider than operand type " << srcType;
841
842 return success();
843}
844
845// Truncate ops can only truncate to a shorter type.
846template <typename ValType, typename Op>
847static LogicalResult verifyTruncateOp(Op op) {
848 Type srcType = getElementTypeOrSelf(op.getIn().getType());
849 Type dstType = getElementTypeOrSelf(op.getType());
850
851 if (srcType.cast<ValType>().getWidth() <= dstType.cast<ValType>().getWidth())
852 return op.emitError("result type ")
853 << dstType << " must be shorter than operand type " << srcType;
854
855 return success();
856}
857
858/// Validate a cast that changes the width of a type.
859template <template <typename> class WidthComparator, typename... ElementTypes>
860static bool checkWidthChangeCast(TypeRange inputs, TypeRange outputs) {
861 if (!areValidCastInputsAndOutputs(inputs, outputs))
862 return false;
863
864 auto srcType = getTypeIfLike<ElementTypes...>(inputs.front());
865 auto dstType = getTypeIfLike<ElementTypes...>(outputs.front());
866 if (!srcType || !dstType)
867 return false;
868
869 return WidthComparator<unsigned>()(dstType.getIntOrFloatBitWidth(),
870 srcType.getIntOrFloatBitWidth());
871}
872
873//===----------------------------------------------------------------------===//
874// ExtUIOp
875//===----------------------------------------------------------------------===//
876
877OpFoldResult arith::ExtUIOp::fold(ArrayRef<Attribute> operands) {
878 if (auto lhs = getIn().getDefiningOp<ExtUIOp>()) {
879 getInMutable().assign(lhs.getIn());
880 return getResult();
881 }
882 Type resType = getType();
883 unsigned bitWidth;
884 if (auto shapedType = resType.dyn_cast<ShapedType>())
885 bitWidth = shapedType.getElementTypeBitWidth();
886 else
887 bitWidth = resType.getIntOrFloatBitWidth();
888 return constFoldCastOp<IntegerAttr, IntegerAttr>(
889 operands, getType(), [bitWidth](const APInt &a, bool &castStatus) {
890 return a.zext(bitWidth);
891 });
892}
893
894bool arith::ExtUIOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
895 return checkWidthChangeCast<std::greater, IntegerType>(inputs, outputs);
896}
897
898LogicalResult arith::ExtUIOp::verify() {
899 return verifyExtOp<IntegerType>(*this);
900}
901
902//===----------------------------------------------------------------------===//
903// ExtSIOp
904//===----------------------------------------------------------------------===//
905
906OpFoldResult arith::ExtSIOp::fold(ArrayRef<Attribute> operands) {
907 if (auto lhs = getIn().getDefiningOp<ExtSIOp>()) {
908 getInMutable().assign(lhs.getIn());
909 return getResult();
910 }
911 Type resType = getType();
912 unsigned bitWidth;
913 if (auto shapedType = resType.dyn_cast<ShapedType>())
914 bitWidth = shapedType.getElementTypeBitWidth();
915 else
916 bitWidth = resType.getIntOrFloatBitWidth();
917 return constFoldCastOp<IntegerAttr, IntegerAttr>(
918 operands, getType(), [bitWidth](const APInt &a, bool &castStatus) {
919 return a.sext(bitWidth);
920 });
921}
922
923bool arith::ExtSIOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
924 return checkWidthChangeCast<std::greater, IntegerType>(inputs, outputs);
925}
926
927void arith::ExtSIOp::getCanonicalizationPatterns(
928 RewritePatternSet &patterns, MLIRContext *context) {
929 patterns.add<ExtSIOfExtUI>(context);
930}
931
932LogicalResult arith::ExtSIOp::verify() {
933 return verifyExtOp<IntegerType>(*this);
934}
935
936//===----------------------------------------------------------------------===//
937// ExtFOp
938//===----------------------------------------------------------------------===//
939
940bool arith::ExtFOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
941 return checkWidthChangeCast<std::greater, FloatType>(inputs, outputs);
942}
943
944LogicalResult arith::ExtFOp::verify() { return verifyExtOp<FloatType>(*this); }
945
946//===----------------------------------------------------------------------===//
947// TruncIOp
948//===----------------------------------------------------------------------===//
949
950OpFoldResult arith::TruncIOp::fold(ArrayRef<Attribute> operands) {
951 assert(operands.size() == 1 && "unary operation takes one operand")(static_cast <bool> (operands.size() == 1 && "unary operation takes one operand"
) ? void (0) : __assert_fail ("operands.size() == 1 && \"unary operation takes one operand\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 951, __extension__
__PRETTY_FUNCTION__))
;
952
953 // trunci(zexti(a)) -> a
954 // trunci(sexti(a)) -> a
955 if (matchPattern(getOperand(), m_Op<arith::ExtUIOp>()) ||
956 matchPattern(getOperand(), m_Op<arith::ExtSIOp>()))
957 return getOperand().getDefiningOp()->getOperand(0);
958
959 // trunci(trunci(a)) -> trunci(a))
960 if (matchPattern(getOperand(), m_Op<arith::TruncIOp>())) {
961 setOperand(getOperand().getDefiningOp()->getOperand(0));
962 return getResult();
963 }
964
965 Type resType = getType();
966 unsigned bitWidth;
967 if (auto shapedType = resType.dyn_cast<ShapedType>())
968 bitWidth = shapedType.getElementTypeBitWidth();
969 else
970 bitWidth = resType.getIntOrFloatBitWidth();
971
972 return constFoldCastOp<IntegerAttr, IntegerAttr>(
973 operands, getType(), [bitWidth](const APInt &a, bool &castStatus) {
974 return a.trunc(bitWidth);
975 });
976}
977
978bool arith::TruncIOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
979 return checkWidthChangeCast<std::less, IntegerType>(inputs, outputs);
980}
981
982LogicalResult arith::TruncIOp::verify() {
983 return verifyTruncateOp<IntegerType>(*this);
984}
985
986//===----------------------------------------------------------------------===//
987// TruncFOp
988//===----------------------------------------------------------------------===//
989
990/// Perform safe const propagation for truncf, i.e. only propagate if FP value
991/// can be represented without precision loss or rounding.
992OpFoldResult arith::TruncFOp::fold(ArrayRef<Attribute> operands) {
993 assert(operands.size() == 1 && "unary operation takes one operand")(static_cast <bool> (operands.size() == 1 && "unary operation takes one operand"
) ? void (0) : __assert_fail ("operands.size() == 1 && \"unary operation takes one operand\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 993, __extension__
__PRETTY_FUNCTION__))
;
994
995 auto constOperand = operands.front();
996 if (!constOperand || !constOperand.isa<FloatAttr>())
997 return {};
998
999 // Convert to target type via 'double'.
1000 double sourceValue =
1001 constOperand.dyn_cast<FloatAttr>().getValue().convertToDouble();
1002 auto targetAttr = FloatAttr::get(getType(), sourceValue);
1003
1004 // Propagate if constant's value does not change after truncation.
1005 if (sourceValue == targetAttr.getValue().convertToDouble())
1006 return targetAttr;
1007
1008 return {};
1009}
1010
1011bool arith::TruncFOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1012 return checkWidthChangeCast<std::less, FloatType>(inputs, outputs);
1013}
1014
1015LogicalResult arith::TruncFOp::verify() {
1016 return verifyTruncateOp<FloatType>(*this);
1017}
1018
1019//===----------------------------------------------------------------------===//
1020// AndIOp
1021//===----------------------------------------------------------------------===//
1022
1023void arith::AndIOp::getCanonicalizationPatterns(
1024 RewritePatternSet &patterns, MLIRContext *context) {
1025 patterns.add<AndOfExtUI, AndOfExtSI>(context);
1026}
1027
1028//===----------------------------------------------------------------------===//
1029// OrIOp
1030//===----------------------------------------------------------------------===//
1031
1032void arith::OrIOp::getCanonicalizationPatterns(
1033 RewritePatternSet &patterns, MLIRContext *context) {
1034 patterns.add<OrOfExtUI, OrOfExtSI>(context);
1035}
1036
1037//===----------------------------------------------------------------------===//
1038// Verifiers for casts between integers and floats.
1039//===----------------------------------------------------------------------===//
1040
1041template <typename From, typename To>
1042static bool checkIntFloatCast(TypeRange inputs, TypeRange outputs) {
1043 if (!areValidCastInputsAndOutputs(inputs, outputs))
1044 return false;
1045
1046 auto srcType = getTypeIfLike<From>(inputs.front());
1047 auto dstType = getTypeIfLike<To>(outputs.back());
1048
1049 return srcType && dstType;
1050}
1051
1052//===----------------------------------------------------------------------===//
1053// UIToFPOp
1054//===----------------------------------------------------------------------===//
1055
1056bool arith::UIToFPOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1057 return checkIntFloatCast<IntegerType, FloatType>(inputs, outputs);
1058}
1059
1060OpFoldResult arith::UIToFPOp::fold(ArrayRef<Attribute> operands) {
1061 Type resType = getType();
1062 Type resEleType;
1063 if (auto shapedType = resType.dyn_cast<ShapedType>())
1064 resEleType = shapedType.getElementType();
1065 else
1066 resEleType = resType;
1067 return constFoldCastOp<IntegerAttr, FloatAttr>(
1068 operands, getType(), [&resEleType](const APInt &a, bool &castStatus) {
1069 FloatType floatTy = resEleType.cast<FloatType>();
1070 APFloat apf(floatTy.getFloatSemantics(),
1071 APInt::getZero(floatTy.getWidth()));
1072 apf.convertFromAPInt(a, /*IsSigned=*/false,
1073 APFloat::rmNearestTiesToEven);
1074 return apf;
1075 });
1076}
1077
1078//===----------------------------------------------------------------------===//
1079// SIToFPOp
1080//===----------------------------------------------------------------------===//
1081
1082bool arith::SIToFPOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1083 return checkIntFloatCast<IntegerType, FloatType>(inputs, outputs);
1084}
1085
1086OpFoldResult arith::SIToFPOp::fold(ArrayRef<Attribute> operands) {
1087 Type resType = getType();
1088 Type resEleType;
1089 if (auto shapedType = resType.dyn_cast<ShapedType>())
1090 resEleType = shapedType.getElementType();
1091 else
1092 resEleType = resType;
1093 return constFoldCastOp<IntegerAttr, FloatAttr>(
1094 operands, getType(), [&resEleType](const APInt &a, bool &castStatus) {
1095 FloatType floatTy = resEleType.cast<FloatType>();
1096 APFloat apf(floatTy.getFloatSemantics(),
1097 APInt::getZero(floatTy.getWidth()));
1098 apf.convertFromAPInt(a, /*IsSigned=*/true,
1099 APFloat::rmNearestTiesToEven);
1100 return apf;
1101 });
1102}
1103//===----------------------------------------------------------------------===//
1104// FPToUIOp
1105//===----------------------------------------------------------------------===//
1106
1107bool arith::FPToUIOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1108 return checkIntFloatCast<FloatType, IntegerType>(inputs, outputs);
1109}
1110
1111OpFoldResult arith::FPToUIOp::fold(ArrayRef<Attribute> operands) {
1112 Type resType = getType();
1113 Type resEleType;
1114 if (auto shapedType = resType.dyn_cast<ShapedType>())
1115 resEleType = shapedType.getElementType();
1116 else
1117 resEleType = resType;
1118 return constFoldCastOp<FloatAttr, IntegerAttr>(
1119 operands, getType(), [&resEleType](const APFloat &a, bool &castStatus) {
1120 IntegerType intTy = resEleType.cast<IntegerType>();
1121 bool ignored;
1122 APSInt api(intTy.getWidth(), /*isUnsigned=*/true);
1123 castStatus = APFloat::opInvalidOp !=
1124 a.convertToInteger(api, APFloat::rmTowardZero, &ignored);
1125 return api;
1126 });
1127}
1128
1129//===----------------------------------------------------------------------===//
1130// FPToSIOp
1131//===----------------------------------------------------------------------===//
1132
1133bool arith::FPToSIOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1134 return checkIntFloatCast<FloatType, IntegerType>(inputs, outputs);
1135}
1136
1137OpFoldResult arith::FPToSIOp::fold(ArrayRef<Attribute> operands) {
1138 Type resType = getType();
1139 Type resEleType;
1140 if (auto shapedType = resType.dyn_cast<ShapedType>())
1141 resEleType = shapedType.getElementType();
1142 else
1143 resEleType = resType;
1144 return constFoldCastOp<FloatAttr, IntegerAttr>(
1145 operands, getType(), [&resEleType](const APFloat &a, bool &castStatus) {
1146 IntegerType intTy = resEleType.cast<IntegerType>();
1147 bool ignored;
1148 APSInt api(intTy.getWidth(), /*isUnsigned=*/false);
1149 castStatus = APFloat::opInvalidOp !=
1150 a.convertToInteger(api, APFloat::rmTowardZero, &ignored);
1151 return api;
1152 });
1153}
1154
1155//===----------------------------------------------------------------------===//
1156// IndexCastOp
1157//===----------------------------------------------------------------------===//
1158
1159bool arith::IndexCastOp::areCastCompatible(TypeRange inputs,
1160 TypeRange outputs) {
1161 if (!areValidCastInputsAndOutputs(inputs, outputs))
1162 return false;
1163
1164 auto srcType = getTypeIfLikeOrMemRef<IntegerType, IndexType>(inputs.front());
1165 auto dstType = getTypeIfLikeOrMemRef<IntegerType, IndexType>(outputs.front());
1166 if (!srcType || !dstType)
1167 return false;
1168
1169 return (srcType.isIndex() && dstType.isSignlessInteger()) ||
1170 (srcType.isSignlessInteger() && dstType.isIndex());
1171}
1172
1173OpFoldResult arith::IndexCastOp::fold(ArrayRef<Attribute> operands) {
1174 // index_cast(constant) -> constant
1175 // A little hack because we go through int. Otherwise, the size of the
1176 // constant might need to change.
1177 if (auto value = operands[0].dyn_cast_or_null<IntegerAttr>())
1178 return IntegerAttr::get(getType(), value.getInt());
1179
1180 return {};
1181}
1182
1183void arith::IndexCastOp::getCanonicalizationPatterns(
1184 RewritePatternSet &patterns, MLIRContext *context) {
1185 patterns.add<IndexCastOfIndexCast, IndexCastOfExtSI>(context);
1186}
1187
1188//===----------------------------------------------------------------------===//
1189// BitcastOp
1190//===----------------------------------------------------------------------===//
1191
1192bool arith::BitcastOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
1193 if (!areValidCastInputsAndOutputs(inputs, outputs))
1194 return false;
1195
1196 auto srcType =
1197 getTypeIfLikeOrMemRef<IntegerType, IndexType, FloatType>(inputs.front());
1198 auto dstType =
1199 getTypeIfLikeOrMemRef<IntegerType, IndexType, FloatType>(outputs.front());
1200 if (!srcType || !dstType)
1201 return false;
1202
1203 return srcType.getIntOrFloatBitWidth() == dstType.getIntOrFloatBitWidth();
1204}
1205
1206OpFoldResult arith::BitcastOp::fold(ArrayRef<Attribute> operands) {
1207 assert(operands.size() == 1 && "bitcast op expects 1 operand")(static_cast <bool> (operands.size() == 1 && "bitcast op expects 1 operand"
) ? void (0) : __assert_fail ("operands.size() == 1 && \"bitcast op expects 1 operand\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1207, __extension__
__PRETTY_FUNCTION__))
;
1208
1209 auto resType = getType();
1210 auto operand = operands[0];
1211 if (!operand)
1212 return {};
1213
1214 /// Bitcast dense elements.
1215 if (auto denseAttr = operand.dyn_cast_or_null<DenseElementsAttr>())
1216 return denseAttr.bitcast(resType.cast<ShapedType>().getElementType());
1217 /// Other shaped types unhandled.
1218 if (resType.isa<ShapedType>())
1219 return {};
1220
1221 /// Bitcast integer or float to integer or float.
1222 APInt bits = operand.isa<FloatAttr>()
1223 ? operand.cast<FloatAttr>().getValue().bitcastToAPInt()
1224 : operand.cast<IntegerAttr>().getValue();
1225
1226 if (auto resFloatType = resType.dyn_cast<FloatType>())
1227 return FloatAttr::get(resType,
1228 APFloat(resFloatType.getFloatSemantics(), bits));
1229 return IntegerAttr::get(resType, bits);
1230}
1231
1232void arith::BitcastOp::getCanonicalizationPatterns(
1233 RewritePatternSet &patterns, MLIRContext *context) {
1234 patterns.add<BitcastOfBitcast>(context);
1235}
1236
1237//===----------------------------------------------------------------------===//
1238// Helpers for compare ops
1239//===----------------------------------------------------------------------===//
1240
1241/// Return the type of the same shape (scalar, vector or tensor) containing i1.
1242static Type getI1SameShape(Type type) {
1243 auto i1Type = IntegerType::get(type.getContext(), 1);
1244 if (auto tensorType = type.dyn_cast<RankedTensorType>())
1245 return RankedTensorType::get(tensorType.getShape(), i1Type);
1246 if (type.isa<UnrankedTensorType>())
1247 return UnrankedTensorType::get(i1Type);
1248 if (auto vectorType = type.dyn_cast<VectorType>())
1249 return VectorType::get(vectorType.getShape(), i1Type,
1250 vectorType.getNumScalableDims());
1251 return i1Type;
1252}
1253
1254//===----------------------------------------------------------------------===//
1255// CmpIOp
1256//===----------------------------------------------------------------------===//
1257
1258/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known integer
1259/// comparison predicates.
1260bool mlir::arith::applyCmpPredicate(arith::CmpIPredicate predicate,
1261 const APInt &lhs, const APInt &rhs) {
1262 switch (predicate) {
1263 case arith::CmpIPredicate::eq:
1264 return lhs.eq(rhs);
1265 case arith::CmpIPredicate::ne:
1266 return lhs.ne(rhs);
1267 case arith::CmpIPredicate::slt:
1268 return lhs.slt(rhs);
1269 case arith::CmpIPredicate::sle:
1270 return lhs.sle(rhs);
1271 case arith::CmpIPredicate::sgt:
1272 return lhs.sgt(rhs);
1273 case arith::CmpIPredicate::sge:
1274 return lhs.sge(rhs);
1275 case arith::CmpIPredicate::ult:
1276 return lhs.ult(rhs);
1277 case arith::CmpIPredicate::ule:
1278 return lhs.ule(rhs);
1279 case arith::CmpIPredicate::ugt:
1280 return lhs.ugt(rhs);
1281 case arith::CmpIPredicate::uge:
1282 return lhs.uge(rhs);
1283 }
1284 llvm_unreachable("unknown cmpi predicate kind")::llvm::llvm_unreachable_internal("unknown cmpi predicate kind"
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1284)
;
1285}
1286
1287/// Returns true if the predicate is true for two equal operands.
1288static bool applyCmpPredicateToEqualOperands(arith::CmpIPredicate predicate) {
1289 switch (predicate) {
1290 case arith::CmpIPredicate::eq:
1291 case arith::CmpIPredicate::sle:
1292 case arith::CmpIPredicate::sge:
1293 case arith::CmpIPredicate::ule:
1294 case arith::CmpIPredicate::uge:
1295 return true;
1296 case arith::CmpIPredicate::ne:
1297 case arith::CmpIPredicate::slt:
1298 case arith::CmpIPredicate::sgt:
1299 case arith::CmpIPredicate::ult:
1300 case arith::CmpIPredicate::ugt:
1301 return false;
1302 }
1303 llvm_unreachable("unknown cmpi predicate kind")::llvm::llvm_unreachable_internal("unknown cmpi predicate kind"
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1303)
;
1304}
1305
1306static Attribute getBoolAttribute(Type type, MLIRContext *ctx, bool value) {
1307 auto boolAttr = BoolAttr::get(ctx, value);
1308 ShapedType shapedType = type.dyn_cast_or_null<ShapedType>();
1309 if (!shapedType)
1310 return boolAttr;
1311 return DenseElementsAttr::get(shapedType, boolAttr);
1312}
1313
1314OpFoldResult arith::CmpIOp::fold(ArrayRef<Attribute> operands) {
1315 assert(operands.size() == 2 && "cmpi takes two operands")(static_cast <bool> (operands.size() == 2 && "cmpi takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"cmpi takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1315, __extension__
__PRETTY_FUNCTION__))
;
1316
1317 // cmpi(pred, x, x)
1318 if (getLhs() == getRhs()) {
1319 auto val = applyCmpPredicateToEqualOperands(getPredicate());
1320 return getBoolAttribute(getType(), getContext(), val);
1321 }
1322
1323 if (matchPattern(getRhs(), m_Zero())) {
1324 if (auto extOp = getLhs().getDefiningOp<ExtSIOp>()) {
1325 if (extOp.getOperand().getType().cast<IntegerType>().getWidth() == 1) {
1326 // extsi(%x : i1 -> iN) != 0 -> %x
1327 if (getPredicate() == arith::CmpIPredicate::ne) {
1328 return extOp.getOperand();
1329 }
1330 }
1331 }
1332 if (auto extOp = getLhs().getDefiningOp<ExtUIOp>()) {
1333 if (extOp.getOperand().getType().cast<IntegerType>().getWidth() == 1) {
1334 // extui(%x : i1 -> iN) != 0 -> %x
1335 if (getPredicate() == arith::CmpIPredicate::ne) {
1336 return extOp.getOperand();
1337 }
1338 }
1339 }
1340 }
1341
1342 auto lhs = operands.front().dyn_cast_or_null<IntegerAttr>();
1343 auto rhs = operands.back().dyn_cast_or_null<IntegerAttr>();
1344 if (!lhs || !rhs)
1345 return {};
1346
1347 auto val = applyCmpPredicate(getPredicate(), lhs.getValue(), rhs.getValue());
1348 return BoolAttr::get(getContext(), val);
1349}
1350
1351void arith::CmpIOp::getCanonicalizationPatterns(RewritePatternSet &patterns,
1352 MLIRContext *context) {
1353 patterns.insert<CmpIExtSI, CmpIExtUI>(context);
1354}
1355
1356//===----------------------------------------------------------------------===//
1357// CmpFOp
1358//===----------------------------------------------------------------------===//
1359
1360/// Compute `lhs` `pred` `rhs`, where `pred` is one of the known floating point
1361/// comparison predicates.
1362bool mlir::arith::applyCmpPredicate(arith::CmpFPredicate predicate,
1363 const APFloat &lhs, const APFloat &rhs) {
1364 auto cmpResult = lhs.compare(rhs);
1365 switch (predicate) {
1366 case arith::CmpFPredicate::AlwaysFalse:
1367 return false;
1368 case arith::CmpFPredicate::OEQ:
1369 return cmpResult == APFloat::cmpEqual;
1370 case arith::CmpFPredicate::OGT:
1371 return cmpResult == APFloat::cmpGreaterThan;
1372 case arith::CmpFPredicate::OGE:
1373 return cmpResult == APFloat::cmpGreaterThan ||
1374 cmpResult == APFloat::cmpEqual;
1375 case arith::CmpFPredicate::OLT:
1376 return cmpResult == APFloat::cmpLessThan;
1377 case arith::CmpFPredicate::OLE:
1378 return cmpResult == APFloat::cmpLessThan || cmpResult == APFloat::cmpEqual;
1379 case arith::CmpFPredicate::ONE:
1380 return cmpResult != APFloat::cmpUnordered && cmpResult != APFloat::cmpEqual;
1381 case arith::CmpFPredicate::ORD:
1382 return cmpResult != APFloat::cmpUnordered;
1383 case arith::CmpFPredicate::UEQ:
1384 return cmpResult == APFloat::cmpUnordered || cmpResult == APFloat::cmpEqual;
1385 case arith::CmpFPredicate::UGT:
1386 return cmpResult == APFloat::cmpUnordered ||
1387 cmpResult == APFloat::cmpGreaterThan;
1388 case arith::CmpFPredicate::UGE:
1389 return cmpResult == APFloat::cmpUnordered ||
1390 cmpResult == APFloat::cmpGreaterThan ||
1391 cmpResult == APFloat::cmpEqual;
1392 case arith::CmpFPredicate::ULT:
1393 return cmpResult == APFloat::cmpUnordered ||
1394 cmpResult == APFloat::cmpLessThan;
1395 case arith::CmpFPredicate::ULE:
1396 return cmpResult == APFloat::cmpUnordered ||
1397 cmpResult == APFloat::cmpLessThan || cmpResult == APFloat::cmpEqual;
1398 case arith::CmpFPredicate::UNE:
1399 return cmpResult != APFloat::cmpEqual;
1400 case arith::CmpFPredicate::UNO:
1401 return cmpResult == APFloat::cmpUnordered;
1402 case arith::CmpFPredicate::AlwaysTrue:
1403 return true;
1404 }
1405 llvm_unreachable("unknown cmpf predicate kind")::llvm::llvm_unreachable_internal("unknown cmpf predicate kind"
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1405)
;
1406}
1407
1408OpFoldResult arith::CmpFOp::fold(ArrayRef<Attribute> operands) {
1409 assert(operands.size() == 2 && "cmpf takes two operands")(static_cast <bool> (operands.size() == 2 && "cmpf takes two operands"
) ? void (0) : __assert_fail ("operands.size() == 2 && \"cmpf takes two operands\""
, "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp", 1409, __extension__
__PRETTY_FUNCTION__))
;
1410
1411 auto lhs = operands.front().dyn_cast_or_null<FloatAttr>();
1412 auto rhs = operands.back().dyn_cast_or_null<FloatAttr>();
1413
1414 // If one operand is NaN, making them both NaN does not change the result.
1415 if (lhs && lhs.getValue().isNaN())
1416 rhs = lhs;
1417 if (rhs && rhs.getValue().isNaN())
1418 lhs = rhs;
1419
1420 if (!lhs || !rhs)
1421 return {};
1422
1423 auto val = applyCmpPredicate(getPredicate(), lhs.getValue(), rhs.getValue());
1424 return BoolAttr::get(getContext(), val);
1425}
1426
1427class CmpFIntToFPConst final : public OpRewritePattern<CmpFOp> {
1428public:
1429 using OpRewritePattern<CmpFOp>::OpRewritePattern;
1430
1431 static CmpIPredicate convertToIntegerPredicate(CmpFPredicate pred,
1432 bool isUnsigned) {
1433 using namespace arith;
1434 switch (pred) {
1435 case CmpFPredicate::UEQ:
1436 case CmpFPredicate::OEQ:
1437 return CmpIPredicate::eq;
1438 case CmpFPredicate::UGT:
1439 case CmpFPredicate::OGT:
1440 return isUnsigned ? CmpIPredicate::ugt : CmpIPredicate::sgt;
1441 case CmpFPredicate::UGE:
1442 case CmpFPredicate::OGE:
1443 return isUnsigned ? CmpIPredicate::uge : CmpIPredicate::sge;
1444 case CmpFPredicate::ULT:
1445 case CmpFPredicate::OLT:
1446 return isUnsigned ? CmpIPredicate::ult : CmpIPredicate::slt;
1447 case CmpFPredicate::ULE:
1448 case CmpFPredicate::OLE:
1449 return isUnsigned ? CmpIPredicate::ule : CmpIPredicate::sle;
1450 case CmpFPredicate::UNE:
1451 case CmpFPredicate::ONE:
1452 return CmpIPredicate::ne;
1453 default:
1454 llvm_unreachable("Unexpected predicate!")::llvm::llvm_unreachable_internal("Unexpected predicate!", "mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp"
, 1454)
;
1455 }
1456 }
1457
1458 LogicalResult matchAndRewrite(CmpFOp op,
1459 PatternRewriter &rewriter) const override {
1460 FloatAttr flt;
1461 if (!matchPattern(op.getRhs(), m_Constant(&flt)))
1462 return failure();
1463
1464 const APFloat &rhs = flt.getValue();
1465
1466 // Don't attempt to fold a nan.
1467 if (rhs.isNaN())
1468 return failure();
1469
1470 // Get the width of the mantissa. We don't want to hack on conversions that
1471 // might lose information from the integer, e.g. "i64 -> float"
1472 FloatType floatTy = op.getRhs().getType().cast<FloatType>();
1473 int mantissaWidth = floatTy.getFPMantissaWidth();
1474 if (mantissaWidth <= 0)
1475 return failure();
1476
1477 bool isUnsigned;
1478 Value intVal;
1479
1480 if (auto si = op.getLhs().getDefiningOp<SIToFPOp>()) {
1481 isUnsigned = false;
1482 intVal = si.getIn();
1483 } else if (auto ui = op.getLhs().getDefiningOp<UIToFPOp>()) {
1484 isUnsigned = true;
1485 intVal = ui.getIn();
1486 } else {
1487 return failure();
1488 }
1489
1490 // Check to see that the input is converted from an integer type that is
1491 // small enough that preserves all bits.
1492 auto intTy = intVal.getType().cast<IntegerType>();
1493 auto intWidth = intTy.getWidth();
1494
1495 // Number of bits representing values, as opposed to the sign
1496 auto valueBits = isUnsigned ? intWidth : (intWidth - 1);
1497
1498 // Following test does NOT adjust intWidth downwards for signed inputs,
1499 // because the most negative value still requires all the mantissa bits
1500 // to distinguish it from one less than that value.
1501 if ((int)intWidth > mantissaWidth) {
1502 // Conversion would lose accuracy. Check if loss can impact comparison.
1503 int exponent = ilogb(rhs);
1504 if (exponent == APFloat::IEK_Inf) {
1505 int maxExponent = ilogb(APFloat::getLargest(rhs.getSemantics()));
1506 if (maxExponent < (int)valueBits) {
1507 // Conversion could create infinity.
1508 return failure();
1509 }
1510 } else {
1511 // Note that if rhs is zero or NaN, then Exp is negative
1512 // and first condition is trivially false.
1513 if (mantissaWidth <= exponent && exponent <= (int)valueBits) {
1514 // Conversion could affect comparison.
1515 return failure();
1516 }
1517 }
1518 }
1519
1520 // Convert to equivalent cmpi predicate
1521 CmpIPredicate pred;
1522 switch (op.getPredicate()) {
1523 case CmpFPredicate::ORD:
1524 // Int to fp conversion doesn't create a nan (ord checks neither is a nan)
1525 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1526 /*width=*/1);
1527 return success();
1528 case CmpFPredicate::UNO:
1529 // Int to fp conversion doesn't create a nan (uno checks either is a nan)
1530 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1531 /*width=*/1);
1532 return success();
1533 default:
1534 pred = convertToIntegerPredicate(op.getPredicate(), isUnsigned);
1535 break;
1536 }
1537
1538 if (!isUnsigned) {
1539 // If the rhs value is > SignedMax, fold the comparison. This handles
1540 // +INF and large values.
1541 APFloat signedMax(rhs.getSemantics());
1542 signedMax.convertFromAPInt(APInt::getSignedMaxValue(intWidth), true,
1543 APFloat::rmNearestTiesToEven);
1544 if (signedMax < rhs) { // smax < 13123.0
1545 if (pred == CmpIPredicate::ne || pred == CmpIPredicate::slt ||
1546 pred == CmpIPredicate::sle)
1547 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1548 /*width=*/1);
1549 else
1550 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1551 /*width=*/1);
1552 return success();
1553 }
1554 } else {
1555 // If the rhs value is > UnsignedMax, fold the comparison. This handles
1556 // +INF and large values.
1557 APFloat unsignedMax(rhs.getSemantics());
1558 unsignedMax.convertFromAPInt(APInt::getMaxValue(intWidth), false,
1559 APFloat::rmNearestTiesToEven);
1560 if (unsignedMax < rhs) { // umax < 13123.0
1561 if (pred == CmpIPredicate::ne || pred == CmpIPredicate::ult ||
1562 pred == CmpIPredicate::ule)
1563 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1564 /*width=*/1);
1565 else
1566 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1567 /*width=*/1);
1568 return success();
1569 }
1570 }
1571
1572 if (!isUnsigned) {
1573 // See if the rhs value is < SignedMin.
1574 APFloat signedMin(rhs.getSemantics());
1575 signedMin.convertFromAPInt(APInt::getSignedMinValue(intWidth), true,
1576 APFloat::rmNearestTiesToEven);
1577 if (signedMin > rhs) { // smin > 12312.0
1578 if (pred == CmpIPredicate::ne || pred == CmpIPredicate::sgt ||
1579 pred == CmpIPredicate::sge)
1580 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1581 /*width=*/1);
1582 else
1583 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1584 /*width=*/1);
1585 return success();
1586 }
1587 } else {
1588 // See if the rhs value is < UnsignedMin.
1589 APFloat unsignedMin(rhs.getSemantics());
1590 unsignedMin.convertFromAPInt(APInt::getMinValue(intWidth), false,
1591 APFloat::rmNearestTiesToEven);
1592 if (unsignedMin > rhs) { // umin > 12312.0
1593 if (pred == CmpIPredicate::ne || pred == CmpIPredicate::ugt ||
1594 pred == CmpIPredicate::uge)
1595 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1596 /*width=*/1);
1597 else
1598 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1599 /*width=*/1);
1600 return success();
1601 }
1602 }
1603
1604 // Okay, now we know that the FP constant fits in the range [SMIN, SMAX] or
1605 // [0, UMAX], but it may still be fractional. See if it is fractional by
1606 // casting the FP value to the integer value and back, checking for
1607 // equality. Don't do this for zero, because -0.0 is not fractional.
1608 bool ignored;
1609 APSInt rhsInt(intWidth, isUnsigned);
1610 if (APFloat::opInvalidOp ==
1611 rhs.convertToInteger(rhsInt, APFloat::rmTowardZero, &ignored)) {
1612 // Undefined behavior invoked - the destination type can't represent
1613 // the input constant.
1614 return failure();
1615 }
1616
1617 if (!rhs.isZero()) {
1618 APFloat apf(floatTy.getFloatSemantics(),
1619 APInt::getZero(floatTy.getWidth()));
1620 apf.convertFromAPInt(rhsInt, !isUnsigned, APFloat::rmNearestTiesToEven);
1621
1622 bool equal = apf == rhs;
1623 if (!equal) {
1624 // If we had a comparison against a fractional value, we have to adjust
1625 // the compare predicate and sometimes the value. rhsInt is rounded
1626 // towards zero at this point.
1627 switch (pred) {
1628 case CmpIPredicate::ne: // (float)int != 4.4 --> true
1629 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1630 /*width=*/1);
1631 return success();
1632 case CmpIPredicate::eq: // (float)int == 4.4 --> false
1633 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1634 /*width=*/1);
1635 return success();
1636 case CmpIPredicate::ule:
1637 // (float)int <= 4.4 --> int <= 4
1638 // (float)int <= -4.4 --> false
1639 if (rhs.isNegative()) {
1640 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1641 /*width=*/1);
1642 return success();
1643 }
1644 break;
1645 case CmpIPredicate::sle:
1646 // (float)int <= 4.4 --> int <= 4
1647 // (float)int <= -4.4 --> int < -4
1648 if (rhs.isNegative())
1649 pred = CmpIPredicate::slt;
1650 break;
1651 case CmpIPredicate::ult:
1652 // (float)int < -4.4 --> false
1653 // (float)int < 4.4 --> int <= 4
1654 if (rhs.isNegative()) {
1655 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/false,
1656 /*width=*/1);
1657 return success();
1658 }
1659 pred = CmpIPredicate::ule;
1660 break;
1661 case CmpIPredicate::slt:
1662 // (float)int < -4.4 --> int < -4
1663 // (float)int < 4.4 --> int <= 4
1664 if (!rhs.isNegative())
1665 pred = CmpIPredicate::sle;
1666 break;
1667 case CmpIPredicate::ugt:
1668 // (float)int > 4.4 --> int > 4
1669 // (float)int > -4.4 --> true
1670 if (rhs.isNegative()) {
1671 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1672 /*width=*/1);
1673 return success();
1674 }
1675 break;
1676 case CmpIPredicate::sgt:
1677 // (float)int > 4.4 --> int > 4
1678 // (float)int > -4.4 --> int >= -4
1679 if (rhs.isNegative())
1680 pred = CmpIPredicate::sge;
1681 break;
1682 case CmpIPredicate::uge:
1683 // (float)int >= -4.4 --> true
1684 // (float)int >= 4.4 --> int > 4
1685 if (rhs.isNegative()) {
1686 rewriter.replaceOpWithNewOp<ConstantIntOp>(op, /*value=*/true,
1687 /*width=*/1);
1688 return success();
1689 }
1690 pred = CmpIPredicate::ugt;
1691 break;
1692 case CmpIPredicate::sge:
1693 // (float)int >= -4.4 --> int >= -4
1694 // (float)int >= 4.4 --> int > 4
1695 if (!rhs.isNegative())
1696 pred = CmpIPredicate::sgt;
1697 break;
1698 }
1699 }
1700 }
1701
1702 // Lower this FP comparison into an appropriate integer version of the
1703 // comparison.
1704 rewriter.replaceOpWithNewOp<CmpIOp>(
1705 op, pred, intVal,
1706 rewriter.create<ConstantOp>(
1707 op.getLoc(), intVal.getType(),
1708 rewriter.getIntegerAttr(intVal.getType(), rhsInt)));
1709 return success();
1710 }
1711};
1712
1713void arith::CmpFOp::getCanonicalizationPatterns(RewritePatternSet &patterns,
1714 MLIRContext *context) {
1715 patterns.insert<CmpFIntToFPConst>(context);
1716}
1717
1718//===----------------------------------------------------------------------===//
1719// SelectOp
1720//===----------------------------------------------------------------------===//
1721
1722// Transforms a select of a boolean to arithmetic operations
1723//
1724// arith.select %arg, %x, %y : i1
1725//
1726// becomes
1727//
1728// and(%arg, %x) or and(!%arg, %y)
1729struct SelectI1Simplify : public OpRewritePattern<arith::SelectOp> {
1730 using OpRewritePattern<arith::SelectOp>::OpRewritePattern;
1731
1732 LogicalResult matchAndRewrite(arith::SelectOp op,
1733 PatternRewriter &rewriter) const override {
1734 if (!op.getType().isInteger(1))
1735 return failure();
1736
1737 Value falseConstant =
1738 rewriter.create<arith::ConstantIntOp>(op.getLoc(), true, 1);
1739 Value notCondition = rewriter.create<arith::XOrIOp>(
1740 op.getLoc(), op.getCondition(), falseConstant);
1741
1742 Value trueVal = rewriter.create<arith::AndIOp>(
1743 op.getLoc(), op.getCondition(), op.getTrueValue());
1744 Value falseVal = rewriter.create<arith::AndIOp>(op.getLoc(), notCondition,
1745 op.getFalseValue());
1746 rewriter.replaceOpWithNewOp<arith::OrIOp>(op, trueVal, falseVal);
1747 return success();
1748 }
1749};
1750
1751// select %arg, %c1, %c0 => extui %arg
1752struct SelectToExtUI : public OpRewritePattern<arith::SelectOp> {
1753 using OpRewritePattern<arith::SelectOp>::OpRewritePattern;
1754
1755 LogicalResult matchAndRewrite(arith::SelectOp op,
1756 PatternRewriter &rewriter) const override {
1757 // Cannot extui i1 to i1, or i1 to f32
1758 if (!op.getType().isa<IntegerType>() || op.getType().isInteger(1))
1759 return failure();
1760
1761 // select %x, c1, %c0 => extui %arg
1762 if (matchPattern(op.getTrueValue(), m_One()))
1763 if (matchPattern(op.getFalseValue(), m_Zero())) {
1764 rewriter.replaceOpWithNewOp<arith::ExtUIOp>(op, op.getType(),
1765 op.getCondition());
1766 return success();
1767 }
1768
1769 // select %x, c0, %c1 => extui (xor %arg, true)
1770 if (matchPattern(op.getTrueValue(), m_Zero()))
1771 if (matchPattern(op.getFalseValue(), m_One())) {
1772 rewriter.replaceOpWithNewOp<arith::ExtUIOp>(
1773 op, op.getType(),
1774 rewriter.create<arith::XOrIOp>(
1775 op.getLoc(), op.getCondition(),
1776 rewriter.create<arith::ConstantIntOp>(
1777 op.getLoc(), 1, op.getCondition().getType())));
1778 return success();
1779 }
1780
1781 return failure();
1782 }
1783};
1784
1785void arith::SelectOp::getCanonicalizationPatterns(RewritePatternSet &results,
1786 MLIRContext *context) {
1787 results.add<SelectI1Simplify, SelectToExtUI>(context);
1788}
1789
1790OpFoldResult arith::SelectOp::fold(ArrayRef<Attribute> operands) {
1791 Value trueVal = getTrueValue();
1792 Value falseVal = getFalseValue();
1793 if (trueVal == falseVal)
1794 return trueVal;
1795
1796 Value condition = getCondition();
1797
1798 // select true, %0, %1 => %0
1799 if (matchPattern(condition, m_One()))
1800 return trueVal;
1801
1802 // select false, %0, %1 => %1
1803 if (matchPattern(condition, m_Zero()))
1804 return falseVal;
1805
1806 // select %x, true, false => %x
1807 if (getType().isInteger(1))
1808 if (matchPattern(getTrueValue(), m_One()))
1809 if (matchPattern(getFalseValue(), m_Zero()))
1810 return condition;
1811
1812 if (auto cmp = dyn_cast_or_null<arith::CmpIOp>(condition.getDefiningOp())) {
1813 auto pred = cmp.getPredicate();
1814 if (pred == arith::CmpIPredicate::eq || pred == arith::CmpIPredicate::ne) {
1815 auto cmpLhs = cmp.getLhs();
1816 auto cmpRhs = cmp.getRhs();
1817
1818 // %0 = arith.cmpi eq, %arg0, %arg1
1819 // %1 = arith.select %0, %arg0, %arg1 => %arg1
1820
1821 // %0 = arith.cmpi ne, %arg0, %arg1
1822 // %1 = arith.select %0, %arg0, %arg1 => %arg0
1823
1824 if ((cmpLhs == trueVal && cmpRhs == falseVal) ||
1825 (cmpRhs == trueVal && cmpLhs == falseVal))
1826 return pred == arith::CmpIPredicate::ne ? trueVal : falseVal;
1827 }
1828 }
1829 return nullptr;
1830}
1831
1832ParseResult SelectOp::parse(OpAsmParser &parser, OperationState &result) {
1833 Type conditionType, resultType;
1834 SmallVector<OpAsmParser::UnresolvedOperand, 3> operands;
1835 if (parser.parseOperandList(operands, /*requiredOperandCount=*/3) ||
1836 parser.parseOptionalAttrDict(result.attributes) ||
1837 parser.parseColonType(resultType))
1838 return failure();
1839
1840 // Check for the explicit condition type if this is a masked tensor or vector.
1841 if (succeeded(parser.parseOptionalComma())) {
1842 conditionType = resultType;
1843 if (parser.parseType(resultType))
1844 return failure();
1845 } else {
1846 conditionType = parser.getBuilder().getI1Type();
1847 }
1848
1849 result.addTypes(resultType);
1850 return parser.resolveOperands(operands,
1851 {conditionType, resultType, resultType},
1852 parser.getNameLoc(), result.operands);
1853}
1854
1855void arith::SelectOp::print(OpAsmPrinter &p) {
1856 p << " " << getOperands();
1857 p.printOptionalAttrDict((*this)->getAttrs());
1858 p << " : ";
1859 if (ShapedType condType = getCondition().getType().dyn_cast<ShapedType>())
1860 p << condType << ", ";
1861 p << getType();
1862}
1863
1864LogicalResult arith::SelectOp::verify() {
1865 Type conditionType = getCondition().getType();
1866 if (conditionType.isSignlessInteger(1))
1867 return success();
1868
1869 // If the result type is a vector or tensor, the type can be a mask with the
1870 // same elements.
1871 Type resultType = getType();
1872 if (!resultType.isa<TensorType, VectorType>())
1873 return emitOpError() << "expected condition to be a signless i1, but got "
1874 << conditionType;
1875 Type shapedConditionType = getI1SameShape(resultType);
1876 if (conditionType != shapedConditionType) {
1877 return emitOpError() << "expected condition type to have the same shape "
1878 "as the result type, expected "
1879 << shapedConditionType << ", but got "
1880 << conditionType;
1881 }
1882 return success();
1883}
1884//===----------------------------------------------------------------------===//
1885// ShLIOp
1886//===----------------------------------------------------------------------===//
1887
1888OpFoldResult arith::ShLIOp::fold(ArrayRef<Attribute> operands) {
1889 // Don't fold if shifting more than the bit width.
1890 bool bounded = false;
1891 auto result = constFoldBinaryOp<IntegerAttr>(
1892 operands, [&](const APInt &a, const APInt &b) {
1893 bounded = b.ule(b.getBitWidth());
1894 return a.shl(b);
1895 });
1896 return bounded ? result : Attribute();
1897}
1898
1899//===----------------------------------------------------------------------===//
1900// ShRUIOp
1901//===----------------------------------------------------------------------===//
1902
1903OpFoldResult arith::ShRUIOp::fold(ArrayRef<Attribute> operands) {
1904 // Don't fold if shifting more than the bit width.
1905 bool bounded = false;
1906 auto result = constFoldBinaryOp<IntegerAttr>(
1907 operands, [&](const APInt &a, const APInt &b) {
1908 bounded = b.ule(b.getBitWidth());
1909 return a.lshr(b);
1910 });
1911 return bounded ? result : Attribute();
1912}
1913
1914//===----------------------------------------------------------------------===//
1915// ShRSIOp
1916//===----------------------------------------------------------------------===//
1917
1918OpFoldResult arith::ShRSIOp::fold(ArrayRef<Attribute> operands) {
1919 // Don't fold if shifting more than the bit width.
1920 bool bounded = false;
1921 auto result = constFoldBinaryOp<IntegerAttr>(
1922 operands, [&](const APInt &a, const APInt &b) {
1923 bounded = b.ule(b.getBitWidth());
1924 return a.ashr(b);
1925 });
1926 return bounded ? result : Attribute();
1927}
1928
1929//===----------------------------------------------------------------------===//
1930// Atomic Enum
1931//===----------------------------------------------------------------------===//
1932
1933/// Returns the identity value attribute associated with an AtomicRMWKind op.
1934Attribute mlir::arith::getIdentityValueAttr(AtomicRMWKind kind, Type resultType,
1935 OpBuilder &builder, Location loc) {
1936 switch (kind) {
1937 case AtomicRMWKind::maxf:
1938 return builder.getFloatAttr(
1939 resultType,
1940 APFloat::getInf(resultType.cast<FloatType>().getFloatSemantics(),
1941 /*Negative=*/true));
1942 case AtomicRMWKind::addf:
1943 case AtomicRMWKind::addi:
1944 case AtomicRMWKind::maxu:
1945 case AtomicRMWKind::ori:
1946 return builder.getZeroAttr(resultType);
1947 case AtomicRMWKind::andi:
1948 return builder.getIntegerAttr(
1949 resultType,
1950 APInt::getAllOnes(resultType.cast<IntegerType>().getWidth()));
1951 case AtomicRMWKind::maxs:
1952 return builder.getIntegerAttr(
1953 resultType,
1954 APInt::getSignedMinValue(resultType.cast<IntegerType>().getWidth()));
1955 case AtomicRMWKind::minf:
1956 return builder.getFloatAttr(
1957 resultType,
1958 APFloat::getInf(resultType.cast<FloatType>().getFloatSemantics(),
1959 /*Negative=*/false));
1960 case AtomicRMWKind::mins:
1961 return builder.getIntegerAttr(
1962 resultType,
1963 APInt::getSignedMaxValue(resultType.cast<IntegerType>().getWidth()));
1964 case AtomicRMWKind::minu:
1965 return builder.getIntegerAttr(
1966 resultType,
1967 APInt::getMaxValue(resultType.cast<IntegerType>().getWidth()));
1968 case AtomicRMWKind::muli:
1969 return builder.getIntegerAttr(resultType, 1);
1970 case AtomicRMWKind::mulf:
1971 return builder.getFloatAttr(resultType, 1);
1972 // TODO: Add remaining reduction operations.
1973 default:
1974 (void)emitOptionalError(loc, "Reduction operation type not supported");
1975 break;
1976 }
1977 return nullptr;
1978}
1979
1980/// Returns the identity value associated with an AtomicRMWKind op.
1981Value mlir::arith::getIdentityValue(AtomicRMWKind op, Type resultType,
1982 OpBuilder &builder, Location loc) {
1983 Attribute attr = getIdentityValueAttr(op, resultType, builder, loc);
1984 return builder.create<arith::ConstantOp>(loc, attr);
1
Calling 'OpBuilder::create'
1985}
1986
1987/// Return the value obtained by applying the reduction operation kind
1988/// associated with a binary AtomicRMWKind op to `lhs` and `rhs`.
1989Value mlir::arith::getReductionOp(AtomicRMWKind op, OpBuilder &builder,
1990 Location loc, Value lhs, Value rhs) {
1991 switch (op) {
1992 case AtomicRMWKind::addf:
1993 return builder.create<arith::AddFOp>(loc, lhs, rhs);
1994 case AtomicRMWKind::addi:
1995 return builder.create<arith::AddIOp>(loc, lhs, rhs);
1996 case AtomicRMWKind::mulf:
1997 return builder.create<arith::MulFOp>(loc, lhs, rhs);
1998 case AtomicRMWKind::muli:
1999 return builder.create<arith::MulIOp>(loc, lhs, rhs);
2000 case AtomicRMWKind::maxf:
2001 return builder.create<arith::MaxFOp>(loc, lhs, rhs);
2002 case AtomicRMWKind::minf:
2003 return builder.create<arith::MinFOp>(loc, lhs, rhs);
2004 case AtomicRMWKind::maxs:
2005 return builder.create<arith::MaxSIOp>(loc, lhs, rhs);
2006 case AtomicRMWKind::mins:
2007 return builder.create<arith::MinSIOp>(loc, lhs, rhs);
2008 case AtomicRMWKind::maxu:
2009 return builder.create<arith::MaxUIOp>(loc, lhs, rhs);
2010 case AtomicRMWKind::minu:
2011 return builder.create<arith::MinUIOp>(loc, lhs, rhs);
2012 case AtomicRMWKind::ori:
2013 return builder.create<arith::OrIOp>(loc, lhs, rhs);
2014 case AtomicRMWKind::andi:
2015 return builder.create<arith::AndIOp>(loc, lhs, rhs);
2016 // TODO: Add remaining reduction operations.
2017 default:
2018 (void)emitOptionalError(loc, "Reduction operation type not supported");
2019 break;
2020 }
2021 return nullptr;
2022}
2023
2024//===----------------------------------------------------------------------===//
2025// TableGen'd op method definitions
2026//===----------------------------------------------------------------------===//
2027
2028#define GET_OP_CLASSES
2029#include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
2030
2031//===----------------------------------------------------------------------===//
2032// TableGen'd enum attribute definitions
2033//===----------------------------------------------------------------------===//
2034
2035#include "mlir/Dialect/Arithmetic/IR/ArithmeticOpsEnums.cpp.inc"

/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/include/mlir/IR/Builders.h

1//===- Builders.h - Helpers for constructing MLIR Classes -------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_IR_BUILDERS_H
10#define MLIR_IR_BUILDERS_H
11
12#include "mlir/IR/OpDefinition.h"
13#include "llvm/Support/Compiler.h"
14
15namespace mlir {
16
17class AffineExpr;
18class BlockAndValueMapping;
19class UnknownLoc;
20class FileLineColLoc;
21class Type;
22class PrimitiveType;
23class IntegerType;
24class FloatType;
25class FunctionType;
26class IndexType;
27class MemRefType;
28class VectorType;
29class RankedTensorType;
30class UnrankedTensorType;
31class TupleType;
32class NoneType;
33class BoolAttr;
34class IntegerAttr;
35class FloatAttr;
36class StringAttr;
37class TypeAttr;
38class ArrayAttr;
39class SymbolRefAttr;
40class ElementsAttr;
41class DenseElementsAttr;
42class DenseIntElementsAttr;
43class AffineMapAttr;
44class AffineMap;
45class UnitAttr;
46
47/// This class is a general helper class for creating context-global objects
48/// like types, attributes, and affine expressions.
49class Builder {
50public:
51 explicit Builder(MLIRContext *context) : context(context) {}
52 explicit Builder(Operation *op) : Builder(op->getContext()) {}
53
54 MLIRContext *getContext() const { return context; }
55
56 // Locations.
57 Location getUnknownLoc();
58 Location getFusedLoc(ArrayRef<Location> locs,
59 Attribute metadata = Attribute());
60
61 // Types.
62 FloatType getBF16Type();
63 FloatType getF16Type();
64 FloatType getF32Type();
65 FloatType getF64Type();
66 FloatType getF80Type();
67 FloatType getF128Type();
68
69 IndexType getIndexType();
70
71 IntegerType getI1Type();
72 IntegerType getI8Type();
73 IntegerType getI32Type();
74 IntegerType getI64Type();
75 IntegerType getIntegerType(unsigned width);
76 IntegerType getIntegerType(unsigned width, bool isSigned);
77 FunctionType getFunctionType(TypeRange inputs, TypeRange results);
78 TupleType getTupleType(TypeRange elementTypes);
79 NoneType getNoneType();
80
81 /// Get or construct an instance of the type 'ty' with provided arguments.
82 template <typename Ty, typename... Args>
83 Ty getType(Args... args) {
84 return Ty::get(context, args...);
85 }
86
87 // Attributes.
88 NamedAttribute getNamedAttr(StringRef name, Attribute val);
89
90 UnitAttr getUnitAttr();
91 BoolAttr getBoolAttr(bool value);
92 DictionaryAttr getDictionaryAttr(ArrayRef<NamedAttribute> value);
93 IntegerAttr getIntegerAttr(Type type, int64_t value);
94 IntegerAttr getIntegerAttr(Type type, const APInt &value);
95 FloatAttr getFloatAttr(Type type, double value);
96 FloatAttr getFloatAttr(Type type, const APFloat &value);
97 StringAttr getStringAttr(const Twine &bytes);
98 ArrayAttr getArrayAttr(ArrayRef<Attribute> value);
99
100 // Returns a 0-valued attribute of the given `type`. This function only
101 // supports boolean, integer, and 16-/32-/64-bit float types, and vector or
102 // ranked tensor of them. Returns null attribute otherwise.
103 Attribute getZeroAttr(Type type);
104
105 // Convenience methods for fixed types.
106 FloatAttr getF16FloatAttr(float value);
107 FloatAttr getF32FloatAttr(float value);
108 FloatAttr getF64FloatAttr(double value);
109
110 IntegerAttr getI8IntegerAttr(int8_t value);
111 IntegerAttr getI16IntegerAttr(int16_t value);
112 IntegerAttr getI32IntegerAttr(int32_t value);
113 IntegerAttr getI64IntegerAttr(int64_t value);
114 IntegerAttr getIndexAttr(int64_t value);
115
116 /// Signed and unsigned integer attribute getters.
117 IntegerAttr getSI32IntegerAttr(int32_t value);
118 IntegerAttr getUI32IntegerAttr(uint32_t value);
119
120 /// Vector-typed DenseIntElementsAttr getters. `values` must not be empty.
121 DenseIntElementsAttr getBoolVectorAttr(ArrayRef<bool> values);
122 DenseIntElementsAttr getI32VectorAttr(ArrayRef<int32_t> values);
123 DenseIntElementsAttr getI64VectorAttr(ArrayRef<int64_t> values);
124 DenseIntElementsAttr getIndexVectorAttr(ArrayRef<int64_t> values);
125
126 /// Tensor-typed DenseIntElementsAttr getters. `values` can be empty.
127 /// These are generally preferable for representing general lists of integers
128 /// as attributes.
129 DenseIntElementsAttr getI32TensorAttr(ArrayRef<int32_t> values);
130 DenseIntElementsAttr getI64TensorAttr(ArrayRef<int64_t> values);
131 DenseIntElementsAttr getIndexTensorAttr(ArrayRef<int64_t> values);
132
133 ArrayAttr getAffineMapArrayAttr(ArrayRef<AffineMap> values);
134 ArrayAttr getBoolArrayAttr(ArrayRef<bool> values);
135 ArrayAttr getI32ArrayAttr(ArrayRef<int32_t> values);
136 ArrayAttr getI64ArrayAttr(ArrayRef<int64_t> values);
137 ArrayAttr getIndexArrayAttr(ArrayRef<int64_t> values);
138 ArrayAttr getF32ArrayAttr(ArrayRef<float> values);
139 ArrayAttr getF64ArrayAttr(ArrayRef<double> values);
140 ArrayAttr getStrArrayAttr(ArrayRef<StringRef> values);
141 ArrayAttr getTypeArrayAttr(TypeRange values);
142
143 // Affine expressions and affine maps.
144 AffineExpr getAffineDimExpr(unsigned position);
145 AffineExpr getAffineSymbolExpr(unsigned position);
146 AffineExpr getAffineConstantExpr(int64_t constant);
147
148 // Special cases of affine maps and integer sets
149 /// Returns a zero result affine map with no dimensions or symbols: () -> ().
150 AffineMap getEmptyAffineMap();
151 /// Returns a single constant result affine map with 0 dimensions and 0
152 /// symbols. One constant result: () -> (val).
153 AffineMap getConstantAffineMap(int64_t val);
154 // One dimension id identity map: (i) -> (i).
155 AffineMap getDimIdentityMap();
156 // Multi-dimensional identity map: (d0, d1, d2) -> (d0, d1, d2).
157 AffineMap getMultiDimIdentityMap(unsigned rank);
158 // One symbol identity map: ()[s] -> (s).
159 AffineMap getSymbolIdentityMap();
160
161 /// Returns a map that shifts its (single) input dimension by 'shift'.
162 /// (d0) -> (d0 + shift)
163 AffineMap getSingleDimShiftAffineMap(int64_t shift);
164
165 /// Returns an affine map that is a translation (shift) of all result
166 /// expressions in 'map' by 'shift'.
167 /// Eg: input: (d0, d1)[s0] -> (d0, d1 + s0), shift = 2
168 /// returns: (d0, d1)[s0] -> (d0 + 2, d1 + s0 + 2)
169 AffineMap getShiftedAffineMap(AffineMap map, int64_t shift);
170
171protected:
172 MLIRContext *context;
173};
174
175/// This class helps build Operations. Operations that are created are
176/// automatically inserted at an insertion point. The builder is copyable.
177class OpBuilder : public Builder {
178public:
179 struct Listener;
180
181 /// Create a builder with the given context.
182 explicit OpBuilder(MLIRContext *ctx, Listener *listener = nullptr)
183 : Builder(ctx), listener(listener) {}
184
185 /// Create a builder and set the insertion point to the start of the region.
186 explicit OpBuilder(Region *region, Listener *listener = nullptr)
187 : OpBuilder(region->getContext(), listener) {
188 if (!region->empty())
189 setInsertionPoint(&region->front(), region->front().begin());
190 }
191 explicit OpBuilder(Region &region, Listener *listener = nullptr)
192 : OpBuilder(&region, listener) {}
193
194 /// Create a builder and set insertion point to the given operation, which
195 /// will cause subsequent insertions to go right before it.
196 explicit OpBuilder(Operation *op, Listener *listener = nullptr)
197 : OpBuilder(op->getContext(), listener) {
198 setInsertionPoint(op);
199 }
200
201 OpBuilder(Block *block, Block::iterator insertPoint,
202 Listener *listener = nullptr)
203 : OpBuilder(block->getParent()->getContext(), listener) {
204 setInsertionPoint(block, insertPoint);
205 }
206
207 /// Create a builder and set the insertion point to before the first operation
208 /// in the block but still inside the block.
209 static OpBuilder atBlockBegin(Block *block, Listener *listener = nullptr) {
210 return OpBuilder(block, block->begin(), listener);
211 }
212
213 /// Create a builder and set the insertion point to after the last operation
214 /// in the block but still inside the block.
215 static OpBuilder atBlockEnd(Block *block, Listener *listener = nullptr) {
216 return OpBuilder(block, block->end(), listener);
217 }
218
219 /// Create a builder and set the insertion point to before the block
220 /// terminator.
221 static OpBuilder atBlockTerminator(Block *block,
222 Listener *listener = nullptr) {
223 auto *terminator = block->getTerminator();
224 assert(terminator != nullptr && "the block has no terminator")(static_cast <bool> (terminator != nullptr && "the block has no terminator"
) ? void (0) : __assert_fail ("terminator != nullptr && \"the block has no terminator\""
, "mlir/include/mlir/IR/Builders.h", 224, __extension__ __PRETTY_FUNCTION__
))
;
225 return OpBuilder(block, Block::iterator(terminator), listener);
226 }
227
228 //===--------------------------------------------------------------------===//
229 // Listeners
230 //===--------------------------------------------------------------------===//
231
232 /// This class represents a listener that may be used to hook into various
233 /// actions within an OpBuilder.
234 struct Listener {
235 virtual ~Listener();
236
237 /// Notification handler for when an operation is inserted into the builder.
238 /// `op` is the operation that was inserted.
239 virtual void notifyOperationInserted(Operation *op) {}
240
241 /// Notification handler for when a block is created using the builder.
242 /// `block` is the block that was created.
243 virtual void notifyBlockCreated(Block *block) {}
244 };
245
246 /// Sets the listener of this builder to the one provided.
247 void setListener(Listener *newListener) { listener = newListener; }
248
249 /// Returns the current listener of this builder, or nullptr if this builder
250 /// doesn't have a listener.
251 Listener *getListener() const { return listener; }
252
253 //===--------------------------------------------------------------------===//
254 // Insertion Point Management
255 //===--------------------------------------------------------------------===//
256
257 /// This class represents a saved insertion point.
258 class InsertPoint {
259 public:
260 /// Creates a new insertion point which doesn't point to anything.
261 InsertPoint() = default;
262
263 /// Creates a new insertion point at the given location.
264 InsertPoint(Block *insertBlock, Block::iterator insertPt)
265 : block(insertBlock), point(insertPt) {}
266
267 /// Returns true if this insert point is set.
268 bool isSet() const { return (block != nullptr); }
269
270 Block *getBlock() const { return block; }
271 Block::iterator getPoint() const { return point; }
272
273 private:
274 Block *block = nullptr;
275 Block::iterator point;
276 };
277
278 /// RAII guard to reset the insertion point of the builder when destroyed.
279 class InsertionGuard {
280 public:
281 InsertionGuard(OpBuilder &builder)
282 : builder(&builder), ip(builder.saveInsertionPoint()) {}
283
284 ~InsertionGuard() {
285 if (builder)
286 builder->restoreInsertionPoint(ip);
287 }
288
289 InsertionGuard(const InsertionGuard &) = delete;
290 InsertionGuard &operator=(const InsertionGuard &) = delete;
291
292 /// Implement the move constructor to clear the builder field of `other`.
293 /// That way it does not restore the insertion point upon destruction as
294 /// that should be done exclusively by the just constructed InsertionGuard.
295 InsertionGuard(InsertionGuard &&other) noexcept
296 : builder(other.builder), ip(other.ip) {
297 other.builder = nullptr;
298 }
299
300 InsertionGuard &operator=(InsertionGuard &&other) = delete;
301
302 private:
303 OpBuilder *builder;
304 OpBuilder::InsertPoint ip;
305 };
306
307 /// Reset the insertion point to no location. Creating an operation without a
308 /// set insertion point is an error, but this can still be useful when the
309 /// current insertion point a builder refers to is being removed.
310 void clearInsertionPoint() {
311 this->block = nullptr;
312 insertPoint = Block::iterator();
313 }
314
315 /// Return a saved insertion point.
316 InsertPoint saveInsertionPoint() const {
317 return InsertPoint(getInsertionBlock(), getInsertionPoint());
318 }
319
320 /// Restore the insert point to a previously saved point.
321 void restoreInsertionPoint(InsertPoint ip) {
322 if (ip.isSet())
323 setInsertionPoint(ip.getBlock(), ip.getPoint());
324 else
325 clearInsertionPoint();
326 }
327
328 /// Set the insertion point to the specified location.
329 void setInsertionPoint(Block *block, Block::iterator insertPoint) {
330 // TODO: check that insertPoint is in this rather than some other block.
331 this->block = block;
332 this->insertPoint = insertPoint;
333 }
334
335 /// Sets the insertion point to the specified operation, which will cause
336 /// subsequent insertions to go right before it.
337 void setInsertionPoint(Operation *op) {
338 setInsertionPoint(op->getBlock(), Block::iterator(op));
339 }
340
341 /// Sets the insertion point to the node after the specified operation, which
342 /// will cause subsequent insertions to go right after it.
343 void setInsertionPointAfter(Operation *op) {
344 setInsertionPoint(op->getBlock(), ++Block::iterator(op));
345 }
346
347 /// Sets the insertion point to the node after the specified value. If value
348 /// has a defining operation, sets the insertion point to the node after such
349 /// defining operation. This will cause subsequent insertions to go right
350 /// after it. Otherwise, value is a BlockArgument. Sets the insertion point to
351 /// the start of its block.
352 void setInsertionPointAfterValue(Value val) {
353 if (Operation *op = val.getDefiningOp()) {
354 setInsertionPointAfter(op);
355 } else {
356 auto blockArg = val.cast<BlockArgument>();
357 setInsertionPointToStart(blockArg.getOwner());
358 }
359 }
360
361 /// Sets the insertion point to the start of the specified block.
362 void setInsertionPointToStart(Block *block) {
363 setInsertionPoint(block, block->begin());
364 }
365
366 /// Sets the insertion point to the end of the specified block.
367 void setInsertionPointToEnd(Block *block) {
368 setInsertionPoint(block, block->end());
369 }
370
371 /// Return the block the current insertion point belongs to. Note that the
372 /// the insertion point is not necessarily the end of the block.
373 Block *getInsertionBlock() const { return block; }
374
375 /// Returns the current insertion point of the builder.
376 Block::iterator getInsertionPoint() const { return insertPoint; }
377
378 /// Returns the current block of the builder.
379 Block *getBlock() const { return block; }
380
381 //===--------------------------------------------------------------------===//
382 // Block Creation
383 //===--------------------------------------------------------------------===//
384
385 /// Add new block with 'argTypes' arguments and set the insertion point to the
386 /// end of it. The block is inserted at the provided insertion point of
387 /// 'parent'. `locs` contains the locations of the inserted arguments, and
388 /// should match the size of `argTypes`.
389 Block *createBlock(Region *parent, Region::iterator insertPt = {},
390 TypeRange argTypes = llvm::None,
391 ArrayRef<Location> locs = llvm::None);
392
393 /// Add new block with 'argTypes' arguments and set the insertion point to the
394 /// end of it. The block is placed before 'insertBefore'. `locs` contains the
395 /// locations of the inserted arguments, and should match the size of
396 /// `argTypes`.
397 Block *createBlock(Block *insertBefore, TypeRange argTypes = llvm::None,
398 ArrayRef<Location> locs = llvm::None);
399
400 //===--------------------------------------------------------------------===//
401 // Operation Creation
402 //===--------------------------------------------------------------------===//
403
404 /// Insert the given operation at the current insertion point and return it.
405 Operation *insert(Operation *op);
406
407 /// Creates an operation given the fields represented as an OperationState.
408 Operation *create(const OperationState &state);
409
410 /// Creates an operation with the given fields.
411 Operation *create(Location loc, StringAttr opName, ValueRange operands,
412 TypeRange types = {},
413 ArrayRef<NamedAttribute> attributes = {},
414 BlockRange successors = {},
415 MutableArrayRef<std::unique_ptr<Region>> regions = {});
416
417private:
418 /// Helper for sanity checking preconditions for create* methods below.
419 template <typename OpT>
420 RegisteredOperationName getCheckRegisteredInfo(MLIRContext *ctx) {
421 Optional<RegisteredOperationName> opName =
422 RegisteredOperationName::lookup(OpT::getOperationName(), ctx);
423 if (LLVM_UNLIKELY(!opName)__builtin_expect((bool)(!opName), false)) {
424 llvm::report_fatal_error(
425 "Building op `" + OpT::getOperationName() +
426 "` but it isn't registered in this MLIRContext: the dialect may not "
427 "be loaded or this operation isn't registered by the dialect. See "
428 "also https://mlir.llvm.org/getting_started/Faq/"
429 "#registered-loaded-dependent-whats-up-with-dialects-management");
430 }
431 return *opName;
432 }
433
434public:
435 /// Create an operation of specific op type at the current insertion point.
436 template <typename OpTy, typename... Args>
437 OpTy create(Location location, Args &&...args) {
438 OperationState state(location,
439 getCheckRegisteredInfo<OpTy>(location.getContext()));
440 OpTy::build(*this, state, std::forward<Args>(args)...);
2
Null pointer value stored to 'value.impl'
3
Calling 'ConstantOp::build'
441 auto *op = create(state);
442 auto result = dyn_cast<OpTy>(op);
443 assert(result && "builder didn't return the right type")(static_cast <bool> (result && "builder didn't return the right type"
) ? void (0) : __assert_fail ("result && \"builder didn't return the right type\""
, "mlir/include/mlir/IR/Builders.h", 443, __extension__ __PRETTY_FUNCTION__
))
;
444 return result;
445 }
446
447 /// Create an operation of specific op type at the current insertion point,
448 /// and immediately try to fold it. This functions populates 'results' with
449 /// the results after folding the operation.
450 template <typename OpTy, typename... Args>
451 void createOrFold(SmallVectorImpl<Value> &results, Location location,
452 Args &&...args) {
453 // Create the operation without using 'create' as we don't want to
454 // insert it yet.
455 OperationState state(location,
456 getCheckRegisteredInfo<OpTy>(location.getContext()));
457 OpTy::build(*this, state, std::forward<Args>(args)...);
458 Operation *op = Operation::create(state);
459
460 // Fold the operation. If successful destroy it, otherwise insert it.
461 if (succeeded(tryFold(op, results)))
462 op->destroy();
463 else
464 insert(op);
465 }
466
467 /// Overload to create or fold a single result operation.
468 template <typename OpTy, typename... Args>
469 typename std::enable_if<OpTy::template hasTrait<OpTrait::OneResult>(),
470 Value>::type
471 createOrFold(Location location, Args &&...args) {
472 SmallVector<Value, 1> results;
473 createOrFold<OpTy>(results, location, std::forward<Args>(args)...);
474 return results.front();
475 }
476
477 /// Overload to create or fold a zero result operation.
478 template <typename OpTy, typename... Args>
479 typename std::enable_if<OpTy::template hasTrait<OpTrait::ZeroResult>(),
480 OpTy>::type
481 createOrFold(Location location, Args &&...args) {
482 auto op = create<OpTy>(location, std::forward<Args>(args)...);
483 SmallVector<Value, 0> unused;
484 (void)tryFold(op.getOperation(), unused);
485
486 // Folding cannot remove a zero-result operation, so for convenience we
487 // continue to return it.
488 return op;
489 }
490
491 /// Attempts to fold the given operation and places new results within
492 /// 'results'. Returns success if the operation was folded, failure otherwise.
493 /// Note: This function does not erase the operation on a successful fold.
494 LogicalResult tryFold(Operation *op, SmallVectorImpl<Value> &results);
495
496 /// Creates a deep copy of the specified operation, remapping any operands
497 /// that use values outside of the operation using the map that is provided
498 /// ( leaving them alone if no entry is present). Replaces references to
499 /// cloned sub-operations to the corresponding operation that is copied,
500 /// and adds those mappings to the map.
501 Operation *clone(Operation &op, BlockAndValueMapping &mapper);
502 Operation *clone(Operation &op);
503
504 /// Creates a deep copy of this operation but keep the operation regions
505 /// empty. Operands are remapped using `mapper` (if present), and `mapper` is
506 /// updated to contain the results.
507 Operation *cloneWithoutRegions(Operation &op, BlockAndValueMapping &mapper) {
508 return insert(op.cloneWithoutRegions(mapper));
509 }
510 Operation *cloneWithoutRegions(Operation &op) {
511 return insert(op.cloneWithoutRegions());
512 }
513 template <typename OpT>
514 OpT cloneWithoutRegions(OpT op) {
515 return cast<OpT>(cloneWithoutRegions(*op.getOperation()));
516 }
517
518private:
519 /// The current block this builder is inserting into.
520 Block *block = nullptr;
521 /// The insertion point within the block that this builder is inserting
522 /// before.
523 Block::iterator insertPoint;
524 /// The optional listener for events of this builder.
525 Listener *listener;
526};
527
528} // namespace mlir
529
530#endif

tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc

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::mlir::arith::AddFOp,
13::mlir::arith::AddIOp,
14::mlir::arith::AndIOp,
15::mlir::arith::BitcastOp,
16::mlir::arith::CeilDivSIOp,
17::mlir::arith::CeilDivUIOp,
18::mlir::arith::CmpFOp,
19::mlir::arith::CmpIOp,
20::mlir::arith::ConstantOp,
21::mlir::arith::DivFOp,
22::mlir::arith::DivSIOp,
23::mlir::arith::DivUIOp,
24::mlir::arith::ExtFOp,
25::mlir::arith::ExtSIOp,
26::mlir::arith::ExtUIOp,
27::mlir::arith::FPToSIOp,
28::mlir::arith::FPToUIOp,
29::mlir::arith::FloorDivSIOp,
30::mlir::arith::IndexCastOp,
31::mlir::arith::MaxFOp,
32::mlir::arith::MaxSIOp,
33::mlir::arith::MaxUIOp,
34::mlir::arith::MinFOp,
35::mlir::arith::MinSIOp,
36::mlir::arith::MinUIOp,
37::mlir::arith::MulFOp,
38::mlir::arith::MulIOp,
39::mlir::arith::NegFOp,
40::mlir::arith::OrIOp,
41::mlir::arith::RemFOp,
42::mlir::arith::RemSIOp,
43::mlir::arith::RemUIOp,
44::mlir::arith::SIToFPOp,
45::mlir::arith::ShLIOp,
46::mlir::arith::ShRSIOp,
47::mlir::arith::ShRUIOp,
48::mlir::arith::SubFOp,
49::mlir::arith::SubIOp,
50::mlir::arith::TruncFOp,
51::mlir::arith::TruncIOp,
52::mlir::arith::UIToFPOp,
53::mlir::arith::XOrIOp,
54::mlir::arith::SelectOp
55#endif // GET_OP_LIST
56
57#ifdef GET_OP_CLASSES
58#undef GET_OP_CLASSES
59
60
61//===----------------------------------------------------------------------===//
62// Local Utility Method Definitions
63//===----------------------------------------------------------------------===//
64
65namespace mlir {
66namespace arith {
67
68static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps0(
69 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
70 unsigned valueIndex) {
71 if (!(((type.isa<::mlir::FloatType>())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
72 return op->emitOpError(valueKind) << " #" << valueIndex
73 << " must be floating-point-like, but got " << type;
74 }
75 return ::mlir::success();
76}
77
78static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps1(
79 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
80 unsigned valueIndex) {
81 if (!(((type.isSignlessIntOrIndex())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
82 return op->emitOpError(valueKind) << " #" << valueIndex
83 << " must be signless-integer-like, but got " << type;
84 }
85 return ::mlir::success();
86}
87
88static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps2(
89 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
90 unsigned valueIndex) {
91 if (!(((((type.isSignlessIntOrIndex())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType())))) || (((type.isa<::mlir::FloatType>())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))))) || (((type.isa<::mlir::MemRefType>())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((elementType.isa<::mlir::IndexType>())) || ((elementType.isa<::mlir::FloatType>())); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
92 return op->emitOpError(valueKind) << " #" << valueIndex
93 << " must be signless-integer-or-float-like or memref of signless-integer or float, but got " << type;
94 }
95 return ::mlir::success();
96}
97
98static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps3(
99 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
100 unsigned valueIndex) {
101 if (!(((type.isSignlessInteger(1))) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
102 return op->emitOpError(valueKind) << " #" << valueIndex
103 << " must be bool-like, but got " << type;
104 }
105 return ::mlir::success();
106}
107
108static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps4(
109 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
110 unsigned valueIndex) {
111 if (!(((type.isSignlessIntOrIndex())) || (((type.isa<::mlir::VectorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
112 return op->emitOpError(valueKind) << " #" << valueIndex
113 << " must be signless-integer-like, but got " << type;
114 }
115 return ::mlir::success();
116}
117
118static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps5(
119 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
120 unsigned valueIndex) {
121 if (!(((type.isSignlessInteger(1))) || (((type.isa<::mlir::VectorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger(1)); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
122 return op->emitOpError(valueKind) << " #" << valueIndex
123 << " must be bool-like, but got " << type;
124 }
125 return ::mlir::success();
126}
127
128static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps6(
129 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
130 unsigned valueIndex) {
131 if (!((true))) {
132 return op->emitOpError(valueKind) << " #" << valueIndex
133 << " must be any type, but got " << type;
134 }
135 return ::mlir::success();
136}
137
138static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps7(
139 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
140 unsigned valueIndex) {
141 if (!(((type.isSignlessInteger())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessInteger()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
142 return op->emitOpError(valueKind) << " #" << valueIndex
143 << " must be signless-fixed-width-integer-like, but got " << type;
144 }
145 return ::mlir::success();
146}
147
148static ::mlir::LogicalResult __mlir_ods_local_type_constraint_ArithmeticOps8(
149 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
150 unsigned valueIndex) {
151 if (!((((type.isSignlessIntOrIndex())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType())))) || (((type.isa<::mlir::MemRefType>())) && ([](::mlir::Type elementType) { return ((elementType.isSignlessInteger())) || ((elementType.isa<::mlir::IndexType>())); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
152 return op->emitOpError(valueKind) << " #" << valueIndex
153 << " must be signless-integer-like or memref of signless-integer, but got " << type;
154 }
155 return ::mlir::success();
156}
157
158static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithmeticOps0(
159 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
160 if (attr && !((attr.isa<::mlir::arith::CmpFPredicateAttr>()))) {
161 return op->emitOpError("attribute '") << attrName
162 << "' 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";
163 }
164 return ::mlir::success();
165}
166
167static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithmeticOps1(
168 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
169 if (attr && !((attr.isa<::mlir::arith::CmpIPredicateAttr>()))) {
170 return op->emitOpError("attribute '") << attrName
171 << "' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9";
172 }
173 return ::mlir::success();
174}
175
176static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_ArithmeticOps2(
177 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
178 if (attr && !((true))) {
179 return op->emitOpError("attribute '") << attrName
180 << "' failed to satisfy constraint: any attribute";
181 }
182 return ::mlir::success();
183}
184} // namespace arith
185} // namespace mlir
186namespace mlir {
187namespace arith {
188
189//===----------------------------------------------------------------------===//
190// ::mlir::arith::AddFOp definitions
191//===----------------------------------------------------------------------===//
192
193AddFOpAdaptor::AddFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
194 odsOpName.emplace("arith.addf", odsAttrs.getContext());
195}
196
197AddFOpAdaptor::AddFOpAdaptor(AddFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
198
199::mlir::ValueRange AddFOpAdaptor::getOperands() {
200 return odsOperands;
201}
202
203std::pair<unsigned, unsigned> AddFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
204 return {index, 1};
205}
206
207::mlir::ValueRange AddFOpAdaptor::getODSOperands(unsigned index) {
208 auto valueRange = getODSOperandIndexAndLength(index);
209 return {std::next(odsOperands.begin(), valueRange.first),
210 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
211}
212
213::mlir::Value AddFOpAdaptor::getLhs() {
214 return *getODSOperands(0).begin();
215}
216
217::mlir::Value AddFOpAdaptor::getRhs() {
218 return *getODSOperands(1).begin();
219}
220
221::mlir::DictionaryAttr AddFOpAdaptor::getAttributes() {
222 return odsAttrs;
223}
224
225::mlir::LogicalResult AddFOpAdaptor::verify(::mlir::Location loc) {
226 return ::mlir::success();
227}
228
229std::pair<unsigned, unsigned> AddFOp::getODSOperandIndexAndLength(unsigned index) {
230 return {index, 1};
231}
232
233::mlir::Operation::operand_range AddFOp::getODSOperands(unsigned index) {
234 auto valueRange = getODSOperandIndexAndLength(index);
235 return {std::next(getOperation()->operand_begin(), valueRange.first),
236 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
237}
238
239::mlir::Value AddFOp::getLhs() {
240 return *getODSOperands(0).begin();
241}
242
243::mlir::Value AddFOp::getRhs() {
244 return *getODSOperands(1).begin();
245}
246
247::mlir::MutableOperandRange AddFOp::getLhsMutable() {
248 auto range = getODSOperandIndexAndLength(0);
249 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
250 return mutableRange;
251}
252
253::mlir::MutableOperandRange AddFOp::getRhsMutable() {
254 auto range = getODSOperandIndexAndLength(1);
255 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
256 return mutableRange;
257}
258
259std::pair<unsigned, unsigned> AddFOp::getODSResultIndexAndLength(unsigned index) {
260 return {index, 1};
261}
262
263::mlir::Operation::result_range AddFOp::getODSResults(unsigned index) {
264 auto valueRange = getODSResultIndexAndLength(index);
265 return {std::next(getOperation()->result_begin(), valueRange.first),
266 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
267}
268
269::mlir::Value AddFOp::getResult() {
270 return *getODSResults(0).begin();
271}
272
273void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
274 odsState.addOperands(lhs);
275 odsState.addOperands(rhs);
276 odsState.addTypes(result);
277}
278
279void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
280 odsState.addOperands(lhs);
281 odsState.addOperands(rhs);
282 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 282, __extension__ __PRETTY_FUNCTION__))
;
283 odsState.addTypes(resultTypes);
284}
285
286void AddFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
287 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 287, __extension__ __PRETTY_FUNCTION__))
;
288 odsState.addOperands(operands);
289 odsState.addAttributes(attributes);
290 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 290, __extension__ __PRETTY_FUNCTION__))
;
291 odsState.addTypes(resultTypes);
292}
293
294void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
295 odsState.addOperands(lhs);
296 odsState.addOperands(rhs);
297 odsState.addTypes({lhs.getType()});
298
299}
300
301void AddFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
302 odsState.addOperands(operands);
303 odsState.addAttributes(attributes);
304 odsState.addTypes({operands[0].getType()});
305
306}
307
308::mlir::LogicalResult AddFOp::verifyInvariantsImpl() {
309 {
310 unsigned index = 0; (void)index;
311 auto valueGroup0 = getODSOperands(0);
312
313 for (auto v : valueGroup0) {
314 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
315 return ::mlir::failure();
316 }
317 auto valueGroup1 = getODSOperands(1);
318
319 for (auto v : valueGroup1) {
320 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
321 return ::mlir::failure();
322 }
323 }
324 {
325 unsigned index = 0; (void)index;
326 auto valueGroup0 = getODSResults(0);
327
328 for (auto v : valueGroup0) {
329 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
330 return ::mlir::failure();
331 }
332 }
333 return ::mlir::success();
334}
335
336::mlir::LogicalResult AddFOp::verifyInvariants() {
337 return verifyInvariantsImpl();
338}
339
340::mlir::ParseResult AddFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
341 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
342 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
343 (void)lhsOperandsLoc;
344 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
345 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
346 (void)rhsOperandsLoc;
347 ::mlir::Type resultRawTypes[1];
348 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
349
350 lhsOperandsLoc = parser.getCurrentLocation();
351 if (parser.parseOperand(lhsRawOperands[0]))
352 return ::mlir::failure();
353 if (parser.parseComma())
354 return ::mlir::failure();
355
356 rhsOperandsLoc = parser.getCurrentLocation();
357 if (parser.parseOperand(rhsRawOperands[0]))
358 return ::mlir::failure();
359 if (parser.parseOptionalAttrDict(result.attributes))
360 return ::mlir::failure();
361 if (parser.parseColon())
362 return ::mlir::failure();
363
364 {
365 ::mlir::Type type;
366 if (parser.parseCustomTypeWithFallback(type))
367 return ::mlir::failure();
368 resultRawTypes[0] = type;
369 }
370 result.addTypes(resultTypes);
371 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
372 return ::mlir::failure();
373 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
374 return ::mlir::failure();
375 return ::mlir::success();
376}
377
378void AddFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
379 _odsPrinter << ' ';
380 _odsPrinter << getLhs();
381 _odsPrinter << ",";
382 _odsPrinter << ' ';
383 _odsPrinter << getRhs();
384 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
385 _odsPrinter << ' ' << ":";
386 _odsPrinter << ' ';
387 {
388 auto type = getResult().getType();
389 if (auto validType = type.dyn_cast<::mlir::Type>())
390 _odsPrinter.printStrippedAttrOrType(validType);
391 else
392 _odsPrinter << type;
393 }
394}
395
396void AddFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
397}
398
399} // namespace arith
400} // namespace mlir
401MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AddFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::AddFOp>::id = {}; } }
402
403namespace mlir {
404namespace arith {
405
406//===----------------------------------------------------------------------===//
407// ::mlir::arith::AddIOp definitions
408//===----------------------------------------------------------------------===//
409
410AddIOpAdaptor::AddIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
411 odsOpName.emplace("arith.addi", odsAttrs.getContext());
412}
413
414AddIOpAdaptor::AddIOpAdaptor(AddIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
415
416::mlir::ValueRange AddIOpAdaptor::getOperands() {
417 return odsOperands;
418}
419
420std::pair<unsigned, unsigned> AddIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
421 return {index, 1};
422}
423
424::mlir::ValueRange AddIOpAdaptor::getODSOperands(unsigned index) {
425 auto valueRange = getODSOperandIndexAndLength(index);
426 return {std::next(odsOperands.begin(), valueRange.first),
427 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
428}
429
430::mlir::Value AddIOpAdaptor::getLhs() {
431 return *getODSOperands(0).begin();
432}
433
434::mlir::Value AddIOpAdaptor::getRhs() {
435 return *getODSOperands(1).begin();
436}
437
438::mlir::DictionaryAttr AddIOpAdaptor::getAttributes() {
439 return odsAttrs;
440}
441
442::mlir::LogicalResult AddIOpAdaptor::verify(::mlir::Location loc) {
443 return ::mlir::success();
444}
445
446std::pair<unsigned, unsigned> AddIOp::getODSOperandIndexAndLength(unsigned index) {
447 return {index, 1};
448}
449
450::mlir::Operation::operand_range AddIOp::getODSOperands(unsigned index) {
451 auto valueRange = getODSOperandIndexAndLength(index);
452 return {std::next(getOperation()->operand_begin(), valueRange.first),
453 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
454}
455
456::mlir::Value AddIOp::getLhs() {
457 return *getODSOperands(0).begin();
458}
459
460::mlir::Value AddIOp::getRhs() {
461 return *getODSOperands(1).begin();
462}
463
464::mlir::MutableOperandRange AddIOp::getLhsMutable() {
465 auto range = getODSOperandIndexAndLength(0);
466 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
467 return mutableRange;
468}
469
470::mlir::MutableOperandRange AddIOp::getRhsMutable() {
471 auto range = getODSOperandIndexAndLength(1);
472 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
473 return mutableRange;
474}
475
476std::pair<unsigned, unsigned> AddIOp::getODSResultIndexAndLength(unsigned index) {
477 return {index, 1};
478}
479
480::mlir::Operation::result_range AddIOp::getODSResults(unsigned index) {
481 auto valueRange = getODSResultIndexAndLength(index);
482 return {std::next(getOperation()->result_begin(), valueRange.first),
483 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
484}
485
486::mlir::Value AddIOp::getResult() {
487 return *getODSResults(0).begin();
488}
489
490void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
491 odsState.addOperands(lhs);
492 odsState.addOperands(rhs);
493 odsState.addTypes(result);
494}
495
496void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
497 odsState.addOperands(lhs);
498 odsState.addOperands(rhs);
499 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 499, __extension__ __PRETTY_FUNCTION__))
;
500 odsState.addTypes(resultTypes);
501}
502
503void AddIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
504 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 504, __extension__ __PRETTY_FUNCTION__))
;
505 odsState.addOperands(operands);
506 odsState.addAttributes(attributes);
507 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 507, __extension__ __PRETTY_FUNCTION__))
;
508 odsState.addTypes(resultTypes);
509}
510
511void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
512 odsState.addOperands(lhs);
513 odsState.addOperands(rhs);
514 odsState.addTypes({lhs.getType()});
515
516}
517
518void AddIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
519 odsState.addOperands(operands);
520 odsState.addAttributes(attributes);
521 odsState.addTypes({operands[0].getType()});
522
523}
524
525::mlir::LogicalResult AddIOp::verifyInvariantsImpl() {
526 {
527 unsigned index = 0; (void)index;
528 auto valueGroup0 = getODSOperands(0);
529
530 for (auto v : valueGroup0) {
531 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
532 return ::mlir::failure();
533 }
534 auto valueGroup1 = getODSOperands(1);
535
536 for (auto v : valueGroup1) {
537 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
538 return ::mlir::failure();
539 }
540 }
541 {
542 unsigned index = 0; (void)index;
543 auto valueGroup0 = getODSResults(0);
544
545 for (auto v : valueGroup0) {
546 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
547 return ::mlir::failure();
548 }
549 }
550 return ::mlir::success();
551}
552
553::mlir::LogicalResult AddIOp::verifyInvariants() {
554 return verifyInvariantsImpl();
555}
556
557::mlir::ParseResult AddIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
558 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
559 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
560 (void)lhsOperandsLoc;
561 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
562 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
563 (void)rhsOperandsLoc;
564 ::mlir::Type resultRawTypes[1];
565 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
566
567 lhsOperandsLoc = parser.getCurrentLocation();
568 if (parser.parseOperand(lhsRawOperands[0]))
569 return ::mlir::failure();
570 if (parser.parseComma())
571 return ::mlir::failure();
572
573 rhsOperandsLoc = parser.getCurrentLocation();
574 if (parser.parseOperand(rhsRawOperands[0]))
575 return ::mlir::failure();
576 if (parser.parseOptionalAttrDict(result.attributes))
577 return ::mlir::failure();
578 if (parser.parseColon())
579 return ::mlir::failure();
580
581 {
582 ::mlir::Type type;
583 if (parser.parseCustomTypeWithFallback(type))
584 return ::mlir::failure();
585 resultRawTypes[0] = type;
586 }
587 result.addTypes(resultTypes);
588 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
589 return ::mlir::failure();
590 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
591 return ::mlir::failure();
592 return ::mlir::success();
593}
594
595void AddIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
596 _odsPrinter << ' ';
597 _odsPrinter << getLhs();
598 _odsPrinter << ",";
599 _odsPrinter << ' ';
600 _odsPrinter << getRhs();
601 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
602 _odsPrinter << ' ' << ":";
603 _odsPrinter << ' ';
604 {
605 auto type = getResult().getType();
606 if (auto validType = type.dyn_cast<::mlir::Type>())
607 _odsPrinter.printStrippedAttrOrType(validType);
608 else
609 _odsPrinter << type;
610 }
611}
612
613void AddIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
614}
615
616} // namespace arith
617} // namespace mlir
618MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AddIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::AddIOp>::id = {}; } }
619
620namespace mlir {
621namespace arith {
622
623//===----------------------------------------------------------------------===//
624// ::mlir::arith::AndIOp definitions
625//===----------------------------------------------------------------------===//
626
627AndIOpAdaptor::AndIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
628 odsOpName.emplace("arith.andi", odsAttrs.getContext());
629}
630
631AndIOpAdaptor::AndIOpAdaptor(AndIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
632
633::mlir::ValueRange AndIOpAdaptor::getOperands() {
634 return odsOperands;
635}
636
637std::pair<unsigned, unsigned> AndIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
638 return {index, 1};
639}
640
641::mlir::ValueRange AndIOpAdaptor::getODSOperands(unsigned index) {
642 auto valueRange = getODSOperandIndexAndLength(index);
643 return {std::next(odsOperands.begin(), valueRange.first),
644 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
645}
646
647::mlir::Value AndIOpAdaptor::getLhs() {
648 return *getODSOperands(0).begin();
649}
650
651::mlir::Value AndIOpAdaptor::getRhs() {
652 return *getODSOperands(1).begin();
653}
654
655::mlir::DictionaryAttr AndIOpAdaptor::getAttributes() {
656 return odsAttrs;
657}
658
659::mlir::LogicalResult AndIOpAdaptor::verify(::mlir::Location loc) {
660 return ::mlir::success();
661}
662
663std::pair<unsigned, unsigned> AndIOp::getODSOperandIndexAndLength(unsigned index) {
664 return {index, 1};
665}
666
667::mlir::Operation::operand_range AndIOp::getODSOperands(unsigned index) {
668 auto valueRange = getODSOperandIndexAndLength(index);
669 return {std::next(getOperation()->operand_begin(), valueRange.first),
670 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
671}
672
673::mlir::Value AndIOp::getLhs() {
674 return *getODSOperands(0).begin();
675}
676
677::mlir::Value AndIOp::getRhs() {
678 return *getODSOperands(1).begin();
679}
680
681::mlir::MutableOperandRange AndIOp::getLhsMutable() {
682 auto range = getODSOperandIndexAndLength(0);
683 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
684 return mutableRange;
685}
686
687::mlir::MutableOperandRange AndIOp::getRhsMutable() {
688 auto range = getODSOperandIndexAndLength(1);
689 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
690 return mutableRange;
691}
692
693std::pair<unsigned, unsigned> AndIOp::getODSResultIndexAndLength(unsigned index) {
694 return {index, 1};
695}
696
697::mlir::Operation::result_range AndIOp::getODSResults(unsigned index) {
698 auto valueRange = getODSResultIndexAndLength(index);
699 return {std::next(getOperation()->result_begin(), valueRange.first),
700 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
701}
702
703::mlir::Value AndIOp::getResult() {
704 return *getODSResults(0).begin();
705}
706
707void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
708 odsState.addOperands(lhs);
709 odsState.addOperands(rhs);
710 odsState.addTypes(result);
711}
712
713void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
714 odsState.addOperands(lhs);
715 odsState.addOperands(rhs);
716 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 716, __extension__ __PRETTY_FUNCTION__))
;
717 odsState.addTypes(resultTypes);
718}
719
720void AndIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
721 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 721, __extension__ __PRETTY_FUNCTION__))
;
722 odsState.addOperands(operands);
723 odsState.addAttributes(attributes);
724 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 724, __extension__ __PRETTY_FUNCTION__))
;
725 odsState.addTypes(resultTypes);
726}
727
728void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
729 odsState.addOperands(lhs);
730 odsState.addOperands(rhs);
731 odsState.addTypes({lhs.getType()});
732
733}
734
735void AndIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
736 odsState.addOperands(operands);
737 odsState.addAttributes(attributes);
738 odsState.addTypes({operands[0].getType()});
739
740}
741
742::mlir::LogicalResult AndIOp::verifyInvariantsImpl() {
743 {
744 unsigned index = 0; (void)index;
745 auto valueGroup0 = getODSOperands(0);
746
747 for (auto v : valueGroup0) {
748 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
749 return ::mlir::failure();
750 }
751 auto valueGroup1 = getODSOperands(1);
752
753 for (auto v : valueGroup1) {
754 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
755 return ::mlir::failure();
756 }
757 }
758 {
759 unsigned index = 0; (void)index;
760 auto valueGroup0 = getODSResults(0);
761
762 for (auto v : valueGroup0) {
763 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
764 return ::mlir::failure();
765 }
766 }
767 return ::mlir::success();
768}
769
770::mlir::LogicalResult AndIOp::verifyInvariants() {
771 return verifyInvariantsImpl();
772}
773
774::mlir::ParseResult AndIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
775 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
776 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
777 (void)lhsOperandsLoc;
778 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
779 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
780 (void)rhsOperandsLoc;
781 ::mlir::Type resultRawTypes[1];
782 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
783
784 lhsOperandsLoc = parser.getCurrentLocation();
785 if (parser.parseOperand(lhsRawOperands[0]))
786 return ::mlir::failure();
787 if (parser.parseComma())
788 return ::mlir::failure();
789
790 rhsOperandsLoc = parser.getCurrentLocation();
791 if (parser.parseOperand(rhsRawOperands[0]))
792 return ::mlir::failure();
793 if (parser.parseOptionalAttrDict(result.attributes))
794 return ::mlir::failure();
795 if (parser.parseColon())
796 return ::mlir::failure();
797
798 {
799 ::mlir::Type type;
800 if (parser.parseCustomTypeWithFallback(type))
801 return ::mlir::failure();
802 resultRawTypes[0] = type;
803 }
804 result.addTypes(resultTypes);
805 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
806 return ::mlir::failure();
807 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
808 return ::mlir::failure();
809 return ::mlir::success();
810}
811
812void AndIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
813 _odsPrinter << ' ';
814 _odsPrinter << getLhs();
815 _odsPrinter << ",";
816 _odsPrinter << ' ';
817 _odsPrinter << getRhs();
818 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
819 _odsPrinter << ' ' << ":";
820 _odsPrinter << ' ';
821 {
822 auto type = getResult().getType();
823 if (auto validType = type.dyn_cast<::mlir::Type>())
824 _odsPrinter.printStrippedAttrOrType(validType);
825 else
826 _odsPrinter << type;
827 }
828}
829
830void AndIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
831}
832
833} // namespace arith
834} // namespace mlir
835MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::AndIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::AndIOp>::id = {}; } }
836
837namespace mlir {
838namespace arith {
839
840//===----------------------------------------------------------------------===//
841// ::mlir::arith::BitcastOp definitions
842//===----------------------------------------------------------------------===//
843
844BitcastOpAdaptor::BitcastOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
845 odsOpName.emplace("arith.bitcast", odsAttrs.getContext());
846}
847
848BitcastOpAdaptor::BitcastOpAdaptor(BitcastOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
849
850::mlir::ValueRange BitcastOpAdaptor::getOperands() {
851 return odsOperands;
852}
853
854std::pair<unsigned, unsigned> BitcastOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
855 return {index, 1};
856}
857
858::mlir::ValueRange BitcastOpAdaptor::getODSOperands(unsigned index) {
859 auto valueRange = getODSOperandIndexAndLength(index);
860 return {std::next(odsOperands.begin(), valueRange.first),
861 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
862}
863
864::mlir::Value BitcastOpAdaptor::getIn() {
865 return *getODSOperands(0).begin();
866}
867
868::mlir::DictionaryAttr BitcastOpAdaptor::getAttributes() {
869 return odsAttrs;
870}
871
872::mlir::LogicalResult BitcastOpAdaptor::verify(::mlir::Location loc) {
873 return ::mlir::success();
874}
875
876std::pair<unsigned, unsigned> BitcastOp::getODSOperandIndexAndLength(unsigned index) {
877 return {index, 1};
878}
879
880::mlir::Operation::operand_range BitcastOp::getODSOperands(unsigned index) {
881 auto valueRange = getODSOperandIndexAndLength(index);
882 return {std::next(getOperation()->operand_begin(), valueRange.first),
883 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
884}
885
886::mlir::Value BitcastOp::getIn() {
887 return *getODSOperands(0).begin();
888}
889
890::mlir::MutableOperandRange BitcastOp::getInMutable() {
891 auto range = getODSOperandIndexAndLength(0);
892 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
893 return mutableRange;
894}
895
896std::pair<unsigned, unsigned> BitcastOp::getODSResultIndexAndLength(unsigned index) {
897 return {index, 1};
898}
899
900::mlir::Operation::result_range BitcastOp::getODSResults(unsigned index) {
901 auto valueRange = getODSResultIndexAndLength(index);
902 return {std::next(getOperation()->result_begin(), valueRange.first),
903 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
904}
905
906::mlir::Value BitcastOp::getOut() {
907 return *getODSResults(0).begin();
908}
909
910void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
911 odsState.addOperands(in);
912 odsState.addTypes(out);
913}
914
915void BitcastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
916 odsState.addOperands(in);
917 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 917, __extension__ __PRETTY_FUNCTION__))
;
918 odsState.addTypes(resultTypes);
919}
920
921void BitcastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
922 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 922, __extension__ __PRETTY_FUNCTION__))
;
923 odsState.addOperands(operands);
924 odsState.addAttributes(attributes);
925 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 925, __extension__ __PRETTY_FUNCTION__))
;
926 odsState.addTypes(resultTypes);
927}
928
929::mlir::LogicalResult BitcastOp::verifyInvariantsImpl() {
930 {
931 unsigned index = 0; (void)index;
932 auto valueGroup0 = getODSOperands(0);
933
934 for (auto v : valueGroup0) {
935 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps2(*this, v.getType(), "operand", index++)))
936 return ::mlir::failure();
937 }
938 }
939 {
940 unsigned index = 0; (void)index;
941 auto valueGroup0 = getODSResults(0);
942
943 for (auto v : valueGroup0) {
944 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps2(*this, v.getType(), "result", index++)))
945 return ::mlir::failure();
946 }
947 }
948 return ::mlir::success();
949}
950
951::mlir::LogicalResult BitcastOp::verifyInvariants() {
952 return verifyInvariantsImpl();
953}
954
955::mlir::ParseResult BitcastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
956 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
957 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
958 (void)inOperandsLoc;
959 ::mlir::Type inRawTypes[1];
960 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
961 ::mlir::Type outRawTypes[1];
962 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
963
964 inOperandsLoc = parser.getCurrentLocation();
965 if (parser.parseOperand(inRawOperands[0]))
966 return ::mlir::failure();
967 if (parser.parseOptionalAttrDict(result.attributes))
968 return ::mlir::failure();
969 if (parser.parseColon())
970 return ::mlir::failure();
971
972 {
973 ::mlir::Type type;
974 if (parser.parseCustomTypeWithFallback(type))
975 return ::mlir::failure();
976 inRawTypes[0] = type;
977 }
978 if (parser.parseKeyword("to"))
979 return ::mlir::failure();
980
981 {
982 ::mlir::Type type;
983 if (parser.parseCustomTypeWithFallback(type))
984 return ::mlir::failure();
985 outRawTypes[0] = type;
986 }
987 result.addTypes(outTypes);
988 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
989 return ::mlir::failure();
990 return ::mlir::success();
991}
992
993void BitcastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
994 _odsPrinter << ' ';
995 _odsPrinter << getIn();
996 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
997 _odsPrinter << ' ' << ":";
998 _odsPrinter << ' ';
999 {
1000 auto type = getIn().getType();
1001 if (auto validType = type.dyn_cast<::mlir::Type>())
1002 _odsPrinter.printStrippedAttrOrType(validType);
1003 else
1004 _odsPrinter << type;
1005 }
1006 _odsPrinter << ' ' << "to";
1007 _odsPrinter << ' ';
1008 {
1009 auto type = getOut().getType();
1010 if (auto validType = type.dyn_cast<::mlir::Type>())
1011 _odsPrinter.printStrippedAttrOrType(validType);
1012 else
1013 _odsPrinter << type;
1014 }
1015}
1016
1017void BitcastOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1018}
1019
1020} // namespace arith
1021} // namespace mlir
1022MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::BitcastOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::BitcastOp>::id = {}; } }
1023
1024namespace mlir {
1025namespace arith {
1026
1027//===----------------------------------------------------------------------===//
1028// ::mlir::arith::CeilDivSIOp definitions
1029//===----------------------------------------------------------------------===//
1030
1031CeilDivSIOpAdaptor::CeilDivSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
1032 odsOpName.emplace("arith.ceildivsi", odsAttrs.getContext());
1033}
1034
1035CeilDivSIOpAdaptor::CeilDivSIOpAdaptor(CeilDivSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
1036
1037::mlir::ValueRange CeilDivSIOpAdaptor::getOperands() {
1038 return odsOperands;
1039}
1040
1041std::pair<unsigned, unsigned> CeilDivSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
1042 return {index, 1};
1043}
1044
1045::mlir::ValueRange CeilDivSIOpAdaptor::getODSOperands(unsigned index) {
1046 auto valueRange = getODSOperandIndexAndLength(index);
1047 return {std::next(odsOperands.begin(), valueRange.first),
1048 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1049}
1050
1051::mlir::Value CeilDivSIOpAdaptor::getLhs() {
1052 return *getODSOperands(0).begin();
1053}
1054
1055::mlir::Value CeilDivSIOpAdaptor::getRhs() {
1056 return *getODSOperands(1).begin();
1057}
1058
1059::mlir::DictionaryAttr CeilDivSIOpAdaptor::getAttributes() {
1060 return odsAttrs;
1061}
1062
1063::mlir::LogicalResult CeilDivSIOpAdaptor::verify(::mlir::Location loc) {
1064 return ::mlir::success();
1065}
1066
1067std::pair<unsigned, unsigned> CeilDivSIOp::getODSOperandIndexAndLength(unsigned index) {
1068 return {index, 1};
1069}
1070
1071::mlir::Operation::operand_range CeilDivSIOp::getODSOperands(unsigned index) {
1072 auto valueRange = getODSOperandIndexAndLength(index);
1073 return {std::next(getOperation()->operand_begin(), valueRange.first),
1074 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1075}
1076
1077::mlir::Value CeilDivSIOp::getLhs() {
1078 return *getODSOperands(0).begin();
1079}
1080
1081::mlir::Value CeilDivSIOp::getRhs() {
1082 return *getODSOperands(1).begin();
1083}
1084
1085::mlir::MutableOperandRange CeilDivSIOp::getLhsMutable() {
1086 auto range = getODSOperandIndexAndLength(0);
1087 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1088 return mutableRange;
1089}
1090
1091::mlir::MutableOperandRange CeilDivSIOp::getRhsMutable() {
1092 auto range = getODSOperandIndexAndLength(1);
1093 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1094 return mutableRange;
1095}
1096
1097std::pair<unsigned, unsigned> CeilDivSIOp::getODSResultIndexAndLength(unsigned index) {
1098 return {index, 1};
1099}
1100
1101::mlir::Operation::result_range CeilDivSIOp::getODSResults(unsigned index) {
1102 auto valueRange = getODSResultIndexAndLength(index);
1103 return {std::next(getOperation()->result_begin(), valueRange.first),
1104 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1105}
1106
1107::mlir::Value CeilDivSIOp::getResult() {
1108 return *getODSResults(0).begin();
1109}
1110
1111void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
1112 odsState.addOperands(lhs);
1113 odsState.addOperands(rhs);
1114 odsState.addTypes(result);
1115}
1116
1117void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
1118 odsState.addOperands(lhs);
1119 odsState.addOperands(rhs);
1120 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1120, __extension__ __PRETTY_FUNCTION__))
;
1121 odsState.addTypes(resultTypes);
1122}
1123
1124void CeilDivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1125 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1125, __extension__ __PRETTY_FUNCTION__))
;
1126 odsState.addOperands(operands);
1127 odsState.addAttributes(attributes);
1128 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1128, __extension__ __PRETTY_FUNCTION__))
;
1129 odsState.addTypes(resultTypes);
1130}
1131
1132void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
1133 odsState.addOperands(lhs);
1134 odsState.addOperands(rhs);
1135 odsState.addTypes({lhs.getType()});
1136
1137}
1138
1139void CeilDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1140 odsState.addOperands(operands);
1141 odsState.addAttributes(attributes);
1142 odsState.addTypes({operands[0].getType()});
1143
1144}
1145
1146::mlir::LogicalResult CeilDivSIOp::verifyInvariantsImpl() {
1147 {
1148 unsigned index = 0; (void)index;
1149 auto valueGroup0 = getODSOperands(0);
1150
1151 for (auto v : valueGroup0) {
1152 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
1153 return ::mlir::failure();
1154 }
1155 auto valueGroup1 = getODSOperands(1);
1156
1157 for (auto v : valueGroup1) {
1158 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
1159 return ::mlir::failure();
1160 }
1161 }
1162 {
1163 unsigned index = 0; (void)index;
1164 auto valueGroup0 = getODSResults(0);
1165
1166 for (auto v : valueGroup0) {
1167 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
1168 return ::mlir::failure();
1169 }
1170 }
1171 return ::mlir::success();
1172}
1173
1174::mlir::LogicalResult CeilDivSIOp::verifyInvariants() {
1175 return verifyInvariantsImpl();
1176}
1177
1178::mlir::ParseResult CeilDivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1179 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
1180 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
1181 (void)lhsOperandsLoc;
1182 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
1183 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
1184 (void)rhsOperandsLoc;
1185 ::mlir::Type resultRawTypes[1];
1186 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
1187
1188 lhsOperandsLoc = parser.getCurrentLocation();
1189 if (parser.parseOperand(lhsRawOperands[0]))
1190 return ::mlir::failure();
1191 if (parser.parseComma())
1192 return ::mlir::failure();
1193
1194 rhsOperandsLoc = parser.getCurrentLocation();
1195 if (parser.parseOperand(rhsRawOperands[0]))
1196 return ::mlir::failure();
1197 if (parser.parseOptionalAttrDict(result.attributes))
1198 return ::mlir::failure();
1199 if (parser.parseColon())
1200 return ::mlir::failure();
1201
1202 {
1203 ::mlir::Type type;
1204 if (parser.parseCustomTypeWithFallback(type))
1205 return ::mlir::failure();
1206 resultRawTypes[0] = type;
1207 }
1208 result.addTypes(resultTypes);
1209 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
1210 return ::mlir::failure();
1211 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
1212 return ::mlir::failure();
1213 return ::mlir::success();
1214}
1215
1216void CeilDivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1217 _odsPrinter << ' ';
1218 _odsPrinter << getLhs();
1219 _odsPrinter << ",";
1220 _odsPrinter << ' ';
1221 _odsPrinter << getRhs();
1222 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
1223 _odsPrinter << ' ' << ":";
1224 _odsPrinter << ' ';
1225 {
1226 auto type = getResult().getType();
1227 if (auto validType = type.dyn_cast<::mlir::Type>())
1228 _odsPrinter.printStrippedAttrOrType(validType);
1229 else
1230 _odsPrinter << type;
1231 }
1232}
1233
1234void CeilDivSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1235}
1236
1237} // namespace arith
1238} // namespace mlir
1239MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::CeilDivSIOp>::id = {}; } }
1240
1241namespace mlir {
1242namespace arith {
1243
1244//===----------------------------------------------------------------------===//
1245// ::mlir::arith::CeilDivUIOp definitions
1246//===----------------------------------------------------------------------===//
1247
1248CeilDivUIOpAdaptor::CeilDivUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
1249 odsOpName.emplace("arith.ceildivui", odsAttrs.getContext());
1250}
1251
1252CeilDivUIOpAdaptor::CeilDivUIOpAdaptor(CeilDivUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
1253
1254::mlir::ValueRange CeilDivUIOpAdaptor::getOperands() {
1255 return odsOperands;
1256}
1257
1258std::pair<unsigned, unsigned> CeilDivUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
1259 return {index, 1};
1260}
1261
1262::mlir::ValueRange CeilDivUIOpAdaptor::getODSOperands(unsigned index) {
1263 auto valueRange = getODSOperandIndexAndLength(index);
1264 return {std::next(odsOperands.begin(), valueRange.first),
1265 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1266}
1267
1268::mlir::Value CeilDivUIOpAdaptor::getLhs() {
1269 return *getODSOperands(0).begin();
1270}
1271
1272::mlir::Value CeilDivUIOpAdaptor::getRhs() {
1273 return *getODSOperands(1).begin();
1274}
1275
1276::mlir::DictionaryAttr CeilDivUIOpAdaptor::getAttributes() {
1277 return odsAttrs;
1278}
1279
1280::mlir::LogicalResult CeilDivUIOpAdaptor::verify(::mlir::Location loc) {
1281 return ::mlir::success();
1282}
1283
1284std::pair<unsigned, unsigned> CeilDivUIOp::getODSOperandIndexAndLength(unsigned index) {
1285 return {index, 1};
1286}
1287
1288::mlir::Operation::operand_range CeilDivUIOp::getODSOperands(unsigned index) {
1289 auto valueRange = getODSOperandIndexAndLength(index);
1290 return {std::next(getOperation()->operand_begin(), valueRange.first),
1291 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1292}
1293
1294::mlir::Value CeilDivUIOp::getLhs() {
1295 return *getODSOperands(0).begin();
1296}
1297
1298::mlir::Value CeilDivUIOp::getRhs() {
1299 return *getODSOperands(1).begin();
1300}
1301
1302::mlir::MutableOperandRange CeilDivUIOp::getLhsMutable() {
1303 auto range = getODSOperandIndexAndLength(0);
1304 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1305 return mutableRange;
1306}
1307
1308::mlir::MutableOperandRange CeilDivUIOp::getRhsMutable() {
1309 auto range = getODSOperandIndexAndLength(1);
1310 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1311 return mutableRange;
1312}
1313
1314std::pair<unsigned, unsigned> CeilDivUIOp::getODSResultIndexAndLength(unsigned index) {
1315 return {index, 1};
1316}
1317
1318::mlir::Operation::result_range CeilDivUIOp::getODSResults(unsigned index) {
1319 auto valueRange = getODSResultIndexAndLength(index);
1320 return {std::next(getOperation()->result_begin(), valueRange.first),
1321 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1322}
1323
1324::mlir::Value CeilDivUIOp::getResult() {
1325 return *getODSResults(0).begin();
1326}
1327
1328void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
1329 odsState.addOperands(lhs);
1330 odsState.addOperands(rhs);
1331 odsState.addTypes(result);
1332}
1333
1334void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
1335 odsState.addOperands(lhs);
1336 odsState.addOperands(rhs);
1337 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1337, __extension__ __PRETTY_FUNCTION__))
;
1338 odsState.addTypes(resultTypes);
1339}
1340
1341void CeilDivUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1342 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1342, __extension__ __PRETTY_FUNCTION__))
;
1343 odsState.addOperands(operands);
1344 odsState.addAttributes(attributes);
1345 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1345, __extension__ __PRETTY_FUNCTION__))
;
1346 odsState.addTypes(resultTypes);
1347}
1348
1349void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
1350 odsState.addOperands(lhs);
1351 odsState.addOperands(rhs);
1352 odsState.addTypes({lhs.getType()});
1353
1354}
1355
1356void CeilDivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1357 odsState.addOperands(operands);
1358 odsState.addAttributes(attributes);
1359 odsState.addTypes({operands[0].getType()});
1360
1361}
1362
1363::mlir::LogicalResult CeilDivUIOp::verifyInvariantsImpl() {
1364 {
1365 unsigned index = 0; (void)index;
1366 auto valueGroup0 = getODSOperands(0);
1367
1368 for (auto v : valueGroup0) {
1369 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
1370 return ::mlir::failure();
1371 }
1372 auto valueGroup1 = getODSOperands(1);
1373
1374 for (auto v : valueGroup1) {
1375 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
1376 return ::mlir::failure();
1377 }
1378 }
1379 {
1380 unsigned index = 0; (void)index;
1381 auto valueGroup0 = getODSResults(0);
1382
1383 for (auto v : valueGroup0) {
1384 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
1385 return ::mlir::failure();
1386 }
1387 }
1388 return ::mlir::success();
1389}
1390
1391::mlir::LogicalResult CeilDivUIOp::verifyInvariants() {
1392 return verifyInvariantsImpl();
1393}
1394
1395::mlir::ParseResult CeilDivUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1396 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
1397 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
1398 (void)lhsOperandsLoc;
1399 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
1400 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
1401 (void)rhsOperandsLoc;
1402 ::mlir::Type resultRawTypes[1];
1403 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
1404
1405 lhsOperandsLoc = parser.getCurrentLocation();
1406 if (parser.parseOperand(lhsRawOperands[0]))
1407 return ::mlir::failure();
1408 if (parser.parseComma())
1409 return ::mlir::failure();
1410
1411 rhsOperandsLoc = parser.getCurrentLocation();
1412 if (parser.parseOperand(rhsRawOperands[0]))
1413 return ::mlir::failure();
1414 if (parser.parseOptionalAttrDict(result.attributes))
1415 return ::mlir::failure();
1416 if (parser.parseColon())
1417 return ::mlir::failure();
1418
1419 {
1420 ::mlir::Type type;
1421 if (parser.parseCustomTypeWithFallback(type))
1422 return ::mlir::failure();
1423 resultRawTypes[0] = type;
1424 }
1425 result.addTypes(resultTypes);
1426 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
1427 return ::mlir::failure();
1428 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
1429 return ::mlir::failure();
1430 return ::mlir::success();
1431}
1432
1433void CeilDivUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1434 _odsPrinter << ' ';
1435 _odsPrinter << getLhs();
1436 _odsPrinter << ",";
1437 _odsPrinter << ' ';
1438 _odsPrinter << getRhs();
1439 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
1440 _odsPrinter << ' ' << ":";
1441 _odsPrinter << ' ';
1442 {
1443 auto type = getResult().getType();
1444 if (auto validType = type.dyn_cast<::mlir::Type>())
1445 _odsPrinter.printStrippedAttrOrType(validType);
1446 else
1447 _odsPrinter << type;
1448 }
1449}
1450
1451void CeilDivUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1452}
1453
1454} // namespace arith
1455} // namespace mlir
1456MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CeilDivUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::CeilDivUIOp>::id = {}; } }
1457
1458namespace mlir {
1459namespace arith {
1460
1461//===----------------------------------------------------------------------===//
1462// ::mlir::arith::CmpFOp definitions
1463//===----------------------------------------------------------------------===//
1464
1465CmpFOpAdaptor::CmpFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
1466 odsOpName.emplace("arith.cmpf", odsAttrs.getContext());
1467}
1468
1469CmpFOpAdaptor::CmpFOpAdaptor(CmpFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
1470
1471::mlir::ValueRange CmpFOpAdaptor::getOperands() {
1472 return odsOperands;
1473}
1474
1475std::pair<unsigned, unsigned> CmpFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
1476 return {index, 1};
1477}
1478
1479::mlir::ValueRange CmpFOpAdaptor::getODSOperands(unsigned index) {
1480 auto valueRange = getODSOperandIndexAndLength(index);
1481 return {std::next(odsOperands.begin(), valueRange.first),
1482 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1483}
1484
1485::mlir::Value CmpFOpAdaptor::getLhs() {
1486 return *getODSOperands(0).begin();
1487}
1488
1489::mlir::Value CmpFOpAdaptor::getRhs() {
1490 return *getODSOperands(1).begin();
1491}
1492
1493::mlir::DictionaryAttr CmpFOpAdaptor::getAttributes() {
1494 return odsAttrs;
1495}
1496
1497::mlir::arith::CmpFPredicateAttr CmpFOpAdaptor::getPredicateAttr() {
1498 assert(odsAttrs && "no attributes when constructing adapter")(static_cast <bool> (odsAttrs && "no attributes when constructing adapter"
) ? void (0) : __assert_fail ("odsAttrs && \"no attributes when constructing adapter\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1498, __extension__ __PRETTY_FUNCTION__))
;
1499 auto attr = ::mlir::impl::getAttrFromSortedRange(odsAttrs.begin() + 0, odsAttrs.end() - 0, CmpFOp::getPredicateAttrName(*odsOpName)).cast<::mlir::arith::CmpFPredicateAttr>();
1500 return attr;
1501}
1502
1503::mlir::arith::CmpFPredicate CmpFOpAdaptor::getPredicate() {
1504 auto attr = getPredicateAttr();
1505 return attr.getValue();
1506}
1507
1508::mlir::LogicalResult CmpFOpAdaptor::verify(::mlir::Location loc) {
1509 auto namedAttrRange = odsAttrs;
1510 auto namedAttrIt = namedAttrRange.begin();
1511 ::mlir::Attribute tblgen_predicate;
1512 while (true) {
1513 if (namedAttrIt == namedAttrRange.end())
1514 return emitError(loc, "'arith.cmpf' op ""requires attribute 'predicate'");
1515 if (namedAttrIt->getName() == CmpFOp::getPredicateAttrName(*odsOpName)) {
1516 tblgen_predicate = namedAttrIt->getValue();
1517 break;
1518 }
1519 ++namedAttrIt;
1520 }
1521
1522 if (tblgen_predicate && !((tblgen_predicate.isa<::mlir::arith::CmpFPredicateAttr>())))
1523 return emitError(loc, "'arith.cmpf' op ""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");
1524 return ::mlir::success();
1525}
1526
1527std::pair<unsigned, unsigned> CmpFOp::getODSOperandIndexAndLength(unsigned index) {
1528 return {index, 1};
1529}
1530
1531::mlir::Operation::operand_range CmpFOp::getODSOperands(unsigned index) {
1532 auto valueRange = getODSOperandIndexAndLength(index);
1533 return {std::next(getOperation()->operand_begin(), valueRange.first),
1534 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1535}
1536
1537::mlir::Value CmpFOp::getLhs() {
1538 return *getODSOperands(0).begin();
1539}
1540
1541::mlir::Value CmpFOp::getRhs() {
1542 return *getODSOperands(1).begin();
1543}
1544
1545::mlir::MutableOperandRange CmpFOp::getLhsMutable() {
1546 auto range = getODSOperandIndexAndLength(0);
1547 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1548 return mutableRange;
1549}
1550
1551::mlir::MutableOperandRange CmpFOp::getRhsMutable() {
1552 auto range = getODSOperandIndexAndLength(1);
1553 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1554 return mutableRange;
1555}
1556
1557std::pair<unsigned, unsigned> CmpFOp::getODSResultIndexAndLength(unsigned index) {
1558 return {index, 1};
1559}
1560
1561::mlir::Operation::result_range CmpFOp::getODSResults(unsigned index) {
1562 auto valueRange = getODSResultIndexAndLength(index);
1563 return {std::next(getOperation()->result_begin(), valueRange.first),
1564 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1565}
1566
1567::mlir::Value CmpFOp::getResult() {
1568 return *getODSResults(0).begin();
1569}
1570
1571::mlir::arith::CmpFPredicateAttr CmpFOp::getPredicateAttr() {
1572 return ::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 0, (*this)->getAttrs().end() - 0, getPredicateAttrName()).cast<::mlir::arith::CmpFPredicateAttr>();
1573}
1574
1575::mlir::arith::CmpFPredicate CmpFOp::getPredicate() {
1576 auto attr = getPredicateAttr();
1577 return attr.getValue();
1578}
1579
1580void CmpFOp::setPredicateAttr(::mlir::arith::CmpFPredicateAttr attr) {
1581 (*this)->setAttr(getPredicateAttrName(), attr);
1582}
1583
1584void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, CmpFPredicate predicate, Value lhs, Value rhs) {
1585 build(odsBuilder, odsState, ::getI1SameShape(lhs.getType()),
1586 predicate, lhs, rhs);
1587
1588}
1589
1590void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1591 odsState.addOperands(lhs);
1592 odsState.addOperands(rhs);
1593 odsState.addAttribute(getPredicateAttrName(odsState.name), predicate);
1594 odsState.addTypes(result);
1595}
1596
1597void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1598 odsState.addOperands(lhs);
1599 odsState.addOperands(rhs);
1600 odsState.addAttribute(getPredicateAttrName(odsState.name), predicate);
1601 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1601, __extension__ __PRETTY_FUNCTION__))
;
1602 odsState.addTypes(resultTypes);
1603}
1604
1605void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1606 odsState.addOperands(lhs);
1607 odsState.addOperands(rhs);
1608 odsState.addAttribute(getPredicateAttrName(odsState.name), ::mlir::arith::CmpFPredicateAttr::get(odsBuilder.getContext(), predicate));
1609 odsState.addTypes(result);
1610}
1611
1612void CmpFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpFPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1613 odsState.addOperands(lhs);
1614 odsState.addOperands(rhs);
1615 odsState.addAttribute(getPredicateAttrName(odsState.name), ::mlir::arith::CmpFPredicateAttr::get(odsBuilder.getContext(), predicate));
1616 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1616, __extension__ __PRETTY_FUNCTION__))
;
1617 odsState.addTypes(resultTypes);
1618}
1619
1620void CmpFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1621 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1621, __extension__ __PRETTY_FUNCTION__))
;
1622 odsState.addOperands(operands);
1623 odsState.addAttributes(attributes);
1624 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1624, __extension__ __PRETTY_FUNCTION__))
;
1625 odsState.addTypes(resultTypes);
1626}
1627
1628::mlir::LogicalResult CmpFOp::verifyInvariantsImpl() {
1629 auto namedAttrRange = (*this)->getAttrs();
1630 auto namedAttrIt = namedAttrRange.begin();
1631 ::mlir::Attribute tblgen_predicate;
1632 while (true) {
1633 if (namedAttrIt == namedAttrRange.end())
1634 return emitOpError("requires attribute 'predicate'");
1635 if (namedAttrIt->getName() == getPredicateAttrName()) {
1636 tblgen_predicate = namedAttrIt->getValue();
1637 break;
1638 }
1639 ++namedAttrIt;
1640 }
1641
1642 if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithmeticOps0(*this, tblgen_predicate, "predicate")))
1643 return ::mlir::failure();
1644 {
1645 unsigned index = 0; (void)index;
1646 auto valueGroup0 = getODSOperands(0);
1647
1648 for (auto v : valueGroup0) {
1649 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
1650 return ::mlir::failure();
1651 }
1652 auto valueGroup1 = getODSOperands(1);
1653
1654 for (auto v : valueGroup1) {
1655 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
1656 return ::mlir::failure();
1657 }
1658 }
1659 {
1660 unsigned index = 0; (void)index;
1661 auto valueGroup0 = getODSResults(0);
1662
1663 for (auto v : valueGroup0) {
1664 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps3(*this, v.getType(), "result", index++)))
1665 return ::mlir::failure();
1666 }
1667 }
1668 if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType()))))
1669 return emitOpError("failed to verify that result type has i1 element type and same shape as operands");
1670 return ::mlir::success();
1671}
1672
1673::mlir::LogicalResult CmpFOp::verifyInvariants() {
1674 return verifyInvariantsImpl();
1675}
1676
1677::mlir::ParseResult CmpFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1678 ::mlir::arith::CmpFPredicateAttr predicateAttr;
1679 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
1680 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
1681 (void)lhsOperandsLoc;
1682 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
1683 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
1684 (void)rhsOperandsLoc;
1685 ::mlir::Type lhsRawTypes[1];
1686 ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes);
1687
1688 {
1689 ::llvm::StringRef attrStr;
1690 ::mlir::NamedAttrList attrStorage;
1691 auto loc = parser.getCurrentLocation();
1692 if (parser.parseOptionalKeyword(&attrStr, {"false","oeq","ogt","oge","olt","ole","one","ord","ueq","ugt","uge","ult","ule","une","uno","true"})) {
1693 ::mlir::StringAttr attrVal;
1694 ::mlir::OptionalParseResult parseResult =
1695 parser.parseOptionalAttribute(attrVal,
1696 parser.getBuilder().getNoneType(),
1697 "predicate", attrStorage);
1698 if (parseResult.hasValue()) {
1699 if (failed(*parseResult))
1700 return ::mlir::failure();
1701 attrStr = attrVal.getValue();
1702 } else {
1703 return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'predicate' [false, oeq, ogt, oge, olt, ole, one, ord, ueq, ugt, uge, ult, ule, une, uno, true]");
1704 }
1705 }
1706 if (!attrStr.empty()) {
1707 auto attrOptional = ::mlir::arith::symbolizeCmpFPredicate(attrStr);
1708 if (!attrOptional)
1709 return parser.emitError(loc, "invalid ")
1710 << "predicate attribute specification: \"" << attrStr << '"';;
1711
1712 predicateAttr = ::mlir::arith::CmpFPredicateAttr::get(parser.getBuilder().getContext(), attrOptional.getValue());
1713 result.addAttribute("predicate", predicateAttr);
1714 }
1715 }
1716 if (parser.parseComma())
1717 return ::mlir::failure();
1718
1719 lhsOperandsLoc = parser.getCurrentLocation();
1720 if (parser.parseOperand(lhsRawOperands[0]))
1721 return ::mlir::failure();
1722 if (parser.parseComma())
1723 return ::mlir::failure();
1724
1725 rhsOperandsLoc = parser.getCurrentLocation();
1726 if (parser.parseOperand(rhsRawOperands[0]))
1727 return ::mlir::failure();
1728 if (parser.parseOptionalAttrDict(result.attributes))
1729 return ::mlir::failure();
1730 if (parser.parseColon())
1731 return ::mlir::failure();
1732
1733 {
1734 ::mlir::Type type;
1735 if (parser.parseCustomTypeWithFallback(type))
1736 return ::mlir::failure();
1737 lhsRawTypes[0] = type;
1738 }
1739 for (::mlir::Type type : lhsTypes) {
1740 (void)type;
1741 if (!(((type.isa<::mlir::FloatType>())) || ((((type.isa<::mlir::VectorType>())) && ((type.cast<::mlir::VectorType>().getRank() > 0))) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isa<::mlir::FloatType>()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
1742 return parser.emitError(parser.getNameLoc()) << "'lhs' must be floating-point-like, but got " << type;
1743 }
1744 }
1745 result.addTypes(::getI1SameShape(lhsTypes[0]));
1746 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
1747 return ::mlir::failure();
1748 if (parser.resolveOperands(rhsOperands, lhsTypes[0], result.operands))
1749 return ::mlir::failure();
1750 return ::mlir::success();
1751}
1752
1753void CmpFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1754 _odsPrinter << ' ';
1755
1756 {
1757 auto caseValue = getPredicate();
1758 auto caseValueStr = stringifyCmpFPredicate(caseValue);
1759 _odsPrinter << caseValueStr;
1760 }
1761 _odsPrinter << ",";
1762 _odsPrinter << ' ';
1763 _odsPrinter << getLhs();
1764 _odsPrinter << ",";
1765 _odsPrinter << ' ';
1766 _odsPrinter << getRhs();
1767 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{"predicate"});
1768 _odsPrinter << ' ' << ":";
1769 _odsPrinter << ' ';
1770 {
1771 auto type = getLhs().getType();
1772 if (auto validType = type.dyn_cast<::mlir::Type>())
1773 _odsPrinter.printStrippedAttrOrType(validType);
1774 else
1775 _odsPrinter << type;
1776 }
1777}
1778
1779void CmpFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1780}
1781
1782} // namespace arith
1783} // namespace mlir
1784MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CmpFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::CmpFOp>::id = {}; } }
1785
1786namespace mlir {
1787namespace arith {
1788
1789//===----------------------------------------------------------------------===//
1790// ::mlir::arith::CmpIOp definitions
1791//===----------------------------------------------------------------------===//
1792
1793CmpIOpAdaptor::CmpIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
1794 odsOpName.emplace("arith.cmpi", odsAttrs.getContext());
1795}
1796
1797CmpIOpAdaptor::CmpIOpAdaptor(CmpIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
1798
1799::mlir::ValueRange CmpIOpAdaptor::getOperands() {
1800 return odsOperands;
1801}
1802
1803std::pair<unsigned, unsigned> CmpIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
1804 return {index, 1};
1805}
1806
1807::mlir::ValueRange CmpIOpAdaptor::getODSOperands(unsigned index) {
1808 auto valueRange = getODSOperandIndexAndLength(index);
1809 return {std::next(odsOperands.begin(), valueRange.first),
1810 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1811}
1812
1813::mlir::Value CmpIOpAdaptor::getLhs() {
1814 return *getODSOperands(0).begin();
1815}
1816
1817::mlir::Value CmpIOpAdaptor::getRhs() {
1818 return *getODSOperands(1).begin();
1819}
1820
1821::mlir::DictionaryAttr CmpIOpAdaptor::getAttributes() {
1822 return odsAttrs;
1823}
1824
1825::mlir::arith::CmpIPredicateAttr CmpIOpAdaptor::getPredicateAttr() {
1826 assert(odsAttrs && "no attributes when constructing adapter")(static_cast <bool> (odsAttrs && "no attributes when constructing adapter"
) ? void (0) : __assert_fail ("odsAttrs && \"no attributes when constructing adapter\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1826, __extension__ __PRETTY_FUNCTION__))
;
1827 auto attr = ::mlir::impl::getAttrFromSortedRange(odsAttrs.begin() + 0, odsAttrs.end() - 0, CmpIOp::getPredicateAttrName(*odsOpName)).cast<::mlir::arith::CmpIPredicateAttr>();
1828 return attr;
1829}
1830
1831::mlir::arith::CmpIPredicate CmpIOpAdaptor::getPredicate() {
1832 auto attr = getPredicateAttr();
1833 return attr.getValue();
1834}
1835
1836::mlir::LogicalResult CmpIOpAdaptor::verify(::mlir::Location loc) {
1837 auto namedAttrRange = odsAttrs;
1838 auto namedAttrIt = namedAttrRange.begin();
1839 ::mlir::Attribute tblgen_predicate;
1840 while (true) {
1841 if (namedAttrIt == namedAttrRange.end())
1842 return emitError(loc, "'arith.cmpi' op ""requires attribute 'predicate'");
1843 if (namedAttrIt->getName() == CmpIOp::getPredicateAttrName(*odsOpName)) {
1844 tblgen_predicate = namedAttrIt->getValue();
1845 break;
1846 }
1847 ++namedAttrIt;
1848 }
1849
1850 if (tblgen_predicate && !((tblgen_predicate.isa<::mlir::arith::CmpIPredicateAttr>())))
1851 return emitError(loc, "'arith.cmpi' op ""attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9");
1852 return ::mlir::success();
1853}
1854
1855std::pair<unsigned, unsigned> CmpIOp::getODSOperandIndexAndLength(unsigned index) {
1856 return {index, 1};
1857}
1858
1859::mlir::Operation::operand_range CmpIOp::getODSOperands(unsigned index) {
1860 auto valueRange = getODSOperandIndexAndLength(index);
1861 return {std::next(getOperation()->operand_begin(), valueRange.first),
1862 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1863}
1864
1865::mlir::Value CmpIOp::getLhs() {
1866 return *getODSOperands(0).begin();
1867}
1868
1869::mlir::Value CmpIOp::getRhs() {
1870 return *getODSOperands(1).begin();
1871}
1872
1873::mlir::MutableOperandRange CmpIOp::getLhsMutable() {
1874 auto range = getODSOperandIndexAndLength(0);
1875 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1876 return mutableRange;
1877}
1878
1879::mlir::MutableOperandRange CmpIOp::getRhsMutable() {
1880 auto range = getODSOperandIndexAndLength(1);
1881 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1882 return mutableRange;
1883}
1884
1885std::pair<unsigned, unsigned> CmpIOp::getODSResultIndexAndLength(unsigned index) {
1886 return {index, 1};
1887}
1888
1889::mlir::Operation::result_range CmpIOp::getODSResults(unsigned index) {
1890 auto valueRange = getODSResultIndexAndLength(index);
1891 return {std::next(getOperation()->result_begin(), valueRange.first),
1892 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1893}
1894
1895::mlir::Value CmpIOp::getResult() {
1896 return *getODSResults(0).begin();
1897}
1898
1899::mlir::arith::CmpIPredicateAttr CmpIOp::getPredicateAttr() {
1900 return ::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 0, (*this)->getAttrs().end() - 0, getPredicateAttrName()).cast<::mlir::arith::CmpIPredicateAttr>();
1901}
1902
1903::mlir::arith::CmpIPredicate CmpIOp::getPredicate() {
1904 auto attr = getPredicateAttr();
1905 return attr.getValue();
1906}
1907
1908void CmpIOp::setPredicateAttr(::mlir::arith::CmpIPredicateAttr attr) {
1909 (*this)->setAttr(getPredicateAttrName(), attr);
1910}
1911
1912void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, CmpIPredicate predicate, Value lhs, Value rhs) {
1913 build(odsBuilder, odsState, ::getI1SameShape(lhs.getType()),
1914 predicate, lhs, rhs);
1915
1916}
1917
1918void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1919 odsState.addOperands(lhs);
1920 odsState.addOperands(rhs);
1921 odsState.addAttribute(getPredicateAttrName(odsState.name), predicate);
1922 odsState.addTypes(result);
1923}
1924
1925void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1926 odsState.addOperands(lhs);
1927 odsState.addOperands(rhs);
1928 odsState.addAttribute(getPredicateAttrName(odsState.name), predicate);
1929 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1929, __extension__ __PRETTY_FUNCTION__))
;
1930 odsState.addTypes(resultTypes);
1931}
1932
1933void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1934 odsState.addOperands(lhs);
1935 odsState.addOperands(rhs);
1936 odsState.addAttribute(getPredicateAttrName(odsState.name), ::mlir::arith::CmpIPredicateAttr::get(odsBuilder.getContext(), predicate));
1937 odsState.addTypes(result);
1938}
1939
1940void CmpIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::arith::CmpIPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
1941 odsState.addOperands(lhs);
1942 odsState.addOperands(rhs);
1943 odsState.addAttribute(getPredicateAttrName(odsState.name), ::mlir::arith::CmpIPredicateAttr::get(odsBuilder.getContext(), predicate));
1944 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1944, __extension__ __PRETTY_FUNCTION__))
;
1945 odsState.addTypes(resultTypes);
1946}
1947
1948void CmpIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1949 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1949, __extension__ __PRETTY_FUNCTION__))
;
1950 odsState.addOperands(operands);
1951 odsState.addAttributes(attributes);
1952 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 1952, __extension__ __PRETTY_FUNCTION__))
;
1953 odsState.addTypes(resultTypes);
1954}
1955
1956::mlir::LogicalResult CmpIOp::verifyInvariantsImpl() {
1957 auto namedAttrRange = (*this)->getAttrs();
1958 auto namedAttrIt = namedAttrRange.begin();
1959 ::mlir::Attribute tblgen_predicate;
1960 while (true) {
1961 if (namedAttrIt == namedAttrRange.end())
1962 return emitOpError("requires attribute 'predicate'");
1963 if (namedAttrIt->getName() == getPredicateAttrName()) {
1964 tblgen_predicate = namedAttrIt->getValue();
1965 break;
1966 }
1967 ++namedAttrIt;
1968 }
1969
1970 if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithmeticOps1(*this, tblgen_predicate, "predicate")))
1971 return ::mlir::failure();
1972 {
1973 unsigned index = 0; (void)index;
1974 auto valueGroup0 = getODSOperands(0);
1975
1976 for (auto v : valueGroup0) {
1977 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps4(*this, v.getType(), "operand", index++)))
1978 return ::mlir::failure();
1979 }
1980 auto valueGroup1 = getODSOperands(1);
1981
1982 for (auto v : valueGroup1) {
1983 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps4(*this, v.getType(), "operand", index++)))
1984 return ::mlir::failure();
1985 }
1986 }
1987 {
1988 unsigned index = 0; (void)index;
1989 auto valueGroup0 = getODSResults(0);
1990
1991 for (auto v : valueGroup0) {
1992 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps5(*this, v.getType(), "result", index++)))
1993 return ::mlir::failure();
1994 }
1995 }
1996 if (!((std::equal_to<>()(::getI1SameShape((*this->getODSOperands(0).begin()).getType()), (*this->getODSResults(0).begin()).getType()))))
1997 return emitOpError("failed to verify that result type has i1 element type and same shape as operands");
1998 return ::mlir::success();
1999}
2000
2001::mlir::LogicalResult CmpIOp::verifyInvariants() {
2002 return verifyInvariantsImpl();
2003}
2004
2005::mlir::ParseResult CmpIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2006 ::mlir::arith::CmpIPredicateAttr predicateAttr;
2007 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
2008 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
2009 (void)lhsOperandsLoc;
2010 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
2011 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
2012 (void)rhsOperandsLoc;
2013 ::mlir::Type lhsRawTypes[1];
2014 ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes);
2015
2016 {
2017 ::llvm::StringRef attrStr;
2018 ::mlir::NamedAttrList attrStorage;
2019 auto loc = parser.getCurrentLocation();
2020 if (parser.parseOptionalKeyword(&attrStr, {"eq","ne","slt","sle","sgt","sge","ult","ule","ugt","uge"})) {
2021 ::mlir::StringAttr attrVal;
2022 ::mlir::OptionalParseResult parseResult =
2023 parser.parseOptionalAttribute(attrVal,
2024 parser.getBuilder().getNoneType(),
2025 "predicate", attrStorage);
2026 if (parseResult.hasValue()) {
2027 if (failed(*parseResult))
2028 return ::mlir::failure();
2029 attrStr = attrVal.getValue();
2030 } else {
2031 return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'predicate' [eq, ne, slt, sle, sgt, sge, ult, ule, ugt, uge]");
2032 }
2033 }
2034 if (!attrStr.empty()) {
2035 auto attrOptional = ::mlir::arith::symbolizeCmpIPredicate(attrStr);
2036 if (!attrOptional)
2037 return parser.emitError(loc, "invalid ")
2038 << "predicate attribute specification: \"" << attrStr << '"';;
2039
2040 predicateAttr = ::mlir::arith::CmpIPredicateAttr::get(parser.getBuilder().getContext(), attrOptional.getValue());
2041 result.addAttribute("predicate", predicateAttr);
2042 }
2043 }
2044 if (parser.parseComma())
2045 return ::mlir::failure();
2046
2047 lhsOperandsLoc = parser.getCurrentLocation();
2048 if (parser.parseOperand(lhsRawOperands[0]))
2049 return ::mlir::failure();
2050 if (parser.parseComma())
2051 return ::mlir::failure();
2052
2053 rhsOperandsLoc = parser.getCurrentLocation();
2054 if (parser.parseOperand(rhsRawOperands[0]))
2055 return ::mlir::failure();
2056 if (parser.parseOptionalAttrDict(result.attributes))
2057 return ::mlir::failure();
2058 if (parser.parseColon())
2059 return ::mlir::failure();
2060
2061 {
2062 ::mlir::Type type;
2063 if (parser.parseCustomTypeWithFallback(type))
2064 return ::mlir::failure();
2065 lhsRawTypes[0] = type;
2066 }
2067 for (::mlir::Type type : lhsTypes) {
2068 (void)type;
2069 if (!(((type.isSignlessIntOrIndex())) || (((type.isa<::mlir::VectorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))) || (((type.isa<::mlir::TensorType>())) && ([](::mlir::Type elementType) { return (elementType.isSignlessIntOrIndex()); }(type.cast<::mlir::ShapedType>().getElementType()))))) {
2070 return parser.emitError(parser.getNameLoc()) << "'lhs' must be signless-integer-like, but got " << type;
2071 }
2072 }
2073 result.addTypes(::getI1SameShape(lhsTypes[0]));
2074 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
2075 return ::mlir::failure();
2076 if (parser.resolveOperands(rhsOperands, lhsTypes[0], result.operands))
2077 return ::mlir::failure();
2078 return ::mlir::success();
2079}
2080
2081void CmpIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2082 _odsPrinter << ' ';
2083
2084 {
2085 auto caseValue = getPredicate();
2086 auto caseValueStr = stringifyCmpIPredicate(caseValue);
2087 _odsPrinter << caseValueStr;
2088 }
2089 _odsPrinter << ",";
2090 _odsPrinter << ' ';
2091 _odsPrinter << getLhs();
2092 _odsPrinter << ",";
2093 _odsPrinter << ' ';
2094 _odsPrinter << getRhs();
2095 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{"predicate"});
2096 _odsPrinter << ' ' << ":";
2097 _odsPrinter << ' ';
2098 {
2099 auto type = getLhs().getType();
2100 if (auto validType = type.dyn_cast<::mlir::Type>())
2101 _odsPrinter.printStrippedAttrOrType(validType);
2102 else
2103 _odsPrinter << type;
2104 }
2105}
2106
2107void CmpIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
2108}
2109
2110} // namespace arith
2111} // namespace mlir
2112MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::CmpIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::CmpIOp>::id = {}; } }
2113
2114namespace mlir {
2115namespace arith {
2116
2117//===----------------------------------------------------------------------===//
2118// ::mlir::arith::ConstantOp definitions
2119//===----------------------------------------------------------------------===//
2120
2121ConstantOpAdaptor::ConstantOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
2122 odsOpName.emplace("arith.constant", odsAttrs.getContext());
2123}
2124
2125ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
2126
2127::mlir::ValueRange ConstantOpAdaptor::getOperands() {
2128 return odsOperands;
2129}
2130
2131std::pair<unsigned, unsigned> ConstantOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
2132 return {index, 1};
2133}
2134
2135::mlir::ValueRange ConstantOpAdaptor::getODSOperands(unsigned index) {
2136 auto valueRange = getODSOperandIndexAndLength(index);
2137 return {std::next(odsOperands.begin(), valueRange.first),
2138 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2139}
2140
2141::mlir::DictionaryAttr ConstantOpAdaptor::getAttributes() {
2142 return odsAttrs;
2143}
2144
2145::mlir::Attribute ConstantOpAdaptor::getValueAttr() {
2146 assert(odsAttrs && "no attributes when constructing adapter")(static_cast <bool> (odsAttrs && "no attributes when constructing adapter"
) ? void (0) : __assert_fail ("odsAttrs && \"no attributes when constructing adapter\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2146, __extension__ __PRETTY_FUNCTION__))
;
2147 auto attr = ::mlir::impl::getAttrFromSortedRange(odsAttrs.begin() + 0, odsAttrs.end() - 0, ConstantOp::getValueAttrName(*odsOpName)).cast<::mlir::Attribute>();
2148 return attr;
2149}
2150
2151::mlir::Attribute ConstantOpAdaptor::getValue() {
2152 auto attr = getValueAttr();
2153 return attr;
2154}
2155
2156::mlir::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) {
2157 auto namedAttrRange = odsAttrs;
2158 auto namedAttrIt = namedAttrRange.begin();
2159 ::mlir::Attribute tblgen_value;
2160 while (true) {
2161 if (namedAttrIt == namedAttrRange.end())
2162 return emitError(loc, "'arith.constant' op ""requires attribute 'value'");
2163 if (namedAttrIt->getName() == ConstantOp::getValueAttrName(*odsOpName)) {
2164 tblgen_value = namedAttrIt->getValue();
2165 break;
2166 }
2167 ++namedAttrIt;
2168 }
2169
2170 if (tblgen_value && !((true)))
2171 return emitError(loc, "'arith.constant' op ""attribute 'value' failed to satisfy constraint: any attribute");
2172 return ::mlir::success();
2173}
2174
2175std::pair<unsigned, unsigned> ConstantOp::getODSOperandIndexAndLength(unsigned index) {
2176 return {index, 1};
2177}
2178
2179::mlir::Operation::operand_range ConstantOp::getODSOperands(unsigned index) {
2180 auto valueRange = getODSOperandIndexAndLength(index);
2181 return {std::next(getOperation()->operand_begin(), valueRange.first),
2182 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2183}
2184
2185std::pair<unsigned, unsigned> ConstantOp::getODSResultIndexAndLength(unsigned index) {
2186 return {index, 1};
2187}
2188
2189::mlir::Operation::result_range ConstantOp::getODSResults(unsigned index) {
2190 auto valueRange = getODSResultIndexAndLength(index);
2191 return {std::next(getOperation()->result_begin(), valueRange.first),
2192 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
2193}
2194
2195::mlir::Value ConstantOp::getResult() {
2196 return *getODSResults(0).begin();
2197}
2198
2199::mlir::Attribute ConstantOp::getValueAttr() {
2200 return ::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 0, (*this)->getAttrs().end() - 0, getValueAttrName()).cast<::mlir::Attribute>();
2201}
2202
2203::mlir::Attribute ConstantOp::getValue() {
2204 auto attr = getValueAttr();
2205 return attr;
2206}
2207
2208void ConstantOp::setValueAttr(::mlir::Attribute attr) {
2209 (*this)->setAttr(getValueAttrName(), attr);
2210}
2211
2212void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value) {
2213 build(odsBuilder, odsState, value.getType(), value);
4
Calling 'Attribute::getType'
2214}
2215
2216void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value, Type type) {
2217 build(odsBuilder, odsState, type, value);
2218}
2219
2220void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Attribute value) {
2221 odsState.addAttribute(getValueAttrName(odsState.name), value);
2222 odsState.addTypes(result);
2223}
2224
2225void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
2226 odsState.addAttribute(getValueAttrName(odsState.name), value);
2227 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2227, __extension__ __PRETTY_FUNCTION__))
;
2228 odsState.addTypes(resultTypes);
2229}
2230
2231void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2232 assert(operands.size() == 0u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 0u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 0u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2232, __extension__ __PRETTY_FUNCTION__))
;
2233 odsState.addOperands(operands);
2234 odsState.addAttributes(attributes);
2235 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2235, __extension__ __PRETTY_FUNCTION__))
;
2236 odsState.addTypes(resultTypes);
2237}
2238
2239::mlir::LogicalResult ConstantOp::verifyInvariantsImpl() {
2240 auto namedAttrRange = (*this)->getAttrs();
2241 auto namedAttrIt = namedAttrRange.begin();
2242 ::mlir::Attribute tblgen_value;
2243 while (true) {
2244 if (namedAttrIt == namedAttrRange.end())
2245 return emitOpError("requires attribute 'value'");
2246 if (namedAttrIt->getName() == getValueAttrName()) {
2247 tblgen_value = namedAttrIt->getValue();
2248 break;
2249 }
2250 ++namedAttrIt;
2251 }
2252
2253 if (::mlir::failed(__mlir_ods_local_attr_constraint_ArithmeticOps2(*this, tblgen_value, "value")))
2254 return ::mlir::failure();
2255 {
2256 unsigned index = 0; (void)index;
2257 auto valueGroup0 = getODSResults(0);
2258
2259 for (auto v : valueGroup0) {
2260 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps6(*this, v.getType(), "result", index++)))
2261 return ::mlir::failure();
2262 }
2263 }
2264 if (!((std::equal_to<>()(::mlir::impl::getAttrFromSortedRange((*this)->getAttrs().begin() + 0, (*this)->getAttrs().end() - 0, getValueAttrName()).getType(), (*this->getODSResults(0).begin()).getType()))))
2265 return emitOpError("failed to verify that result and attribute have the same type");
2266 return ::mlir::success();
2267}
2268
2269::mlir::LogicalResult ConstantOp::verifyInvariants() {
2270 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
2271 return ::mlir::success();
2272 return ::mlir::failure();
2273}
2274
2275::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2276 ::mlir::Attribute valueAttr;
2277 if (parser.parseOptionalAttrDict(result.attributes))
2278 return ::mlir::failure();
2279
2280 if (parser.parseAttribute(valueAttr, ::mlir::Type{}, "value", result.attributes))
2281 return ::mlir::failure();
2282 result.addTypes(valueAttr.getType());
2283 return ::mlir::success();
2284}
2285
2286void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2287 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{"value"});
2288 _odsPrinter << ' ';
2289 _odsPrinter.printAttribute(getValueAttr());
2290}
2291
2292void ConstantOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
2293}
2294
2295} // namespace arith
2296} // namespace mlir
2297MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ConstantOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ConstantOp>::id = {}; } }
2298
2299namespace mlir {
2300namespace arith {
2301
2302//===----------------------------------------------------------------------===//
2303// ::mlir::arith::DivFOp definitions
2304//===----------------------------------------------------------------------===//
2305
2306DivFOpAdaptor::DivFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
2307 odsOpName.emplace("arith.divf", odsAttrs.getContext());
2308}
2309
2310DivFOpAdaptor::DivFOpAdaptor(DivFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
2311
2312::mlir::ValueRange DivFOpAdaptor::getOperands() {
2313 return odsOperands;
2314}
2315
2316std::pair<unsigned, unsigned> DivFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
2317 return {index, 1};
2318}
2319
2320::mlir::ValueRange DivFOpAdaptor::getODSOperands(unsigned index) {
2321 auto valueRange = getODSOperandIndexAndLength(index);
2322 return {std::next(odsOperands.begin(), valueRange.first),
2323 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2324}
2325
2326::mlir::Value DivFOpAdaptor::getLhs() {
2327 return *getODSOperands(0).begin();
2328}
2329
2330::mlir::Value DivFOpAdaptor::getRhs() {
2331 return *getODSOperands(1).begin();
2332}
2333
2334::mlir::DictionaryAttr DivFOpAdaptor::getAttributes() {
2335 return odsAttrs;
2336}
2337
2338::mlir::LogicalResult DivFOpAdaptor::verify(::mlir::Location loc) {
2339 return ::mlir::success();
2340}
2341
2342std::pair<unsigned, unsigned> DivFOp::getODSOperandIndexAndLength(unsigned index) {
2343 return {index, 1};
2344}
2345
2346::mlir::Operation::operand_range DivFOp::getODSOperands(unsigned index) {
2347 auto valueRange = getODSOperandIndexAndLength(index);
2348 return {std::next(getOperation()->operand_begin(), valueRange.first),
2349 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2350}
2351
2352::mlir::Value DivFOp::getLhs() {
2353 return *getODSOperands(0).begin();
2354}
2355
2356::mlir::Value DivFOp::getRhs() {
2357 return *getODSOperands(1).begin();
2358}
2359
2360::mlir::MutableOperandRange DivFOp::getLhsMutable() {
2361 auto range = getODSOperandIndexAndLength(0);
2362 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2363 return mutableRange;
2364}
2365
2366::mlir::MutableOperandRange DivFOp::getRhsMutable() {
2367 auto range = getODSOperandIndexAndLength(1);
2368 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2369 return mutableRange;
2370}
2371
2372std::pair<unsigned, unsigned> DivFOp::getODSResultIndexAndLength(unsigned index) {
2373 return {index, 1};
2374}
2375
2376::mlir::Operation::result_range DivFOp::getODSResults(unsigned index) {
2377 auto valueRange = getODSResultIndexAndLength(index);
2378 return {std::next(getOperation()->result_begin(), valueRange.first),
2379 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
2380}
2381
2382::mlir::Value DivFOp::getResult() {
2383 return *getODSResults(0).begin();
2384}
2385
2386void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
2387 odsState.addOperands(lhs);
2388 odsState.addOperands(rhs);
2389 odsState.addTypes(result);
2390}
2391
2392void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
2393 odsState.addOperands(lhs);
2394 odsState.addOperands(rhs);
2395 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2395, __extension__ __PRETTY_FUNCTION__))
;
2396 odsState.addTypes(resultTypes);
2397}
2398
2399void DivFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2400 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2400, __extension__ __PRETTY_FUNCTION__))
;
2401 odsState.addOperands(operands);
2402 odsState.addAttributes(attributes);
2403 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2403, __extension__ __PRETTY_FUNCTION__))
;
2404 odsState.addTypes(resultTypes);
2405}
2406
2407void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
2408 odsState.addOperands(lhs);
2409 odsState.addOperands(rhs);
2410 odsState.addTypes({lhs.getType()});
2411
2412}
2413
2414void DivFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2415 odsState.addOperands(operands);
2416 odsState.addAttributes(attributes);
2417 odsState.addTypes({operands[0].getType()});
2418
2419}
2420
2421::mlir::LogicalResult DivFOp::verifyInvariantsImpl() {
2422 {
2423 unsigned index = 0; (void)index;
2424 auto valueGroup0 = getODSOperands(0);
2425
2426 for (auto v : valueGroup0) {
2427 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
2428 return ::mlir::failure();
2429 }
2430 auto valueGroup1 = getODSOperands(1);
2431
2432 for (auto v : valueGroup1) {
2433 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
2434 return ::mlir::failure();
2435 }
2436 }
2437 {
2438 unsigned index = 0; (void)index;
2439 auto valueGroup0 = getODSResults(0);
2440
2441 for (auto v : valueGroup0) {
2442 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
2443 return ::mlir::failure();
2444 }
2445 }
2446 return ::mlir::success();
2447}
2448
2449::mlir::LogicalResult DivFOp::verifyInvariants() {
2450 return verifyInvariantsImpl();
2451}
2452
2453::mlir::ParseResult DivFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2454 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
2455 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
2456 (void)lhsOperandsLoc;
2457 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
2458 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
2459 (void)rhsOperandsLoc;
2460 ::mlir::Type resultRawTypes[1];
2461 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
2462
2463 lhsOperandsLoc = parser.getCurrentLocation();
2464 if (parser.parseOperand(lhsRawOperands[0]))
2465 return ::mlir::failure();
2466 if (parser.parseComma())
2467 return ::mlir::failure();
2468
2469 rhsOperandsLoc = parser.getCurrentLocation();
2470 if (parser.parseOperand(rhsRawOperands[0]))
2471 return ::mlir::failure();
2472 if (parser.parseOptionalAttrDict(result.attributes))
2473 return ::mlir::failure();
2474 if (parser.parseColon())
2475 return ::mlir::failure();
2476
2477 {
2478 ::mlir::Type type;
2479 if (parser.parseCustomTypeWithFallback(type))
2480 return ::mlir::failure();
2481 resultRawTypes[0] = type;
2482 }
2483 result.addTypes(resultTypes);
2484 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
2485 return ::mlir::failure();
2486 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
2487 return ::mlir::failure();
2488 return ::mlir::success();
2489}
2490
2491void DivFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2492 _odsPrinter << ' ';
2493 _odsPrinter << getLhs();
2494 _odsPrinter << ",";
2495 _odsPrinter << ' ';
2496 _odsPrinter << getRhs();
2497 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
2498 _odsPrinter << ' ' << ":";
2499 _odsPrinter << ' ';
2500 {
2501 auto type = getResult().getType();
2502 if (auto validType = type.dyn_cast<::mlir::Type>())
2503 _odsPrinter.printStrippedAttrOrType(validType);
2504 else
2505 _odsPrinter << type;
2506 }
2507}
2508
2509void DivFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
2510}
2511
2512} // namespace arith
2513} // namespace mlir
2514MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::DivFOp>::id = {}; } }
2515
2516namespace mlir {
2517namespace arith {
2518
2519//===----------------------------------------------------------------------===//
2520// ::mlir::arith::DivSIOp definitions
2521//===----------------------------------------------------------------------===//
2522
2523DivSIOpAdaptor::DivSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
2524 odsOpName.emplace("arith.divsi", odsAttrs.getContext());
2525}
2526
2527DivSIOpAdaptor::DivSIOpAdaptor(DivSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
2528
2529::mlir::ValueRange DivSIOpAdaptor::getOperands() {
2530 return odsOperands;
2531}
2532
2533std::pair<unsigned, unsigned> DivSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
2534 return {index, 1};
2535}
2536
2537::mlir::ValueRange DivSIOpAdaptor::getODSOperands(unsigned index) {
2538 auto valueRange = getODSOperandIndexAndLength(index);
2539 return {std::next(odsOperands.begin(), valueRange.first),
2540 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2541}
2542
2543::mlir::Value DivSIOpAdaptor::getLhs() {
2544 return *getODSOperands(0).begin();
2545}
2546
2547::mlir::Value DivSIOpAdaptor::getRhs() {
2548 return *getODSOperands(1).begin();
2549}
2550
2551::mlir::DictionaryAttr DivSIOpAdaptor::getAttributes() {
2552 return odsAttrs;
2553}
2554
2555::mlir::LogicalResult DivSIOpAdaptor::verify(::mlir::Location loc) {
2556 return ::mlir::success();
2557}
2558
2559std::pair<unsigned, unsigned> DivSIOp::getODSOperandIndexAndLength(unsigned index) {
2560 return {index, 1};
2561}
2562
2563::mlir::Operation::operand_range DivSIOp::getODSOperands(unsigned index) {
2564 auto valueRange = getODSOperandIndexAndLength(index);
2565 return {std::next(getOperation()->operand_begin(), valueRange.first),
2566 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2567}
2568
2569::mlir::Value DivSIOp::getLhs() {
2570 return *getODSOperands(0).begin();
2571}
2572
2573::mlir::Value DivSIOp::getRhs() {
2574 return *getODSOperands(1).begin();
2575}
2576
2577::mlir::MutableOperandRange DivSIOp::getLhsMutable() {
2578 auto range = getODSOperandIndexAndLength(0);
2579 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2580 return mutableRange;
2581}
2582
2583::mlir::MutableOperandRange DivSIOp::getRhsMutable() {
2584 auto range = getODSOperandIndexAndLength(1);
2585 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2586 return mutableRange;
2587}
2588
2589std::pair<unsigned, unsigned> DivSIOp::getODSResultIndexAndLength(unsigned index) {
2590 return {index, 1};
2591}
2592
2593::mlir::Operation::result_range DivSIOp::getODSResults(unsigned index) {
2594 auto valueRange = getODSResultIndexAndLength(index);
2595 return {std::next(getOperation()->result_begin(), valueRange.first),
2596 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
2597}
2598
2599::mlir::Value DivSIOp::getResult() {
2600 return *getODSResults(0).begin();
2601}
2602
2603void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
2604 odsState.addOperands(lhs);
2605 odsState.addOperands(rhs);
2606 odsState.addTypes(result);
2607}
2608
2609void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
2610 odsState.addOperands(lhs);
2611 odsState.addOperands(rhs);
2612 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2612, __extension__ __PRETTY_FUNCTION__))
;
2613 odsState.addTypes(resultTypes);
2614}
2615
2616void DivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2617 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2617, __extension__ __PRETTY_FUNCTION__))
;
2618 odsState.addOperands(operands);
2619 odsState.addAttributes(attributes);
2620 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2620, __extension__ __PRETTY_FUNCTION__))
;
2621 odsState.addTypes(resultTypes);
2622}
2623
2624void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
2625 odsState.addOperands(lhs);
2626 odsState.addOperands(rhs);
2627 odsState.addTypes({lhs.getType()});
2628
2629}
2630
2631void DivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2632 odsState.addOperands(operands);
2633 odsState.addAttributes(attributes);
2634 odsState.addTypes({operands[0].getType()});
2635
2636}
2637
2638::mlir::LogicalResult DivSIOp::verifyInvariantsImpl() {
2639 {
2640 unsigned index = 0; (void)index;
2641 auto valueGroup0 = getODSOperands(0);
2642
2643 for (auto v : valueGroup0) {
2644 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
2645 return ::mlir::failure();
2646 }
2647 auto valueGroup1 = getODSOperands(1);
2648
2649 for (auto v : valueGroup1) {
2650 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
2651 return ::mlir::failure();
2652 }
2653 }
2654 {
2655 unsigned index = 0; (void)index;
2656 auto valueGroup0 = getODSResults(0);
2657
2658 for (auto v : valueGroup0) {
2659 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
2660 return ::mlir::failure();
2661 }
2662 }
2663 return ::mlir::success();
2664}
2665
2666::mlir::LogicalResult DivSIOp::verifyInvariants() {
2667 return verifyInvariantsImpl();
2668}
2669
2670::mlir::ParseResult DivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2671 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
2672 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
2673 (void)lhsOperandsLoc;
2674 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
2675 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
2676 (void)rhsOperandsLoc;
2677 ::mlir::Type resultRawTypes[1];
2678 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
2679
2680 lhsOperandsLoc = parser.getCurrentLocation();
2681 if (parser.parseOperand(lhsRawOperands[0]))
2682 return ::mlir::failure();
2683 if (parser.parseComma())
2684 return ::mlir::failure();
2685
2686 rhsOperandsLoc = parser.getCurrentLocation();
2687 if (parser.parseOperand(rhsRawOperands[0]))
2688 return ::mlir::failure();
2689 if (parser.parseOptionalAttrDict(result.attributes))
2690 return ::mlir::failure();
2691 if (parser.parseColon())
2692 return ::mlir::failure();
2693
2694 {
2695 ::mlir::Type type;
2696 if (parser.parseCustomTypeWithFallback(type))
2697 return ::mlir::failure();
2698 resultRawTypes[0] = type;
2699 }
2700 result.addTypes(resultTypes);
2701 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
2702 return ::mlir::failure();
2703 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
2704 return ::mlir::failure();
2705 return ::mlir::success();
2706}
2707
2708void DivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2709 _odsPrinter << ' ';
2710 _odsPrinter << getLhs();
2711 _odsPrinter << ",";
2712 _odsPrinter << ' ';
2713 _odsPrinter << getRhs();
2714 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
2715 _odsPrinter << ' ' << ":";
2716 _odsPrinter << ' ';
2717 {
2718 auto type = getResult().getType();
2719 if (auto validType = type.dyn_cast<::mlir::Type>())
2720 _odsPrinter.printStrippedAttrOrType(validType);
2721 else
2722 _odsPrinter << type;
2723 }
2724}
2725
2726void DivSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
2727}
2728
2729} // namespace arith
2730} // namespace mlir
2731MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::DivSIOp>::id = {}; } }
2732
2733namespace mlir {
2734namespace arith {
2735
2736//===----------------------------------------------------------------------===//
2737// ::mlir::arith::DivUIOp definitions
2738//===----------------------------------------------------------------------===//
2739
2740DivUIOpAdaptor::DivUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
2741 odsOpName.emplace("arith.divui", odsAttrs.getContext());
2742}
2743
2744DivUIOpAdaptor::DivUIOpAdaptor(DivUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
2745
2746::mlir::ValueRange DivUIOpAdaptor::getOperands() {
2747 return odsOperands;
2748}
2749
2750std::pair<unsigned, unsigned> DivUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
2751 return {index, 1};
2752}
2753
2754::mlir::ValueRange DivUIOpAdaptor::getODSOperands(unsigned index) {
2755 auto valueRange = getODSOperandIndexAndLength(index);
2756 return {std::next(odsOperands.begin(), valueRange.first),
2757 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2758}
2759
2760::mlir::Value DivUIOpAdaptor::getLhs() {
2761 return *getODSOperands(0).begin();
2762}
2763
2764::mlir::Value DivUIOpAdaptor::getRhs() {
2765 return *getODSOperands(1).begin();
2766}
2767
2768::mlir::DictionaryAttr DivUIOpAdaptor::getAttributes() {
2769 return odsAttrs;
2770}
2771
2772::mlir::LogicalResult DivUIOpAdaptor::verify(::mlir::Location loc) {
2773 return ::mlir::success();
2774}
2775
2776std::pair<unsigned, unsigned> DivUIOp::getODSOperandIndexAndLength(unsigned index) {
2777 return {index, 1};
2778}
2779
2780::mlir::Operation::operand_range DivUIOp::getODSOperands(unsigned index) {
2781 auto valueRange = getODSOperandIndexAndLength(index);
2782 return {std::next(getOperation()->operand_begin(), valueRange.first),
2783 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2784}
2785
2786::mlir::Value DivUIOp::getLhs() {
2787 return *getODSOperands(0).begin();
2788}
2789
2790::mlir::Value DivUIOp::getRhs() {
2791 return *getODSOperands(1).begin();
2792}
2793
2794::mlir::MutableOperandRange DivUIOp::getLhsMutable() {
2795 auto range = getODSOperandIndexAndLength(0);
2796 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2797 return mutableRange;
2798}
2799
2800::mlir::MutableOperandRange DivUIOp::getRhsMutable() {
2801 auto range = getODSOperandIndexAndLength(1);
2802 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2803 return mutableRange;
2804}
2805
2806std::pair<unsigned, unsigned> DivUIOp::getODSResultIndexAndLength(unsigned index) {
2807 return {index, 1};
2808}
2809
2810::mlir::Operation::result_range DivUIOp::getODSResults(unsigned index) {
2811 auto valueRange = getODSResultIndexAndLength(index);
2812 return {std::next(getOperation()->result_begin(), valueRange.first),
2813 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
2814}
2815
2816::mlir::Value DivUIOp::getResult() {
2817 return *getODSResults(0).begin();
2818}
2819
2820void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
2821 odsState.addOperands(lhs);
2822 odsState.addOperands(rhs);
2823 odsState.addTypes(result);
2824}
2825
2826void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
2827 odsState.addOperands(lhs);
2828 odsState.addOperands(rhs);
2829 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2829, __extension__ __PRETTY_FUNCTION__))
;
2830 odsState.addTypes(resultTypes);
2831}
2832
2833void DivUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2834 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2834, __extension__ __PRETTY_FUNCTION__))
;
2835 odsState.addOperands(operands);
2836 odsState.addAttributes(attributes);
2837 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 2837, __extension__ __PRETTY_FUNCTION__))
;
2838 odsState.addTypes(resultTypes);
2839}
2840
2841void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
2842 odsState.addOperands(lhs);
2843 odsState.addOperands(rhs);
2844 odsState.addTypes({lhs.getType()});
2845
2846}
2847
2848void DivUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
2849 odsState.addOperands(operands);
2850 odsState.addAttributes(attributes);
2851 odsState.addTypes({operands[0].getType()});
2852
2853}
2854
2855::mlir::LogicalResult DivUIOp::verifyInvariantsImpl() {
2856 {
2857 unsigned index = 0; (void)index;
2858 auto valueGroup0 = getODSOperands(0);
2859
2860 for (auto v : valueGroup0) {
2861 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
2862 return ::mlir::failure();
2863 }
2864 auto valueGroup1 = getODSOperands(1);
2865
2866 for (auto v : valueGroup1) {
2867 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
2868 return ::mlir::failure();
2869 }
2870 }
2871 {
2872 unsigned index = 0; (void)index;
2873 auto valueGroup0 = getODSResults(0);
2874
2875 for (auto v : valueGroup0) {
2876 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
2877 return ::mlir::failure();
2878 }
2879 }
2880 return ::mlir::success();
2881}
2882
2883::mlir::LogicalResult DivUIOp::verifyInvariants() {
2884 return verifyInvariantsImpl();
2885}
2886
2887::mlir::ParseResult DivUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
2888 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
2889 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
2890 (void)lhsOperandsLoc;
2891 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
2892 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
2893 (void)rhsOperandsLoc;
2894 ::mlir::Type resultRawTypes[1];
2895 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
2896
2897 lhsOperandsLoc = parser.getCurrentLocation();
2898 if (parser.parseOperand(lhsRawOperands[0]))
2899 return ::mlir::failure();
2900 if (parser.parseComma())
2901 return ::mlir::failure();
2902
2903 rhsOperandsLoc = parser.getCurrentLocation();
2904 if (parser.parseOperand(rhsRawOperands[0]))
2905 return ::mlir::failure();
2906 if (parser.parseOptionalAttrDict(result.attributes))
2907 return ::mlir::failure();
2908 if (parser.parseColon())
2909 return ::mlir::failure();
2910
2911 {
2912 ::mlir::Type type;
2913 if (parser.parseCustomTypeWithFallback(type))
2914 return ::mlir::failure();
2915 resultRawTypes[0] = type;
2916 }
2917 result.addTypes(resultTypes);
2918 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
2919 return ::mlir::failure();
2920 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
2921 return ::mlir::failure();
2922 return ::mlir::success();
2923}
2924
2925void DivUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
2926 _odsPrinter << ' ';
2927 _odsPrinter << getLhs();
2928 _odsPrinter << ",";
2929 _odsPrinter << ' ';
2930 _odsPrinter << getRhs();
2931 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
2932 _odsPrinter << ' ' << ":";
2933 _odsPrinter << ' ';
2934 {
2935 auto type = getResult().getType();
2936 if (auto validType = type.dyn_cast<::mlir::Type>())
2937 _odsPrinter.printStrippedAttrOrType(validType);
2938 else
2939 _odsPrinter << type;
2940 }
2941}
2942
2943void DivUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
2944}
2945
2946} // namespace arith
2947} // namespace mlir
2948MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::DivUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::DivUIOp>::id = {}; } }
2949
2950namespace mlir {
2951namespace arith {
2952
2953//===----------------------------------------------------------------------===//
2954// ::mlir::arith::ExtFOp definitions
2955//===----------------------------------------------------------------------===//
2956
2957ExtFOpAdaptor::ExtFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
2958 odsOpName.emplace("arith.extf", odsAttrs.getContext());
2959}
2960
2961ExtFOpAdaptor::ExtFOpAdaptor(ExtFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
2962
2963::mlir::ValueRange ExtFOpAdaptor::getOperands() {
2964 return odsOperands;
2965}
2966
2967std::pair<unsigned, unsigned> ExtFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
2968 return {index, 1};
2969}
2970
2971::mlir::ValueRange ExtFOpAdaptor::getODSOperands(unsigned index) {
2972 auto valueRange = getODSOperandIndexAndLength(index);
2973 return {std::next(odsOperands.begin(), valueRange.first),
2974 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2975}
2976
2977::mlir::Value ExtFOpAdaptor::getIn() {
2978 return *getODSOperands(0).begin();
2979}
2980
2981::mlir::DictionaryAttr ExtFOpAdaptor::getAttributes() {
2982 return odsAttrs;
2983}
2984
2985::mlir::LogicalResult ExtFOpAdaptor::verify(::mlir::Location loc) {
2986 return ::mlir::success();
2987}
2988
2989std::pair<unsigned, unsigned> ExtFOp::getODSOperandIndexAndLength(unsigned index) {
2990 return {index, 1};
2991}
2992
2993::mlir::Operation::operand_range ExtFOp::getODSOperands(unsigned index) {
2994 auto valueRange = getODSOperandIndexAndLength(index);
2995 return {std::next(getOperation()->operand_begin(), valueRange.first),
2996 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2997}
2998
2999::mlir::Value ExtFOp::getIn() {
3000 return *getODSOperands(0).begin();
3001}
3002
3003::mlir::MutableOperandRange ExtFOp::getInMutable() {
3004 auto range = getODSOperandIndexAndLength(0);
3005 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3006 return mutableRange;
3007}
3008
3009std::pair<unsigned, unsigned> ExtFOp::getODSResultIndexAndLength(unsigned index) {
3010 return {index, 1};
3011}
3012
3013::mlir::Operation::result_range ExtFOp::getODSResults(unsigned index) {
3014 auto valueRange = getODSResultIndexAndLength(index);
3015 return {std::next(getOperation()->result_begin(), valueRange.first),
3016 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3017}
3018
3019::mlir::Value ExtFOp::getOut() {
3020 return *getODSResults(0).begin();
3021}
3022
3023void ExtFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
3024 odsState.addOperands(in);
3025 odsState.addTypes(out);
3026}
3027
3028void ExtFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
3029 odsState.addOperands(in);
3030 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3030, __extension__ __PRETTY_FUNCTION__))
;
3031 odsState.addTypes(resultTypes);
3032}
3033
3034void ExtFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3035 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3035, __extension__ __PRETTY_FUNCTION__))
;
3036 odsState.addOperands(operands);
3037 odsState.addAttributes(attributes);
3038 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3038, __extension__ __PRETTY_FUNCTION__))
;
3039 odsState.addTypes(resultTypes);
3040}
3041
3042::mlir::LogicalResult ExtFOp::verifyInvariantsImpl() {
3043 {
3044 unsigned index = 0; (void)index;
3045 auto valueGroup0 = getODSOperands(0);
3046
3047 for (auto v : valueGroup0) {
3048 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
3049 return ::mlir::failure();
3050 }
3051 }
3052 {
3053 unsigned index = 0; (void)index;
3054 auto valueGroup0 = getODSResults(0);
3055
3056 for (auto v : valueGroup0) {
3057 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
3058 return ::mlir::failure();
3059 }
3060 }
3061 return ::mlir::success();
3062}
3063
3064::mlir::LogicalResult ExtFOp::verifyInvariants() {
3065 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
3066 return ::mlir::success();
3067 return ::mlir::failure();
3068}
3069
3070::mlir::ParseResult ExtFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
3071 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
3072 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
3073 (void)inOperandsLoc;
3074 ::mlir::Type inRawTypes[1];
3075 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
3076 ::mlir::Type outRawTypes[1];
3077 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
3078
3079 inOperandsLoc = parser.getCurrentLocation();
3080 if (parser.parseOperand(inRawOperands[0]))
3081 return ::mlir::failure();
3082 if (parser.parseOptionalAttrDict(result.attributes))
3083 return ::mlir::failure();
3084 if (parser.parseColon())
3085 return ::mlir::failure();
3086
3087 {
3088 ::mlir::Type type;
3089 if (parser.parseCustomTypeWithFallback(type))
3090 return ::mlir::failure();
3091 inRawTypes[0] = type;
3092 }
3093 if (parser.parseKeyword("to"))
3094 return ::mlir::failure();
3095
3096 {
3097 ::mlir::Type type;
3098 if (parser.parseCustomTypeWithFallback(type))
3099 return ::mlir::failure();
3100 outRawTypes[0] = type;
3101 }
3102 result.addTypes(outTypes);
3103 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
3104 return ::mlir::failure();
3105 return ::mlir::success();
3106}
3107
3108void ExtFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
3109 _odsPrinter << ' ';
3110 _odsPrinter << getIn();
3111 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
3112 _odsPrinter << ' ' << ":";
3113 _odsPrinter << ' ';
3114 {
3115 auto type = getIn().getType();
3116 if (auto validType = type.dyn_cast<::mlir::Type>())
3117 _odsPrinter.printStrippedAttrOrType(validType);
3118 else
3119 _odsPrinter << type;
3120 }
3121 _odsPrinter << ' ' << "to";
3122 _odsPrinter << ' ';
3123 {
3124 auto type = getOut().getType();
3125 if (auto validType = type.dyn_cast<::mlir::Type>())
3126 _odsPrinter.printStrippedAttrOrType(validType);
3127 else
3128 _odsPrinter << type;
3129 }
3130}
3131
3132void ExtFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
3133}
3134
3135} // namespace arith
3136} // namespace mlir
3137MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ExtFOp>::id = {}; } }
3138
3139namespace mlir {
3140namespace arith {
3141
3142//===----------------------------------------------------------------------===//
3143// ::mlir::arith::ExtSIOp definitions
3144//===----------------------------------------------------------------------===//
3145
3146ExtSIOpAdaptor::ExtSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
3147 odsOpName.emplace("arith.extsi", odsAttrs.getContext());
3148}
3149
3150ExtSIOpAdaptor::ExtSIOpAdaptor(ExtSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
3151
3152::mlir::ValueRange ExtSIOpAdaptor::getOperands() {
3153 return odsOperands;
3154}
3155
3156std::pair<unsigned, unsigned> ExtSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
3157 return {index, 1};
3158}
3159
3160::mlir::ValueRange ExtSIOpAdaptor::getODSOperands(unsigned index) {
3161 auto valueRange = getODSOperandIndexAndLength(index);
3162 return {std::next(odsOperands.begin(), valueRange.first),
3163 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3164}
3165
3166::mlir::Value ExtSIOpAdaptor::getIn() {
3167 return *getODSOperands(0).begin();
3168}
3169
3170::mlir::DictionaryAttr ExtSIOpAdaptor::getAttributes() {
3171 return odsAttrs;
3172}
3173
3174::mlir::LogicalResult ExtSIOpAdaptor::verify(::mlir::Location loc) {
3175 return ::mlir::success();
3176}
3177
3178std::pair<unsigned, unsigned> ExtSIOp::getODSOperandIndexAndLength(unsigned index) {
3179 return {index, 1};
3180}
3181
3182::mlir::Operation::operand_range ExtSIOp::getODSOperands(unsigned index) {
3183 auto valueRange = getODSOperandIndexAndLength(index);
3184 return {std::next(getOperation()->operand_begin(), valueRange.first),
3185 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
3186}
3187
3188::mlir::Value ExtSIOp::getIn() {
3189 return *getODSOperands(0).begin();
3190}
3191
3192::mlir::MutableOperandRange ExtSIOp::getInMutable() {
3193 auto range = getODSOperandIndexAndLength(0);
3194 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3195 return mutableRange;
3196}
3197
3198std::pair<unsigned, unsigned> ExtSIOp::getODSResultIndexAndLength(unsigned index) {
3199 return {index, 1};
3200}
3201
3202::mlir::Operation::result_range ExtSIOp::getODSResults(unsigned index) {
3203 auto valueRange = getODSResultIndexAndLength(index);
3204 return {std::next(getOperation()->result_begin(), valueRange.first),
3205 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3206}
3207
3208::mlir::Value ExtSIOp::getOut() {
3209 return *getODSResults(0).begin();
3210}
3211
3212void ExtSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
3213 odsState.addOperands(in);
3214 odsState.addTypes(out);
3215}
3216
3217void ExtSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
3218 odsState.addOperands(in);
3219 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3219, __extension__ __PRETTY_FUNCTION__))
;
3220 odsState.addTypes(resultTypes);
3221}
3222
3223void ExtSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3224 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3224, __extension__ __PRETTY_FUNCTION__))
;
3225 odsState.addOperands(operands);
3226 odsState.addAttributes(attributes);
3227 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3227, __extension__ __PRETTY_FUNCTION__))
;
3228 odsState.addTypes(resultTypes);
3229}
3230
3231::mlir::LogicalResult ExtSIOp::verifyInvariantsImpl() {
3232 {
3233 unsigned index = 0; (void)index;
3234 auto valueGroup0 = getODSOperands(0);
3235
3236 for (auto v : valueGroup0) {
3237 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "operand", index++)))
3238 return ::mlir::failure();
3239 }
3240 }
3241 {
3242 unsigned index = 0; (void)index;
3243 auto valueGroup0 = getODSResults(0);
3244
3245 for (auto v : valueGroup0) {
3246 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "result", index++)))
3247 return ::mlir::failure();
3248 }
3249 }
3250 return ::mlir::success();
3251}
3252
3253::mlir::LogicalResult ExtSIOp::verifyInvariants() {
3254 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
3255 return ::mlir::success();
3256 return ::mlir::failure();
3257}
3258
3259::mlir::ParseResult ExtSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
3260 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
3261 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
3262 (void)inOperandsLoc;
3263 ::mlir::Type inRawTypes[1];
3264 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
3265 ::mlir::Type outRawTypes[1];
3266 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
3267
3268 inOperandsLoc = parser.getCurrentLocation();
3269 if (parser.parseOperand(inRawOperands[0]))
3270 return ::mlir::failure();
3271 if (parser.parseOptionalAttrDict(result.attributes))
3272 return ::mlir::failure();
3273 if (parser.parseColon())
3274 return ::mlir::failure();
3275
3276 {
3277 ::mlir::Type type;
3278 if (parser.parseCustomTypeWithFallback(type))
3279 return ::mlir::failure();
3280 inRawTypes[0] = type;
3281 }
3282 if (parser.parseKeyword("to"))
3283 return ::mlir::failure();
3284
3285 {
3286 ::mlir::Type type;
3287 if (parser.parseCustomTypeWithFallback(type))
3288 return ::mlir::failure();
3289 outRawTypes[0] = type;
3290 }
3291 result.addTypes(outTypes);
3292 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
3293 return ::mlir::failure();
3294 return ::mlir::success();
3295}
3296
3297void ExtSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
3298 _odsPrinter << ' ';
3299 _odsPrinter << getIn();
3300 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
3301 _odsPrinter << ' ' << ":";
3302 _odsPrinter << ' ';
3303 {
3304 auto type = getIn().getType();
3305 if (auto validType = type.dyn_cast<::mlir::Type>())
3306 _odsPrinter.printStrippedAttrOrType(validType);
3307 else
3308 _odsPrinter << type;
3309 }
3310 _odsPrinter << ' ' << "to";
3311 _odsPrinter << ' ';
3312 {
3313 auto type = getOut().getType();
3314 if (auto validType = type.dyn_cast<::mlir::Type>())
3315 _odsPrinter.printStrippedAttrOrType(validType);
3316 else
3317 _odsPrinter << type;
3318 }
3319}
3320
3321void ExtSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
3322}
3323
3324} // namespace arith
3325} // namespace mlir
3326MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ExtSIOp>::id = {}; } }
3327
3328namespace mlir {
3329namespace arith {
3330
3331//===----------------------------------------------------------------------===//
3332// ::mlir::arith::ExtUIOp definitions
3333//===----------------------------------------------------------------------===//
3334
3335ExtUIOpAdaptor::ExtUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
3336 odsOpName.emplace("arith.extui", odsAttrs.getContext());
3337}
3338
3339ExtUIOpAdaptor::ExtUIOpAdaptor(ExtUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
3340
3341::mlir::ValueRange ExtUIOpAdaptor::getOperands() {
3342 return odsOperands;
3343}
3344
3345std::pair<unsigned, unsigned> ExtUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
3346 return {index, 1};
3347}
3348
3349::mlir::ValueRange ExtUIOpAdaptor::getODSOperands(unsigned index) {
3350 auto valueRange = getODSOperandIndexAndLength(index);
3351 return {std::next(odsOperands.begin(), valueRange.first),
3352 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3353}
3354
3355::mlir::Value ExtUIOpAdaptor::getIn() {
3356 return *getODSOperands(0).begin();
3357}
3358
3359::mlir::DictionaryAttr ExtUIOpAdaptor::getAttributes() {
3360 return odsAttrs;
3361}
3362
3363::mlir::LogicalResult ExtUIOpAdaptor::verify(::mlir::Location loc) {
3364 return ::mlir::success();
3365}
3366
3367std::pair<unsigned, unsigned> ExtUIOp::getODSOperandIndexAndLength(unsigned index) {
3368 return {index, 1};
3369}
3370
3371::mlir::Operation::operand_range ExtUIOp::getODSOperands(unsigned index) {
3372 auto valueRange = getODSOperandIndexAndLength(index);
3373 return {std::next(getOperation()->operand_begin(), valueRange.first),
3374 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
3375}
3376
3377::mlir::Value ExtUIOp::getIn() {
3378 return *getODSOperands(0).begin();
3379}
3380
3381::mlir::MutableOperandRange ExtUIOp::getInMutable() {
3382 auto range = getODSOperandIndexAndLength(0);
3383 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3384 return mutableRange;
3385}
3386
3387std::pair<unsigned, unsigned> ExtUIOp::getODSResultIndexAndLength(unsigned index) {
3388 return {index, 1};
3389}
3390
3391::mlir::Operation::result_range ExtUIOp::getODSResults(unsigned index) {
3392 auto valueRange = getODSResultIndexAndLength(index);
3393 return {std::next(getOperation()->result_begin(), valueRange.first),
3394 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3395}
3396
3397::mlir::Value ExtUIOp::getOut() {
3398 return *getODSResults(0).begin();
3399}
3400
3401void ExtUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
3402 odsState.addOperands(in);
3403 odsState.addTypes(out);
3404}
3405
3406void ExtUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
3407 odsState.addOperands(in);
3408 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3408, __extension__ __PRETTY_FUNCTION__))
;
3409 odsState.addTypes(resultTypes);
3410}
3411
3412void ExtUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3413 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3413, __extension__ __PRETTY_FUNCTION__))
;
3414 odsState.addOperands(operands);
3415 odsState.addAttributes(attributes);
3416 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3416, __extension__ __PRETTY_FUNCTION__))
;
3417 odsState.addTypes(resultTypes);
3418}
3419
3420::mlir::LogicalResult ExtUIOp::verifyInvariantsImpl() {
3421 {
3422 unsigned index = 0; (void)index;
3423 auto valueGroup0 = getODSOperands(0);
3424
3425 for (auto v : valueGroup0) {
3426 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "operand", index++)))
3427 return ::mlir::failure();
3428 }
3429 }
3430 {
3431 unsigned index = 0; (void)index;
3432 auto valueGroup0 = getODSResults(0);
3433
3434 for (auto v : valueGroup0) {
3435 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "result", index++)))
3436 return ::mlir::failure();
3437 }
3438 }
3439 return ::mlir::success();
3440}
3441
3442::mlir::LogicalResult ExtUIOp::verifyInvariants() {
3443 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
3444 return ::mlir::success();
3445 return ::mlir::failure();
3446}
3447
3448::mlir::ParseResult ExtUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
3449 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
3450 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
3451 (void)inOperandsLoc;
3452 ::mlir::Type inRawTypes[1];
3453 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
3454 ::mlir::Type outRawTypes[1];
3455 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
3456
3457 inOperandsLoc = parser.getCurrentLocation();
3458 if (parser.parseOperand(inRawOperands[0]))
3459 return ::mlir::failure();
3460 if (parser.parseOptionalAttrDict(result.attributes))
3461 return ::mlir::failure();
3462 if (parser.parseColon())
3463 return ::mlir::failure();
3464
3465 {
3466 ::mlir::Type type;
3467 if (parser.parseCustomTypeWithFallback(type))
3468 return ::mlir::failure();
3469 inRawTypes[0] = type;
3470 }
3471 if (parser.parseKeyword("to"))
3472 return ::mlir::failure();
3473
3474 {
3475 ::mlir::Type type;
3476 if (parser.parseCustomTypeWithFallback(type))
3477 return ::mlir::failure();
3478 outRawTypes[0] = type;
3479 }
3480 result.addTypes(outTypes);
3481 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
3482 return ::mlir::failure();
3483 return ::mlir::success();
3484}
3485
3486void ExtUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
3487 _odsPrinter << ' ';
3488 _odsPrinter << getIn();
3489 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
3490 _odsPrinter << ' ' << ":";
3491 _odsPrinter << ' ';
3492 {
3493 auto type = getIn().getType();
3494 if (auto validType = type.dyn_cast<::mlir::Type>())
3495 _odsPrinter.printStrippedAttrOrType(validType);
3496 else
3497 _odsPrinter << type;
3498 }
3499 _odsPrinter << ' ' << "to";
3500 _odsPrinter << ' ';
3501 {
3502 auto type = getOut().getType();
3503 if (auto validType = type.dyn_cast<::mlir::Type>())
3504 _odsPrinter.printStrippedAttrOrType(validType);
3505 else
3506 _odsPrinter << type;
3507 }
3508}
3509
3510void ExtUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
3511}
3512
3513} // namespace arith
3514} // namespace mlir
3515MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ExtUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ExtUIOp>::id = {}; } }
3516
3517namespace mlir {
3518namespace arith {
3519
3520//===----------------------------------------------------------------------===//
3521// ::mlir::arith::FPToSIOp definitions
3522//===----------------------------------------------------------------------===//
3523
3524FPToSIOpAdaptor::FPToSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
3525 odsOpName.emplace("arith.fptosi", odsAttrs.getContext());
3526}
3527
3528FPToSIOpAdaptor::FPToSIOpAdaptor(FPToSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
3529
3530::mlir::ValueRange FPToSIOpAdaptor::getOperands() {
3531 return odsOperands;
3532}
3533
3534std::pair<unsigned, unsigned> FPToSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
3535 return {index, 1};
3536}
3537
3538::mlir::ValueRange FPToSIOpAdaptor::getODSOperands(unsigned index) {
3539 auto valueRange = getODSOperandIndexAndLength(index);
3540 return {std::next(odsOperands.begin(), valueRange.first),
3541 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3542}
3543
3544::mlir::Value FPToSIOpAdaptor::getIn() {
3545 return *getODSOperands(0).begin();
3546}
3547
3548::mlir::DictionaryAttr FPToSIOpAdaptor::getAttributes() {
3549 return odsAttrs;
3550}
3551
3552::mlir::LogicalResult FPToSIOpAdaptor::verify(::mlir::Location loc) {
3553 return ::mlir::success();
3554}
3555
3556std::pair<unsigned, unsigned> FPToSIOp::getODSOperandIndexAndLength(unsigned index) {
3557 return {index, 1};
3558}
3559
3560::mlir::Operation::operand_range FPToSIOp::getODSOperands(unsigned index) {
3561 auto valueRange = getODSOperandIndexAndLength(index);
3562 return {std::next(getOperation()->operand_begin(), valueRange.first),
3563 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
3564}
3565
3566::mlir::Value FPToSIOp::getIn() {
3567 return *getODSOperands(0).begin();
3568}
3569
3570::mlir::MutableOperandRange FPToSIOp::getInMutable() {
3571 auto range = getODSOperandIndexAndLength(0);
3572 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3573 return mutableRange;
3574}
3575
3576std::pair<unsigned, unsigned> FPToSIOp::getODSResultIndexAndLength(unsigned index) {
3577 return {index, 1};
3578}
3579
3580::mlir::Operation::result_range FPToSIOp::getODSResults(unsigned index) {
3581 auto valueRange = getODSResultIndexAndLength(index);
3582 return {std::next(getOperation()->result_begin(), valueRange.first),
3583 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3584}
3585
3586::mlir::Value FPToSIOp::getOut() {
3587 return *getODSResults(0).begin();
3588}
3589
3590void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
3591 odsState.addOperands(in);
3592 odsState.addTypes(out);
3593}
3594
3595void FPToSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
3596 odsState.addOperands(in);
3597 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3597, __extension__ __PRETTY_FUNCTION__))
;
3598 odsState.addTypes(resultTypes);
3599}
3600
3601void FPToSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3602 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3602, __extension__ __PRETTY_FUNCTION__))
;
3603 odsState.addOperands(operands);
3604 odsState.addAttributes(attributes);
3605 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3605, __extension__ __PRETTY_FUNCTION__))
;
3606 odsState.addTypes(resultTypes);
3607}
3608
3609::mlir::LogicalResult FPToSIOp::verifyInvariantsImpl() {
3610 {
3611 unsigned index = 0; (void)index;
3612 auto valueGroup0 = getODSOperands(0);
3613
3614 for (auto v : valueGroup0) {
3615 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
3616 return ::mlir::failure();
3617 }
3618 }
3619 {
3620 unsigned index = 0; (void)index;
3621 auto valueGroup0 = getODSResults(0);
3622
3623 for (auto v : valueGroup0) {
3624 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "result", index++)))
3625 return ::mlir::failure();
3626 }
3627 }
3628 return ::mlir::success();
3629}
3630
3631::mlir::LogicalResult FPToSIOp::verifyInvariants() {
3632 return verifyInvariantsImpl();
3633}
3634
3635::mlir::ParseResult FPToSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
3636 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
3637 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
3638 (void)inOperandsLoc;
3639 ::mlir::Type inRawTypes[1];
3640 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
3641 ::mlir::Type outRawTypes[1];
3642 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
3643
3644 inOperandsLoc = parser.getCurrentLocation();
3645 if (parser.parseOperand(inRawOperands[0]))
3646 return ::mlir::failure();
3647 if (parser.parseOptionalAttrDict(result.attributes))
3648 return ::mlir::failure();
3649 if (parser.parseColon())
3650 return ::mlir::failure();
3651
3652 {
3653 ::mlir::Type type;
3654 if (parser.parseCustomTypeWithFallback(type))
3655 return ::mlir::failure();
3656 inRawTypes[0] = type;
3657 }
3658 if (parser.parseKeyword("to"))
3659 return ::mlir::failure();
3660
3661 {
3662 ::mlir::Type type;
3663 if (parser.parseCustomTypeWithFallback(type))
3664 return ::mlir::failure();
3665 outRawTypes[0] = type;
3666 }
3667 result.addTypes(outTypes);
3668 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
3669 return ::mlir::failure();
3670 return ::mlir::success();
3671}
3672
3673void FPToSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
3674 _odsPrinter << ' ';
3675 _odsPrinter << getIn();
3676 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
3677 _odsPrinter << ' ' << ":";
3678 _odsPrinter << ' ';
3679 {
3680 auto type = getIn().getType();
3681 if (auto validType = type.dyn_cast<::mlir::Type>())
3682 _odsPrinter.printStrippedAttrOrType(validType);
3683 else
3684 _odsPrinter << type;
3685 }
3686 _odsPrinter << ' ' << "to";
3687 _odsPrinter << ' ';
3688 {
3689 auto type = getOut().getType();
3690 if (auto validType = type.dyn_cast<::mlir::Type>())
3691 _odsPrinter.printStrippedAttrOrType(validType);
3692 else
3693 _odsPrinter << type;
3694 }
3695}
3696
3697void FPToSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
3698}
3699
3700} // namespace arith
3701} // namespace mlir
3702MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FPToSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::FPToSIOp>::id = {}; } }
3703
3704namespace mlir {
3705namespace arith {
3706
3707//===----------------------------------------------------------------------===//
3708// ::mlir::arith::FPToUIOp definitions
3709//===----------------------------------------------------------------------===//
3710
3711FPToUIOpAdaptor::FPToUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
3712 odsOpName.emplace("arith.fptoui", odsAttrs.getContext());
3713}
3714
3715FPToUIOpAdaptor::FPToUIOpAdaptor(FPToUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
3716
3717::mlir::ValueRange FPToUIOpAdaptor::getOperands() {
3718 return odsOperands;
3719}
3720
3721std::pair<unsigned, unsigned> FPToUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
3722 return {index, 1};
3723}
3724
3725::mlir::ValueRange FPToUIOpAdaptor::getODSOperands(unsigned index) {
3726 auto valueRange = getODSOperandIndexAndLength(index);
3727 return {std::next(odsOperands.begin(), valueRange.first),
3728 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3729}
3730
3731::mlir::Value FPToUIOpAdaptor::getIn() {
3732 return *getODSOperands(0).begin();
3733}
3734
3735::mlir::DictionaryAttr FPToUIOpAdaptor::getAttributes() {
3736 return odsAttrs;
3737}
3738
3739::mlir::LogicalResult FPToUIOpAdaptor::verify(::mlir::Location loc) {
3740 return ::mlir::success();
3741}
3742
3743std::pair<unsigned, unsigned> FPToUIOp::getODSOperandIndexAndLength(unsigned index) {
3744 return {index, 1};
3745}
3746
3747::mlir::Operation::operand_range FPToUIOp::getODSOperands(unsigned index) {
3748 auto valueRange = getODSOperandIndexAndLength(index);
3749 return {std::next(getOperation()->operand_begin(), valueRange.first),
3750 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
3751}
3752
3753::mlir::Value FPToUIOp::getIn() {
3754 return *getODSOperands(0).begin();
3755}
3756
3757::mlir::MutableOperandRange FPToUIOp::getInMutable() {
3758 auto range = getODSOperandIndexAndLength(0);
3759 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3760 return mutableRange;
3761}
3762
3763std::pair<unsigned, unsigned> FPToUIOp::getODSResultIndexAndLength(unsigned index) {
3764 return {index, 1};
3765}
3766
3767::mlir::Operation::result_range FPToUIOp::getODSResults(unsigned index) {
3768 auto valueRange = getODSResultIndexAndLength(index);
3769 return {std::next(getOperation()->result_begin(), valueRange.first),
3770 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3771}
3772
3773::mlir::Value FPToUIOp::getOut() {
3774 return *getODSResults(0).begin();
3775}
3776
3777void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
3778 odsState.addOperands(in);
3779 odsState.addTypes(out);
3780}
3781
3782void FPToUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
3783 odsState.addOperands(in);
3784 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3784, __extension__ __PRETTY_FUNCTION__))
;
3785 odsState.addTypes(resultTypes);
3786}
3787
3788void FPToUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3789 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3789, __extension__ __PRETTY_FUNCTION__))
;
3790 odsState.addOperands(operands);
3791 odsState.addAttributes(attributes);
3792 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3792, __extension__ __PRETTY_FUNCTION__))
;
3793 odsState.addTypes(resultTypes);
3794}
3795
3796::mlir::LogicalResult FPToUIOp::verifyInvariantsImpl() {
3797 {
3798 unsigned index = 0; (void)index;
3799 auto valueGroup0 = getODSOperands(0);
3800
3801 for (auto v : valueGroup0) {
3802 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
3803 return ::mlir::failure();
3804 }
3805 }
3806 {
3807 unsigned index = 0; (void)index;
3808 auto valueGroup0 = getODSResults(0);
3809
3810 for (auto v : valueGroup0) {
3811 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "result", index++)))
3812 return ::mlir::failure();
3813 }
3814 }
3815 return ::mlir::success();
3816}
3817
3818::mlir::LogicalResult FPToUIOp::verifyInvariants() {
3819 return verifyInvariantsImpl();
3820}
3821
3822::mlir::ParseResult FPToUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
3823 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
3824 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
3825 (void)inOperandsLoc;
3826 ::mlir::Type inRawTypes[1];
3827 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
3828 ::mlir::Type outRawTypes[1];
3829 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
3830
3831 inOperandsLoc = parser.getCurrentLocation();
3832 if (parser.parseOperand(inRawOperands[0]))
3833 return ::mlir::failure();
3834 if (parser.parseOptionalAttrDict(result.attributes))
3835 return ::mlir::failure();
3836 if (parser.parseColon())
3837 return ::mlir::failure();
3838
3839 {
3840 ::mlir::Type type;
3841 if (parser.parseCustomTypeWithFallback(type))
3842 return ::mlir::failure();
3843 inRawTypes[0] = type;
3844 }
3845 if (parser.parseKeyword("to"))
3846 return ::mlir::failure();
3847
3848 {
3849 ::mlir::Type type;
3850 if (parser.parseCustomTypeWithFallback(type))
3851 return ::mlir::failure();
3852 outRawTypes[0] = type;
3853 }
3854 result.addTypes(outTypes);
3855 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
3856 return ::mlir::failure();
3857 return ::mlir::success();
3858}
3859
3860void FPToUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
3861 _odsPrinter << ' ';
3862 _odsPrinter << getIn();
3863 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
3864 _odsPrinter << ' ' << ":";
3865 _odsPrinter << ' ';
3866 {
3867 auto type = getIn().getType();
3868 if (auto validType = type.dyn_cast<::mlir::Type>())
3869 _odsPrinter.printStrippedAttrOrType(validType);
3870 else
3871 _odsPrinter << type;
3872 }
3873 _odsPrinter << ' ' << "to";
3874 _odsPrinter << ' ';
3875 {
3876 auto type = getOut().getType();
3877 if (auto validType = type.dyn_cast<::mlir::Type>())
3878 _odsPrinter.printStrippedAttrOrType(validType);
3879 else
3880 _odsPrinter << type;
3881 }
3882}
3883
3884void FPToUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
3885}
3886
3887} // namespace arith
3888} // namespace mlir
3889MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FPToUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::FPToUIOp>::id = {}; } }
3890
3891namespace mlir {
3892namespace arith {
3893
3894//===----------------------------------------------------------------------===//
3895// ::mlir::arith::FloorDivSIOp definitions
3896//===----------------------------------------------------------------------===//
3897
3898FloorDivSIOpAdaptor::FloorDivSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
3899 odsOpName.emplace("arith.floordivsi", odsAttrs.getContext());
3900}
3901
3902FloorDivSIOpAdaptor::FloorDivSIOpAdaptor(FloorDivSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
3903
3904::mlir::ValueRange FloorDivSIOpAdaptor::getOperands() {
3905 return odsOperands;
3906}
3907
3908std::pair<unsigned, unsigned> FloorDivSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
3909 return {index, 1};
3910}
3911
3912::mlir::ValueRange FloorDivSIOpAdaptor::getODSOperands(unsigned index) {
3913 auto valueRange = getODSOperandIndexAndLength(index);
3914 return {std::next(odsOperands.begin(), valueRange.first),
3915 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
3916}
3917
3918::mlir::Value FloorDivSIOpAdaptor::getLhs() {
3919 return *getODSOperands(0).begin();
3920}
3921
3922::mlir::Value FloorDivSIOpAdaptor::getRhs() {
3923 return *getODSOperands(1).begin();
3924}
3925
3926::mlir::DictionaryAttr FloorDivSIOpAdaptor::getAttributes() {
3927 return odsAttrs;
3928}
3929
3930::mlir::LogicalResult FloorDivSIOpAdaptor::verify(::mlir::Location loc) {
3931 return ::mlir::success();
3932}
3933
3934std::pair<unsigned, unsigned> FloorDivSIOp::getODSOperandIndexAndLength(unsigned index) {
3935 return {index, 1};
3936}
3937
3938::mlir::Operation::operand_range FloorDivSIOp::getODSOperands(unsigned index) {
3939 auto valueRange = getODSOperandIndexAndLength(index);
3940 return {std::next(getOperation()->operand_begin(), valueRange.first),
3941 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
3942}
3943
3944::mlir::Value FloorDivSIOp::getLhs() {
3945 return *getODSOperands(0).begin();
3946}
3947
3948::mlir::Value FloorDivSIOp::getRhs() {
3949 return *getODSOperands(1).begin();
3950}
3951
3952::mlir::MutableOperandRange FloorDivSIOp::getLhsMutable() {
3953 auto range = getODSOperandIndexAndLength(0);
3954 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3955 return mutableRange;
3956}
3957
3958::mlir::MutableOperandRange FloorDivSIOp::getRhsMutable() {
3959 auto range = getODSOperandIndexAndLength(1);
3960 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
3961 return mutableRange;
3962}
3963
3964std::pair<unsigned, unsigned> FloorDivSIOp::getODSResultIndexAndLength(unsigned index) {
3965 return {index, 1};
3966}
3967
3968::mlir::Operation::result_range FloorDivSIOp::getODSResults(unsigned index) {
3969 auto valueRange = getODSResultIndexAndLength(index);
3970 return {std::next(getOperation()->result_begin(), valueRange.first),
3971 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
3972}
3973
3974::mlir::Value FloorDivSIOp::getResult() {
3975 return *getODSResults(0).begin();
3976}
3977
3978void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
3979 odsState.addOperands(lhs);
3980 odsState.addOperands(rhs);
3981 odsState.addTypes(result);
3982}
3983
3984void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
3985 odsState.addOperands(lhs);
3986 odsState.addOperands(rhs);
3987 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3987, __extension__ __PRETTY_FUNCTION__))
;
3988 odsState.addTypes(resultTypes);
3989}
3990
3991void FloorDivSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
3992 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3992, __extension__ __PRETTY_FUNCTION__))
;
3993 odsState.addOperands(operands);
3994 odsState.addAttributes(attributes);
3995 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 3995, __extension__ __PRETTY_FUNCTION__))
;
3996 odsState.addTypes(resultTypes);
3997}
3998
3999void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
4000 odsState.addOperands(lhs);
4001 odsState.addOperands(rhs);
4002 odsState.addTypes({lhs.getType()});
4003
4004}
4005
4006void FloorDivSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4007 odsState.addOperands(operands);
4008 odsState.addAttributes(attributes);
4009 odsState.addTypes({operands[0].getType()});
4010
4011}
4012
4013::mlir::LogicalResult FloorDivSIOp::verifyInvariantsImpl() {
4014 {
4015 unsigned index = 0; (void)index;
4016 auto valueGroup0 = getODSOperands(0);
4017
4018 for (auto v : valueGroup0) {
4019 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4020 return ::mlir::failure();
4021 }
4022 auto valueGroup1 = getODSOperands(1);
4023
4024 for (auto v : valueGroup1) {
4025 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4026 return ::mlir::failure();
4027 }
4028 }
4029 {
4030 unsigned index = 0; (void)index;
4031 auto valueGroup0 = getODSResults(0);
4032
4033 for (auto v : valueGroup0) {
4034 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
4035 return ::mlir::failure();
4036 }
4037 }
4038 return ::mlir::success();
4039}
4040
4041::mlir::LogicalResult FloorDivSIOp::verifyInvariants() {
4042 return verifyInvariantsImpl();
4043}
4044
4045::mlir::ParseResult FloorDivSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
4046 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
4047 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
4048 (void)lhsOperandsLoc;
4049 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
4050 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
4051 (void)rhsOperandsLoc;
4052 ::mlir::Type resultRawTypes[1];
4053 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
4054
4055 lhsOperandsLoc = parser.getCurrentLocation();
4056 if (parser.parseOperand(lhsRawOperands[0]))
4057 return ::mlir::failure();
4058 if (parser.parseComma())
4059 return ::mlir::failure();
4060
4061 rhsOperandsLoc = parser.getCurrentLocation();
4062 if (parser.parseOperand(rhsRawOperands[0]))
4063 return ::mlir::failure();
4064 if (parser.parseOptionalAttrDict(result.attributes))
4065 return ::mlir::failure();
4066 if (parser.parseColon())
4067 return ::mlir::failure();
4068
4069 {
4070 ::mlir::Type type;
4071 if (parser.parseCustomTypeWithFallback(type))
4072 return ::mlir::failure();
4073 resultRawTypes[0] = type;
4074 }
4075 result.addTypes(resultTypes);
4076 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
4077 return ::mlir::failure();
4078 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
4079 return ::mlir::failure();
4080 return ::mlir::success();
4081}
4082
4083void FloorDivSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
4084 _odsPrinter << ' ';
4085 _odsPrinter << getLhs();
4086 _odsPrinter << ",";
4087 _odsPrinter << ' ';
4088 _odsPrinter << getRhs();
4089 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
4090 _odsPrinter << ' ' << ":";
4091 _odsPrinter << ' ';
4092 {
4093 auto type = getResult().getType();
4094 if (auto validType = type.dyn_cast<::mlir::Type>())
4095 _odsPrinter.printStrippedAttrOrType(validType);
4096 else
4097 _odsPrinter << type;
4098 }
4099}
4100
4101void FloorDivSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
4102}
4103
4104} // namespace arith
4105} // namespace mlir
4106MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::FloorDivSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::FloorDivSIOp>::id = {}; } }
4107
4108namespace mlir {
4109namespace arith {
4110
4111//===----------------------------------------------------------------------===//
4112// ::mlir::arith::IndexCastOp definitions
4113//===----------------------------------------------------------------------===//
4114
4115IndexCastOpAdaptor::IndexCastOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
4116 odsOpName.emplace("arith.index_cast", odsAttrs.getContext());
4117}
4118
4119IndexCastOpAdaptor::IndexCastOpAdaptor(IndexCastOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
4120
4121::mlir::ValueRange IndexCastOpAdaptor::getOperands() {
4122 return odsOperands;
4123}
4124
4125std::pair<unsigned, unsigned> IndexCastOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
4126 return {index, 1};
4127}
4128
4129::mlir::ValueRange IndexCastOpAdaptor::getODSOperands(unsigned index) {
4130 auto valueRange = getODSOperandIndexAndLength(index);
4131 return {std::next(odsOperands.begin(), valueRange.first),
4132 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4133}
4134
4135::mlir::Value IndexCastOpAdaptor::getIn() {
4136 return *getODSOperands(0).begin();
4137}
4138
4139::mlir::DictionaryAttr IndexCastOpAdaptor::getAttributes() {
4140 return odsAttrs;
4141}
4142
4143::mlir::LogicalResult IndexCastOpAdaptor::verify(::mlir::Location loc) {
4144 return ::mlir::success();
4145}
4146
4147std::pair<unsigned, unsigned> IndexCastOp::getODSOperandIndexAndLength(unsigned index) {
4148 return {index, 1};
4149}
4150
4151::mlir::Operation::operand_range IndexCastOp::getODSOperands(unsigned index) {
4152 auto valueRange = getODSOperandIndexAndLength(index);
4153 return {std::next(getOperation()->operand_begin(), valueRange.first),
4154 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
4155}
4156
4157::mlir::Value IndexCastOp::getIn() {
4158 return *getODSOperands(0).begin();
4159}
4160
4161::mlir::MutableOperandRange IndexCastOp::getInMutable() {
4162 auto range = getODSOperandIndexAndLength(0);
4163 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4164 return mutableRange;
4165}
4166
4167std::pair<unsigned, unsigned> IndexCastOp::getODSResultIndexAndLength(unsigned index) {
4168 return {index, 1};
4169}
4170
4171::mlir::Operation::result_range IndexCastOp::getODSResults(unsigned index) {
4172 auto valueRange = getODSResultIndexAndLength(index);
4173 return {std::next(getOperation()->result_begin(), valueRange.first),
4174 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
4175}
4176
4177::mlir::Value IndexCastOp::getOut() {
4178 return *getODSResults(0).begin();
4179}
4180
4181void IndexCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
4182 odsState.addOperands(in);
4183 odsState.addTypes(out);
4184}
4185
4186void IndexCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
4187 odsState.addOperands(in);
4188 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4188, __extension__ __PRETTY_FUNCTION__))
;
4189 odsState.addTypes(resultTypes);
4190}
4191
4192void IndexCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4193 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4193, __extension__ __PRETTY_FUNCTION__))
;
4194 odsState.addOperands(operands);
4195 odsState.addAttributes(attributes);
4196 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4196, __extension__ __PRETTY_FUNCTION__))
;
4197 odsState.addTypes(resultTypes);
4198}
4199
4200::mlir::LogicalResult IndexCastOp::verifyInvariantsImpl() {
4201 {
4202 unsigned index = 0; (void)index;
4203 auto valueGroup0 = getODSOperands(0);
4204
4205 for (auto v : valueGroup0) {
4206 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps8(*this, v.getType(), "operand", index++)))
4207 return ::mlir::failure();
4208 }
4209 }
4210 {
4211 unsigned index = 0; (void)index;
4212 auto valueGroup0 = getODSResults(0);
4213
4214 for (auto v : valueGroup0) {
4215 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps8(*this, v.getType(), "result", index++)))
4216 return ::mlir::failure();
4217 }
4218 }
4219 return ::mlir::success();
4220}
4221
4222::mlir::LogicalResult IndexCastOp::verifyInvariants() {
4223 return verifyInvariantsImpl();
4224}
4225
4226::mlir::ParseResult IndexCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
4227 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
4228 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
4229 (void)inOperandsLoc;
4230 ::mlir::Type inRawTypes[1];
4231 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
4232 ::mlir::Type outRawTypes[1];
4233 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
4234
4235 inOperandsLoc = parser.getCurrentLocation();
4236 if (parser.parseOperand(inRawOperands[0]))
4237 return ::mlir::failure();
4238 if (parser.parseOptionalAttrDict(result.attributes))
4239 return ::mlir::failure();
4240 if (parser.parseColon())
4241 return ::mlir::failure();
4242
4243 {
4244 ::mlir::Type type;
4245 if (parser.parseCustomTypeWithFallback(type))
4246 return ::mlir::failure();
4247 inRawTypes[0] = type;
4248 }
4249 if (parser.parseKeyword("to"))
4250 return ::mlir::failure();
4251
4252 {
4253 ::mlir::Type type;
4254 if (parser.parseCustomTypeWithFallback(type))
4255 return ::mlir::failure();
4256 outRawTypes[0] = type;
4257 }
4258 result.addTypes(outTypes);
4259 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
4260 return ::mlir::failure();
4261 return ::mlir::success();
4262}
4263
4264void IndexCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
4265 _odsPrinter << ' ';
4266 _odsPrinter << getIn();
4267 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
4268 _odsPrinter << ' ' << ":";
4269 _odsPrinter << ' ';
4270 {
4271 auto type = getIn().getType();
4272 if (auto validType = type.dyn_cast<::mlir::Type>())
4273 _odsPrinter.printStrippedAttrOrType(validType);
4274 else
4275 _odsPrinter << type;
4276 }
4277 _odsPrinter << ' ' << "to";
4278 _odsPrinter << ' ';
4279 {
4280 auto type = getOut().getType();
4281 if (auto validType = type.dyn_cast<::mlir::Type>())
4282 _odsPrinter.printStrippedAttrOrType(validType);
4283 else
4284 _odsPrinter << type;
4285 }
4286}
4287
4288void IndexCastOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
4289}
4290
4291} // namespace arith
4292} // namespace mlir
4293MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::IndexCastOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::IndexCastOp>::id = {}; } }
4294
4295namespace mlir {
4296namespace arith {
4297
4298//===----------------------------------------------------------------------===//
4299// ::mlir::arith::MaxFOp definitions
4300//===----------------------------------------------------------------------===//
4301
4302MaxFOpAdaptor::MaxFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
4303 odsOpName.emplace("arith.maxf", odsAttrs.getContext());
4304}
4305
4306MaxFOpAdaptor::MaxFOpAdaptor(MaxFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
4307
4308::mlir::ValueRange MaxFOpAdaptor::getOperands() {
4309 return odsOperands;
4310}
4311
4312std::pair<unsigned, unsigned> MaxFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
4313 return {index, 1};
4314}
4315
4316::mlir::ValueRange MaxFOpAdaptor::getODSOperands(unsigned index) {
4317 auto valueRange = getODSOperandIndexAndLength(index);
4318 return {std::next(odsOperands.begin(), valueRange.first),
4319 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4320}
4321
4322::mlir::Value MaxFOpAdaptor::getLhs() {
4323 return *getODSOperands(0).begin();
4324}
4325
4326::mlir::Value MaxFOpAdaptor::getRhs() {
4327 return *getODSOperands(1).begin();
4328}
4329
4330::mlir::DictionaryAttr MaxFOpAdaptor::getAttributes() {
4331 return odsAttrs;
4332}
4333
4334::mlir::LogicalResult MaxFOpAdaptor::verify(::mlir::Location loc) {
4335 return ::mlir::success();
4336}
4337
4338std::pair<unsigned, unsigned> MaxFOp::getODSOperandIndexAndLength(unsigned index) {
4339 return {index, 1};
4340}
4341
4342::mlir::Operation::operand_range MaxFOp::getODSOperands(unsigned index) {
4343 auto valueRange = getODSOperandIndexAndLength(index);
4344 return {std::next(getOperation()->operand_begin(), valueRange.first),
4345 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
4346}
4347
4348::mlir::Value MaxFOp::getLhs() {
4349 return *getODSOperands(0).begin();
4350}
4351
4352::mlir::Value MaxFOp::getRhs() {
4353 return *getODSOperands(1).begin();
4354}
4355
4356::mlir::MutableOperandRange MaxFOp::getLhsMutable() {
4357 auto range = getODSOperandIndexAndLength(0);
4358 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4359 return mutableRange;
4360}
4361
4362::mlir::MutableOperandRange MaxFOp::getRhsMutable() {
4363 auto range = getODSOperandIndexAndLength(1);
4364 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4365 return mutableRange;
4366}
4367
4368std::pair<unsigned, unsigned> MaxFOp::getODSResultIndexAndLength(unsigned index) {
4369 return {index, 1};
4370}
4371
4372::mlir::Operation::result_range MaxFOp::getODSResults(unsigned index) {
4373 auto valueRange = getODSResultIndexAndLength(index);
4374 return {std::next(getOperation()->result_begin(), valueRange.first),
4375 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
4376}
4377
4378::mlir::Value MaxFOp::getResult() {
4379 return *getODSResults(0).begin();
4380}
4381
4382void MaxFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
4383 odsState.addOperands(lhs);
4384 odsState.addOperands(rhs);
4385 odsState.addTypes(result);
4386}
4387
4388void MaxFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
4389 odsState.addOperands(lhs);
4390 odsState.addOperands(rhs);
4391 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4391, __extension__ __PRETTY_FUNCTION__))
;
4392 odsState.addTypes(resultTypes);
4393}
4394
4395void MaxFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4396 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4396, __extension__ __PRETTY_FUNCTION__))
;
4397 odsState.addOperands(operands);
4398 odsState.addAttributes(attributes);
4399 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4399, __extension__ __PRETTY_FUNCTION__))
;
4400 odsState.addTypes(resultTypes);
4401}
4402
4403void MaxFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
4404 odsState.addOperands(lhs);
4405 odsState.addOperands(rhs);
4406 odsState.addTypes({lhs.getType()});
4407
4408}
4409
4410void MaxFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4411 odsState.addOperands(operands);
4412 odsState.addAttributes(attributes);
4413 odsState.addTypes({operands[0].getType()});
4414
4415}
4416
4417::mlir::LogicalResult MaxFOp::verifyInvariantsImpl() {
4418 {
4419 unsigned index = 0; (void)index;
4420 auto valueGroup0 = getODSOperands(0);
4421
4422 for (auto v : valueGroup0) {
4423 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
4424 return ::mlir::failure();
4425 }
4426 auto valueGroup1 = getODSOperands(1);
4427
4428 for (auto v : valueGroup1) {
4429 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
4430 return ::mlir::failure();
4431 }
4432 }
4433 {
4434 unsigned index = 0; (void)index;
4435 auto valueGroup0 = getODSResults(0);
4436
4437 for (auto v : valueGroup0) {
4438 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
4439 return ::mlir::failure();
4440 }
4441 }
4442 return ::mlir::success();
4443}
4444
4445::mlir::LogicalResult MaxFOp::verifyInvariants() {
4446 return verifyInvariantsImpl();
4447}
4448
4449::mlir::ParseResult MaxFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
4450 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
4451 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
4452 (void)lhsOperandsLoc;
4453 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
4454 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
4455 (void)rhsOperandsLoc;
4456 ::mlir::Type resultRawTypes[1];
4457 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
4458
4459 lhsOperandsLoc = parser.getCurrentLocation();
4460 if (parser.parseOperand(lhsRawOperands[0]))
4461 return ::mlir::failure();
4462 if (parser.parseComma())
4463 return ::mlir::failure();
4464
4465 rhsOperandsLoc = parser.getCurrentLocation();
4466 if (parser.parseOperand(rhsRawOperands[0]))
4467 return ::mlir::failure();
4468 if (parser.parseOptionalAttrDict(result.attributes))
4469 return ::mlir::failure();
4470 if (parser.parseColon())
4471 return ::mlir::failure();
4472
4473 {
4474 ::mlir::Type type;
4475 if (parser.parseCustomTypeWithFallback(type))
4476 return ::mlir::failure();
4477 resultRawTypes[0] = type;
4478 }
4479 result.addTypes(resultTypes);
4480 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
4481 return ::mlir::failure();
4482 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
4483 return ::mlir::failure();
4484 return ::mlir::success();
4485}
4486
4487void MaxFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
4488 _odsPrinter << ' ';
4489 _odsPrinter << getLhs();
4490 _odsPrinter << ",";
4491 _odsPrinter << ' ';
4492 _odsPrinter << getRhs();
4493 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
4494 _odsPrinter << ' ' << ":";
4495 _odsPrinter << ' ';
4496 {
4497 auto type = getResult().getType();
4498 if (auto validType = type.dyn_cast<::mlir::Type>())
4499 _odsPrinter.printStrippedAttrOrType(validType);
4500 else
4501 _odsPrinter << type;
4502 }
4503}
4504
4505void MaxFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
4506}
4507
4508} // namespace arith
4509} // namespace mlir
4510MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MaxFOp>::id = {}; } }
4511
4512namespace mlir {
4513namespace arith {
4514
4515//===----------------------------------------------------------------------===//
4516// ::mlir::arith::MaxSIOp definitions
4517//===----------------------------------------------------------------------===//
4518
4519MaxSIOpAdaptor::MaxSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
4520 odsOpName.emplace("arith.maxsi", odsAttrs.getContext());
4521}
4522
4523MaxSIOpAdaptor::MaxSIOpAdaptor(MaxSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
4524
4525::mlir::ValueRange MaxSIOpAdaptor::getOperands() {
4526 return odsOperands;
4527}
4528
4529std::pair<unsigned, unsigned> MaxSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
4530 return {index, 1};
4531}
4532
4533::mlir::ValueRange MaxSIOpAdaptor::getODSOperands(unsigned index) {
4534 auto valueRange = getODSOperandIndexAndLength(index);
4535 return {std::next(odsOperands.begin(), valueRange.first),
4536 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4537}
4538
4539::mlir::Value MaxSIOpAdaptor::getLhs() {
4540 return *getODSOperands(0).begin();
4541}
4542
4543::mlir::Value MaxSIOpAdaptor::getRhs() {
4544 return *getODSOperands(1).begin();
4545}
4546
4547::mlir::DictionaryAttr MaxSIOpAdaptor::getAttributes() {
4548 return odsAttrs;
4549}
4550
4551::mlir::LogicalResult MaxSIOpAdaptor::verify(::mlir::Location loc) {
4552 return ::mlir::success();
4553}
4554
4555std::pair<unsigned, unsigned> MaxSIOp::getODSOperandIndexAndLength(unsigned index) {
4556 return {index, 1};
4557}
4558
4559::mlir::Operation::operand_range MaxSIOp::getODSOperands(unsigned index) {
4560 auto valueRange = getODSOperandIndexAndLength(index);
4561 return {std::next(getOperation()->operand_begin(), valueRange.first),
4562 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
4563}
4564
4565::mlir::Value MaxSIOp::getLhs() {
4566 return *getODSOperands(0).begin();
4567}
4568
4569::mlir::Value MaxSIOp::getRhs() {
4570 return *getODSOperands(1).begin();
4571}
4572
4573::mlir::MutableOperandRange MaxSIOp::getLhsMutable() {
4574 auto range = getODSOperandIndexAndLength(0);
4575 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4576 return mutableRange;
4577}
4578
4579::mlir::MutableOperandRange MaxSIOp::getRhsMutable() {
4580 auto range = getODSOperandIndexAndLength(1);
4581 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4582 return mutableRange;
4583}
4584
4585std::pair<unsigned, unsigned> MaxSIOp::getODSResultIndexAndLength(unsigned index) {
4586 return {index, 1};
4587}
4588
4589::mlir::Operation::result_range MaxSIOp::getODSResults(unsigned index) {
4590 auto valueRange = getODSResultIndexAndLength(index);
4591 return {std::next(getOperation()->result_begin(), valueRange.first),
4592 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
4593}
4594
4595::mlir::Value MaxSIOp::getResult() {
4596 return *getODSResults(0).begin();
4597}
4598
4599void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
4600 odsState.addOperands(lhs);
4601 odsState.addOperands(rhs);
4602 odsState.addTypes(result);
4603}
4604
4605void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
4606 odsState.addOperands(lhs);
4607 odsState.addOperands(rhs);
4608 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4608, __extension__ __PRETTY_FUNCTION__))
;
4609 odsState.addTypes(resultTypes);
4610}
4611
4612void MaxSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4613 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4613, __extension__ __PRETTY_FUNCTION__))
;
4614 odsState.addOperands(operands);
4615 odsState.addAttributes(attributes);
4616 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4616, __extension__ __PRETTY_FUNCTION__))
;
4617 odsState.addTypes(resultTypes);
4618}
4619
4620void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
4621 odsState.addOperands(lhs);
4622 odsState.addOperands(rhs);
4623 odsState.addTypes({lhs.getType()});
4624
4625}
4626
4627void MaxSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4628 odsState.addOperands(operands);
4629 odsState.addAttributes(attributes);
4630 odsState.addTypes({operands[0].getType()});
4631
4632}
4633
4634::mlir::LogicalResult MaxSIOp::verifyInvariantsImpl() {
4635 {
4636 unsigned index = 0; (void)index;
4637 auto valueGroup0 = getODSOperands(0);
4638
4639 for (auto v : valueGroup0) {
4640 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4641 return ::mlir::failure();
4642 }
4643 auto valueGroup1 = getODSOperands(1);
4644
4645 for (auto v : valueGroup1) {
4646 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4647 return ::mlir::failure();
4648 }
4649 }
4650 {
4651 unsigned index = 0; (void)index;
4652 auto valueGroup0 = getODSResults(0);
4653
4654 for (auto v : valueGroup0) {
4655 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
4656 return ::mlir::failure();
4657 }
4658 }
4659 return ::mlir::success();
4660}
4661
4662::mlir::LogicalResult MaxSIOp::verifyInvariants() {
4663 return verifyInvariantsImpl();
4664}
4665
4666::mlir::ParseResult MaxSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
4667 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
4668 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
4669 (void)lhsOperandsLoc;
4670 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
4671 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
4672 (void)rhsOperandsLoc;
4673 ::mlir::Type resultRawTypes[1];
4674 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
4675
4676 lhsOperandsLoc = parser.getCurrentLocation();
4677 if (parser.parseOperand(lhsRawOperands[0]))
4678 return ::mlir::failure();
4679 if (parser.parseComma())
4680 return ::mlir::failure();
4681
4682 rhsOperandsLoc = parser.getCurrentLocation();
4683 if (parser.parseOperand(rhsRawOperands[0]))
4684 return ::mlir::failure();
4685 if (parser.parseOptionalAttrDict(result.attributes))
4686 return ::mlir::failure();
4687 if (parser.parseColon())
4688 return ::mlir::failure();
4689
4690 {
4691 ::mlir::Type type;
4692 if (parser.parseCustomTypeWithFallback(type))
4693 return ::mlir::failure();
4694 resultRawTypes[0] = type;
4695 }
4696 result.addTypes(resultTypes);
4697 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
4698 return ::mlir::failure();
4699 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
4700 return ::mlir::failure();
4701 return ::mlir::success();
4702}
4703
4704void MaxSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
4705 _odsPrinter << ' ';
4706 _odsPrinter << getLhs();
4707 _odsPrinter << ",";
4708 _odsPrinter << ' ';
4709 _odsPrinter << getRhs();
4710 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
4711 _odsPrinter << ' ' << ":";
4712 _odsPrinter << ' ';
4713 {
4714 auto type = getResult().getType();
4715 if (auto validType = type.dyn_cast<::mlir::Type>())
4716 _odsPrinter.printStrippedAttrOrType(validType);
4717 else
4718 _odsPrinter << type;
4719 }
4720}
4721
4722void MaxSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
4723}
4724
4725} // namespace arith
4726} // namespace mlir
4727MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MaxSIOp>::id = {}; } }
4728
4729namespace mlir {
4730namespace arith {
4731
4732//===----------------------------------------------------------------------===//
4733// ::mlir::arith::MaxUIOp definitions
4734//===----------------------------------------------------------------------===//
4735
4736MaxUIOpAdaptor::MaxUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
4737 odsOpName.emplace("arith.maxui", odsAttrs.getContext());
4738}
4739
4740MaxUIOpAdaptor::MaxUIOpAdaptor(MaxUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
4741
4742::mlir::ValueRange MaxUIOpAdaptor::getOperands() {
4743 return odsOperands;
4744}
4745
4746std::pair<unsigned, unsigned> MaxUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
4747 return {index, 1};
4748}
4749
4750::mlir::ValueRange MaxUIOpAdaptor::getODSOperands(unsigned index) {
4751 auto valueRange = getODSOperandIndexAndLength(index);
4752 return {std::next(odsOperands.begin(), valueRange.first),
4753 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4754}
4755
4756::mlir::Value MaxUIOpAdaptor::getLhs() {
4757 return *getODSOperands(0).begin();
4758}
4759
4760::mlir::Value MaxUIOpAdaptor::getRhs() {
4761 return *getODSOperands(1).begin();
4762}
4763
4764::mlir::DictionaryAttr MaxUIOpAdaptor::getAttributes() {
4765 return odsAttrs;
4766}
4767
4768::mlir::LogicalResult MaxUIOpAdaptor::verify(::mlir::Location loc) {
4769 return ::mlir::success();
4770}
4771
4772std::pair<unsigned, unsigned> MaxUIOp::getODSOperandIndexAndLength(unsigned index) {
4773 return {index, 1};
4774}
4775
4776::mlir::Operation::operand_range MaxUIOp::getODSOperands(unsigned index) {
4777 auto valueRange = getODSOperandIndexAndLength(index);
4778 return {std::next(getOperation()->operand_begin(), valueRange.first),
4779 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
4780}
4781
4782::mlir::Value MaxUIOp::getLhs() {
4783 return *getODSOperands(0).begin();
4784}
4785
4786::mlir::Value MaxUIOp::getRhs() {
4787 return *getODSOperands(1).begin();
4788}
4789
4790::mlir::MutableOperandRange MaxUIOp::getLhsMutable() {
4791 auto range = getODSOperandIndexAndLength(0);
4792 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4793 return mutableRange;
4794}
4795
4796::mlir::MutableOperandRange MaxUIOp::getRhsMutable() {
4797 auto range = getODSOperandIndexAndLength(1);
4798 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
4799 return mutableRange;
4800}
4801
4802std::pair<unsigned, unsigned> MaxUIOp::getODSResultIndexAndLength(unsigned index) {
4803 return {index, 1};
4804}
4805
4806::mlir::Operation::result_range MaxUIOp::getODSResults(unsigned index) {
4807 auto valueRange = getODSResultIndexAndLength(index);
4808 return {std::next(getOperation()->result_begin(), valueRange.first),
4809 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
4810}
4811
4812::mlir::Value MaxUIOp::getResult() {
4813 return *getODSResults(0).begin();
4814}
4815
4816void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
4817 odsState.addOperands(lhs);
4818 odsState.addOperands(rhs);
4819 odsState.addTypes(result);
4820}
4821
4822void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
4823 odsState.addOperands(lhs);
4824 odsState.addOperands(rhs);
4825 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4825, __extension__ __PRETTY_FUNCTION__))
;
4826 odsState.addTypes(resultTypes);
4827}
4828
4829void MaxUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4830 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4830, __extension__ __PRETTY_FUNCTION__))
;
4831 odsState.addOperands(operands);
4832 odsState.addAttributes(attributes);
4833 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 4833, __extension__ __PRETTY_FUNCTION__))
;
4834 odsState.addTypes(resultTypes);
4835}
4836
4837void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
4838 odsState.addOperands(lhs);
4839 odsState.addOperands(rhs);
4840 odsState.addTypes({lhs.getType()});
4841
4842}
4843
4844void MaxUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
4845 odsState.addOperands(operands);
4846 odsState.addAttributes(attributes);
4847 odsState.addTypes({operands[0].getType()});
4848
4849}
4850
4851::mlir::LogicalResult MaxUIOp::verifyInvariantsImpl() {
4852 {
4853 unsigned index = 0; (void)index;
4854 auto valueGroup0 = getODSOperands(0);
4855
4856 for (auto v : valueGroup0) {
4857 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4858 return ::mlir::failure();
4859 }
4860 auto valueGroup1 = getODSOperands(1);
4861
4862 for (auto v : valueGroup1) {
4863 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
4864 return ::mlir::failure();
4865 }
4866 }
4867 {
4868 unsigned index = 0; (void)index;
4869 auto valueGroup0 = getODSResults(0);
4870
4871 for (auto v : valueGroup0) {
4872 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
4873 return ::mlir::failure();
4874 }
4875 }
4876 return ::mlir::success();
4877}
4878
4879::mlir::LogicalResult MaxUIOp::verifyInvariants() {
4880 return verifyInvariantsImpl();
4881}
4882
4883::mlir::ParseResult MaxUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
4884 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
4885 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
4886 (void)lhsOperandsLoc;
4887 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
4888 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
4889 (void)rhsOperandsLoc;
4890 ::mlir::Type resultRawTypes[1];
4891 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
4892
4893 lhsOperandsLoc = parser.getCurrentLocation();
4894 if (parser.parseOperand(lhsRawOperands[0]))
4895 return ::mlir::failure();
4896 if (parser.parseComma())
4897 return ::mlir::failure();
4898
4899 rhsOperandsLoc = parser.getCurrentLocation();
4900 if (parser.parseOperand(rhsRawOperands[0]))
4901 return ::mlir::failure();
4902 if (parser.parseOptionalAttrDict(result.attributes))
4903 return ::mlir::failure();
4904 if (parser.parseColon())
4905 return ::mlir::failure();
4906
4907 {
4908 ::mlir::Type type;
4909 if (parser.parseCustomTypeWithFallback(type))
4910 return ::mlir::failure();
4911 resultRawTypes[0] = type;
4912 }
4913 result.addTypes(resultTypes);
4914 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
4915 return ::mlir::failure();
4916 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
4917 return ::mlir::failure();
4918 return ::mlir::success();
4919}
4920
4921void MaxUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
4922 _odsPrinter << ' ';
4923 _odsPrinter << getLhs();
4924 _odsPrinter << ",";
4925 _odsPrinter << ' ';
4926 _odsPrinter << getRhs();
4927 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
4928 _odsPrinter << ' ' << ":";
4929 _odsPrinter << ' ';
4930 {
4931 auto type = getResult().getType();
4932 if (auto validType = type.dyn_cast<::mlir::Type>())
4933 _odsPrinter.printStrippedAttrOrType(validType);
4934 else
4935 _odsPrinter << type;
4936 }
4937}
4938
4939void MaxUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
4940}
4941
4942} // namespace arith
4943} // namespace mlir
4944MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MaxUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MaxUIOp>::id = {}; } }
4945
4946namespace mlir {
4947namespace arith {
4948
4949//===----------------------------------------------------------------------===//
4950// ::mlir::arith::MinFOp definitions
4951//===----------------------------------------------------------------------===//
4952
4953MinFOpAdaptor::MinFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
4954 odsOpName.emplace("arith.minf", odsAttrs.getContext());
4955}
4956
4957MinFOpAdaptor::MinFOpAdaptor(MinFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
4958
4959::mlir::ValueRange MinFOpAdaptor::getOperands() {
4960 return odsOperands;
4961}
4962
4963std::pair<unsigned, unsigned> MinFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
4964 return {index, 1};
4965}
4966
4967::mlir::ValueRange MinFOpAdaptor::getODSOperands(unsigned index) {
4968 auto valueRange = getODSOperandIndexAndLength(index);
4969 return {std::next(odsOperands.begin(), valueRange.first),
4970 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
4971}
4972
4973::mlir::Value MinFOpAdaptor::getLhs() {
4974 return *getODSOperands(0).begin();
4975}
4976
4977::mlir::Value MinFOpAdaptor::getRhs() {
4978 return *getODSOperands(1).begin();
4979}
4980
4981::mlir::DictionaryAttr MinFOpAdaptor::getAttributes() {
4982 return odsAttrs;
4983}
4984
4985::mlir::LogicalResult MinFOpAdaptor::verify(::mlir::Location loc) {
4986 return ::mlir::success();
4987}
4988
4989std::pair<unsigned, unsigned> MinFOp::getODSOperandIndexAndLength(unsigned index) {
4990 return {index, 1};
4991}
4992
4993::mlir::Operation::operand_range MinFOp::getODSOperands(unsigned index) {
4994 auto valueRange = getODSOperandIndexAndLength(index);
4995 return {std::next(getOperation()->operand_begin(), valueRange.first),
4996 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
4997}
4998
4999::mlir::Value MinFOp::getLhs() {
5000 return *getODSOperands(0).begin();
5001}
5002
5003::mlir::Value MinFOp::getRhs() {
5004 return *getODSOperands(1).begin();
5005}
5006
5007::mlir::MutableOperandRange MinFOp::getLhsMutable() {
5008 auto range = getODSOperandIndexAndLength(0);
5009 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5010 return mutableRange;
5011}
5012
5013::mlir::MutableOperandRange MinFOp::getRhsMutable() {
5014 auto range = getODSOperandIndexAndLength(1);
5015 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5016 return mutableRange;
5017}
5018
5019std::pair<unsigned, unsigned> MinFOp::getODSResultIndexAndLength(unsigned index) {
5020 return {index, 1};
5021}
5022
5023::mlir::Operation::result_range MinFOp::getODSResults(unsigned index) {
5024 auto valueRange = getODSResultIndexAndLength(index);
5025 return {std::next(getOperation()->result_begin(), valueRange.first),
5026 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
5027}
5028
5029::mlir::Value MinFOp::getResult() {
5030 return *getODSResults(0).begin();
5031}
5032
5033void MinFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
5034 odsState.addOperands(lhs);
5035 odsState.addOperands(rhs);
5036 odsState.addTypes(result);
5037}
5038
5039void MinFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
5040 odsState.addOperands(lhs);
5041 odsState.addOperands(rhs);
5042 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5042, __extension__ __PRETTY_FUNCTION__))
;
5043 odsState.addTypes(resultTypes);
5044}
5045
5046void MinFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5047 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5047, __extension__ __PRETTY_FUNCTION__))
;
5048 odsState.addOperands(operands);
5049 odsState.addAttributes(attributes);
5050 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5050, __extension__ __PRETTY_FUNCTION__))
;
5051 odsState.addTypes(resultTypes);
5052}
5053
5054void MinFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
5055 odsState.addOperands(lhs);
5056 odsState.addOperands(rhs);
5057 odsState.addTypes({lhs.getType()});
5058
5059}
5060
5061void MinFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5062 odsState.addOperands(operands);
5063 odsState.addAttributes(attributes);
5064 odsState.addTypes({operands[0].getType()});
5065
5066}
5067
5068::mlir::LogicalResult MinFOp::verifyInvariantsImpl() {
5069 {
5070 unsigned index = 0; (void)index;
5071 auto valueGroup0 = getODSOperands(0);
5072
5073 for (auto v : valueGroup0) {
5074 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
5075 return ::mlir::failure();
5076 }
5077 auto valueGroup1 = getODSOperands(1);
5078
5079 for (auto v : valueGroup1) {
5080 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
5081 return ::mlir::failure();
5082 }
5083 }
5084 {
5085 unsigned index = 0; (void)index;
5086 auto valueGroup0 = getODSResults(0);
5087
5088 for (auto v : valueGroup0) {
5089 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
5090 return ::mlir::failure();
5091 }
5092 }
5093 return ::mlir::success();
5094}
5095
5096::mlir::LogicalResult MinFOp::verifyInvariants() {
5097 return verifyInvariantsImpl();
5098}
5099
5100::mlir::ParseResult MinFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
5101 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
5102 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
5103 (void)lhsOperandsLoc;
5104 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
5105 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
5106 (void)rhsOperandsLoc;
5107 ::mlir::Type resultRawTypes[1];
5108 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
5109
5110 lhsOperandsLoc = parser.getCurrentLocation();
5111 if (parser.parseOperand(lhsRawOperands[0]))
5112 return ::mlir::failure();
5113 if (parser.parseComma())
5114 return ::mlir::failure();
5115
5116 rhsOperandsLoc = parser.getCurrentLocation();
5117 if (parser.parseOperand(rhsRawOperands[0]))
5118 return ::mlir::failure();
5119 if (parser.parseOptionalAttrDict(result.attributes))
5120 return ::mlir::failure();
5121 if (parser.parseColon())
5122 return ::mlir::failure();
5123
5124 {
5125 ::mlir::Type type;
5126 if (parser.parseCustomTypeWithFallback(type))
5127 return ::mlir::failure();
5128 resultRawTypes[0] = type;
5129 }
5130 result.addTypes(resultTypes);
5131 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
5132 return ::mlir::failure();
5133 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
5134 return ::mlir::failure();
5135 return ::mlir::success();
5136}
5137
5138void MinFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
5139 _odsPrinter << ' ';
5140 _odsPrinter << getLhs();
5141 _odsPrinter << ",";
5142 _odsPrinter << ' ';
5143 _odsPrinter << getRhs();
5144 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
5145 _odsPrinter << ' ' << ":";
5146 _odsPrinter << ' ';
5147 {
5148 auto type = getResult().getType();
5149 if (auto validType = type.dyn_cast<::mlir::Type>())
5150 _odsPrinter.printStrippedAttrOrType(validType);
5151 else
5152 _odsPrinter << type;
5153 }
5154}
5155
5156void MinFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
5157}
5158
5159} // namespace arith
5160} // namespace mlir
5161MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MinFOp>::id = {}; } }
5162
5163namespace mlir {
5164namespace arith {
5165
5166//===----------------------------------------------------------------------===//
5167// ::mlir::arith::MinSIOp definitions
5168//===----------------------------------------------------------------------===//
5169
5170MinSIOpAdaptor::MinSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
5171 odsOpName.emplace("arith.minsi", odsAttrs.getContext());
5172}
5173
5174MinSIOpAdaptor::MinSIOpAdaptor(MinSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
5175
5176::mlir::ValueRange MinSIOpAdaptor::getOperands() {
5177 return odsOperands;
5178}
5179
5180std::pair<unsigned, unsigned> MinSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
5181 return {index, 1};
5182}
5183
5184::mlir::ValueRange MinSIOpAdaptor::getODSOperands(unsigned index) {
5185 auto valueRange = getODSOperandIndexAndLength(index);
5186 return {std::next(odsOperands.begin(), valueRange.first),
5187 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5188}
5189
5190::mlir::Value MinSIOpAdaptor::getLhs() {
5191 return *getODSOperands(0).begin();
5192}
5193
5194::mlir::Value MinSIOpAdaptor::getRhs() {
5195 return *getODSOperands(1).begin();
5196}
5197
5198::mlir::DictionaryAttr MinSIOpAdaptor::getAttributes() {
5199 return odsAttrs;
5200}
5201
5202::mlir::LogicalResult MinSIOpAdaptor::verify(::mlir::Location loc) {
5203 return ::mlir::success();
5204}
5205
5206std::pair<unsigned, unsigned> MinSIOp::getODSOperandIndexAndLength(unsigned index) {
5207 return {index, 1};
5208}
5209
5210::mlir::Operation::operand_range MinSIOp::getODSOperands(unsigned index) {
5211 auto valueRange = getODSOperandIndexAndLength(index);
5212 return {std::next(getOperation()->operand_begin(), valueRange.first),
5213 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
5214}
5215
5216::mlir::Value MinSIOp::getLhs() {
5217 return *getODSOperands(0).begin();
5218}
5219
5220::mlir::Value MinSIOp::getRhs() {
5221 return *getODSOperands(1).begin();
5222}
5223
5224::mlir::MutableOperandRange MinSIOp::getLhsMutable() {
5225 auto range = getODSOperandIndexAndLength(0);
5226 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5227 return mutableRange;
5228}
5229
5230::mlir::MutableOperandRange MinSIOp::getRhsMutable() {
5231 auto range = getODSOperandIndexAndLength(1);
5232 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5233 return mutableRange;
5234}
5235
5236std::pair<unsigned, unsigned> MinSIOp::getODSResultIndexAndLength(unsigned index) {
5237 return {index, 1};
5238}
5239
5240::mlir::Operation::result_range MinSIOp::getODSResults(unsigned index) {
5241 auto valueRange = getODSResultIndexAndLength(index);
5242 return {std::next(getOperation()->result_begin(), valueRange.first),
5243 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
5244}
5245
5246::mlir::Value MinSIOp::getResult() {
5247 return *getODSResults(0).begin();
5248}
5249
5250void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
5251 odsState.addOperands(lhs);
5252 odsState.addOperands(rhs);
5253 odsState.addTypes(result);
5254}
5255
5256void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
5257 odsState.addOperands(lhs);
5258 odsState.addOperands(rhs);
5259 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5259, __extension__ __PRETTY_FUNCTION__))
;
5260 odsState.addTypes(resultTypes);
5261}
5262
5263void MinSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5264 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5264, __extension__ __PRETTY_FUNCTION__))
;
5265 odsState.addOperands(operands);
5266 odsState.addAttributes(attributes);
5267 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5267, __extension__ __PRETTY_FUNCTION__))
;
5268 odsState.addTypes(resultTypes);
5269}
5270
5271void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
5272 odsState.addOperands(lhs);
5273 odsState.addOperands(rhs);
5274 odsState.addTypes({lhs.getType()});
5275
5276}
5277
5278void MinSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5279 odsState.addOperands(operands);
5280 odsState.addAttributes(attributes);
5281 odsState.addTypes({operands[0].getType()});
5282
5283}
5284
5285::mlir::LogicalResult MinSIOp::verifyInvariantsImpl() {
5286 {
5287 unsigned index = 0; (void)index;
5288 auto valueGroup0 = getODSOperands(0);
5289
5290 for (auto v : valueGroup0) {
5291 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5292 return ::mlir::failure();
5293 }
5294 auto valueGroup1 = getODSOperands(1);
5295
5296 for (auto v : valueGroup1) {
5297 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5298 return ::mlir::failure();
5299 }
5300 }
5301 {
5302 unsigned index = 0; (void)index;
5303 auto valueGroup0 = getODSResults(0);
5304
5305 for (auto v : valueGroup0) {
5306 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
5307 return ::mlir::failure();
5308 }
5309 }
5310 return ::mlir::success();
5311}
5312
5313::mlir::LogicalResult MinSIOp::verifyInvariants() {
5314 return verifyInvariantsImpl();
5315}
5316
5317::mlir::ParseResult MinSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
5318 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
5319 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
5320 (void)lhsOperandsLoc;
5321 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
5322 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
5323 (void)rhsOperandsLoc;
5324 ::mlir::Type resultRawTypes[1];
5325 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
5326
5327 lhsOperandsLoc = parser.getCurrentLocation();
5328 if (parser.parseOperand(lhsRawOperands[0]))
5329 return ::mlir::failure();
5330 if (parser.parseComma())
5331 return ::mlir::failure();
5332
5333 rhsOperandsLoc = parser.getCurrentLocation();
5334 if (parser.parseOperand(rhsRawOperands[0]))
5335 return ::mlir::failure();
5336 if (parser.parseOptionalAttrDict(result.attributes))
5337 return ::mlir::failure();
5338 if (parser.parseColon())
5339 return ::mlir::failure();
5340
5341 {
5342 ::mlir::Type type;
5343 if (parser.parseCustomTypeWithFallback(type))
5344 return ::mlir::failure();
5345 resultRawTypes[0] = type;
5346 }
5347 result.addTypes(resultTypes);
5348 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
5349 return ::mlir::failure();
5350 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
5351 return ::mlir::failure();
5352 return ::mlir::success();
5353}
5354
5355void MinSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
5356 _odsPrinter << ' ';
5357 _odsPrinter << getLhs();
5358 _odsPrinter << ",";
5359 _odsPrinter << ' ';
5360 _odsPrinter << getRhs();
5361 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
5362 _odsPrinter << ' ' << ":";
5363 _odsPrinter << ' ';
5364 {
5365 auto type = getResult().getType();
5366 if (auto validType = type.dyn_cast<::mlir::Type>())
5367 _odsPrinter.printStrippedAttrOrType(validType);
5368 else
5369 _odsPrinter << type;
5370 }
5371}
5372
5373void MinSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
5374}
5375
5376} // namespace arith
5377} // namespace mlir
5378MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MinSIOp>::id = {}; } }
5379
5380namespace mlir {
5381namespace arith {
5382
5383//===----------------------------------------------------------------------===//
5384// ::mlir::arith::MinUIOp definitions
5385//===----------------------------------------------------------------------===//
5386
5387MinUIOpAdaptor::MinUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
5388 odsOpName.emplace("arith.minui", odsAttrs.getContext());
5389}
5390
5391MinUIOpAdaptor::MinUIOpAdaptor(MinUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
5392
5393::mlir::ValueRange MinUIOpAdaptor::getOperands() {
5394 return odsOperands;
5395}
5396
5397std::pair<unsigned, unsigned> MinUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
5398 return {index, 1};
5399}
5400
5401::mlir::ValueRange MinUIOpAdaptor::getODSOperands(unsigned index) {
5402 auto valueRange = getODSOperandIndexAndLength(index);
5403 return {std::next(odsOperands.begin(), valueRange.first),
5404 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5405}
5406
5407::mlir::Value MinUIOpAdaptor::getLhs() {
5408 return *getODSOperands(0).begin();
5409}
5410
5411::mlir::Value MinUIOpAdaptor::getRhs() {
5412 return *getODSOperands(1).begin();
5413}
5414
5415::mlir::DictionaryAttr MinUIOpAdaptor::getAttributes() {
5416 return odsAttrs;
5417}
5418
5419::mlir::LogicalResult MinUIOpAdaptor::verify(::mlir::Location loc) {
5420 return ::mlir::success();
5421}
5422
5423std::pair<unsigned, unsigned> MinUIOp::getODSOperandIndexAndLength(unsigned index) {
5424 return {index, 1};
5425}
5426
5427::mlir::Operation::operand_range MinUIOp::getODSOperands(unsigned index) {
5428 auto valueRange = getODSOperandIndexAndLength(index);
5429 return {std::next(getOperation()->operand_begin(), valueRange.first),
5430 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
5431}
5432
5433::mlir::Value MinUIOp::getLhs() {
5434 return *getODSOperands(0).begin();
5435}
5436
5437::mlir::Value MinUIOp::getRhs() {
5438 return *getODSOperands(1).begin();
5439}
5440
5441::mlir::MutableOperandRange MinUIOp::getLhsMutable() {
5442 auto range = getODSOperandIndexAndLength(0);
5443 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5444 return mutableRange;
5445}
5446
5447::mlir::MutableOperandRange MinUIOp::getRhsMutable() {
5448 auto range = getODSOperandIndexAndLength(1);
5449 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5450 return mutableRange;
5451}
5452
5453std::pair<unsigned, unsigned> MinUIOp::getODSResultIndexAndLength(unsigned index) {
5454 return {index, 1};
5455}
5456
5457::mlir::Operation::result_range MinUIOp::getODSResults(unsigned index) {
5458 auto valueRange = getODSResultIndexAndLength(index);
5459 return {std::next(getOperation()->result_begin(), valueRange.first),
5460 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
5461}
5462
5463::mlir::Value MinUIOp::getResult() {
5464 return *getODSResults(0).begin();
5465}
5466
5467void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
5468 odsState.addOperands(lhs);
5469 odsState.addOperands(rhs);
5470 odsState.addTypes(result);
5471}
5472
5473void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
5474 odsState.addOperands(lhs);
5475 odsState.addOperands(rhs);
5476 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5476, __extension__ __PRETTY_FUNCTION__))
;
5477 odsState.addTypes(resultTypes);
5478}
5479
5480void MinUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5481 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5481, __extension__ __PRETTY_FUNCTION__))
;
5482 odsState.addOperands(operands);
5483 odsState.addAttributes(attributes);
5484 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5484, __extension__ __PRETTY_FUNCTION__))
;
5485 odsState.addTypes(resultTypes);
5486}
5487
5488void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
5489 odsState.addOperands(lhs);
5490 odsState.addOperands(rhs);
5491 odsState.addTypes({lhs.getType()});
5492
5493}
5494
5495void MinUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5496 odsState.addOperands(operands);
5497 odsState.addAttributes(attributes);
5498 odsState.addTypes({operands[0].getType()});
5499
5500}
5501
5502::mlir::LogicalResult MinUIOp::verifyInvariantsImpl() {
5503 {
5504 unsigned index = 0; (void)index;
5505 auto valueGroup0 = getODSOperands(0);
5506
5507 for (auto v : valueGroup0) {
5508 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5509 return ::mlir::failure();
5510 }
5511 auto valueGroup1 = getODSOperands(1);
5512
5513 for (auto v : valueGroup1) {
5514 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5515 return ::mlir::failure();
5516 }
5517 }
5518 {
5519 unsigned index = 0; (void)index;
5520 auto valueGroup0 = getODSResults(0);
5521
5522 for (auto v : valueGroup0) {
5523 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
5524 return ::mlir::failure();
5525 }
5526 }
5527 return ::mlir::success();
5528}
5529
5530::mlir::LogicalResult MinUIOp::verifyInvariants() {
5531 return verifyInvariantsImpl();
5532}
5533
5534::mlir::ParseResult MinUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
5535 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
5536 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
5537 (void)lhsOperandsLoc;
5538 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
5539 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
5540 (void)rhsOperandsLoc;
5541 ::mlir::Type resultRawTypes[1];
5542 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
5543
5544 lhsOperandsLoc = parser.getCurrentLocation();
5545 if (parser.parseOperand(lhsRawOperands[0]))
5546 return ::mlir::failure();
5547 if (parser.parseComma())
5548 return ::mlir::failure();
5549
5550 rhsOperandsLoc = parser.getCurrentLocation();
5551 if (parser.parseOperand(rhsRawOperands[0]))
5552 return ::mlir::failure();
5553 if (parser.parseOptionalAttrDict(result.attributes))
5554 return ::mlir::failure();
5555 if (parser.parseColon())
5556 return ::mlir::failure();
5557
5558 {
5559 ::mlir::Type type;
5560 if (parser.parseCustomTypeWithFallback(type))
5561 return ::mlir::failure();
5562 resultRawTypes[0] = type;
5563 }
5564 result.addTypes(resultTypes);
5565 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
5566 return ::mlir::failure();
5567 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
5568 return ::mlir::failure();
5569 return ::mlir::success();
5570}
5571
5572void MinUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
5573 _odsPrinter << ' ';
5574 _odsPrinter << getLhs();
5575 _odsPrinter << ",";
5576 _odsPrinter << ' ';
5577 _odsPrinter << getRhs();
5578 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
5579 _odsPrinter << ' ' << ":";
5580 _odsPrinter << ' ';
5581 {
5582 auto type = getResult().getType();
5583 if (auto validType = type.dyn_cast<::mlir::Type>())
5584 _odsPrinter.printStrippedAttrOrType(validType);
5585 else
5586 _odsPrinter << type;
5587 }
5588}
5589
5590void MinUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
5591}
5592
5593} // namespace arith
5594} // namespace mlir
5595MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MinUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MinUIOp>::id = {}; } }
5596
5597namespace mlir {
5598namespace arith {
5599
5600//===----------------------------------------------------------------------===//
5601// ::mlir::arith::MulFOp definitions
5602//===----------------------------------------------------------------------===//
5603
5604MulFOpAdaptor::MulFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
5605 odsOpName.emplace("arith.mulf", odsAttrs.getContext());
5606}
5607
5608MulFOpAdaptor::MulFOpAdaptor(MulFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
5609
5610::mlir::ValueRange MulFOpAdaptor::getOperands() {
5611 return odsOperands;
5612}
5613
5614std::pair<unsigned, unsigned> MulFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
5615 return {index, 1};
5616}
5617
5618::mlir::ValueRange MulFOpAdaptor::getODSOperands(unsigned index) {
5619 auto valueRange = getODSOperandIndexAndLength(index);
5620 return {std::next(odsOperands.begin(), valueRange.first),
5621 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5622}
5623
5624::mlir::Value MulFOpAdaptor::getLhs() {
5625 return *getODSOperands(0).begin();
5626}
5627
5628::mlir::Value MulFOpAdaptor::getRhs() {
5629 return *getODSOperands(1).begin();
5630}
5631
5632::mlir::DictionaryAttr MulFOpAdaptor::getAttributes() {
5633 return odsAttrs;
5634}
5635
5636::mlir::LogicalResult MulFOpAdaptor::verify(::mlir::Location loc) {
5637 return ::mlir::success();
5638}
5639
5640std::pair<unsigned, unsigned> MulFOp::getODSOperandIndexAndLength(unsigned index) {
5641 return {index, 1};
5642}
5643
5644::mlir::Operation::operand_range MulFOp::getODSOperands(unsigned index) {
5645 auto valueRange = getODSOperandIndexAndLength(index);
5646 return {std::next(getOperation()->operand_begin(), valueRange.first),
5647 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
5648}
5649
5650::mlir::Value MulFOp::getLhs() {
5651 return *getODSOperands(0).begin();
5652}
5653
5654::mlir::Value MulFOp::getRhs() {
5655 return *getODSOperands(1).begin();
5656}
5657
5658::mlir::MutableOperandRange MulFOp::getLhsMutable() {
5659 auto range = getODSOperandIndexAndLength(0);
5660 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5661 return mutableRange;
5662}
5663
5664::mlir::MutableOperandRange MulFOp::getRhsMutable() {
5665 auto range = getODSOperandIndexAndLength(1);
5666 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5667 return mutableRange;
5668}
5669
5670std::pair<unsigned, unsigned> MulFOp::getODSResultIndexAndLength(unsigned index) {
5671 return {index, 1};
5672}
5673
5674::mlir::Operation::result_range MulFOp::getODSResults(unsigned index) {
5675 auto valueRange = getODSResultIndexAndLength(index);
5676 return {std::next(getOperation()->result_begin(), valueRange.first),
5677 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
5678}
5679
5680::mlir::Value MulFOp::getResult() {
5681 return *getODSResults(0).begin();
5682}
5683
5684void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
5685 odsState.addOperands(lhs);
5686 odsState.addOperands(rhs);
5687 odsState.addTypes(result);
5688}
5689
5690void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
5691 odsState.addOperands(lhs);
5692 odsState.addOperands(rhs);
5693 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5693, __extension__ __PRETTY_FUNCTION__))
;
5694 odsState.addTypes(resultTypes);
5695}
5696
5697void MulFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5698 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5698, __extension__ __PRETTY_FUNCTION__))
;
5699 odsState.addOperands(operands);
5700 odsState.addAttributes(attributes);
5701 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5701, __extension__ __PRETTY_FUNCTION__))
;
5702 odsState.addTypes(resultTypes);
5703}
5704
5705void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
5706 odsState.addOperands(lhs);
5707 odsState.addOperands(rhs);
5708 odsState.addTypes({lhs.getType()});
5709
5710}
5711
5712void MulFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5713 odsState.addOperands(operands);
5714 odsState.addAttributes(attributes);
5715 odsState.addTypes({operands[0].getType()});
5716
5717}
5718
5719::mlir::LogicalResult MulFOp::verifyInvariantsImpl() {
5720 {
5721 unsigned index = 0; (void)index;
5722 auto valueGroup0 = getODSOperands(0);
5723
5724 for (auto v : valueGroup0) {
5725 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
5726 return ::mlir::failure();
5727 }
5728 auto valueGroup1 = getODSOperands(1);
5729
5730 for (auto v : valueGroup1) {
5731 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
5732 return ::mlir::failure();
5733 }
5734 }
5735 {
5736 unsigned index = 0; (void)index;
5737 auto valueGroup0 = getODSResults(0);
5738
5739 for (auto v : valueGroup0) {
5740 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
5741 return ::mlir::failure();
5742 }
5743 }
5744 return ::mlir::success();
5745}
5746
5747::mlir::LogicalResult MulFOp::verifyInvariants() {
5748 return verifyInvariantsImpl();
5749}
5750
5751::mlir::ParseResult MulFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
5752 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
5753 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
5754 (void)lhsOperandsLoc;
5755 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
5756 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
5757 (void)rhsOperandsLoc;
5758 ::mlir::Type resultRawTypes[1];
5759 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
5760
5761 lhsOperandsLoc = parser.getCurrentLocation();
5762 if (parser.parseOperand(lhsRawOperands[0]))
5763 return ::mlir::failure();
5764 if (parser.parseComma())
5765 return ::mlir::failure();
5766
5767 rhsOperandsLoc = parser.getCurrentLocation();
5768 if (parser.parseOperand(rhsRawOperands[0]))
5769 return ::mlir::failure();
5770 if (parser.parseOptionalAttrDict(result.attributes))
5771 return ::mlir::failure();
5772 if (parser.parseColon())
5773 return ::mlir::failure();
5774
5775 {
5776 ::mlir::Type type;
5777 if (parser.parseCustomTypeWithFallback(type))
5778 return ::mlir::failure();
5779 resultRawTypes[0] = type;
5780 }
5781 result.addTypes(resultTypes);
5782 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
5783 return ::mlir::failure();
5784 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
5785 return ::mlir::failure();
5786 return ::mlir::success();
5787}
5788
5789void MulFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
5790 _odsPrinter << ' ';
5791 _odsPrinter << getLhs();
5792 _odsPrinter << ",";
5793 _odsPrinter << ' ';
5794 _odsPrinter << getRhs();
5795 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
5796 _odsPrinter << ' ' << ":";
5797 _odsPrinter << ' ';
5798 {
5799 auto type = getResult().getType();
5800 if (auto validType = type.dyn_cast<::mlir::Type>())
5801 _odsPrinter.printStrippedAttrOrType(validType);
5802 else
5803 _odsPrinter << type;
5804 }
5805}
5806
5807void MulFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
5808}
5809
5810} // namespace arith
5811} // namespace mlir
5812MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MulFOp>::id = {}; } }
5813
5814namespace mlir {
5815namespace arith {
5816
5817//===----------------------------------------------------------------------===//
5818// ::mlir::arith::MulIOp definitions
5819//===----------------------------------------------------------------------===//
5820
5821MulIOpAdaptor::MulIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
5822 odsOpName.emplace("arith.muli", odsAttrs.getContext());
5823}
5824
5825MulIOpAdaptor::MulIOpAdaptor(MulIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
5826
5827::mlir::ValueRange MulIOpAdaptor::getOperands() {
5828 return odsOperands;
5829}
5830
5831std::pair<unsigned, unsigned> MulIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
5832 return {index, 1};
5833}
5834
5835::mlir::ValueRange MulIOpAdaptor::getODSOperands(unsigned index) {
5836 auto valueRange = getODSOperandIndexAndLength(index);
5837 return {std::next(odsOperands.begin(), valueRange.first),
5838 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
5839}
5840
5841::mlir::Value MulIOpAdaptor::getLhs() {
5842 return *getODSOperands(0).begin();
5843}
5844
5845::mlir::Value MulIOpAdaptor::getRhs() {
5846 return *getODSOperands(1).begin();
5847}
5848
5849::mlir::DictionaryAttr MulIOpAdaptor::getAttributes() {
5850 return odsAttrs;
5851}
5852
5853::mlir::LogicalResult MulIOpAdaptor::verify(::mlir::Location loc) {
5854 return ::mlir::success();
5855}
5856
5857std::pair<unsigned, unsigned> MulIOp::getODSOperandIndexAndLength(unsigned index) {
5858 return {index, 1};
5859}
5860
5861::mlir::Operation::operand_range MulIOp::getODSOperands(unsigned index) {
5862 auto valueRange = getODSOperandIndexAndLength(index);
5863 return {std::next(getOperation()->operand_begin(), valueRange.first),
5864 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
5865}
5866
5867::mlir::Value MulIOp::getLhs() {
5868 return *getODSOperands(0).begin();
5869}
5870
5871::mlir::Value MulIOp::getRhs() {
5872 return *getODSOperands(1).begin();
5873}
5874
5875::mlir::MutableOperandRange MulIOp::getLhsMutable() {
5876 auto range = getODSOperandIndexAndLength(0);
5877 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5878 return mutableRange;
5879}
5880
5881::mlir::MutableOperandRange MulIOp::getRhsMutable() {
5882 auto range = getODSOperandIndexAndLength(1);
5883 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
5884 return mutableRange;
5885}
5886
5887std::pair<unsigned, unsigned> MulIOp::getODSResultIndexAndLength(unsigned index) {
5888 return {index, 1};
5889}
5890
5891::mlir::Operation::result_range MulIOp::getODSResults(unsigned index) {
5892 auto valueRange = getODSResultIndexAndLength(index);
5893 return {std::next(getOperation()->result_begin(), valueRange.first),
5894 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
5895}
5896
5897::mlir::Value MulIOp::getResult() {
5898 return *getODSResults(0).begin();
5899}
5900
5901void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
5902 odsState.addOperands(lhs);
5903 odsState.addOperands(rhs);
5904 odsState.addTypes(result);
5905}
5906
5907void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
5908 odsState.addOperands(lhs);
5909 odsState.addOperands(rhs);
5910 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5910, __extension__ __PRETTY_FUNCTION__))
;
5911 odsState.addTypes(resultTypes);
5912}
5913
5914void MulIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5915 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5915, __extension__ __PRETTY_FUNCTION__))
;
5916 odsState.addOperands(operands);
5917 odsState.addAttributes(attributes);
5918 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 5918, __extension__ __PRETTY_FUNCTION__))
;
5919 odsState.addTypes(resultTypes);
5920}
5921
5922void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
5923 odsState.addOperands(lhs);
5924 odsState.addOperands(rhs);
5925 odsState.addTypes({lhs.getType()});
5926
5927}
5928
5929void MulIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
5930 odsState.addOperands(operands);
5931 odsState.addAttributes(attributes);
5932 odsState.addTypes({operands[0].getType()});
5933
5934}
5935
5936::mlir::LogicalResult MulIOp::verifyInvariantsImpl() {
5937 {
5938 unsigned index = 0; (void)index;
5939 auto valueGroup0 = getODSOperands(0);
5940
5941 for (auto v : valueGroup0) {
5942 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5943 return ::mlir::failure();
5944 }
5945 auto valueGroup1 = getODSOperands(1);
5946
5947 for (auto v : valueGroup1) {
5948 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
5949 return ::mlir::failure();
5950 }
5951 }
5952 {
5953 unsigned index = 0; (void)index;
5954 auto valueGroup0 = getODSResults(0);
5955
5956 for (auto v : valueGroup0) {
5957 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
5958 return ::mlir::failure();
5959 }
5960 }
5961 return ::mlir::success();
5962}
5963
5964::mlir::LogicalResult MulIOp::verifyInvariants() {
5965 return verifyInvariantsImpl();
5966}
5967
5968::mlir::ParseResult MulIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
5969 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
5970 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
5971 (void)lhsOperandsLoc;
5972 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
5973 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
5974 (void)rhsOperandsLoc;
5975 ::mlir::Type resultRawTypes[1];
5976 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
5977
5978 lhsOperandsLoc = parser.getCurrentLocation();
5979 if (parser.parseOperand(lhsRawOperands[0]))
5980 return ::mlir::failure();
5981 if (parser.parseComma())
5982 return ::mlir::failure();
5983
5984 rhsOperandsLoc = parser.getCurrentLocation();
5985 if (parser.parseOperand(rhsRawOperands[0]))
5986 return ::mlir::failure();
5987 if (parser.parseOptionalAttrDict(result.attributes))
5988 return ::mlir::failure();
5989 if (parser.parseColon())
5990 return ::mlir::failure();
5991
5992 {
5993 ::mlir::Type type;
5994 if (parser.parseCustomTypeWithFallback(type))
5995 return ::mlir::failure();
5996 resultRawTypes[0] = type;
5997 }
5998 result.addTypes(resultTypes);
5999 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
6000 return ::mlir::failure();
6001 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
6002 return ::mlir::failure();
6003 return ::mlir::success();
6004}
6005
6006void MulIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
6007 _odsPrinter << ' ';
6008 _odsPrinter << getLhs();
6009 _odsPrinter << ",";
6010 _odsPrinter << ' ';
6011 _odsPrinter << getRhs();
6012 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
6013 _odsPrinter << ' ' << ":";
6014 _odsPrinter << ' ';
6015 {
6016 auto type = getResult().getType();
6017 if (auto validType = type.dyn_cast<::mlir::Type>())
6018 _odsPrinter.printStrippedAttrOrType(validType);
6019 else
6020 _odsPrinter << type;
6021 }
6022}
6023
6024void MulIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
6025}
6026
6027} // namespace arith
6028} // namespace mlir
6029MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::MulIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::MulIOp>::id = {}; } }
6030
6031namespace mlir {
6032namespace arith {
6033
6034//===----------------------------------------------------------------------===//
6035// ::mlir::arith::NegFOp definitions
6036//===----------------------------------------------------------------------===//
6037
6038NegFOpAdaptor::NegFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
6039 odsOpName.emplace("arith.negf", odsAttrs.getContext());
6040}
6041
6042NegFOpAdaptor::NegFOpAdaptor(NegFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
6043
6044::mlir::ValueRange NegFOpAdaptor::getOperands() {
6045 return odsOperands;
6046}
6047
6048std::pair<unsigned, unsigned> NegFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
6049 return {index, 1};
6050}
6051
6052::mlir::ValueRange NegFOpAdaptor::getODSOperands(unsigned index) {
6053 auto valueRange = getODSOperandIndexAndLength(index);
6054 return {std::next(odsOperands.begin(), valueRange.first),
6055 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6056}
6057
6058::mlir::Value NegFOpAdaptor::getOperand() {
6059 return *getODSOperands(0).begin();
6060}
6061
6062::mlir::DictionaryAttr NegFOpAdaptor::getAttributes() {
6063 return odsAttrs;
6064}
6065
6066::mlir::LogicalResult NegFOpAdaptor::verify(::mlir::Location loc) {
6067 return ::mlir::success();
6068}
6069
6070std::pair<unsigned, unsigned> NegFOp::getODSOperandIndexAndLength(unsigned index) {
6071 return {index, 1};
6072}
6073
6074::mlir::Operation::operand_range NegFOp::getODSOperands(unsigned index) {
6075 auto valueRange = getODSOperandIndexAndLength(index);
6076 return {std::next(getOperation()->operand_begin(), valueRange.first),
6077 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
6078}
6079
6080::mlir::Value NegFOp::getOperand() {
6081 return *getODSOperands(0).begin();
6082}
6083
6084::mlir::MutableOperandRange NegFOp::getOperandMutable() {
6085 auto range = getODSOperandIndexAndLength(0);
6086 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6087 return mutableRange;
6088}
6089
6090std::pair<unsigned, unsigned> NegFOp::getODSResultIndexAndLength(unsigned index) {
6091 return {index, 1};
6092}
6093
6094::mlir::Operation::result_range NegFOp::getODSResults(unsigned index) {
6095 auto valueRange = getODSResultIndexAndLength(index);
6096 return {std::next(getOperation()->result_begin(), valueRange.first),
6097 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
6098}
6099
6100::mlir::Value NegFOp::getResult() {
6101 return *getODSResults(0).begin();
6102}
6103
6104void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) {
6105 odsState.addOperands(operand);
6106 odsState.addTypes(result);
6107}
6108
6109void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) {
6110 odsState.addOperands(operand);
6111 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6111, __extension__ __PRETTY_FUNCTION__))
;
6112 odsState.addTypes(resultTypes);
6113}
6114
6115void NegFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6116 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6116, __extension__ __PRETTY_FUNCTION__))
;
6117 odsState.addOperands(operands);
6118 odsState.addAttributes(attributes);
6119 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6119, __extension__ __PRETTY_FUNCTION__))
;
6120 odsState.addTypes(resultTypes);
6121}
6122
6123void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand) {
6124 odsState.addOperands(operand);
6125 odsState.addTypes({operand.getType()});
6126
6127}
6128
6129void NegFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6130 odsState.addOperands(operands);
6131 odsState.addAttributes(attributes);
6132 odsState.addTypes({operands[0].getType()});
6133
6134}
6135
6136::mlir::LogicalResult NegFOp::verifyInvariantsImpl() {
6137 {
6138 unsigned index = 0; (void)index;
6139 auto valueGroup0 = getODSOperands(0);
6140
6141 for (auto v : valueGroup0) {
6142 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
6143 return ::mlir::failure();
6144 }
6145 }
6146 {
6147 unsigned index = 0; (void)index;
6148 auto valueGroup0 = getODSResults(0);
6149
6150 for (auto v : valueGroup0) {
6151 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
6152 return ::mlir::failure();
6153 }
6154 }
6155 return ::mlir::success();
6156}
6157
6158::mlir::LogicalResult NegFOp::verifyInvariants() {
6159 return verifyInvariantsImpl();
6160}
6161
6162::mlir::ParseResult NegFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
6163 ::mlir::OpAsmParser::UnresolvedOperand operandRawOperands[1];
6164 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(operandRawOperands); ::llvm::SMLoc operandOperandsLoc;
6165 (void)operandOperandsLoc;
6166 ::mlir::Type resultRawTypes[1];
6167 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
6168
6169 operandOperandsLoc = parser.getCurrentLocation();
6170 if (parser.parseOperand(operandRawOperands[0]))
6171 return ::mlir::failure();
6172 if (parser.parseOptionalAttrDict(result.attributes))
6173 return ::mlir::failure();
6174 if (parser.parseColon())
6175 return ::mlir::failure();
6176
6177 {
6178 ::mlir::Type type;
6179 if (parser.parseCustomTypeWithFallback(type))
6180 return ::mlir::failure();
6181 resultRawTypes[0] = type;
6182 }
6183 result.addTypes(resultTypes);
6184 if (parser.resolveOperands(operandOperands, resultTypes[0], result.operands))
6185 return ::mlir::failure();
6186 return ::mlir::success();
6187}
6188
6189void NegFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
6190 _odsPrinter << ' ';
6191 _odsPrinter << getOperand();
6192 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
6193 _odsPrinter << ' ' << ":";
6194 _odsPrinter << ' ';
6195 {
6196 auto type = getResult().getType();
6197 if (auto validType = type.dyn_cast<::mlir::Type>())
6198 _odsPrinter.printStrippedAttrOrType(validType);
6199 else
6200 _odsPrinter << type;
6201 }
6202}
6203
6204void NegFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
6205}
6206
6207} // namespace arith
6208} // namespace mlir
6209MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::NegFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::NegFOp>::id = {}; } }
6210
6211namespace mlir {
6212namespace arith {
6213
6214//===----------------------------------------------------------------------===//
6215// ::mlir::arith::OrIOp definitions
6216//===----------------------------------------------------------------------===//
6217
6218OrIOpAdaptor::OrIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
6219 odsOpName.emplace("arith.ori", odsAttrs.getContext());
6220}
6221
6222OrIOpAdaptor::OrIOpAdaptor(OrIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
6223
6224::mlir::ValueRange OrIOpAdaptor::getOperands() {
6225 return odsOperands;
6226}
6227
6228std::pair<unsigned, unsigned> OrIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
6229 return {index, 1};
6230}
6231
6232::mlir::ValueRange OrIOpAdaptor::getODSOperands(unsigned index) {
6233 auto valueRange = getODSOperandIndexAndLength(index);
6234 return {std::next(odsOperands.begin(), valueRange.first),
6235 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6236}
6237
6238::mlir::Value OrIOpAdaptor::getLhs() {
6239 return *getODSOperands(0).begin();
6240}
6241
6242::mlir::Value OrIOpAdaptor::getRhs() {
6243 return *getODSOperands(1).begin();
6244}
6245
6246::mlir::DictionaryAttr OrIOpAdaptor::getAttributes() {
6247 return odsAttrs;
6248}
6249
6250::mlir::LogicalResult OrIOpAdaptor::verify(::mlir::Location loc) {
6251 return ::mlir::success();
6252}
6253
6254std::pair<unsigned, unsigned> OrIOp::getODSOperandIndexAndLength(unsigned index) {
6255 return {index, 1};
6256}
6257
6258::mlir::Operation::operand_range OrIOp::getODSOperands(unsigned index) {
6259 auto valueRange = getODSOperandIndexAndLength(index);
6260 return {std::next(getOperation()->operand_begin(), valueRange.first),
6261 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
6262}
6263
6264::mlir::Value OrIOp::getLhs() {
6265 return *getODSOperands(0).begin();
6266}
6267
6268::mlir::Value OrIOp::getRhs() {
6269 return *getODSOperands(1).begin();
6270}
6271
6272::mlir::MutableOperandRange OrIOp::getLhsMutable() {
6273 auto range = getODSOperandIndexAndLength(0);
6274 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6275 return mutableRange;
6276}
6277
6278::mlir::MutableOperandRange OrIOp::getRhsMutable() {
6279 auto range = getODSOperandIndexAndLength(1);
6280 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6281 return mutableRange;
6282}
6283
6284std::pair<unsigned, unsigned> OrIOp::getODSResultIndexAndLength(unsigned index) {
6285 return {index, 1};
6286}
6287
6288::mlir::Operation::result_range OrIOp::getODSResults(unsigned index) {
6289 auto valueRange = getODSResultIndexAndLength(index);
6290 return {std::next(getOperation()->result_begin(), valueRange.first),
6291 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
6292}
6293
6294::mlir::Value OrIOp::getResult() {
6295 return *getODSResults(0).begin();
6296}
6297
6298void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
6299 odsState.addOperands(lhs);
6300 odsState.addOperands(rhs);
6301 odsState.addTypes(result);
6302}
6303
6304void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
6305 odsState.addOperands(lhs);
6306 odsState.addOperands(rhs);
6307 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6307, __extension__ __PRETTY_FUNCTION__))
;
6308 odsState.addTypes(resultTypes);
6309}
6310
6311void OrIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6312 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6312, __extension__ __PRETTY_FUNCTION__))
;
6313 odsState.addOperands(operands);
6314 odsState.addAttributes(attributes);
6315 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6315, __extension__ __PRETTY_FUNCTION__))
;
6316 odsState.addTypes(resultTypes);
6317}
6318
6319void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
6320 odsState.addOperands(lhs);
6321 odsState.addOperands(rhs);
6322 odsState.addTypes({lhs.getType()});
6323
6324}
6325
6326void OrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6327 odsState.addOperands(operands);
6328 odsState.addAttributes(attributes);
6329 odsState.addTypes({operands[0].getType()});
6330
6331}
6332
6333::mlir::LogicalResult OrIOp::verifyInvariantsImpl() {
6334 {
6335 unsigned index = 0; (void)index;
6336 auto valueGroup0 = getODSOperands(0);
6337
6338 for (auto v : valueGroup0) {
6339 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6340 return ::mlir::failure();
6341 }
6342 auto valueGroup1 = getODSOperands(1);
6343
6344 for (auto v : valueGroup1) {
6345 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6346 return ::mlir::failure();
6347 }
6348 }
6349 {
6350 unsigned index = 0; (void)index;
6351 auto valueGroup0 = getODSResults(0);
6352
6353 for (auto v : valueGroup0) {
6354 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
6355 return ::mlir::failure();
6356 }
6357 }
6358 return ::mlir::success();
6359}
6360
6361::mlir::LogicalResult OrIOp::verifyInvariants() {
6362 return verifyInvariantsImpl();
6363}
6364
6365::mlir::ParseResult OrIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
6366 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
6367 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
6368 (void)lhsOperandsLoc;
6369 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
6370 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
6371 (void)rhsOperandsLoc;
6372 ::mlir::Type resultRawTypes[1];
6373 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
6374
6375 lhsOperandsLoc = parser.getCurrentLocation();
6376 if (parser.parseOperand(lhsRawOperands[0]))
6377 return ::mlir::failure();
6378 if (parser.parseComma())
6379 return ::mlir::failure();
6380
6381 rhsOperandsLoc = parser.getCurrentLocation();
6382 if (parser.parseOperand(rhsRawOperands[0]))
6383 return ::mlir::failure();
6384 if (parser.parseOptionalAttrDict(result.attributes))
6385 return ::mlir::failure();
6386 if (parser.parseColon())
6387 return ::mlir::failure();
6388
6389 {
6390 ::mlir::Type type;
6391 if (parser.parseCustomTypeWithFallback(type))
6392 return ::mlir::failure();
6393 resultRawTypes[0] = type;
6394 }
6395 result.addTypes(resultTypes);
6396 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
6397 return ::mlir::failure();
6398 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
6399 return ::mlir::failure();
6400 return ::mlir::success();
6401}
6402
6403void OrIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
6404 _odsPrinter << ' ';
6405 _odsPrinter << getLhs();
6406 _odsPrinter << ",";
6407 _odsPrinter << ' ';
6408 _odsPrinter << getRhs();
6409 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
6410 _odsPrinter << ' ' << ":";
6411 _odsPrinter << ' ';
6412 {
6413 auto type = getResult().getType();
6414 if (auto validType = type.dyn_cast<::mlir::Type>())
6415 _odsPrinter.printStrippedAttrOrType(validType);
6416 else
6417 _odsPrinter << type;
6418 }
6419}
6420
6421void OrIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
6422}
6423
6424} // namespace arith
6425} // namespace mlir
6426MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::OrIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::OrIOp>::id = {}; } }
6427
6428namespace mlir {
6429namespace arith {
6430
6431//===----------------------------------------------------------------------===//
6432// ::mlir::arith::RemFOp definitions
6433//===----------------------------------------------------------------------===//
6434
6435RemFOpAdaptor::RemFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
6436 odsOpName.emplace("arith.remf", odsAttrs.getContext());
6437}
6438
6439RemFOpAdaptor::RemFOpAdaptor(RemFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
6440
6441::mlir::ValueRange RemFOpAdaptor::getOperands() {
6442 return odsOperands;
6443}
6444
6445std::pair<unsigned, unsigned> RemFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
6446 return {index, 1};
6447}
6448
6449::mlir::ValueRange RemFOpAdaptor::getODSOperands(unsigned index) {
6450 auto valueRange = getODSOperandIndexAndLength(index);
6451 return {std::next(odsOperands.begin(), valueRange.first),
6452 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6453}
6454
6455::mlir::Value RemFOpAdaptor::getLhs() {
6456 return *getODSOperands(0).begin();
6457}
6458
6459::mlir::Value RemFOpAdaptor::getRhs() {
6460 return *getODSOperands(1).begin();
6461}
6462
6463::mlir::DictionaryAttr RemFOpAdaptor::getAttributes() {
6464 return odsAttrs;
6465}
6466
6467::mlir::LogicalResult RemFOpAdaptor::verify(::mlir::Location loc) {
6468 return ::mlir::success();
6469}
6470
6471std::pair<unsigned, unsigned> RemFOp::getODSOperandIndexAndLength(unsigned index) {
6472 return {index, 1};
6473}
6474
6475::mlir::Operation::operand_range RemFOp::getODSOperands(unsigned index) {
6476 auto valueRange = getODSOperandIndexAndLength(index);
6477 return {std::next(getOperation()->operand_begin(), valueRange.first),
6478 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
6479}
6480
6481::mlir::Value RemFOp::getLhs() {
6482 return *getODSOperands(0).begin();
6483}
6484
6485::mlir::Value RemFOp::getRhs() {
6486 return *getODSOperands(1).begin();
6487}
6488
6489::mlir::MutableOperandRange RemFOp::getLhsMutable() {
6490 auto range = getODSOperandIndexAndLength(0);
6491 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6492 return mutableRange;
6493}
6494
6495::mlir::MutableOperandRange RemFOp::getRhsMutable() {
6496 auto range = getODSOperandIndexAndLength(1);
6497 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6498 return mutableRange;
6499}
6500
6501std::pair<unsigned, unsigned> RemFOp::getODSResultIndexAndLength(unsigned index) {
6502 return {index, 1};
6503}
6504
6505::mlir::Operation::result_range RemFOp::getODSResults(unsigned index) {
6506 auto valueRange = getODSResultIndexAndLength(index);
6507 return {std::next(getOperation()->result_begin(), valueRange.first),
6508 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
6509}
6510
6511::mlir::Value RemFOp::getResult() {
6512 return *getODSResults(0).begin();
6513}
6514
6515void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
6516 odsState.addOperands(lhs);
6517 odsState.addOperands(rhs);
6518 odsState.addTypes(result);
6519}
6520
6521void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
6522 odsState.addOperands(lhs);
6523 odsState.addOperands(rhs);
6524 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6524, __extension__ __PRETTY_FUNCTION__))
;
6525 odsState.addTypes(resultTypes);
6526}
6527
6528void RemFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6529 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6529, __extension__ __PRETTY_FUNCTION__))
;
6530 odsState.addOperands(operands);
6531 odsState.addAttributes(attributes);
6532 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6532, __extension__ __PRETTY_FUNCTION__))
;
6533 odsState.addTypes(resultTypes);
6534}
6535
6536void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
6537 odsState.addOperands(lhs);
6538 odsState.addOperands(rhs);
6539 odsState.addTypes({lhs.getType()});
6540
6541}
6542
6543void RemFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6544 odsState.addOperands(operands);
6545 odsState.addAttributes(attributes);
6546 odsState.addTypes({operands[0].getType()});
6547
6548}
6549
6550::mlir::LogicalResult RemFOp::verifyInvariantsImpl() {
6551 {
6552 unsigned index = 0; (void)index;
6553 auto valueGroup0 = getODSOperands(0);
6554
6555 for (auto v : valueGroup0) {
6556 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
6557 return ::mlir::failure();
6558 }
6559 auto valueGroup1 = getODSOperands(1);
6560
6561 for (auto v : valueGroup1) {
6562 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
6563 return ::mlir::failure();
6564 }
6565 }
6566 {
6567 unsigned index = 0; (void)index;
6568 auto valueGroup0 = getODSResults(0);
6569
6570 for (auto v : valueGroup0) {
6571 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
6572 return ::mlir::failure();
6573 }
6574 }
6575 return ::mlir::success();
6576}
6577
6578::mlir::LogicalResult RemFOp::verifyInvariants() {
6579 return verifyInvariantsImpl();
6580}
6581
6582::mlir::ParseResult RemFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
6583 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
6584 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
6585 (void)lhsOperandsLoc;
6586 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
6587 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
6588 (void)rhsOperandsLoc;
6589 ::mlir::Type resultRawTypes[1];
6590 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
6591
6592 lhsOperandsLoc = parser.getCurrentLocation();
6593 if (parser.parseOperand(lhsRawOperands[0]))
6594 return ::mlir::failure();
6595 if (parser.parseComma())
6596 return ::mlir::failure();
6597
6598 rhsOperandsLoc = parser.getCurrentLocation();
6599 if (parser.parseOperand(rhsRawOperands[0]))
6600 return ::mlir::failure();
6601 if (parser.parseOptionalAttrDict(result.attributes))
6602 return ::mlir::failure();
6603 if (parser.parseColon())
6604 return ::mlir::failure();
6605
6606 {
6607 ::mlir::Type type;
6608 if (parser.parseCustomTypeWithFallback(type))
6609 return ::mlir::failure();
6610 resultRawTypes[0] = type;
6611 }
6612 result.addTypes(resultTypes);
6613 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
6614 return ::mlir::failure();
6615 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
6616 return ::mlir::failure();
6617 return ::mlir::success();
6618}
6619
6620void RemFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
6621 _odsPrinter << ' ';
6622 _odsPrinter << getLhs();
6623 _odsPrinter << ",";
6624 _odsPrinter << ' ';
6625 _odsPrinter << getRhs();
6626 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
6627 _odsPrinter << ' ' << ":";
6628 _odsPrinter << ' ';
6629 {
6630 auto type = getResult().getType();
6631 if (auto validType = type.dyn_cast<::mlir::Type>())
6632 _odsPrinter.printStrippedAttrOrType(validType);
6633 else
6634 _odsPrinter << type;
6635 }
6636}
6637
6638void RemFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
6639}
6640
6641} // namespace arith
6642} // namespace mlir
6643MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::RemFOp>::id = {}; } }
6644
6645namespace mlir {
6646namespace arith {
6647
6648//===----------------------------------------------------------------------===//
6649// ::mlir::arith::RemSIOp definitions
6650//===----------------------------------------------------------------------===//
6651
6652RemSIOpAdaptor::RemSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
6653 odsOpName.emplace("arith.remsi", odsAttrs.getContext());
6654}
6655
6656RemSIOpAdaptor::RemSIOpAdaptor(RemSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
6657
6658::mlir::ValueRange RemSIOpAdaptor::getOperands() {
6659 return odsOperands;
6660}
6661
6662std::pair<unsigned, unsigned> RemSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
6663 return {index, 1};
6664}
6665
6666::mlir::ValueRange RemSIOpAdaptor::getODSOperands(unsigned index) {
6667 auto valueRange = getODSOperandIndexAndLength(index);
6668 return {std::next(odsOperands.begin(), valueRange.first),
6669 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6670}
6671
6672::mlir::Value RemSIOpAdaptor::getLhs() {
6673 return *getODSOperands(0).begin();
6674}
6675
6676::mlir::Value RemSIOpAdaptor::getRhs() {
6677 return *getODSOperands(1).begin();
6678}
6679
6680::mlir::DictionaryAttr RemSIOpAdaptor::getAttributes() {
6681 return odsAttrs;
6682}
6683
6684::mlir::LogicalResult RemSIOpAdaptor::verify(::mlir::Location loc) {
6685 return ::mlir::success();
6686}
6687
6688std::pair<unsigned, unsigned> RemSIOp::getODSOperandIndexAndLength(unsigned index) {
6689 return {index, 1};
6690}
6691
6692::mlir::Operation::operand_range RemSIOp::getODSOperands(unsigned index) {
6693 auto valueRange = getODSOperandIndexAndLength(index);
6694 return {std::next(getOperation()->operand_begin(), valueRange.first),
6695 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
6696}
6697
6698::mlir::Value RemSIOp::getLhs() {
6699 return *getODSOperands(0).begin();
6700}
6701
6702::mlir::Value RemSIOp::getRhs() {
6703 return *getODSOperands(1).begin();
6704}
6705
6706::mlir::MutableOperandRange RemSIOp::getLhsMutable() {
6707 auto range = getODSOperandIndexAndLength(0);
6708 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6709 return mutableRange;
6710}
6711
6712::mlir::MutableOperandRange RemSIOp::getRhsMutable() {
6713 auto range = getODSOperandIndexAndLength(1);
6714 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6715 return mutableRange;
6716}
6717
6718std::pair<unsigned, unsigned> RemSIOp::getODSResultIndexAndLength(unsigned index) {
6719 return {index, 1};
6720}
6721
6722::mlir::Operation::result_range RemSIOp::getODSResults(unsigned index) {
6723 auto valueRange = getODSResultIndexAndLength(index);
6724 return {std::next(getOperation()->result_begin(), valueRange.first),
6725 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
6726}
6727
6728::mlir::Value RemSIOp::getResult() {
6729 return *getODSResults(0).begin();
6730}
6731
6732void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
6733 odsState.addOperands(lhs);
6734 odsState.addOperands(rhs);
6735 odsState.addTypes(result);
6736}
6737
6738void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
6739 odsState.addOperands(lhs);
6740 odsState.addOperands(rhs);
6741 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6741, __extension__ __PRETTY_FUNCTION__))
;
6742 odsState.addTypes(resultTypes);
6743}
6744
6745void RemSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6746 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6746, __extension__ __PRETTY_FUNCTION__))
;
6747 odsState.addOperands(operands);
6748 odsState.addAttributes(attributes);
6749 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6749, __extension__ __PRETTY_FUNCTION__))
;
6750 odsState.addTypes(resultTypes);
6751}
6752
6753void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
6754 odsState.addOperands(lhs);
6755 odsState.addOperands(rhs);
6756 odsState.addTypes({lhs.getType()});
6757
6758}
6759
6760void RemSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6761 odsState.addOperands(operands);
6762 odsState.addAttributes(attributes);
6763 odsState.addTypes({operands[0].getType()});
6764
6765}
6766
6767::mlir::LogicalResult RemSIOp::verifyInvariantsImpl() {
6768 {
6769 unsigned index = 0; (void)index;
6770 auto valueGroup0 = getODSOperands(0);
6771
6772 for (auto v : valueGroup0) {
6773 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6774 return ::mlir::failure();
6775 }
6776 auto valueGroup1 = getODSOperands(1);
6777
6778 for (auto v : valueGroup1) {
6779 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6780 return ::mlir::failure();
6781 }
6782 }
6783 {
6784 unsigned index = 0; (void)index;
6785 auto valueGroup0 = getODSResults(0);
6786
6787 for (auto v : valueGroup0) {
6788 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
6789 return ::mlir::failure();
6790 }
6791 }
6792 return ::mlir::success();
6793}
6794
6795::mlir::LogicalResult RemSIOp::verifyInvariants() {
6796 return verifyInvariantsImpl();
6797}
6798
6799::mlir::ParseResult RemSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
6800 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
6801 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
6802 (void)lhsOperandsLoc;
6803 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
6804 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
6805 (void)rhsOperandsLoc;
6806 ::mlir::Type resultRawTypes[1];
6807 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
6808
6809 lhsOperandsLoc = parser.getCurrentLocation();
6810 if (parser.parseOperand(lhsRawOperands[0]))
6811 return ::mlir::failure();
6812 if (parser.parseComma())
6813 return ::mlir::failure();
6814
6815 rhsOperandsLoc = parser.getCurrentLocation();
6816 if (parser.parseOperand(rhsRawOperands[0]))
6817 return ::mlir::failure();
6818 if (parser.parseOptionalAttrDict(result.attributes))
6819 return ::mlir::failure();
6820 if (parser.parseColon())
6821 return ::mlir::failure();
6822
6823 {
6824 ::mlir::Type type;
6825 if (parser.parseCustomTypeWithFallback(type))
6826 return ::mlir::failure();
6827 resultRawTypes[0] = type;
6828 }
6829 result.addTypes(resultTypes);
6830 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
6831 return ::mlir::failure();
6832 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
6833 return ::mlir::failure();
6834 return ::mlir::success();
6835}
6836
6837void RemSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
6838 _odsPrinter << ' ';
6839 _odsPrinter << getLhs();
6840 _odsPrinter << ",";
6841 _odsPrinter << ' ';
6842 _odsPrinter << getRhs();
6843 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
6844 _odsPrinter << ' ' << ":";
6845 _odsPrinter << ' ';
6846 {
6847 auto type = getResult().getType();
6848 if (auto validType = type.dyn_cast<::mlir::Type>())
6849 _odsPrinter.printStrippedAttrOrType(validType);
6850 else
6851 _odsPrinter << type;
6852 }
6853}
6854
6855void RemSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
6856}
6857
6858} // namespace arith
6859} // namespace mlir
6860MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::RemSIOp>::id = {}; } }
6861
6862namespace mlir {
6863namespace arith {
6864
6865//===----------------------------------------------------------------------===//
6866// ::mlir::arith::RemUIOp definitions
6867//===----------------------------------------------------------------------===//
6868
6869RemUIOpAdaptor::RemUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
6870 odsOpName.emplace("arith.remui", odsAttrs.getContext());
6871}
6872
6873RemUIOpAdaptor::RemUIOpAdaptor(RemUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
6874
6875::mlir::ValueRange RemUIOpAdaptor::getOperands() {
6876 return odsOperands;
6877}
6878
6879std::pair<unsigned, unsigned> RemUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
6880 return {index, 1};
6881}
6882
6883::mlir::ValueRange RemUIOpAdaptor::getODSOperands(unsigned index) {
6884 auto valueRange = getODSOperandIndexAndLength(index);
6885 return {std::next(odsOperands.begin(), valueRange.first),
6886 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
6887}
6888
6889::mlir::Value RemUIOpAdaptor::getLhs() {
6890 return *getODSOperands(0).begin();
6891}
6892
6893::mlir::Value RemUIOpAdaptor::getRhs() {
6894 return *getODSOperands(1).begin();
6895}
6896
6897::mlir::DictionaryAttr RemUIOpAdaptor::getAttributes() {
6898 return odsAttrs;
6899}
6900
6901::mlir::LogicalResult RemUIOpAdaptor::verify(::mlir::Location loc) {
6902 return ::mlir::success();
6903}
6904
6905std::pair<unsigned, unsigned> RemUIOp::getODSOperandIndexAndLength(unsigned index) {
6906 return {index, 1};
6907}
6908
6909::mlir::Operation::operand_range RemUIOp::getODSOperands(unsigned index) {
6910 auto valueRange = getODSOperandIndexAndLength(index);
6911 return {std::next(getOperation()->operand_begin(), valueRange.first),
6912 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
6913}
6914
6915::mlir::Value RemUIOp::getLhs() {
6916 return *getODSOperands(0).begin();
6917}
6918
6919::mlir::Value RemUIOp::getRhs() {
6920 return *getODSOperands(1).begin();
6921}
6922
6923::mlir::MutableOperandRange RemUIOp::getLhsMutable() {
6924 auto range = getODSOperandIndexAndLength(0);
6925 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6926 return mutableRange;
6927}
6928
6929::mlir::MutableOperandRange RemUIOp::getRhsMutable() {
6930 auto range = getODSOperandIndexAndLength(1);
6931 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
6932 return mutableRange;
6933}
6934
6935std::pair<unsigned, unsigned> RemUIOp::getODSResultIndexAndLength(unsigned index) {
6936 return {index, 1};
6937}
6938
6939::mlir::Operation::result_range RemUIOp::getODSResults(unsigned index) {
6940 auto valueRange = getODSResultIndexAndLength(index);
6941 return {std::next(getOperation()->result_begin(), valueRange.first),
6942 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
6943}
6944
6945::mlir::Value RemUIOp::getResult() {
6946 return *getODSResults(0).begin();
6947}
6948
6949void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
6950 odsState.addOperands(lhs);
6951 odsState.addOperands(rhs);
6952 odsState.addTypes(result);
6953}
6954
6955void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
6956 odsState.addOperands(lhs);
6957 odsState.addOperands(rhs);
6958 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6958, __extension__ __PRETTY_FUNCTION__))
;
6959 odsState.addTypes(resultTypes);
6960}
6961
6962void RemUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6963 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6963, __extension__ __PRETTY_FUNCTION__))
;
6964 odsState.addOperands(operands);
6965 odsState.addAttributes(attributes);
6966 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 6966, __extension__ __PRETTY_FUNCTION__))
;
6967 odsState.addTypes(resultTypes);
6968}
6969
6970void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
6971 odsState.addOperands(lhs);
6972 odsState.addOperands(rhs);
6973 odsState.addTypes({lhs.getType()});
6974
6975}
6976
6977void RemUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
6978 odsState.addOperands(operands);
6979 odsState.addAttributes(attributes);
6980 odsState.addTypes({operands[0].getType()});
6981
6982}
6983
6984::mlir::LogicalResult RemUIOp::verifyInvariantsImpl() {
6985 {
6986 unsigned index = 0; (void)index;
6987 auto valueGroup0 = getODSOperands(0);
6988
6989 for (auto v : valueGroup0) {
6990 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6991 return ::mlir::failure();
6992 }
6993 auto valueGroup1 = getODSOperands(1);
6994
6995 for (auto v : valueGroup1) {
6996 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
6997 return ::mlir::failure();
6998 }
6999 }
7000 {
7001 unsigned index = 0; (void)index;
7002 auto valueGroup0 = getODSResults(0);
7003
7004 for (auto v : valueGroup0) {
7005 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
7006 return ::mlir::failure();
7007 }
7008 }
7009 return ::mlir::success();
7010}
7011
7012::mlir::LogicalResult RemUIOp::verifyInvariants() {
7013 return verifyInvariantsImpl();
7014}
7015
7016::mlir::ParseResult RemUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
7017 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
7018 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
7019 (void)lhsOperandsLoc;
7020 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
7021 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
7022 (void)rhsOperandsLoc;
7023 ::mlir::Type resultRawTypes[1];
7024 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
7025
7026 lhsOperandsLoc = parser.getCurrentLocation();
7027 if (parser.parseOperand(lhsRawOperands[0]))
7028 return ::mlir::failure();
7029 if (parser.parseComma())
7030 return ::mlir::failure();
7031
7032 rhsOperandsLoc = parser.getCurrentLocation();
7033 if (parser.parseOperand(rhsRawOperands[0]))
7034 return ::mlir::failure();
7035 if (parser.parseOptionalAttrDict(result.attributes))
7036 return ::mlir::failure();
7037 if (parser.parseColon())
7038 return ::mlir::failure();
7039
7040 {
7041 ::mlir::Type type;
7042 if (parser.parseCustomTypeWithFallback(type))
7043 return ::mlir::failure();
7044 resultRawTypes[0] = type;
7045 }
7046 result.addTypes(resultTypes);
7047 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
7048 return ::mlir::failure();
7049 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
7050 return ::mlir::failure();
7051 return ::mlir::success();
7052}
7053
7054void RemUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
7055 _odsPrinter << ' ';
7056 _odsPrinter << getLhs();
7057 _odsPrinter << ",";
7058 _odsPrinter << ' ';
7059 _odsPrinter << getRhs();
7060 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
7061 _odsPrinter << ' ' << ":";
7062 _odsPrinter << ' ';
7063 {
7064 auto type = getResult().getType();
7065 if (auto validType = type.dyn_cast<::mlir::Type>())
7066 _odsPrinter.printStrippedAttrOrType(validType);
7067 else
7068 _odsPrinter << type;
7069 }
7070}
7071
7072void RemUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
7073}
7074
7075} // namespace arith
7076} // namespace mlir
7077MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::RemUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::RemUIOp>::id = {}; } }
7078
7079namespace mlir {
7080namespace arith {
7081
7082//===----------------------------------------------------------------------===//
7083// ::mlir::arith::SIToFPOp definitions
7084//===----------------------------------------------------------------------===//
7085
7086SIToFPOpAdaptor::SIToFPOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
7087 odsOpName.emplace("arith.sitofp", odsAttrs.getContext());
7088}
7089
7090SIToFPOpAdaptor::SIToFPOpAdaptor(SIToFPOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
7091
7092::mlir::ValueRange SIToFPOpAdaptor::getOperands() {
7093 return odsOperands;
7094}
7095
7096std::pair<unsigned, unsigned> SIToFPOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
7097 return {index, 1};
7098}
7099
7100::mlir::ValueRange SIToFPOpAdaptor::getODSOperands(unsigned index) {
7101 auto valueRange = getODSOperandIndexAndLength(index);
7102 return {std::next(odsOperands.begin(), valueRange.first),
7103 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7104}
7105
7106::mlir::Value SIToFPOpAdaptor::getIn() {
7107 return *getODSOperands(0).begin();
7108}
7109
7110::mlir::DictionaryAttr SIToFPOpAdaptor::getAttributes() {
7111 return odsAttrs;
7112}
7113
7114::mlir::LogicalResult SIToFPOpAdaptor::verify(::mlir::Location loc) {
7115 return ::mlir::success();
7116}
7117
7118std::pair<unsigned, unsigned> SIToFPOp::getODSOperandIndexAndLength(unsigned index) {
7119 return {index, 1};
7120}
7121
7122::mlir::Operation::operand_range SIToFPOp::getODSOperands(unsigned index) {
7123 auto valueRange = getODSOperandIndexAndLength(index);
7124 return {std::next(getOperation()->operand_begin(), valueRange.first),
7125 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
7126}
7127
7128::mlir::Value SIToFPOp::getIn() {
7129 return *getODSOperands(0).begin();
7130}
7131
7132::mlir::MutableOperandRange SIToFPOp::getInMutable() {
7133 auto range = getODSOperandIndexAndLength(0);
7134 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7135 return mutableRange;
7136}
7137
7138std::pair<unsigned, unsigned> SIToFPOp::getODSResultIndexAndLength(unsigned index) {
7139 return {index, 1};
7140}
7141
7142::mlir::Operation::result_range SIToFPOp::getODSResults(unsigned index) {
7143 auto valueRange = getODSResultIndexAndLength(index);
7144 return {std::next(getOperation()->result_begin(), valueRange.first),
7145 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
7146}
7147
7148::mlir::Value SIToFPOp::getOut() {
7149 return *getODSResults(0).begin();
7150}
7151
7152void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
7153 odsState.addOperands(in);
7154 odsState.addTypes(out);
7155}
7156
7157void SIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
7158 odsState.addOperands(in);
7159 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7159, __extension__ __PRETTY_FUNCTION__))
;
7160 odsState.addTypes(resultTypes);
7161}
7162
7163void SIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7164 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7164, __extension__ __PRETTY_FUNCTION__))
;
7165 odsState.addOperands(operands);
7166 odsState.addAttributes(attributes);
7167 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7167, __extension__ __PRETTY_FUNCTION__))
;
7168 odsState.addTypes(resultTypes);
7169}
7170
7171::mlir::LogicalResult SIToFPOp::verifyInvariantsImpl() {
7172 {
7173 unsigned index = 0; (void)index;
7174 auto valueGroup0 = getODSOperands(0);
7175
7176 for (auto v : valueGroup0) {
7177 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "operand", index++)))
7178 return ::mlir::failure();
7179 }
7180 }
7181 {
7182 unsigned index = 0; (void)index;
7183 auto valueGroup0 = getODSResults(0);
7184
7185 for (auto v : valueGroup0) {
7186 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
7187 return ::mlir::failure();
7188 }
7189 }
7190 return ::mlir::success();
7191}
7192
7193::mlir::LogicalResult SIToFPOp::verifyInvariants() {
7194 return verifyInvariantsImpl();
7195}
7196
7197::mlir::ParseResult SIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
7198 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
7199 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
7200 (void)inOperandsLoc;
7201 ::mlir::Type inRawTypes[1];
7202 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
7203 ::mlir::Type outRawTypes[1];
7204 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
7205
7206 inOperandsLoc = parser.getCurrentLocation();
7207 if (parser.parseOperand(inRawOperands[0]))
7208 return ::mlir::failure();
7209 if (parser.parseOptionalAttrDict(result.attributes))
7210 return ::mlir::failure();
7211 if (parser.parseColon())
7212 return ::mlir::failure();
7213
7214 {
7215 ::mlir::Type type;
7216 if (parser.parseCustomTypeWithFallback(type))
7217 return ::mlir::failure();
7218 inRawTypes[0] = type;
7219 }
7220 if (parser.parseKeyword("to"))
7221 return ::mlir::failure();
7222
7223 {
7224 ::mlir::Type type;
7225 if (parser.parseCustomTypeWithFallback(type))
7226 return ::mlir::failure();
7227 outRawTypes[0] = type;
7228 }
7229 result.addTypes(outTypes);
7230 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
7231 return ::mlir::failure();
7232 return ::mlir::success();
7233}
7234
7235void SIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
7236 _odsPrinter << ' ';
7237 _odsPrinter << getIn();
7238 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
7239 _odsPrinter << ' ' << ":";
7240 _odsPrinter << ' ';
7241 {
7242 auto type = getIn().getType();
7243 if (auto validType = type.dyn_cast<::mlir::Type>())
7244 _odsPrinter.printStrippedAttrOrType(validType);
7245 else
7246 _odsPrinter << type;
7247 }
7248 _odsPrinter << ' ' << "to";
7249 _odsPrinter << ' ';
7250 {
7251 auto type = getOut().getType();
7252 if (auto validType = type.dyn_cast<::mlir::Type>())
7253 _odsPrinter.printStrippedAttrOrType(validType);
7254 else
7255 _odsPrinter << type;
7256 }
7257}
7258
7259void SIToFPOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
7260}
7261
7262} // namespace arith
7263} // namespace mlir
7264MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SIToFPOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::SIToFPOp>::id = {}; } }
7265
7266namespace mlir {
7267namespace arith {
7268
7269//===----------------------------------------------------------------------===//
7270// ::mlir::arith::ShLIOp definitions
7271//===----------------------------------------------------------------------===//
7272
7273ShLIOpAdaptor::ShLIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
7274 odsOpName.emplace("arith.shli", odsAttrs.getContext());
7275}
7276
7277ShLIOpAdaptor::ShLIOpAdaptor(ShLIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
7278
7279::mlir::ValueRange ShLIOpAdaptor::getOperands() {
7280 return odsOperands;
7281}
7282
7283std::pair<unsigned, unsigned> ShLIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
7284 return {index, 1};
7285}
7286
7287::mlir::ValueRange ShLIOpAdaptor::getODSOperands(unsigned index) {
7288 auto valueRange = getODSOperandIndexAndLength(index);
7289 return {std::next(odsOperands.begin(), valueRange.first),
7290 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7291}
7292
7293::mlir::Value ShLIOpAdaptor::getLhs() {
7294 return *getODSOperands(0).begin();
7295}
7296
7297::mlir::Value ShLIOpAdaptor::getRhs() {
7298 return *getODSOperands(1).begin();
7299}
7300
7301::mlir::DictionaryAttr ShLIOpAdaptor::getAttributes() {
7302 return odsAttrs;
7303}
7304
7305::mlir::LogicalResult ShLIOpAdaptor::verify(::mlir::Location loc) {
7306 return ::mlir::success();
7307}
7308
7309std::pair<unsigned, unsigned> ShLIOp::getODSOperandIndexAndLength(unsigned index) {
7310 return {index, 1};
7311}
7312
7313::mlir::Operation::operand_range ShLIOp::getODSOperands(unsigned index) {
7314 auto valueRange = getODSOperandIndexAndLength(index);
7315 return {std::next(getOperation()->operand_begin(), valueRange.first),
7316 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
7317}
7318
7319::mlir::Value ShLIOp::getLhs() {
7320 return *getODSOperands(0).begin();
7321}
7322
7323::mlir::Value ShLIOp::getRhs() {
7324 return *getODSOperands(1).begin();
7325}
7326
7327::mlir::MutableOperandRange ShLIOp::getLhsMutable() {
7328 auto range = getODSOperandIndexAndLength(0);
7329 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7330 return mutableRange;
7331}
7332
7333::mlir::MutableOperandRange ShLIOp::getRhsMutable() {
7334 auto range = getODSOperandIndexAndLength(1);
7335 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7336 return mutableRange;
7337}
7338
7339std::pair<unsigned, unsigned> ShLIOp::getODSResultIndexAndLength(unsigned index) {
7340 return {index, 1};
7341}
7342
7343::mlir::Operation::result_range ShLIOp::getODSResults(unsigned index) {
7344 auto valueRange = getODSResultIndexAndLength(index);
7345 return {std::next(getOperation()->result_begin(), valueRange.first),
7346 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
7347}
7348
7349::mlir::Value ShLIOp::getResult() {
7350 return *getODSResults(0).begin();
7351}
7352
7353void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
7354 odsState.addOperands(lhs);
7355 odsState.addOperands(rhs);
7356 odsState.addTypes(result);
7357}
7358
7359void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
7360 odsState.addOperands(lhs);
7361 odsState.addOperands(rhs);
7362 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7362, __extension__ __PRETTY_FUNCTION__))
;
7363 odsState.addTypes(resultTypes);
7364}
7365
7366void ShLIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7367 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7367, __extension__ __PRETTY_FUNCTION__))
;
7368 odsState.addOperands(operands);
7369 odsState.addAttributes(attributes);
7370 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7370, __extension__ __PRETTY_FUNCTION__))
;
7371 odsState.addTypes(resultTypes);
7372}
7373
7374void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
7375 odsState.addOperands(lhs);
7376 odsState.addOperands(rhs);
7377 odsState.addTypes({lhs.getType()});
7378
7379}
7380
7381void ShLIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7382 odsState.addOperands(operands);
7383 odsState.addAttributes(attributes);
7384 odsState.addTypes({operands[0].getType()});
7385
7386}
7387
7388::mlir::LogicalResult ShLIOp::verifyInvariantsImpl() {
7389 {
7390 unsigned index = 0; (void)index;
7391 auto valueGroup0 = getODSOperands(0);
7392
7393 for (auto v : valueGroup0) {
7394 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7395 return ::mlir::failure();
7396 }
7397 auto valueGroup1 = getODSOperands(1);
7398
7399 for (auto v : valueGroup1) {
7400 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7401 return ::mlir::failure();
7402 }
7403 }
7404 {
7405 unsigned index = 0; (void)index;
7406 auto valueGroup0 = getODSResults(0);
7407
7408 for (auto v : valueGroup0) {
7409 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
7410 return ::mlir::failure();
7411 }
7412 }
7413 return ::mlir::success();
7414}
7415
7416::mlir::LogicalResult ShLIOp::verifyInvariants() {
7417 return verifyInvariantsImpl();
7418}
7419
7420::mlir::ParseResult ShLIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
7421 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
7422 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
7423 (void)lhsOperandsLoc;
7424 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
7425 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
7426 (void)rhsOperandsLoc;
7427 ::mlir::Type resultRawTypes[1];
7428 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
7429
7430 lhsOperandsLoc = parser.getCurrentLocation();
7431 if (parser.parseOperand(lhsRawOperands[0]))
7432 return ::mlir::failure();
7433 if (parser.parseComma())
7434 return ::mlir::failure();
7435
7436 rhsOperandsLoc = parser.getCurrentLocation();
7437 if (parser.parseOperand(rhsRawOperands[0]))
7438 return ::mlir::failure();
7439 if (parser.parseOptionalAttrDict(result.attributes))
7440 return ::mlir::failure();
7441 if (parser.parseColon())
7442 return ::mlir::failure();
7443
7444 {
7445 ::mlir::Type type;
7446 if (parser.parseCustomTypeWithFallback(type))
7447 return ::mlir::failure();
7448 resultRawTypes[0] = type;
7449 }
7450 result.addTypes(resultTypes);
7451 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
7452 return ::mlir::failure();
7453 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
7454 return ::mlir::failure();
7455 return ::mlir::success();
7456}
7457
7458void ShLIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
7459 _odsPrinter << ' ';
7460 _odsPrinter << getLhs();
7461 _odsPrinter << ",";
7462 _odsPrinter << ' ';
7463 _odsPrinter << getRhs();
7464 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
7465 _odsPrinter << ' ' << ":";
7466 _odsPrinter << ' ';
7467 {
7468 auto type = getResult().getType();
7469 if (auto validType = type.dyn_cast<::mlir::Type>())
7470 _odsPrinter.printStrippedAttrOrType(validType);
7471 else
7472 _odsPrinter << type;
7473 }
7474}
7475
7476void ShLIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
7477}
7478
7479} // namespace arith
7480} // namespace mlir
7481MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShLIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ShLIOp>::id = {}; } }
7482
7483namespace mlir {
7484namespace arith {
7485
7486//===----------------------------------------------------------------------===//
7487// ::mlir::arith::ShRSIOp definitions
7488//===----------------------------------------------------------------------===//
7489
7490ShRSIOpAdaptor::ShRSIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
7491 odsOpName.emplace("arith.shrsi", odsAttrs.getContext());
7492}
7493
7494ShRSIOpAdaptor::ShRSIOpAdaptor(ShRSIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
7495
7496::mlir::ValueRange ShRSIOpAdaptor::getOperands() {
7497 return odsOperands;
7498}
7499
7500std::pair<unsigned, unsigned> ShRSIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
7501 return {index, 1};
7502}
7503
7504::mlir::ValueRange ShRSIOpAdaptor::getODSOperands(unsigned index) {
7505 auto valueRange = getODSOperandIndexAndLength(index);
7506 return {std::next(odsOperands.begin(), valueRange.first),
7507 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7508}
7509
7510::mlir::Value ShRSIOpAdaptor::getLhs() {
7511 return *getODSOperands(0).begin();
7512}
7513
7514::mlir::Value ShRSIOpAdaptor::getRhs() {
7515 return *getODSOperands(1).begin();
7516}
7517
7518::mlir::DictionaryAttr ShRSIOpAdaptor::getAttributes() {
7519 return odsAttrs;
7520}
7521
7522::mlir::LogicalResult ShRSIOpAdaptor::verify(::mlir::Location loc) {
7523 return ::mlir::success();
7524}
7525
7526std::pair<unsigned, unsigned> ShRSIOp::getODSOperandIndexAndLength(unsigned index) {
7527 return {index, 1};
7528}
7529
7530::mlir::Operation::operand_range ShRSIOp::getODSOperands(unsigned index) {
7531 auto valueRange = getODSOperandIndexAndLength(index);
7532 return {std::next(getOperation()->operand_begin(), valueRange.first),
7533 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
7534}
7535
7536::mlir::Value ShRSIOp::getLhs() {
7537 return *getODSOperands(0).begin();
7538}
7539
7540::mlir::Value ShRSIOp::getRhs() {
7541 return *getODSOperands(1).begin();
7542}
7543
7544::mlir::MutableOperandRange ShRSIOp::getLhsMutable() {
7545 auto range = getODSOperandIndexAndLength(0);
7546 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7547 return mutableRange;
7548}
7549
7550::mlir::MutableOperandRange ShRSIOp::getRhsMutable() {
7551 auto range = getODSOperandIndexAndLength(1);
7552 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7553 return mutableRange;
7554}
7555
7556std::pair<unsigned, unsigned> ShRSIOp::getODSResultIndexAndLength(unsigned index) {
7557 return {index, 1};
7558}
7559
7560::mlir::Operation::result_range ShRSIOp::getODSResults(unsigned index) {
7561 auto valueRange = getODSResultIndexAndLength(index);
7562 return {std::next(getOperation()->result_begin(), valueRange.first),
7563 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
7564}
7565
7566::mlir::Value ShRSIOp::getResult() {
7567 return *getODSResults(0).begin();
7568}
7569
7570void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
7571 odsState.addOperands(lhs);
7572 odsState.addOperands(rhs);
7573 odsState.addTypes(result);
7574}
7575
7576void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
7577 odsState.addOperands(lhs);
7578 odsState.addOperands(rhs);
7579 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7579, __extension__ __PRETTY_FUNCTION__))
;
7580 odsState.addTypes(resultTypes);
7581}
7582
7583void ShRSIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7584 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7584, __extension__ __PRETTY_FUNCTION__))
;
7585 odsState.addOperands(operands);
7586 odsState.addAttributes(attributes);
7587 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7587, __extension__ __PRETTY_FUNCTION__))
;
7588 odsState.addTypes(resultTypes);
7589}
7590
7591void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
7592 odsState.addOperands(lhs);
7593 odsState.addOperands(rhs);
7594 odsState.addTypes({lhs.getType()});
7595
7596}
7597
7598void ShRSIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7599 odsState.addOperands(operands);
7600 odsState.addAttributes(attributes);
7601 odsState.addTypes({operands[0].getType()});
7602
7603}
7604
7605::mlir::LogicalResult ShRSIOp::verifyInvariantsImpl() {
7606 {
7607 unsigned index = 0; (void)index;
7608 auto valueGroup0 = getODSOperands(0);
7609
7610 for (auto v : valueGroup0) {
7611 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7612 return ::mlir::failure();
7613 }
7614 auto valueGroup1 = getODSOperands(1);
7615
7616 for (auto v : valueGroup1) {
7617 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7618 return ::mlir::failure();
7619 }
7620 }
7621 {
7622 unsigned index = 0; (void)index;
7623 auto valueGroup0 = getODSResults(0);
7624
7625 for (auto v : valueGroup0) {
7626 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
7627 return ::mlir::failure();
7628 }
7629 }
7630 return ::mlir::success();
7631}
7632
7633::mlir::LogicalResult ShRSIOp::verifyInvariants() {
7634 return verifyInvariantsImpl();
7635}
7636
7637::mlir::ParseResult ShRSIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
7638 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
7639 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
7640 (void)lhsOperandsLoc;
7641 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
7642 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
7643 (void)rhsOperandsLoc;
7644 ::mlir::Type resultRawTypes[1];
7645 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
7646
7647 lhsOperandsLoc = parser.getCurrentLocation();
7648 if (parser.parseOperand(lhsRawOperands[0]))
7649 return ::mlir::failure();
7650 if (parser.parseComma())
7651 return ::mlir::failure();
7652
7653 rhsOperandsLoc = parser.getCurrentLocation();
7654 if (parser.parseOperand(rhsRawOperands[0]))
7655 return ::mlir::failure();
7656 if (parser.parseOptionalAttrDict(result.attributes))
7657 return ::mlir::failure();
7658 if (parser.parseColon())
7659 return ::mlir::failure();
7660
7661 {
7662 ::mlir::Type type;
7663 if (parser.parseCustomTypeWithFallback(type))
7664 return ::mlir::failure();
7665 resultRawTypes[0] = type;
7666 }
7667 result.addTypes(resultTypes);
7668 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
7669 return ::mlir::failure();
7670 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
7671 return ::mlir::failure();
7672 return ::mlir::success();
7673}
7674
7675void ShRSIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
7676 _odsPrinter << ' ';
7677 _odsPrinter << getLhs();
7678 _odsPrinter << ",";
7679 _odsPrinter << ' ';
7680 _odsPrinter << getRhs();
7681 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
7682 _odsPrinter << ' ' << ":";
7683 _odsPrinter << ' ';
7684 {
7685 auto type = getResult().getType();
7686 if (auto validType = type.dyn_cast<::mlir::Type>())
7687 _odsPrinter.printStrippedAttrOrType(validType);
7688 else
7689 _odsPrinter << type;
7690 }
7691}
7692
7693void ShRSIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
7694}
7695
7696} // namespace arith
7697} // namespace mlir
7698MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShRSIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ShRSIOp>::id = {}; } }
7699
7700namespace mlir {
7701namespace arith {
7702
7703//===----------------------------------------------------------------------===//
7704// ::mlir::arith::ShRUIOp definitions
7705//===----------------------------------------------------------------------===//
7706
7707ShRUIOpAdaptor::ShRUIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
7708 odsOpName.emplace("arith.shrui", odsAttrs.getContext());
7709}
7710
7711ShRUIOpAdaptor::ShRUIOpAdaptor(ShRUIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
7712
7713::mlir::ValueRange ShRUIOpAdaptor::getOperands() {
7714 return odsOperands;
7715}
7716
7717std::pair<unsigned, unsigned> ShRUIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
7718 return {index, 1};
7719}
7720
7721::mlir::ValueRange ShRUIOpAdaptor::getODSOperands(unsigned index) {
7722 auto valueRange = getODSOperandIndexAndLength(index);
7723 return {std::next(odsOperands.begin(), valueRange.first),
7724 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7725}
7726
7727::mlir::Value ShRUIOpAdaptor::getLhs() {
7728 return *getODSOperands(0).begin();
7729}
7730
7731::mlir::Value ShRUIOpAdaptor::getRhs() {
7732 return *getODSOperands(1).begin();
7733}
7734
7735::mlir::DictionaryAttr ShRUIOpAdaptor::getAttributes() {
7736 return odsAttrs;
7737}
7738
7739::mlir::LogicalResult ShRUIOpAdaptor::verify(::mlir::Location loc) {
7740 return ::mlir::success();
7741}
7742
7743std::pair<unsigned, unsigned> ShRUIOp::getODSOperandIndexAndLength(unsigned index) {
7744 return {index, 1};
7745}
7746
7747::mlir::Operation::operand_range ShRUIOp::getODSOperands(unsigned index) {
7748 auto valueRange = getODSOperandIndexAndLength(index);
7749 return {std::next(getOperation()->operand_begin(), valueRange.first),
7750 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
7751}
7752
7753::mlir::Value ShRUIOp::getLhs() {
7754 return *getODSOperands(0).begin();
7755}
7756
7757::mlir::Value ShRUIOp::getRhs() {
7758 return *getODSOperands(1).begin();
7759}
7760
7761::mlir::MutableOperandRange ShRUIOp::getLhsMutable() {
7762 auto range = getODSOperandIndexAndLength(0);
7763 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7764 return mutableRange;
7765}
7766
7767::mlir::MutableOperandRange ShRUIOp::getRhsMutable() {
7768 auto range = getODSOperandIndexAndLength(1);
7769 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7770 return mutableRange;
7771}
7772
7773std::pair<unsigned, unsigned> ShRUIOp::getODSResultIndexAndLength(unsigned index) {
7774 return {index, 1};
7775}
7776
7777::mlir::Operation::result_range ShRUIOp::getODSResults(unsigned index) {
7778 auto valueRange = getODSResultIndexAndLength(index);
7779 return {std::next(getOperation()->result_begin(), valueRange.first),
7780 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
7781}
7782
7783::mlir::Value ShRUIOp::getResult() {
7784 return *getODSResults(0).begin();
7785}
7786
7787void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
7788 odsState.addOperands(lhs);
7789 odsState.addOperands(rhs);
7790 odsState.addTypes(result);
7791}
7792
7793void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
7794 odsState.addOperands(lhs);
7795 odsState.addOperands(rhs);
7796 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7796, __extension__ __PRETTY_FUNCTION__))
;
7797 odsState.addTypes(resultTypes);
7798}
7799
7800void ShRUIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7801 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7801, __extension__ __PRETTY_FUNCTION__))
;
7802 odsState.addOperands(operands);
7803 odsState.addAttributes(attributes);
7804 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 7804, __extension__ __PRETTY_FUNCTION__))
;
7805 odsState.addTypes(resultTypes);
7806}
7807
7808void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
7809 odsState.addOperands(lhs);
7810 odsState.addOperands(rhs);
7811 odsState.addTypes({lhs.getType()});
7812
7813}
7814
7815void ShRUIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
7816 odsState.addOperands(operands);
7817 odsState.addAttributes(attributes);
7818 odsState.addTypes({operands[0].getType()});
7819
7820}
7821
7822::mlir::LogicalResult ShRUIOp::verifyInvariantsImpl() {
7823 {
7824 unsigned index = 0; (void)index;
7825 auto valueGroup0 = getODSOperands(0);
7826
7827 for (auto v : valueGroup0) {
7828 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7829 return ::mlir::failure();
7830 }
7831 auto valueGroup1 = getODSOperands(1);
7832
7833 for (auto v : valueGroup1) {
7834 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
7835 return ::mlir::failure();
7836 }
7837 }
7838 {
7839 unsigned index = 0; (void)index;
7840 auto valueGroup0 = getODSResults(0);
7841
7842 for (auto v : valueGroup0) {
7843 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
7844 return ::mlir::failure();
7845 }
7846 }
7847 return ::mlir::success();
7848}
7849
7850::mlir::LogicalResult ShRUIOp::verifyInvariants() {
7851 return verifyInvariantsImpl();
7852}
7853
7854::mlir::ParseResult ShRUIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
7855 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
7856 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
7857 (void)lhsOperandsLoc;
7858 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
7859 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
7860 (void)rhsOperandsLoc;
7861 ::mlir::Type resultRawTypes[1];
7862 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
7863
7864 lhsOperandsLoc = parser.getCurrentLocation();
7865 if (parser.parseOperand(lhsRawOperands[0]))
7866 return ::mlir::failure();
7867 if (parser.parseComma())
7868 return ::mlir::failure();
7869
7870 rhsOperandsLoc = parser.getCurrentLocation();
7871 if (parser.parseOperand(rhsRawOperands[0]))
7872 return ::mlir::failure();
7873 if (parser.parseOptionalAttrDict(result.attributes))
7874 return ::mlir::failure();
7875 if (parser.parseColon())
7876 return ::mlir::failure();
7877
7878 {
7879 ::mlir::Type type;
7880 if (parser.parseCustomTypeWithFallback(type))
7881 return ::mlir::failure();
7882 resultRawTypes[0] = type;
7883 }
7884 result.addTypes(resultTypes);
7885 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
7886 return ::mlir::failure();
7887 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
7888 return ::mlir::failure();
7889 return ::mlir::success();
7890}
7891
7892void ShRUIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
7893 _odsPrinter << ' ';
7894 _odsPrinter << getLhs();
7895 _odsPrinter << ",";
7896 _odsPrinter << ' ';
7897 _odsPrinter << getRhs();
7898 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
7899 _odsPrinter << ' ' << ":";
7900 _odsPrinter << ' ';
7901 {
7902 auto type = getResult().getType();
7903 if (auto validType = type.dyn_cast<::mlir::Type>())
7904 _odsPrinter.printStrippedAttrOrType(validType);
7905 else
7906 _odsPrinter << type;
7907 }
7908}
7909
7910void ShRUIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
7911}
7912
7913} // namespace arith
7914} // namespace mlir
7915MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::ShRUIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::ShRUIOp>::id = {}; } }
7916
7917namespace mlir {
7918namespace arith {
7919
7920//===----------------------------------------------------------------------===//
7921// ::mlir::arith::SubFOp definitions
7922//===----------------------------------------------------------------------===//
7923
7924SubFOpAdaptor::SubFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
7925 odsOpName.emplace("arith.subf", odsAttrs.getContext());
7926}
7927
7928SubFOpAdaptor::SubFOpAdaptor(SubFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
7929
7930::mlir::ValueRange SubFOpAdaptor::getOperands() {
7931 return odsOperands;
7932}
7933
7934std::pair<unsigned, unsigned> SubFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
7935 return {index, 1};
7936}
7937
7938::mlir::ValueRange SubFOpAdaptor::getODSOperands(unsigned index) {
7939 auto valueRange = getODSOperandIndexAndLength(index);
7940 return {std::next(odsOperands.begin(), valueRange.first),
7941 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
7942}
7943
7944::mlir::Value SubFOpAdaptor::getLhs() {
7945 return *getODSOperands(0).begin();
7946}
7947
7948::mlir::Value SubFOpAdaptor::getRhs() {
7949 return *getODSOperands(1).begin();
7950}
7951
7952::mlir::DictionaryAttr SubFOpAdaptor::getAttributes() {
7953 return odsAttrs;
7954}
7955
7956::mlir::LogicalResult SubFOpAdaptor::verify(::mlir::Location loc) {
7957 return ::mlir::success();
7958}
7959
7960std::pair<unsigned, unsigned> SubFOp::getODSOperandIndexAndLength(unsigned index) {
7961 return {index, 1};
7962}
7963
7964::mlir::Operation::operand_range SubFOp::getODSOperands(unsigned index) {
7965 auto valueRange = getODSOperandIndexAndLength(index);
7966 return {std::next(getOperation()->operand_begin(), valueRange.first),
7967 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
7968}
7969
7970::mlir::Value SubFOp::getLhs() {
7971 return *getODSOperands(0).begin();
7972}
7973
7974::mlir::Value SubFOp::getRhs() {
7975 return *getODSOperands(1).begin();
7976}
7977
7978::mlir::MutableOperandRange SubFOp::getLhsMutable() {
7979 auto range = getODSOperandIndexAndLength(0);
7980 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7981 return mutableRange;
7982}
7983
7984::mlir::MutableOperandRange SubFOp::getRhsMutable() {
7985 auto range = getODSOperandIndexAndLength(1);
7986 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
7987 return mutableRange;
7988}
7989
7990std::pair<unsigned, unsigned> SubFOp::getODSResultIndexAndLength(unsigned index) {
7991 return {index, 1};
7992}
7993
7994::mlir::Operation::result_range SubFOp::getODSResults(unsigned index) {
7995 auto valueRange = getODSResultIndexAndLength(index);
7996 return {std::next(getOperation()->result_begin(), valueRange.first),
7997 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
7998}
7999
8000::mlir::Value SubFOp::getResult() {
8001 return *getODSResults(0).begin();
8002}
8003
8004void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
8005 odsState.addOperands(lhs);
8006 odsState.addOperands(rhs);
8007 odsState.addTypes(result);
8008}
8009
8010void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
8011 odsState.addOperands(lhs);
8012 odsState.addOperands(rhs);
8013 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8013, __extension__ __PRETTY_FUNCTION__))
;
8014 odsState.addTypes(resultTypes);
8015}
8016
8017void SubFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8018 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8018, __extension__ __PRETTY_FUNCTION__))
;
8019 odsState.addOperands(operands);
8020 odsState.addAttributes(attributes);
8021 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8021, __extension__ __PRETTY_FUNCTION__))
;
8022 odsState.addTypes(resultTypes);
8023}
8024
8025void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
8026 odsState.addOperands(lhs);
8027 odsState.addOperands(rhs);
8028 odsState.addTypes({lhs.getType()});
8029
8030}
8031
8032void SubFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8033 odsState.addOperands(operands);
8034 odsState.addAttributes(attributes);
8035 odsState.addTypes({operands[0].getType()});
8036
8037}
8038
8039::mlir::LogicalResult SubFOp::verifyInvariantsImpl() {
8040 {
8041 unsigned index = 0; (void)index;
8042 auto valueGroup0 = getODSOperands(0);
8043
8044 for (auto v : valueGroup0) {
8045 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
8046 return ::mlir::failure();
8047 }
8048 auto valueGroup1 = getODSOperands(1);
8049
8050 for (auto v : valueGroup1) {
8051 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
8052 return ::mlir::failure();
8053 }
8054 }
8055 {
8056 unsigned index = 0; (void)index;
8057 auto valueGroup0 = getODSResults(0);
8058
8059 for (auto v : valueGroup0) {
8060 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
8061 return ::mlir::failure();
8062 }
8063 }
8064 return ::mlir::success();
8065}
8066
8067::mlir::LogicalResult SubFOp::verifyInvariants() {
8068 return verifyInvariantsImpl();
8069}
8070
8071::mlir::ParseResult SubFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
8072 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
8073 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
8074 (void)lhsOperandsLoc;
8075 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
8076 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
8077 (void)rhsOperandsLoc;
8078 ::mlir::Type resultRawTypes[1];
8079 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
8080
8081 lhsOperandsLoc = parser.getCurrentLocation();
8082 if (parser.parseOperand(lhsRawOperands[0]))
8083 return ::mlir::failure();
8084 if (parser.parseComma())
8085 return ::mlir::failure();
8086
8087 rhsOperandsLoc = parser.getCurrentLocation();
8088 if (parser.parseOperand(rhsRawOperands[0]))
8089 return ::mlir::failure();
8090 if (parser.parseOptionalAttrDict(result.attributes))
8091 return ::mlir::failure();
8092 if (parser.parseColon())
8093 return ::mlir::failure();
8094
8095 {
8096 ::mlir::Type type;
8097 if (parser.parseCustomTypeWithFallback(type))
8098 return ::mlir::failure();
8099 resultRawTypes[0] = type;
8100 }
8101 result.addTypes(resultTypes);
8102 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
8103 return ::mlir::failure();
8104 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
8105 return ::mlir::failure();
8106 return ::mlir::success();
8107}
8108
8109void SubFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
8110 _odsPrinter << ' ';
8111 _odsPrinter << getLhs();
8112 _odsPrinter << ",";
8113 _odsPrinter << ' ';
8114 _odsPrinter << getRhs();
8115 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
8116 _odsPrinter << ' ' << ":";
8117 _odsPrinter << ' ';
8118 {
8119 auto type = getResult().getType();
8120 if (auto validType = type.dyn_cast<::mlir::Type>())
8121 _odsPrinter.printStrippedAttrOrType(validType);
8122 else
8123 _odsPrinter << type;
8124 }
8125}
8126
8127void SubFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
8128}
8129
8130} // namespace arith
8131} // namespace mlir
8132MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SubFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::SubFOp>::id = {}; } }
8133
8134namespace mlir {
8135namespace arith {
8136
8137//===----------------------------------------------------------------------===//
8138// ::mlir::arith::SubIOp definitions
8139//===----------------------------------------------------------------------===//
8140
8141SubIOpAdaptor::SubIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
8142 odsOpName.emplace("arith.subi", odsAttrs.getContext());
8143}
8144
8145SubIOpAdaptor::SubIOpAdaptor(SubIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
8146
8147::mlir::ValueRange SubIOpAdaptor::getOperands() {
8148 return odsOperands;
8149}
8150
8151std::pair<unsigned, unsigned> SubIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
8152 return {index, 1};
8153}
8154
8155::mlir::ValueRange SubIOpAdaptor::getODSOperands(unsigned index) {
8156 auto valueRange = getODSOperandIndexAndLength(index);
8157 return {std::next(odsOperands.begin(), valueRange.first),
8158 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8159}
8160
8161::mlir::Value SubIOpAdaptor::getLhs() {
8162 return *getODSOperands(0).begin();
8163}
8164
8165::mlir::Value SubIOpAdaptor::getRhs() {
8166 return *getODSOperands(1).begin();
8167}
8168
8169::mlir::DictionaryAttr SubIOpAdaptor::getAttributes() {
8170 return odsAttrs;
8171}
8172
8173::mlir::LogicalResult SubIOpAdaptor::verify(::mlir::Location loc) {
8174 return ::mlir::success();
8175}
8176
8177std::pair<unsigned, unsigned> SubIOp::getODSOperandIndexAndLength(unsigned index) {
8178 return {index, 1};
8179}
8180
8181::mlir::Operation::operand_range SubIOp::getODSOperands(unsigned index) {
8182 auto valueRange = getODSOperandIndexAndLength(index);
8183 return {std::next(getOperation()->operand_begin(), valueRange.first),
8184 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
8185}
8186
8187::mlir::Value SubIOp::getLhs() {
8188 return *getODSOperands(0).begin();
8189}
8190
8191::mlir::Value SubIOp::getRhs() {
8192 return *getODSOperands(1).begin();
8193}
8194
8195::mlir::MutableOperandRange SubIOp::getLhsMutable() {
8196 auto range = getODSOperandIndexAndLength(0);
8197 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8198 return mutableRange;
8199}
8200
8201::mlir::MutableOperandRange SubIOp::getRhsMutable() {
8202 auto range = getODSOperandIndexAndLength(1);
8203 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8204 return mutableRange;
8205}
8206
8207std::pair<unsigned, unsigned> SubIOp::getODSResultIndexAndLength(unsigned index) {
8208 return {index, 1};
8209}
8210
8211::mlir::Operation::result_range SubIOp::getODSResults(unsigned index) {
8212 auto valueRange = getODSResultIndexAndLength(index);
8213 return {std::next(getOperation()->result_begin(), valueRange.first),
8214 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
8215}
8216
8217::mlir::Value SubIOp::getResult() {
8218 return *getODSResults(0).begin();
8219}
8220
8221void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
8222 odsState.addOperands(lhs);
8223 odsState.addOperands(rhs);
8224 odsState.addTypes(result);
8225}
8226
8227void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
8228 odsState.addOperands(lhs);
8229 odsState.addOperands(rhs);
8230 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8230, __extension__ __PRETTY_FUNCTION__))
;
8231 odsState.addTypes(resultTypes);
8232}
8233
8234void SubIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8235 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8235, __extension__ __PRETTY_FUNCTION__))
;
8236 odsState.addOperands(operands);
8237 odsState.addAttributes(attributes);
8238 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8238, __extension__ __PRETTY_FUNCTION__))
;
8239 odsState.addTypes(resultTypes);
8240}
8241
8242void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
8243 odsState.addOperands(lhs);
8244 odsState.addOperands(rhs);
8245 odsState.addTypes({lhs.getType()});
8246
8247}
8248
8249void SubIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8250 odsState.addOperands(operands);
8251 odsState.addAttributes(attributes);
8252 odsState.addTypes({operands[0].getType()});
8253
8254}
8255
8256::mlir::LogicalResult SubIOp::verifyInvariantsImpl() {
8257 {
8258 unsigned index = 0; (void)index;
8259 auto valueGroup0 = getODSOperands(0);
8260
8261 for (auto v : valueGroup0) {
8262 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
8263 return ::mlir::failure();
8264 }
8265 auto valueGroup1 = getODSOperands(1);
8266
8267 for (auto v : valueGroup1) {
8268 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
8269 return ::mlir::failure();
8270 }
8271 }
8272 {
8273 unsigned index = 0; (void)index;
8274 auto valueGroup0 = getODSResults(0);
8275
8276 for (auto v : valueGroup0) {
8277 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
8278 return ::mlir::failure();
8279 }
8280 }
8281 return ::mlir::success();
8282}
8283
8284::mlir::LogicalResult SubIOp::verifyInvariants() {
8285 return verifyInvariantsImpl();
8286}
8287
8288::mlir::ParseResult SubIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
8289 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
8290 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
8291 (void)lhsOperandsLoc;
8292 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
8293 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
8294 (void)rhsOperandsLoc;
8295 ::mlir::Type resultRawTypes[1];
8296 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
8297
8298 lhsOperandsLoc = parser.getCurrentLocation();
8299 if (parser.parseOperand(lhsRawOperands[0]))
8300 return ::mlir::failure();
8301 if (parser.parseComma())
8302 return ::mlir::failure();
8303
8304 rhsOperandsLoc = parser.getCurrentLocation();
8305 if (parser.parseOperand(rhsRawOperands[0]))
8306 return ::mlir::failure();
8307 if (parser.parseOptionalAttrDict(result.attributes))
8308 return ::mlir::failure();
8309 if (parser.parseColon())
8310 return ::mlir::failure();
8311
8312 {
8313 ::mlir::Type type;
8314 if (parser.parseCustomTypeWithFallback(type))
8315 return ::mlir::failure();
8316 resultRawTypes[0] = type;
8317 }
8318 result.addTypes(resultTypes);
8319 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
8320 return ::mlir::failure();
8321 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
8322 return ::mlir::failure();
8323 return ::mlir::success();
8324}
8325
8326void SubIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
8327 _odsPrinter << ' ';
8328 _odsPrinter << getLhs();
8329 _odsPrinter << ",";
8330 _odsPrinter << ' ';
8331 _odsPrinter << getRhs();
8332 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
8333 _odsPrinter << ' ' << ":";
8334 _odsPrinter << ' ';
8335 {
8336 auto type = getResult().getType();
8337 if (auto validType = type.dyn_cast<::mlir::Type>())
8338 _odsPrinter.printStrippedAttrOrType(validType);
8339 else
8340 _odsPrinter << type;
8341 }
8342}
8343
8344void SubIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
8345}
8346
8347} // namespace arith
8348} // namespace mlir
8349MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SubIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::SubIOp>::id = {}; } }
8350
8351namespace mlir {
8352namespace arith {
8353
8354//===----------------------------------------------------------------------===//
8355// ::mlir::arith::TruncFOp definitions
8356//===----------------------------------------------------------------------===//
8357
8358TruncFOpAdaptor::TruncFOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
8359 odsOpName.emplace("arith.truncf", odsAttrs.getContext());
8360}
8361
8362TruncFOpAdaptor::TruncFOpAdaptor(TruncFOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
8363
8364::mlir::ValueRange TruncFOpAdaptor::getOperands() {
8365 return odsOperands;
8366}
8367
8368std::pair<unsigned, unsigned> TruncFOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
8369 return {index, 1};
8370}
8371
8372::mlir::ValueRange TruncFOpAdaptor::getODSOperands(unsigned index) {
8373 auto valueRange = getODSOperandIndexAndLength(index);
8374 return {std::next(odsOperands.begin(), valueRange.first),
8375 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8376}
8377
8378::mlir::Value TruncFOpAdaptor::getIn() {
8379 return *getODSOperands(0).begin();
8380}
8381
8382::mlir::DictionaryAttr TruncFOpAdaptor::getAttributes() {
8383 return odsAttrs;
8384}
8385
8386::mlir::LogicalResult TruncFOpAdaptor::verify(::mlir::Location loc) {
8387 return ::mlir::success();
8388}
8389
8390std::pair<unsigned, unsigned> TruncFOp::getODSOperandIndexAndLength(unsigned index) {
8391 return {index, 1};
8392}
8393
8394::mlir::Operation::operand_range TruncFOp::getODSOperands(unsigned index) {
8395 auto valueRange = getODSOperandIndexAndLength(index);
8396 return {std::next(getOperation()->operand_begin(), valueRange.first),
8397 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
8398}
8399
8400::mlir::Value TruncFOp::getIn() {
8401 return *getODSOperands(0).begin();
8402}
8403
8404::mlir::MutableOperandRange TruncFOp::getInMutable() {
8405 auto range = getODSOperandIndexAndLength(0);
8406 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8407 return mutableRange;
8408}
8409
8410std::pair<unsigned, unsigned> TruncFOp::getODSResultIndexAndLength(unsigned index) {
8411 return {index, 1};
8412}
8413
8414::mlir::Operation::result_range TruncFOp::getODSResults(unsigned index) {
8415 auto valueRange = getODSResultIndexAndLength(index);
8416 return {std::next(getOperation()->result_begin(), valueRange.first),
8417 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
8418}
8419
8420::mlir::Value TruncFOp::getOut() {
8421 return *getODSResults(0).begin();
8422}
8423
8424void TruncFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
8425 odsState.addOperands(in);
8426 odsState.addTypes(out);
8427}
8428
8429void TruncFOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
8430 odsState.addOperands(in);
8431 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8431, __extension__ __PRETTY_FUNCTION__))
;
8432 odsState.addTypes(resultTypes);
8433}
8434
8435void TruncFOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8436 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8436, __extension__ __PRETTY_FUNCTION__))
;
8437 odsState.addOperands(operands);
8438 odsState.addAttributes(attributes);
8439 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8439, __extension__ __PRETTY_FUNCTION__))
;
8440 odsState.addTypes(resultTypes);
8441}
8442
8443::mlir::LogicalResult TruncFOp::verifyInvariantsImpl() {
8444 {
8445 unsigned index = 0; (void)index;
8446 auto valueGroup0 = getODSOperands(0);
8447
8448 for (auto v : valueGroup0) {
8449 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "operand", index++)))
8450 return ::mlir::failure();
8451 }
8452 }
8453 {
8454 unsigned index = 0; (void)index;
8455 auto valueGroup0 = getODSResults(0);
8456
8457 for (auto v : valueGroup0) {
8458 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
8459 return ::mlir::failure();
8460 }
8461 }
8462 return ::mlir::success();
8463}
8464
8465::mlir::LogicalResult TruncFOp::verifyInvariants() {
8466 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
8467 return ::mlir::success();
8468 return ::mlir::failure();
8469}
8470
8471::mlir::ParseResult TruncFOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
8472 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
8473 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
8474 (void)inOperandsLoc;
8475 ::mlir::Type inRawTypes[1];
8476 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
8477 ::mlir::Type outRawTypes[1];
8478 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
8479
8480 inOperandsLoc = parser.getCurrentLocation();
8481 if (parser.parseOperand(inRawOperands[0]))
8482 return ::mlir::failure();
8483 if (parser.parseOptionalAttrDict(result.attributes))
8484 return ::mlir::failure();
8485 if (parser.parseColon())
8486 return ::mlir::failure();
8487
8488 {
8489 ::mlir::Type type;
8490 if (parser.parseCustomTypeWithFallback(type))
8491 return ::mlir::failure();
8492 inRawTypes[0] = type;
8493 }
8494 if (parser.parseKeyword("to"))
8495 return ::mlir::failure();
8496
8497 {
8498 ::mlir::Type type;
8499 if (parser.parseCustomTypeWithFallback(type))
8500 return ::mlir::failure();
8501 outRawTypes[0] = type;
8502 }
8503 result.addTypes(outTypes);
8504 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
8505 return ::mlir::failure();
8506 return ::mlir::success();
8507}
8508
8509void TruncFOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
8510 _odsPrinter << ' ';
8511 _odsPrinter << getIn();
8512 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
8513 _odsPrinter << ' ' << ":";
8514 _odsPrinter << ' ';
8515 {
8516 auto type = getIn().getType();
8517 if (auto validType = type.dyn_cast<::mlir::Type>())
8518 _odsPrinter.printStrippedAttrOrType(validType);
8519 else
8520 _odsPrinter << type;
8521 }
8522 _odsPrinter << ' ' << "to";
8523 _odsPrinter << ' ';
8524 {
8525 auto type = getOut().getType();
8526 if (auto validType = type.dyn_cast<::mlir::Type>())
8527 _odsPrinter.printStrippedAttrOrType(validType);
8528 else
8529 _odsPrinter << type;
8530 }
8531}
8532
8533void TruncFOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
8534}
8535
8536} // namespace arith
8537} // namespace mlir
8538MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::TruncFOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::TruncFOp>::id = {}; } }
8539
8540namespace mlir {
8541namespace arith {
8542
8543//===----------------------------------------------------------------------===//
8544// ::mlir::arith::TruncIOp definitions
8545//===----------------------------------------------------------------------===//
8546
8547TruncIOpAdaptor::TruncIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
8548 odsOpName.emplace("arith.trunci", odsAttrs.getContext());
8549}
8550
8551TruncIOpAdaptor::TruncIOpAdaptor(TruncIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
8552
8553::mlir::ValueRange TruncIOpAdaptor::getOperands() {
8554 return odsOperands;
8555}
8556
8557std::pair<unsigned, unsigned> TruncIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
8558 return {index, 1};
8559}
8560
8561::mlir::ValueRange TruncIOpAdaptor::getODSOperands(unsigned index) {
8562 auto valueRange = getODSOperandIndexAndLength(index);
8563 return {std::next(odsOperands.begin(), valueRange.first),
8564 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8565}
8566
8567::mlir::Value TruncIOpAdaptor::getIn() {
8568 return *getODSOperands(0).begin();
8569}
8570
8571::mlir::DictionaryAttr TruncIOpAdaptor::getAttributes() {
8572 return odsAttrs;
8573}
8574
8575::mlir::LogicalResult TruncIOpAdaptor::verify(::mlir::Location loc) {
8576 return ::mlir::success();
8577}
8578
8579std::pair<unsigned, unsigned> TruncIOp::getODSOperandIndexAndLength(unsigned index) {
8580 return {index, 1};
8581}
8582
8583::mlir::Operation::operand_range TruncIOp::getODSOperands(unsigned index) {
8584 auto valueRange = getODSOperandIndexAndLength(index);
8585 return {std::next(getOperation()->operand_begin(), valueRange.first),
8586 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
8587}
8588
8589::mlir::Value TruncIOp::getIn() {
8590 return *getODSOperands(0).begin();
8591}
8592
8593::mlir::MutableOperandRange TruncIOp::getInMutable() {
8594 auto range = getODSOperandIndexAndLength(0);
8595 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8596 return mutableRange;
8597}
8598
8599std::pair<unsigned, unsigned> TruncIOp::getODSResultIndexAndLength(unsigned index) {
8600 return {index, 1};
8601}
8602
8603::mlir::Operation::result_range TruncIOp::getODSResults(unsigned index) {
8604 auto valueRange = getODSResultIndexAndLength(index);
8605 return {std::next(getOperation()->result_begin(), valueRange.first),
8606 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
8607}
8608
8609::mlir::Value TruncIOp::getOut() {
8610 return *getODSResults(0).begin();
8611}
8612
8613void TruncIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
8614 odsState.addOperands(in);
8615 odsState.addTypes(out);
8616}
8617
8618void TruncIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
8619 odsState.addOperands(in);
8620 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8620, __extension__ __PRETTY_FUNCTION__))
;
8621 odsState.addTypes(resultTypes);
8622}
8623
8624void TruncIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8625 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8625, __extension__ __PRETTY_FUNCTION__))
;
8626 odsState.addOperands(operands);
8627 odsState.addAttributes(attributes);
8628 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8628, __extension__ __PRETTY_FUNCTION__))
;
8629 odsState.addTypes(resultTypes);
8630}
8631
8632::mlir::LogicalResult TruncIOp::verifyInvariantsImpl() {
8633 {
8634 unsigned index = 0; (void)index;
8635 auto valueGroup0 = getODSOperands(0);
8636
8637 for (auto v : valueGroup0) {
8638 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "operand", index++)))
8639 return ::mlir::failure();
8640 }
8641 }
8642 {
8643 unsigned index = 0; (void)index;
8644 auto valueGroup0 = getODSResults(0);
8645
8646 for (auto v : valueGroup0) {
8647 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "result", index++)))
8648 return ::mlir::failure();
8649 }
8650 }
8651 return ::mlir::success();
8652}
8653
8654::mlir::LogicalResult TruncIOp::verifyInvariants() {
8655 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
8656 return ::mlir::success();
8657 return ::mlir::failure();
8658}
8659
8660::mlir::ParseResult TruncIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
8661 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
8662 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
8663 (void)inOperandsLoc;
8664 ::mlir::Type inRawTypes[1];
8665 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
8666 ::mlir::Type outRawTypes[1];
8667 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
8668
8669 inOperandsLoc = parser.getCurrentLocation();
8670 if (parser.parseOperand(inRawOperands[0]))
8671 return ::mlir::failure();
8672 if (parser.parseOptionalAttrDict(result.attributes))
8673 return ::mlir::failure();
8674 if (parser.parseColon())
8675 return ::mlir::failure();
8676
8677 {
8678 ::mlir::Type type;
8679 if (parser.parseCustomTypeWithFallback(type))
8680 return ::mlir::failure();
8681 inRawTypes[0] = type;
8682 }
8683 if (parser.parseKeyword("to"))
8684 return ::mlir::failure();
8685
8686 {
8687 ::mlir::Type type;
8688 if (parser.parseCustomTypeWithFallback(type))
8689 return ::mlir::failure();
8690 outRawTypes[0] = type;
8691 }
8692 result.addTypes(outTypes);
8693 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
8694 return ::mlir::failure();
8695 return ::mlir::success();
8696}
8697
8698void TruncIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
8699 _odsPrinter << ' ';
8700 _odsPrinter << getIn();
8701 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
8702 _odsPrinter << ' ' << ":";
8703 _odsPrinter << ' ';
8704 {
8705 auto type = getIn().getType();
8706 if (auto validType = type.dyn_cast<::mlir::Type>())
8707 _odsPrinter.printStrippedAttrOrType(validType);
8708 else
8709 _odsPrinter << type;
8710 }
8711 _odsPrinter << ' ' << "to";
8712 _odsPrinter << ' ';
8713 {
8714 auto type = getOut().getType();
8715 if (auto validType = type.dyn_cast<::mlir::Type>())
8716 _odsPrinter.printStrippedAttrOrType(validType);
8717 else
8718 _odsPrinter << type;
8719 }
8720}
8721
8722void TruncIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
8723}
8724
8725} // namespace arith
8726} // namespace mlir
8727MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::TruncIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::TruncIOp>::id = {}; } }
8728
8729namespace mlir {
8730namespace arith {
8731
8732//===----------------------------------------------------------------------===//
8733// ::mlir::arith::UIToFPOp definitions
8734//===----------------------------------------------------------------------===//
8735
8736UIToFPOpAdaptor::UIToFPOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
8737 odsOpName.emplace("arith.uitofp", odsAttrs.getContext());
8738}
8739
8740UIToFPOpAdaptor::UIToFPOpAdaptor(UIToFPOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
8741
8742::mlir::ValueRange UIToFPOpAdaptor::getOperands() {
8743 return odsOperands;
8744}
8745
8746std::pair<unsigned, unsigned> UIToFPOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
8747 return {index, 1};
8748}
8749
8750::mlir::ValueRange UIToFPOpAdaptor::getODSOperands(unsigned index) {
8751 auto valueRange = getODSOperandIndexAndLength(index);
8752 return {std::next(odsOperands.begin(), valueRange.first),
8753 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8754}
8755
8756::mlir::Value UIToFPOpAdaptor::getIn() {
8757 return *getODSOperands(0).begin();
8758}
8759
8760::mlir::DictionaryAttr UIToFPOpAdaptor::getAttributes() {
8761 return odsAttrs;
8762}
8763
8764::mlir::LogicalResult UIToFPOpAdaptor::verify(::mlir::Location loc) {
8765 return ::mlir::success();
8766}
8767
8768std::pair<unsigned, unsigned> UIToFPOp::getODSOperandIndexAndLength(unsigned index) {
8769 return {index, 1};
8770}
8771
8772::mlir::Operation::operand_range UIToFPOp::getODSOperands(unsigned index) {
8773 auto valueRange = getODSOperandIndexAndLength(index);
8774 return {std::next(getOperation()->operand_begin(), valueRange.first),
8775 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
8776}
8777
8778::mlir::Value UIToFPOp::getIn() {
8779 return *getODSOperands(0).begin();
8780}
8781
8782::mlir::MutableOperandRange UIToFPOp::getInMutable() {
8783 auto range = getODSOperandIndexAndLength(0);
8784 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8785 return mutableRange;
8786}
8787
8788std::pair<unsigned, unsigned> UIToFPOp::getODSResultIndexAndLength(unsigned index) {
8789 return {index, 1};
8790}
8791
8792::mlir::Operation::result_range UIToFPOp::getODSResults(unsigned index) {
8793 auto valueRange = getODSResultIndexAndLength(index);
8794 return {std::next(getOperation()->result_begin(), valueRange.first),
8795 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
8796}
8797
8798::mlir::Value UIToFPOp::getOut() {
8799 return *getODSResults(0).begin();
8800}
8801
8802void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value in) {
8803 odsState.addOperands(in);
8804 odsState.addTypes(out);
8805}
8806
8807void UIToFPOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value in) {
8808 odsState.addOperands(in);
8809 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8809, __extension__ __PRETTY_FUNCTION__))
;
8810 odsState.addTypes(resultTypes);
8811}
8812
8813void UIToFPOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
8814 assert(operands.size() == 1u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 1u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 1u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8814, __extension__ __PRETTY_FUNCTION__))
;
8815 odsState.addOperands(operands);
8816 odsState.addAttributes(attributes);
8817 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 8817, __extension__ __PRETTY_FUNCTION__))
;
8818 odsState.addTypes(resultTypes);
8819}
8820
8821::mlir::LogicalResult UIToFPOp::verifyInvariantsImpl() {
8822 {
8823 unsigned index = 0; (void)index;
8824 auto valueGroup0 = getODSOperands(0);
8825
8826 for (auto v : valueGroup0) {
8827 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps7(*this, v.getType(), "operand", index++)))
8828 return ::mlir::failure();
8829 }
8830 }
8831 {
8832 unsigned index = 0; (void)index;
8833 auto valueGroup0 = getODSResults(0);
8834
8835 for (auto v : valueGroup0) {
8836 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps0(*this, v.getType(), "result", index++)))
8837 return ::mlir::failure();
8838 }
8839 }
8840 return ::mlir::success();
8841}
8842
8843::mlir::LogicalResult UIToFPOp::verifyInvariants() {
8844 return verifyInvariantsImpl();
8845}
8846
8847::mlir::ParseResult UIToFPOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
8848 ::mlir::OpAsmParser::UnresolvedOperand inRawOperands[1];
8849 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inOperands(inRawOperands); ::llvm::SMLoc inOperandsLoc;
8850 (void)inOperandsLoc;
8851 ::mlir::Type inRawTypes[1];
8852 ::llvm::ArrayRef<::mlir::Type> inTypes(inRawTypes);
8853 ::mlir::Type outRawTypes[1];
8854 ::llvm::ArrayRef<::mlir::Type> outTypes(outRawTypes);
8855
8856 inOperandsLoc = parser.getCurrentLocation();
8857 if (parser.parseOperand(inRawOperands[0]))
8858 return ::mlir::failure();
8859 if (parser.parseOptionalAttrDict(result.attributes))
8860 return ::mlir::failure();
8861 if (parser.parseColon())
8862 return ::mlir::failure();
8863
8864 {
8865 ::mlir::Type type;
8866 if (parser.parseCustomTypeWithFallback(type))
8867 return ::mlir::failure();
8868 inRawTypes[0] = type;
8869 }
8870 if (parser.parseKeyword("to"))
8871 return ::mlir::failure();
8872
8873 {
8874 ::mlir::Type type;
8875 if (parser.parseCustomTypeWithFallback(type))
8876 return ::mlir::failure();
8877 outRawTypes[0] = type;
8878 }
8879 result.addTypes(outTypes);
8880 if (parser.resolveOperands(inOperands, inTypes, inOperandsLoc, result.operands))
8881 return ::mlir::failure();
8882 return ::mlir::success();
8883}
8884
8885void UIToFPOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
8886 _odsPrinter << ' ';
8887 _odsPrinter << getIn();
8888 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
8889 _odsPrinter << ' ' << ":";
8890 _odsPrinter << ' ';
8891 {
8892 auto type = getIn().getType();
8893 if (auto validType = type.dyn_cast<::mlir::Type>())
8894 _odsPrinter.printStrippedAttrOrType(validType);
8895 else
8896 _odsPrinter << type;
8897 }
8898 _odsPrinter << ' ' << "to";
8899 _odsPrinter << ' ';
8900 {
8901 auto type = getOut().getType();
8902 if (auto validType = type.dyn_cast<::mlir::Type>())
8903 _odsPrinter.printStrippedAttrOrType(validType);
8904 else
8905 _odsPrinter << type;
8906 }
8907}
8908
8909void UIToFPOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
8910}
8911
8912} // namespace arith
8913} // namespace mlir
8914MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::UIToFPOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::UIToFPOp>::id = {}; } }
8915
8916namespace mlir {
8917namespace arith {
8918
8919//===----------------------------------------------------------------------===//
8920// ::mlir::arith::XOrIOp definitions
8921//===----------------------------------------------------------------------===//
8922
8923XOrIOpAdaptor::XOrIOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
8924 odsOpName.emplace("arith.xori", odsAttrs.getContext());
8925}
8926
8927XOrIOpAdaptor::XOrIOpAdaptor(XOrIOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
8928
8929::mlir::ValueRange XOrIOpAdaptor::getOperands() {
8930 return odsOperands;
8931}
8932
8933std::pair<unsigned, unsigned> XOrIOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
8934 return {index, 1};
8935}
8936
8937::mlir::ValueRange XOrIOpAdaptor::getODSOperands(unsigned index) {
8938 auto valueRange = getODSOperandIndexAndLength(index);
8939 return {std::next(odsOperands.begin(), valueRange.first),
8940 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
8941}
8942
8943::mlir::Value XOrIOpAdaptor::getLhs() {
8944 return *getODSOperands(0).begin();
8945}
8946
8947::mlir::Value XOrIOpAdaptor::getRhs() {
8948 return *getODSOperands(1).begin();
8949}
8950
8951::mlir::DictionaryAttr XOrIOpAdaptor::getAttributes() {
8952 return odsAttrs;
8953}
8954
8955::mlir::LogicalResult XOrIOpAdaptor::verify(::mlir::Location loc) {
8956 return ::mlir::success();
8957}
8958
8959std::pair<unsigned, unsigned> XOrIOp::getODSOperandIndexAndLength(unsigned index) {
8960 return {index, 1};
8961}
8962
8963::mlir::Operation::operand_range XOrIOp::getODSOperands(unsigned index) {
8964 auto valueRange = getODSOperandIndexAndLength(index);
8965 return {std::next(getOperation()->operand_begin(), valueRange.first),
8966 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
8967}
8968
8969::mlir::Value XOrIOp::getLhs() {
8970 return *getODSOperands(0).begin();
8971}
8972
8973::mlir::Value XOrIOp::getRhs() {
8974 return *getODSOperands(1).begin();
8975}
8976
8977::mlir::MutableOperandRange XOrIOp::getLhsMutable() {
8978 auto range = getODSOperandIndexAndLength(0);
8979 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8980 return mutableRange;
8981}
8982
8983::mlir::MutableOperandRange XOrIOp::getRhsMutable() {
8984 auto range = getODSOperandIndexAndLength(1);
8985 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
8986 return mutableRange;
8987}
8988
8989std::pair<unsigned, unsigned> XOrIOp::getODSResultIndexAndLength(unsigned index) {
8990 return {index, 1};
8991}
8992
8993::mlir::Operation::result_range XOrIOp::getODSResults(unsigned index) {
8994 auto valueRange = getODSResultIndexAndLength(index);
8995 return {std::next(getOperation()->result_begin(), valueRange.first),
8996 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
8997}
8998
8999::mlir::Value XOrIOp::getResult() {
9000 return *getODSResults(0).begin();
9001}
9002
9003void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
9004 odsState.addOperands(lhs);
9005 odsState.addOperands(rhs);
9006 odsState.addTypes(result);
9007}
9008
9009void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
9010 odsState.addOperands(lhs);
9011 odsState.addOperands(rhs);
9012 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9012, __extension__ __PRETTY_FUNCTION__))
;
9013 odsState.addTypes(resultTypes);
9014}
9015
9016void XOrIOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
9017 assert(operands.size() == 2u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 2u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 2u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9017, __extension__ __PRETTY_FUNCTION__))
;
9018 odsState.addOperands(operands);
9019 odsState.addAttributes(attributes);
9020 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9020, __extension__ __PRETTY_FUNCTION__))
;
9021 odsState.addTypes(resultTypes);
9022}
9023
9024void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
9025 odsState.addOperands(lhs);
9026 odsState.addOperands(rhs);
9027 odsState.addTypes({lhs.getType()});
9028
9029}
9030
9031void XOrIOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
9032 odsState.addOperands(operands);
9033 odsState.addAttributes(attributes);
9034 odsState.addTypes({operands[0].getType()});
9035
9036}
9037
9038::mlir::LogicalResult XOrIOp::verifyInvariantsImpl() {
9039 {
9040 unsigned index = 0; (void)index;
9041 auto valueGroup0 = getODSOperands(0);
9042
9043 for (auto v : valueGroup0) {
9044 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
9045 return ::mlir::failure();
9046 }
9047 auto valueGroup1 = getODSOperands(1);
9048
9049 for (auto v : valueGroup1) {
9050 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "operand", index++)))
9051 return ::mlir::failure();
9052 }
9053 }
9054 {
9055 unsigned index = 0; (void)index;
9056 auto valueGroup0 = getODSResults(0);
9057
9058 for (auto v : valueGroup0) {
9059 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps1(*this, v.getType(), "result", index++)))
9060 return ::mlir::failure();
9061 }
9062 }
9063 return ::mlir::success();
9064}
9065
9066::mlir::LogicalResult XOrIOp::verifyInvariants() {
9067 return verifyInvariantsImpl();
9068}
9069
9070::mlir::ParseResult XOrIOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
9071 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
9072 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
9073 (void)lhsOperandsLoc;
9074 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
9075 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
9076 (void)rhsOperandsLoc;
9077 ::mlir::Type resultRawTypes[1];
9078 ::llvm::ArrayRef<::mlir::Type> resultTypes(resultRawTypes);
9079
9080 lhsOperandsLoc = parser.getCurrentLocation();
9081 if (parser.parseOperand(lhsRawOperands[0]))
9082 return ::mlir::failure();
9083 if (parser.parseComma())
9084 return ::mlir::failure();
9085
9086 rhsOperandsLoc = parser.getCurrentLocation();
9087 if (parser.parseOperand(rhsRawOperands[0]))
9088 return ::mlir::failure();
9089 if (parser.parseOptionalAttrDict(result.attributes))
9090 return ::mlir::failure();
9091 if (parser.parseColon())
9092 return ::mlir::failure();
9093
9094 {
9095 ::mlir::Type type;
9096 if (parser.parseCustomTypeWithFallback(type))
9097 return ::mlir::failure();
9098 resultRawTypes[0] = type;
9099 }
9100 result.addTypes(resultTypes);
9101 if (parser.resolveOperands(lhsOperands, resultTypes[0], result.operands))
9102 return ::mlir::failure();
9103 if (parser.resolveOperands(rhsOperands, resultTypes[0], result.operands))
9104 return ::mlir::failure();
9105 return ::mlir::success();
9106}
9107
9108void XOrIOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
9109 _odsPrinter << ' ';
9110 _odsPrinter << getLhs();
9111 _odsPrinter << ",";
9112 _odsPrinter << ' ';
9113 _odsPrinter << getRhs();
9114 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), /*elidedAttrs=*/{});
9115 _odsPrinter << ' ' << ":";
9116 _odsPrinter << ' ';
9117 {
9118 auto type = getResult().getType();
9119 if (auto validType = type.dyn_cast<::mlir::Type>())
9120 _odsPrinter.printStrippedAttrOrType(validType);
9121 else
9122 _odsPrinter << type;
9123 }
9124}
9125
9126void XOrIOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
9127}
9128
9129} // namespace arith
9130} // namespace mlir
9131MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::XOrIOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::XOrIOp>::id = {}; } }
9132
9133namespace mlir {
9134namespace arith {
9135
9136//===----------------------------------------------------------------------===//
9137// ::mlir::arith::SelectOp definitions
9138//===----------------------------------------------------------------------===//
9139
9140SelectOpAdaptor::SelectOpAdaptor(::mlir::ValueRange values, ::mlir::DictionaryAttr attrs, ::mlir::RegionRange regions) : odsOperands(values), odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
9141 odsOpName.emplace("arith.select", odsAttrs.getContext());
9142}
9143
9144SelectOpAdaptor::SelectOpAdaptor(SelectOp op) : odsOperands(op->getOperands()), odsAttrs(op->getAttrDictionary()), odsRegions(op->getRegions()), odsOpName(op->getName()) {}
9145
9146::mlir::ValueRange SelectOpAdaptor::getOperands() {
9147 return odsOperands;
9148}
9149
9150std::pair<unsigned, unsigned> SelectOpAdaptor::getODSOperandIndexAndLength(unsigned index) {
9151 return {index, 1};
9152}
9153
9154::mlir::ValueRange SelectOpAdaptor::getODSOperands(unsigned index) {
9155 auto valueRange = getODSOperandIndexAndLength(index);
9156 return {std::next(odsOperands.begin(), valueRange.first),
9157 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
9158}
9159
9160::mlir::Value SelectOpAdaptor::getCondition() {
9161 return *getODSOperands(0).begin();
9162}
9163
9164::mlir::Value SelectOpAdaptor::getTrueValue() {
9165 return *getODSOperands(1).begin();
9166}
9167
9168::mlir::Value SelectOpAdaptor::getFalseValue() {
9169 return *getODSOperands(2).begin();
9170}
9171
9172::mlir::DictionaryAttr SelectOpAdaptor::getAttributes() {
9173 return odsAttrs;
9174}
9175
9176::mlir::LogicalResult SelectOpAdaptor::verify(::mlir::Location loc) {
9177 return ::mlir::success();
9178}
9179
9180std::pair<unsigned, unsigned> SelectOp::getODSOperandIndexAndLength(unsigned index) {
9181 return {index, 1};
9182}
9183
9184::mlir::Operation::operand_range SelectOp::getODSOperands(unsigned index) {
9185 auto valueRange = getODSOperandIndexAndLength(index);
9186 return {std::next(getOperation()->operand_begin(), valueRange.first),
9187 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
9188}
9189
9190::mlir::Value SelectOp::getCondition() {
9191 return *getODSOperands(0).begin();
9192}
9193
9194::mlir::Value SelectOp::getTrueValue() {
9195 return *getODSOperands(1).begin();
9196}
9197
9198::mlir::Value SelectOp::getFalseValue() {
9199 return *getODSOperands(2).begin();
9200}
9201
9202::mlir::MutableOperandRange SelectOp::getConditionMutable() {
9203 auto range = getODSOperandIndexAndLength(0);
9204 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
9205 return mutableRange;
9206}
9207
9208::mlir::MutableOperandRange SelectOp::getTrueValueMutable() {
9209 auto range = getODSOperandIndexAndLength(1);
9210 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
9211 return mutableRange;
9212}
9213
9214::mlir::MutableOperandRange SelectOp::getFalseValueMutable() {
9215 auto range = getODSOperandIndexAndLength(2);
9216 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
9217 return mutableRange;
9218}
9219
9220std::pair<unsigned, unsigned> SelectOp::getODSResultIndexAndLength(unsigned index) {
9221 return {index, 1};
9222}
9223
9224::mlir::Operation::result_range SelectOp::getODSResults(unsigned index) {
9225 auto valueRange = getODSResultIndexAndLength(index);
9226 return {std::next(getOperation()->result_begin(), valueRange.first),
9227 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
9228}
9229
9230::mlir::Value SelectOp::getResult() {
9231 return *getODSResults(0).begin();
9232}
9233
9234void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
9235 odsState.addOperands(condition);
9236 odsState.addOperands(true_value);
9237 odsState.addOperands(false_value);
9238 odsState.addTypes(result);
9239}
9240
9241void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
9242 odsState.addOperands(condition);
9243 odsState.addOperands(true_value);
9244 odsState.addOperands(false_value);
9245
9246 ::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
9247 if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
9248 odsState.location, odsState.operands,
9249 odsState.attributes.getDictionary(odsState.getContext()),
9250 /*regions=*/{}, inferredReturnTypes)))
9251 odsState.addTypes(inferredReturnTypes);
9252 else
9253 ::llvm::report_fatal_error("Failed to infer result type(s).");
9254}
9255
9256void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
9257 odsState.addOperands(condition);
9258 odsState.addOperands(true_value);
9259 odsState.addOperands(false_value);
9260 assert(resultTypes.size() == 1u && "mismatched number of results")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of results") ? void (0) : __assert_fail (
"resultTypes.size() == 1u && \"mismatched number of results\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9260, __extension__ __PRETTY_FUNCTION__))
;
9261 odsState.addTypes(resultTypes);
9262}
9263
9264void SelectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
9265 assert(operands.size() == 3u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 3u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 3u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9265, __extension__ __PRETTY_FUNCTION__))
;
9266 odsState.addOperands(operands);
9267 odsState.addAttributes(attributes);
9268 assert(resultTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (resultTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("resultTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9268, __extension__ __PRETTY_FUNCTION__))
;
9269 odsState.addTypes(resultTypes);
9270}
9271
9272void SelectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
9273 assert(operands.size() == 3u && "mismatched number of parameters")(static_cast <bool> (operands.size() == 3u && "mismatched number of parameters"
) ? void (0) : __assert_fail ("operands.size() == 3u && \"mismatched number of parameters\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9273, __extension__ __PRETTY_FUNCTION__))
;
9274 odsState.addOperands(operands);
9275 odsState.addAttributes(attributes);
9276
9277 ::mlir::SmallVector<::mlir::Type, 2> inferredReturnTypes;
9278 if (::mlir::succeeded(SelectOp::inferReturnTypes(odsBuilder.getContext(),
9279 odsState.location, operands,
9280 odsState.attributes.getDictionary(odsState.getContext()),
9281 odsState.regions, inferredReturnTypes))) {
9282 assert(inferredReturnTypes.size() == 1u && "mismatched number of return types")(static_cast <bool> (inferredReturnTypes.size() == 1u &&
"mismatched number of return types") ? void (0) : __assert_fail
("inferredReturnTypes.size() == 1u && \"mismatched number of return types\""
, "tools/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticOps.cpp.inc"
, 9282, __extension__ __PRETTY_FUNCTION__))
;
9283 odsState.addTypes(inferredReturnTypes);
9284 } else {
9285 ::llvm::report_fatal_error("Failed to infer result type(s).");
9286 }
9287}
9288
9289::mlir::LogicalResult SelectOp::verifyInvariantsImpl() {
9290 {
9291 unsigned index = 0; (void)index;
9292 auto valueGroup0 = getODSOperands(0);
9293
9294 for (auto v : valueGroup0) {
9295 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps3(*this, v.getType(), "operand", index++)))
9296 return ::mlir::failure();
9297 }
9298 auto valueGroup1 = getODSOperands(1);
9299
9300 for (auto v : valueGroup1) {
9301 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps6(*this, v.getType(), "operand", index++)))
9302 return ::mlir::failure();
9303 }
9304 auto valueGroup2 = getODSOperands(2);
9305
9306 for (auto v : valueGroup2) {
9307 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps6(*this, v.getType(), "operand", index++)))
9308 return ::mlir::failure();
9309 }
9310 }
9311 {
9312 unsigned index = 0; (void)index;
9313 auto valueGroup0 = getODSResults(0);
9314
9315 for (auto v : valueGroup0) {
9316 if (::mlir::failed(__mlir_ods_local_type_constraint_ArithmeticOps6(*this, v.getType(), "result", index++)))
9317 return ::mlir::failure();
9318 }
9319 }
9320 if (!((::llvm::is_splat(::llvm::makeArrayRef({(*this->getODSOperands(1).begin()).getType(), (*this->getODSOperands(2).begin()).getType(), (*this->getODSResults(0).begin()).getType()})))))
9321 return emitOpError("failed to verify that all of {true_value, false_value, result} have same type");
9322 return ::mlir::success();
9323}
9324
9325::mlir::LogicalResult SelectOp::verifyInvariants() {
9326 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
9327 return ::mlir::success();
9328 return ::mlir::failure();
9329}
9330
9331::mlir::LogicalResult SelectOp::inferReturnTypes(::mlir::MLIRContext *context, ::llvm::Optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
9332 inferredReturnTypes.resize(1);
9333 ::mlir::Builder odsBuilder(context);
9334 inferredReturnTypes[0] = operands[2].getType();
9335 return ::mlir::success();
9336}
9337
9338void SelectOp::getEffects(::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
9339}
9340
9341} // namespace arith
9342} // namespace mlir
9343MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::arith::SelectOp)namespace mlir { namespace detail { SelfOwningTypeID TypeIDResolver
< ::mlir::arith::SelectOp>::id = {}; } }
9344
9345
9346#endif // GET_OP_CLASSES
9347

/build/llvm-toolchain-snapshot-15~++20220420111733+e13d2efed663/mlir/include/mlir/IR/Attributes.h

1//===- Attributes.h - MLIR Attribute Classes --------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_IR_ATTRIBUTES_H
10#define MLIR_IR_ATTRIBUTES_H
11
12#include "mlir/IR/AttributeSupport.h"
13#include "llvm/Support/PointerLikeTypeTraits.h"
14
15namespace mlir {
16class StringAttr;
17
18/// Attributes are known-constant values of operations.
19///
20/// Instances of the Attribute class are references to immortal key-value pairs
21/// with immutable, uniqued keys owned by MLIRContext. As such, an Attribute is
22/// a thin wrapper around an underlying storage pointer. Attributes are usually
23/// passed by value.
24class Attribute {
25public:
26 /// Utility class for implementing attributes.
27 template <typename ConcreteType, typename BaseType, typename StorageType,
28 template <typename T> class... Traits>
29 using AttrBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType,
30 detail::AttributeUniquer, Traits...>;
31
32 using ImplType = AttributeStorage;
33 using ValueType = void;
34 using AbstractTy = AbstractAttribute;
35
36 constexpr Attribute() {}
37 /* implicit */ Attribute(const ImplType *impl)
38 : impl(const_cast<ImplType *>(impl)) {}
39
40 Attribute(const Attribute &other) = default;
41 Attribute &operator=(const Attribute &other) = default;
42
43 bool operator==(Attribute other) const { return impl == other.impl; }
44 bool operator!=(Attribute other) const { return !(*this == other); }
45 explicit operator bool() const { return impl; }
46
47 bool operator!() const { return impl == nullptr; }
48
49 template <typename U> bool isa() const;
50 template <typename First, typename Second, typename... Rest>
51 bool isa() const;
52 template <typename First, typename... Rest>
53 bool isa_and_nonnull() const;
54 template <typename U> U dyn_cast() const;
55 template <typename U> U dyn_cast_or_null() const;
56 template <typename U> U cast() const;
57
58 // Support dyn_cast'ing Attribute to itself.
59 static bool classof(Attribute) { return true; }
60
61 /// Return a unique identifier for the concrete attribute type. This is used
62 /// to support dynamic type casting.
63 TypeID getTypeID() { return impl->getAbstractAttribute().getTypeID(); }
64
65 /// Return the type of this attribute.
66 Type getType() const { return impl->getType(); }
5
Called C++ object pointer is null
67
68 /// Return the context this attribute belongs to.
69 MLIRContext *getContext() const;
70
71 /// Get the dialect this attribute is registered to.
72 Dialect &getDialect() const {
73 return impl->getAbstractAttribute().getDialect();
74 }
75
76 /// Print the attribute.
77 void print(raw_ostream &os) const;
78 void dump() const;
79
80 /// Get an opaque pointer to the attribute.
81 const void *getAsOpaquePointer() const { return impl; }
82 /// Construct an attribute from the opaque pointer representation.
83 static Attribute getFromOpaquePointer(const void *ptr) {
84 return Attribute(reinterpret_cast<const ImplType *>(ptr));
85 }
86
87 friend ::llvm::hash_code hash_value(Attribute arg);
88
89 /// Returns true if the type was registered with a particular trait.
90 template <template <typename T> class Trait>
91 bool hasTrait() {
92 return getAbstractAttribute().hasTrait<Trait>();
93 }
94
95 /// Return the abstract descriptor for this attribute.
96 const AbstractTy &getAbstractAttribute() const {
97 return impl->getAbstractAttribute();
98 }
99
100protected:
101 ImplType *impl{nullptr};
102};
103
104inline raw_ostream &operator<<(raw_ostream &os, Attribute attr) {
105 attr.print(os);
106 return os;
107}
108
109template <typename U> bool Attribute::isa() const {
110 assert(impl && "isa<> used on a null attribute.")(static_cast <bool> (impl && "isa<> used on a null attribute."
) ? void (0) : __assert_fail ("impl && \"isa<> used on a null attribute.\""
, "mlir/include/mlir/IR/Attributes.h", 110, __extension__ __PRETTY_FUNCTION__
))
;
111 return U::classof(*this);
112}
113
114template <typename First, typename Second, typename... Rest>
115bool Attribute::isa() const {
116 return isa<First>() || isa<Second, Rest...>();
117}
118
119template <typename First, typename... Rest>
120bool Attribute::isa_and_nonnull() const {
121 return impl && isa<First, Rest...>();
122}
123
124template <typename U> U Attribute::dyn_cast() const {
125 return isa<U>() ? U(impl) : U(nullptr);
126}
127template <typename U> U Attribute::dyn_cast_or_null() const {
128 return (impl && isa<U>()) ? U(impl) : U(nullptr);
129}
130template <typename U> U Attribute::cast() const {
131 assert(isa<U>())(static_cast <bool> (isa<U>()) ? void (0) : __assert_fail
("isa<U>()", "mlir/include/mlir/IR/Attributes.h", 131,
__extension__ __PRETTY_FUNCTION__))
;
132 return U(impl);
133}
134
135inline ::llvm::hash_code hash_value(Attribute arg) {
136 return DenseMapInfo<const Attribute::ImplType *>::getHashValue(arg.impl);
137}
138
139//===----------------------------------------------------------------------===//
140// NamedAttribute
141//===----------------------------------------------------------------------===//
142
143/// NamedAttribute represents a combination of a name and an Attribute value.
144class NamedAttribute {
145public:
146 NamedAttribute(StringAttr name, Attribute value);
147
148 /// Return the name of the attribute.
149 StringAttr getName() const;
150
151 /// Return the dialect of the name of this attribute, if the name is prefixed
152 /// by a dialect namespace. For example, `llvm.fast_math` would return the
153 /// LLVM dialect (if it is loaded). Returns nullptr if the dialect isn't
154 /// loaded, or if the name is not prefixed by a dialect namespace.
155 Dialect *getNameDialect() const;
156
157 /// Return the value of the attribute.
158 Attribute getValue() const { return value; }
159
160 /// Set the name of this attribute.
161 void setName(StringAttr newName);
162
163 /// Set the value of this attribute.
164 void setValue(Attribute newValue) {
165 assert(value && "expected valid attribute value")(static_cast <bool> (value && "expected valid attribute value"
) ? void (0) : __assert_fail ("value && \"expected valid attribute value\""
, "mlir/include/mlir/IR/Attributes.h", 165, __extension__ __PRETTY_FUNCTION__
))
;
166 value = newValue;
167 }
168
169 /// Compare this attribute to the provided attribute, ordering by name.
170 bool operator<(const NamedAttribute &rhs) const;
171 /// Compare this attribute to the provided string, ordering by name.
172 bool operator<(StringRef rhs) const;
173
174 bool operator==(const NamedAttribute &rhs) const {
175 return name == rhs.name && value == rhs.value;
176 }
177 bool operator!=(const NamedAttribute &rhs) const { return !(*this == rhs); }
178
179private:
180 NamedAttribute(Attribute name, Attribute value) : name(name), value(value) {}
181
182 /// Allow access to internals to enable hashing.
183 friend ::llvm::hash_code hash_value(const NamedAttribute &arg);
184 friend DenseMapInfo<NamedAttribute>;
185
186 /// The name of the attribute. This is represented as a StringAttr, but
187 /// type-erased to Attribute in the field.
188 Attribute name;
189 /// The value of the attribute.
190 Attribute value;
191};
192
193inline ::llvm::hash_code hash_value(const NamedAttribute &arg) {
194 using AttrPairT = std::pair<Attribute, Attribute>;
195 return DenseMapInfo<AttrPairT>::getHashValue(AttrPairT(arg.name, arg.value));
196}
197
198//===----------------------------------------------------------------------===//
199// AttributeTraitBase
200//===----------------------------------------------------------------------===//
201
202namespace AttributeTrait {
203/// This class represents the base of an attribute trait.
204template <typename ConcreteType, template <typename> class TraitType>
205using TraitBase = detail::StorageUserTraitBase<ConcreteType, TraitType>;
206} // namespace AttributeTrait
207
208//===----------------------------------------------------------------------===//
209// AttributeInterface
210//===----------------------------------------------------------------------===//
211
212/// This class represents the base of an attribute interface. See the definition
213/// of `detail::Interface` for requirements on the `Traits` type.
214template <typename ConcreteType, typename Traits>
215class AttributeInterface
216 : public detail::Interface<ConcreteType, Attribute, Traits, Attribute,
217 AttributeTrait::TraitBase> {
218public:
219 using Base = AttributeInterface<ConcreteType, Traits>;
220 using InterfaceBase = detail::Interface<ConcreteType, Attribute, Traits,
221 Attribute, AttributeTrait::TraitBase>;
222 using InterfaceBase::InterfaceBase;
223
224private:
225 /// Returns the impl interface instance for the given type.
226 static typename InterfaceBase::Concept *getInterfaceFor(Attribute attr) {
227 return attr.getAbstractAttribute().getInterface<ConcreteType>();
228 }
229
230 /// Allow access to 'getInterfaceFor'.
231 friend InterfaceBase;
232};
233
234} // namespace mlir.
235
236namespace llvm {
237
238// Attribute hash just like pointers.
239template <> struct DenseMapInfo<mlir::Attribute> {
240 static mlir::Attribute getEmptyKey() {
241 auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
242 return mlir::Attribute(static_cast<mlir::Attribute::ImplType *>(pointer));
243 }
244 static mlir::Attribute getTombstoneKey() {
245 auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
246 return mlir::Attribute(static_cast<mlir::Attribute::ImplType *>(pointer));
247 }
248 static unsigned getHashValue(mlir::Attribute val) {
249 return mlir::hash_value(val);
250 }
251 static bool isEqual(mlir::Attribute LHS, mlir::Attribute RHS) {
252 return LHS == RHS;
253 }
254};
255template <typename T>
256struct DenseMapInfo<
257 T, std::enable_if_t<std::is_base_of<mlir::Attribute, T>::value>>
258 : public DenseMapInfo<mlir::Attribute> {
259 static T getEmptyKey() {
260 const void *pointer = llvm::DenseMapInfo<const void *>::getEmptyKey();
261 return T::getFromOpaquePointer(pointer);
262 }
263 static T getTombstoneKey() {
264 const void *pointer = llvm::DenseMapInfo<const void *>::getTombstoneKey();
265 return T::getFromOpaquePointer(pointer);
266 }
267};
268
269/// Allow LLVM to steal the low bits of Attributes.
270template <> struct PointerLikeTypeTraits<mlir::Attribute> {
271 static inline void *getAsVoidPointer(mlir::Attribute attr) {
272 return const_cast<void *>(attr.getAsOpaquePointer());
273 }
274 static inline mlir::Attribute getFromVoidPointer(void *ptr) {
275 return mlir::Attribute::getFromOpaquePointer(ptr);
276 }
277 static constexpr int NumLowBitsAvailable = llvm::PointerLikeTypeTraits<
278 mlir::AttributeStorage *>::NumLowBitsAvailable;
279};
280
281template <> struct DenseMapInfo<mlir::NamedAttribute> {
282 static mlir::NamedAttribute getEmptyKey() {
283 auto emptyAttr = llvm::DenseMapInfo<mlir::Attribute>::getEmptyKey();
284 return mlir::NamedAttribute(emptyAttr, emptyAttr);
285 }
286 static mlir::NamedAttribute getTombstoneKey() {
287 auto tombAttr = llvm::DenseMapInfo<mlir::Attribute>::getTombstoneKey();
288 return mlir::NamedAttribute(tombAttr, tombAttr);
289 }
290 static unsigned getHashValue(mlir::NamedAttribute val) {
291 return mlir::hash_value(val);
292 }
293 static bool isEqual(mlir::NamedAttribute lhs, mlir::NamedAttribute rhs) {
294 return lhs == rhs;
295 }
296};
297
298} // namespace llvm
299
300#endif