/home/arjun/llvm-project/build/tools/mlir/include/mlir/Dialect/StandardOps/IR/Ops.h.inc
Line | Count | Source (jump to first uncovered line) |
1 | | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | | |* *| |
3 | | |* Op Declarations *| |
4 | | |* *| |
5 | | |* Automatically generated file, do not edit! *| |
6 | | |* *| |
7 | | \*===----------------------------------------------------------------------===*/ |
8 | | |
9 | | #ifdef GET_OP_CLASSES |
10 | | #undef GET_OP_CLASSES |
11 | | |
12 | | class AbsFOp; |
13 | | class AddCFOp; |
14 | | class AddFOp; |
15 | | class AddIOp; |
16 | | class AllocOp; |
17 | | class AllocaOp; |
18 | | class AndOp; |
19 | | class AssumeAlignmentOp; |
20 | | class AtomicRMWOp; |
21 | | class AtomicYieldOp; |
22 | | class BranchOp; |
23 | | class CallIndirectOp; |
24 | | class CallOp; |
25 | | class CeilFOp; |
26 | | class CmpFOp; |
27 | | class CmpIOp; |
28 | | class CondBranchOp; |
29 | | class ConstantOp; |
30 | | class CopySignOp; |
31 | | class CosOp; |
32 | | class CreateComplexOp; |
33 | | class DeallocOp; |
34 | | class DimOp; |
35 | | class DivFOp; |
36 | | class Exp2Op; |
37 | | class ExpOp; |
38 | | class ExtractElementOp; |
39 | | class FPExtOp; |
40 | | class FPToSIOp; |
41 | | class FPTruncOp; |
42 | | class GenericAtomicRMWOp; |
43 | | class ImOp; |
44 | | class IndexCastOp; |
45 | | class LoadOp; |
46 | | class Log10Op; |
47 | | class Log2Op; |
48 | | class LogOp; |
49 | | class MemRefCastOp; |
50 | | class MulFOp; |
51 | | class MulIOp; |
52 | | class NegFOp; |
53 | | class OrOp; |
54 | | class PrefetchOp; |
55 | | class RankOp; |
56 | | class ReOp; |
57 | | class RemFOp; |
58 | | class ReturnOp; |
59 | | class RsqrtOp; |
60 | | class SIToFPOp; |
61 | | class SelectOp; |
62 | | class ShiftLeftOp; |
63 | | class SignExtendIOp; |
64 | | class SignedDivIOp; |
65 | | class SignedRemIOp; |
66 | | class SignedShiftRightOp; |
67 | | class SinOp; |
68 | | class SplatOp; |
69 | | class SqrtOp; |
70 | | class StoreOp; |
71 | | class SubCFOp; |
72 | | class SubFOp; |
73 | | class SubIOp; |
74 | | class SubViewOp; |
75 | | class TanhOp; |
76 | | class TensorCastOp; |
77 | | class TensorFromElementsOp; |
78 | | class TensorLoadOp; |
79 | | class TensorStoreOp; |
80 | | class TruncateIOp; |
81 | | class UnsignedDivIOp; |
82 | | class UnsignedRemIOp; |
83 | | class UnsignedShiftRightOp; |
84 | | class ViewOp; |
85 | | class XOrOp; |
86 | | class ZeroExtendIOp; |
87 | | |
88 | | //===----------------------------------------------------------------------===// |
89 | | // AbsFOp declarations |
90 | | //===----------------------------------------------------------------------===// |
91 | | |
92 | | class AbsFOpOperandAdaptor { |
93 | | public: |
94 | | AbsFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
95 | | AbsFOpOperandAdaptor(AbsFOp& op); |
96 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
97 | | ValueRange getODSOperands(unsigned index); |
98 | | Value operand(); |
99 | | |
100 | | private: |
101 | | ValueRange odsOperands; |
102 | | DictionaryAttr odsAttrs; |
103 | | }; |
104 | | class AbsFOp : public Op<AbsFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
105 | | public: |
106 | | using Op::Op; |
107 | | using OperandAdaptor = AbsFOpOperandAdaptor; |
108 | | static StringRef getOperationName(); |
109 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
110 | | Operation::operand_range getODSOperands(unsigned index); |
111 | | Value operand(); |
112 | | ::mlir::MutableOperandRange operandMutable(); |
113 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
114 | | Operation::result_range getODSResults(unsigned index); |
115 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
116 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
117 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
118 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
119 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
120 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
121 | | void print(OpAsmPrinter &p); |
122 | | LogicalResult verify(); |
123 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
124 | | }; |
125 | | |
126 | | //===----------------------------------------------------------------------===// |
127 | | // AddCFOp declarations |
128 | | //===----------------------------------------------------------------------===// |
129 | | |
130 | | class AddCFOpOperandAdaptor { |
131 | | public: |
132 | | AddCFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
133 | | AddCFOpOperandAdaptor(AddCFOp& op); |
134 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
135 | | ValueRange getODSOperands(unsigned index); |
136 | | Value lhs(); |
137 | | Value rhs(); |
138 | | |
139 | | private: |
140 | | ValueRange odsOperands; |
141 | | DictionaryAttr odsAttrs; |
142 | | }; |
143 | | class AddCFOp : public Op<AddCFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
144 | | public: |
145 | | using Op::Op; |
146 | | using OperandAdaptor = AddCFOpOperandAdaptor; |
147 | | static StringRef getOperationName(); |
148 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
149 | | Operation::operand_range getODSOperands(unsigned index); |
150 | | Value lhs(); |
151 | | Value rhs(); |
152 | | ::mlir::MutableOperandRange lhsMutable(); |
153 | | ::mlir::MutableOperandRange rhsMutable(); |
154 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
155 | | Operation::result_range getODSResults(unsigned index); |
156 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
157 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
158 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
159 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
160 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
161 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
162 | | void print(OpAsmPrinter &p); |
163 | | LogicalResult verify(); |
164 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
165 | | }; |
166 | | |
167 | | //===----------------------------------------------------------------------===// |
168 | | // AddFOp declarations |
169 | | //===----------------------------------------------------------------------===// |
170 | | |
171 | | class AddFOpOperandAdaptor { |
172 | | public: |
173 | | AddFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
174 | | AddFOpOperandAdaptor(AddFOp& op); |
175 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
176 | | ValueRange getODSOperands(unsigned index); |
177 | | Value lhs(); |
178 | | Value rhs(); |
179 | | |
180 | | private: |
181 | | ValueRange odsOperands; |
182 | | DictionaryAttr odsAttrs; |
183 | | }; |
184 | | class AddFOp : public Op<AddFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
185 | | public: |
186 | | using Op::Op; |
187 | | using OperandAdaptor = AddFOpOperandAdaptor; |
188 | | static StringRef getOperationName(); |
189 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
190 | | Operation::operand_range getODSOperands(unsigned index); |
191 | | Value lhs(); |
192 | | Value rhs(); |
193 | | ::mlir::MutableOperandRange lhsMutable(); |
194 | | ::mlir::MutableOperandRange rhsMutable(); |
195 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
196 | | Operation::result_range getODSResults(unsigned index); |
197 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
198 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
199 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
200 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
201 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
202 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
203 | | void print(OpAsmPrinter &p); |
204 | | LogicalResult verify(); |
205 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
206 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
207 | | }; |
208 | | |
209 | | //===----------------------------------------------------------------------===// |
210 | | // AddIOp declarations |
211 | | //===----------------------------------------------------------------------===// |
212 | | |
213 | | class AddIOpOperandAdaptor { |
214 | | public: |
215 | | AddIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
216 | | AddIOpOperandAdaptor(AddIOp& op); |
217 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
218 | | ValueRange getODSOperands(unsigned index); |
219 | | Value lhs(); |
220 | | Value rhs(); |
221 | | |
222 | | private: |
223 | | ValueRange odsOperands; |
224 | | DictionaryAttr odsAttrs; |
225 | | }; |
226 | | class AddIOp : public Op<AddIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::IsCommutative, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
227 | | public: |
228 | | using Op::Op; |
229 | | using OperandAdaptor = AddIOpOperandAdaptor; |
230 | | static StringRef getOperationName(); |
231 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
232 | | Operation::operand_range getODSOperands(unsigned index); |
233 | | Value lhs(); |
234 | | Value rhs(); |
235 | | ::mlir::MutableOperandRange lhsMutable(); |
236 | | ::mlir::MutableOperandRange rhsMutable(); |
237 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
238 | | Operation::result_range getODSResults(unsigned index); |
239 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
240 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
241 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
242 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
243 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
244 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
245 | | void print(OpAsmPrinter &p); |
246 | | LogicalResult verify(); |
247 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
248 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
249 | | }; |
250 | | |
251 | | //===----------------------------------------------------------------------===// |
252 | | // AllocOp declarations |
253 | | //===----------------------------------------------------------------------===// |
254 | | |
255 | | class AllocOpOperandAdaptor { |
256 | | public: |
257 | | AllocOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
258 | | AllocOpOperandAdaptor(AllocOp& op); |
259 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
260 | | ValueRange getODSOperands(unsigned index); |
261 | | ValueRange value(); |
262 | | IntegerAttr alignment(); |
263 | | |
264 | | private: |
265 | | ValueRange odsOperands; |
266 | | DictionaryAttr odsAttrs; |
267 | | }; |
268 | | class AllocOp : public Op<AllocOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait> { |
269 | | public: |
270 | | using Op::Op; |
271 | | using OperandAdaptor = AllocOpOperandAdaptor; |
272 | | static StringRef getOperationName(); |
273 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
274 | | Operation::operand_range getODSOperands(unsigned index); |
275 | | Operation::operand_range value(); |
276 | | ::mlir::MutableOperandRange valueMutable(); |
277 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
278 | | Operation::result_range getODSResults(unsigned index); |
279 | | IntegerAttr alignmentAttr(); |
280 | | Optional< APInt > alignment(); |
281 | | void alignmentAttr(IntegerAttr attr); |
282 | | static void build(OpBuilder &builder, OperationState &result, MemRefType memrefType); |
283 | | static void build(OpBuilder &builder, OperationState &result, MemRefType memrefType, ValueRange operands, IntegerAttr alignment = IntegerAttr()); |
284 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, ValueRange value, /*optional*/IntegerAttr alignment); |
285 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange value, /*optional*/IntegerAttr alignment); |
286 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
287 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
288 | | void print(OpAsmPrinter &p); |
289 | | LogicalResult verify(); |
290 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
291 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
292 | | |
293 | 0 | static StringRef getAlignmentAttrName() { return "alignment"; } |
294 | | |
295 | 0 | MemRefType getType() { return getResult().getType().cast<MemRefType>(); } |
296 | | |
297 | | /// Returns the number of symbolic operands (the ones in square brackets), |
298 | | /// which bind to the symbols of the memref's layout map. |
299 | 0 | unsigned getNumSymbolicOperands() { |
300 | 0 | return getNumOperands() - getType().getNumDynamicDims(); |
301 | 0 | } |
302 | | |
303 | | /// Returns the symbolic operands (the ones in square brackets), which bind |
304 | | /// to the symbols of the memref's layout map. |
305 | 0 | operand_range getSymbolicOperands() { |
306 | 0 | return {operand_begin() + getType().getNumDynamicDims(), operand_end()}; |
307 | 0 | } |
308 | | |
309 | | /// Returns the dynamic sizes for this alloc operation if specified. |
310 | 0 | operand_range getDynamicSizes() { return getOperands(); } |
311 | | |
312 | | }; |
313 | | |
314 | | //===----------------------------------------------------------------------===// |
315 | | // AllocaOp declarations |
316 | | //===----------------------------------------------------------------------===// |
317 | | |
318 | | class AllocaOpOperandAdaptor { |
319 | | public: |
320 | | AllocaOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
321 | | AllocaOpOperandAdaptor(AllocaOp& op); |
322 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
323 | | ValueRange getODSOperands(unsigned index); |
324 | | ValueRange value(); |
325 | | IntegerAttr alignment(); |
326 | | |
327 | | private: |
328 | | ValueRange odsOperands; |
329 | | DictionaryAttr odsAttrs; |
330 | | }; |
331 | | class AllocaOp : public Op<AllocaOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait> { |
332 | | public: |
333 | | using Op::Op; |
334 | | using OperandAdaptor = AllocaOpOperandAdaptor; |
335 | | static StringRef getOperationName(); |
336 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
337 | | Operation::operand_range getODSOperands(unsigned index); |
338 | | Operation::operand_range value(); |
339 | | ::mlir::MutableOperandRange valueMutable(); |
340 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
341 | | Operation::result_range getODSResults(unsigned index); |
342 | | IntegerAttr alignmentAttr(); |
343 | | Optional< APInt > alignment(); |
344 | | void alignmentAttr(IntegerAttr attr); |
345 | | static void build(OpBuilder &builder, OperationState &result, MemRefType memrefType); |
346 | | static void build(OpBuilder &builder, OperationState &result, MemRefType memrefType, ValueRange operands, IntegerAttr alignment = IntegerAttr()); |
347 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, ValueRange value, /*optional*/IntegerAttr alignment); |
348 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange value, /*optional*/IntegerAttr alignment); |
349 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
350 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
351 | | void print(OpAsmPrinter &p); |
352 | | LogicalResult verify(); |
353 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
354 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
355 | | |
356 | 0 | static StringRef getAlignmentAttrName() { return "alignment"; } |
357 | | |
358 | 0 | MemRefType getType() { return getResult().getType().cast<MemRefType>(); } |
359 | | |
360 | | /// Returns the number of symbolic operands (the ones in square brackets), |
361 | | /// which bind to the symbols of the memref's layout map. |
362 | 0 | unsigned getNumSymbolicOperands() { |
363 | 0 | return getNumOperands() - getType().getNumDynamicDims(); |
364 | 0 | } |
365 | | |
366 | | /// Returns the symbolic operands (the ones in square brackets), which bind |
367 | | /// to the symbols of the memref's layout map. |
368 | 0 | operand_range getSymbolicOperands() { |
369 | 0 | return {operand_begin() + getType().getNumDynamicDims(), operand_end()}; |
370 | 0 | } |
371 | | |
372 | | /// Returns the dynamic sizes for this alloc operation if specified. |
373 | 0 | operand_range getDynamicSizes() { return getOperands(); } |
374 | | |
375 | | }; |
376 | | |
377 | | //===----------------------------------------------------------------------===// |
378 | | // AndOp declarations |
379 | | //===----------------------------------------------------------------------===// |
380 | | |
381 | | class AndOpOperandAdaptor { |
382 | | public: |
383 | | AndOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
384 | | AndOpOperandAdaptor(AndOp& op); |
385 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
386 | | ValueRange getODSOperands(unsigned index); |
387 | | Value lhs(); |
388 | | Value rhs(); |
389 | | |
390 | | private: |
391 | | ValueRange odsOperands; |
392 | | DictionaryAttr odsAttrs; |
393 | | }; |
394 | | class AndOp : public Op<AndOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::IsCommutative, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
395 | | public: |
396 | | using Op::Op; |
397 | | using OperandAdaptor = AndOpOperandAdaptor; |
398 | | static StringRef getOperationName(); |
399 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
400 | | Operation::operand_range getODSOperands(unsigned index); |
401 | | Value lhs(); |
402 | | Value rhs(); |
403 | | ::mlir::MutableOperandRange lhsMutable(); |
404 | | ::mlir::MutableOperandRange rhsMutable(); |
405 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
406 | | Operation::result_range getODSResults(unsigned index); |
407 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
408 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
409 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
410 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
411 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
412 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
413 | | void print(OpAsmPrinter &p); |
414 | | LogicalResult verify(); |
415 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
416 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
417 | | }; |
418 | | |
419 | | //===----------------------------------------------------------------------===// |
420 | | // AssumeAlignmentOp declarations |
421 | | //===----------------------------------------------------------------------===// |
422 | | |
423 | | class AssumeAlignmentOpOperandAdaptor { |
424 | | public: |
425 | | AssumeAlignmentOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
426 | | AssumeAlignmentOpOperandAdaptor(AssumeAlignmentOp& op); |
427 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
428 | | ValueRange getODSOperands(unsigned index); |
429 | | Value memref(); |
430 | | IntegerAttr alignment(); |
431 | | |
432 | | private: |
433 | | ValueRange odsOperands; |
434 | | DictionaryAttr odsAttrs; |
435 | | }; |
436 | | class AssumeAlignmentOp : public Op<AssumeAlignmentOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand> { |
437 | | public: |
438 | | using Op::Op; |
439 | | using OperandAdaptor = AssumeAlignmentOpOperandAdaptor; |
440 | | static StringRef getOperationName(); |
441 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
442 | | Operation::operand_range getODSOperands(unsigned index); |
443 | | Value memref(); |
444 | | ::mlir::MutableOperandRange memrefMutable(); |
445 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
446 | | Operation::result_range getODSResults(unsigned index); |
447 | | IntegerAttr alignmentAttr(); |
448 | | APInt alignment(); |
449 | | void alignmentAttr(IntegerAttr attr); |
450 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, IntegerAttr alignment); |
451 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, IntegerAttr alignment); |
452 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, APInt alignment); |
453 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, APInt alignment); |
454 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
455 | | LogicalResult verify(); |
456 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
457 | | void print(OpAsmPrinter &p); |
458 | | }; |
459 | | |
460 | | //===----------------------------------------------------------------------===// |
461 | | // AtomicRMWOp declarations |
462 | | //===----------------------------------------------------------------------===// |
463 | | |
464 | | class AtomicRMWOpOperandAdaptor { |
465 | | public: |
466 | | AtomicRMWOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
467 | | AtomicRMWOpOperandAdaptor(AtomicRMWOp& op); |
468 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
469 | | ValueRange getODSOperands(unsigned index); |
470 | | Value value(); |
471 | | Value memref(); |
472 | | ValueRange indices(); |
473 | | IntegerAttr kind(); |
474 | | |
475 | | private: |
476 | | ValueRange odsOperands; |
477 | | DictionaryAttr odsAttrs; |
478 | | }; |
479 | | class AtomicRMWOp : public Op<AtomicRMWOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<2>::Impl> { |
480 | | public: |
481 | | using Op::Op; |
482 | | using OperandAdaptor = AtomicRMWOpOperandAdaptor; |
483 | | static StringRef getOperationName(); |
484 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
485 | | Operation::operand_range getODSOperands(unsigned index); |
486 | | Value value(); |
487 | | Value memref(); |
488 | | Operation::operand_range indices(); |
489 | | ::mlir::MutableOperandRange valueMutable(); |
490 | | ::mlir::MutableOperandRange memrefMutable(); |
491 | | ::mlir::MutableOperandRange indicesMutable(); |
492 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
493 | | Operation::result_range getODSResults(unsigned index); |
494 | | Value result(); |
495 | | IntegerAttr kindAttr(); |
496 | | ::mlir::AtomicRMWKind kind(); |
497 | | void kindAttr(IntegerAttr attr); |
498 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr kind, Value value, Value memref, ValueRange indices); |
499 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr kind, Value value, Value memref, ValueRange indices); |
500 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::AtomicRMWKind kind, Value value, Value memref, ValueRange indices); |
501 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::AtomicRMWKind kind, Value value, Value memref, ValueRange indices); |
502 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
503 | | LogicalResult verify(); |
504 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
505 | | void print(OpAsmPrinter &p); |
506 | | |
507 | 0 | MemRefType getMemRefType() { |
508 | 0 | return memref().getType().cast<MemRefType>(); |
509 | 0 | } |
510 | | |
511 | | }; |
512 | | |
513 | | //===----------------------------------------------------------------------===// |
514 | | // AtomicYieldOp declarations |
515 | | //===----------------------------------------------------------------------===// |
516 | | |
517 | | class AtomicYieldOpOperandAdaptor { |
518 | | public: |
519 | | AtomicYieldOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
520 | | AtomicYieldOpOperandAdaptor(AtomicYieldOp& op); |
521 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
522 | | ValueRange getODSOperands(unsigned index); |
523 | | Value result(); |
524 | | |
525 | | private: |
526 | | ValueRange odsOperands; |
527 | | DictionaryAttr odsAttrs; |
528 | | }; |
529 | | class AtomicYieldOp : public Op<AtomicYieldOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::HasParent<GenericAtomicRMWOp>::Impl, MemoryEffectOpInterface::Trait, OpTrait::IsTerminator> { |
530 | | public: |
531 | | using Op::Op; |
532 | | using OperandAdaptor = AtomicYieldOpOperandAdaptor; |
533 | | static StringRef getOperationName(); |
534 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
535 | | Operation::operand_range getODSOperands(unsigned index); |
536 | | Value result(); |
537 | | ::mlir::MutableOperandRange resultMutable(); |
538 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
539 | | Operation::result_range getODSResults(unsigned index); |
540 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value result); |
541 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value result); |
542 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
543 | | LogicalResult verify(); |
544 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
545 | | void print(OpAsmPrinter &p); |
546 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
547 | | }; |
548 | | |
549 | | //===----------------------------------------------------------------------===// |
550 | | // BranchOp declarations |
551 | | //===----------------------------------------------------------------------===// |
552 | | |
553 | | class BranchOpOperandAdaptor { |
554 | | public: |
555 | | BranchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
556 | | BranchOpOperandAdaptor(BranchOp& op); |
557 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
558 | | ValueRange getODSOperands(unsigned index); |
559 | | ValueRange destOperands(); |
560 | | |
561 | | private: |
562 | | ValueRange odsOperands; |
563 | | DictionaryAttr odsAttrs; |
564 | | }; |
565 | | class BranchOp : public Op<BranchOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::OneSuccessor, OpTrait::VariadicOperands, BranchOpInterface::Trait, MemoryEffectOpInterface::Trait, OpTrait::IsTerminator> { |
566 | | public: |
567 | | using Op::Op; |
568 | | using OperandAdaptor = BranchOpOperandAdaptor; |
569 | | static StringRef getOperationName(); |
570 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
571 | | Operation::operand_range getODSOperands(unsigned index); |
572 | | Operation::operand_range destOperands(); |
573 | | ::mlir::MutableOperandRange destOperandsMutable(); |
574 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
575 | | Operation::result_range getODSResults(unsigned index); |
576 | | Block *dest(); |
577 | | static void build(OpBuilder &, OperationState &result, Block *dest, ValueRange destOperands = {}); |
578 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange destOperands, Block *dest); |
579 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange destOperands, Block *dest); |
580 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
581 | | LogicalResult verify(); |
582 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
583 | | Optional<MutableOperandRange> getMutableSuccessorOperands(unsigned index); |
584 | | Block *getSuccessorForOperands(ArrayRef<Attribute> operands); |
585 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
586 | | void print(OpAsmPrinter &p); |
587 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
588 | | |
589 | | Block *getDest(); |
590 | | void setDest(Block *block); |
591 | | |
592 | | /// Erase the operand at 'index' from the operand list. |
593 | | void eraseOperand(unsigned index); |
594 | | |
595 | | }; |
596 | | |
597 | | //===----------------------------------------------------------------------===// |
598 | | // CallIndirectOp declarations |
599 | | //===----------------------------------------------------------------------===// |
600 | | |
601 | | class CallIndirectOpOperandAdaptor { |
602 | | public: |
603 | | CallIndirectOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
604 | | CallIndirectOpOperandAdaptor(CallIndirectOp& op); |
605 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
606 | | ValueRange getODSOperands(unsigned index); |
607 | | Value callee(); |
608 | | ValueRange operands(); |
609 | | |
610 | | private: |
611 | | ValueRange odsOperands; |
612 | | DictionaryAttr odsAttrs; |
613 | | }; |
614 | | class CallIndirectOp : public Op<CallIndirectOp, OpTrait::ZeroRegion, OpTrait::VariadicResults, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, CallOpInterface::Trait> { |
615 | | public: |
616 | | using Op::Op; |
617 | | using OperandAdaptor = CallIndirectOpOperandAdaptor; |
618 | | static StringRef getOperationName(); |
619 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
620 | | Operation::operand_range getODSOperands(unsigned index); |
621 | | Value callee(); |
622 | | Operation::operand_range operands(); |
623 | | ::mlir::MutableOperandRange calleeMutable(); |
624 | | ::mlir::MutableOperandRange operandsMutable(); |
625 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
626 | | Operation::result_range getODSResults(unsigned index); |
627 | | Operation::result_range results(); |
628 | | static void build(OpBuilder &, OperationState &result, Value callee,ValueRange operands = {}); |
629 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> results, Value callee, ValueRange operands); |
630 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
631 | | LogicalResult verify(); |
632 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
633 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
634 | | void print(OpAsmPrinter &p); |
635 | | |
636 | 0 | Value getCallee() { return getOperand(0); } |
637 | | |
638 | | /// Get the argument operands to the called function. |
639 | 0 | operand_range getArgOperands() { |
640 | 0 | return {arg_operand_begin(), arg_operand_end()}; |
641 | 0 | } |
642 | | |
643 | 0 | operand_iterator arg_operand_begin() { return ++operand_begin(); } |
644 | 0 | operand_iterator arg_operand_end() { return operand_end(); } |
645 | | |
646 | | /// Return the callee of this operation. |
647 | 0 | CallInterfaceCallable getCallableForCallee() { return getCallee(); } |
648 | | |
649 | | }; |
650 | | |
651 | | //===----------------------------------------------------------------------===// |
652 | | // CallOp declarations |
653 | | //===----------------------------------------------------------------------===// |
654 | | |
655 | | class CallOpOperandAdaptor { |
656 | | public: |
657 | | CallOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
658 | | CallOpOperandAdaptor(CallOp& op); |
659 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
660 | | ValueRange getODSOperands(unsigned index); |
661 | | ValueRange operands(); |
662 | | FlatSymbolRefAttr callee(); |
663 | | |
664 | | private: |
665 | | ValueRange odsOperands; |
666 | | DictionaryAttr odsAttrs; |
667 | | }; |
668 | | class CallOp : public Op<CallOp, OpTrait::ZeroRegion, OpTrait::VariadicResults, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, CallOpInterface::Trait> { |
669 | | public: |
670 | | using Op::Op; |
671 | | using OperandAdaptor = CallOpOperandAdaptor; |
672 | | static StringRef getOperationName(); |
673 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
674 | | Operation::operand_range getODSOperands(unsigned index); |
675 | | Operation::operand_range operands(); |
676 | | ::mlir::MutableOperandRange operandsMutable(); |
677 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
678 | | Operation::result_range getODSResults(unsigned index); |
679 | | FlatSymbolRefAttr calleeAttr(); |
680 | | StringRef callee(); |
681 | | void calleeAttr(FlatSymbolRefAttr attr); |
682 | | static void build(OpBuilder &builder, OperationState &result, FuncOp callee,ValueRange operands = {}); |
683 | | static void build(OpBuilder &builder, OperationState &result, SymbolRefAttr callee,ArrayRef<Type> results, ValueRange operands = {}); |
684 | | static void build(OpBuilder &builder, OperationState &result, StringRef callee,ArrayRef<Type> results, ValueRange operands = {}); |
685 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultType0, FlatSymbolRefAttr callee, ValueRange operands); |
686 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultType0, StringRef callee, ValueRange operands); |
687 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
688 | | LogicalResult verify(); |
689 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
690 | | void print(OpAsmPrinter &p); |
691 | | |
692 | 0 | StringRef getCallee() { return callee(); } |
693 | | FunctionType getCalleeType(); |
694 | | |
695 | | /// Get the argument operands to the called function. |
696 | 0 | operand_range getArgOperands() { |
697 | 0 | return {arg_operand_begin(), arg_operand_end()}; |
698 | 0 | } |
699 | | |
700 | 0 | operand_iterator arg_operand_begin() { return operand_begin(); } |
701 | 0 | operand_iterator arg_operand_end() { return operand_end(); } |
702 | | |
703 | | /// Return the callee of this operation. |
704 | 0 | CallInterfaceCallable getCallableForCallee() { |
705 | 0 | return getAttrOfType<SymbolRefAttr>("callee"); |
706 | 0 | } |
707 | | |
708 | | }; |
709 | | |
710 | | //===----------------------------------------------------------------------===// |
711 | | // CeilFOp declarations |
712 | | //===----------------------------------------------------------------------===// |
713 | | |
714 | | class CeilFOpOperandAdaptor { |
715 | | public: |
716 | | CeilFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
717 | | CeilFOpOperandAdaptor(CeilFOp& op); |
718 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
719 | | ValueRange getODSOperands(unsigned index); |
720 | | Value operand(); |
721 | | |
722 | | private: |
723 | | ValueRange odsOperands; |
724 | | DictionaryAttr odsAttrs; |
725 | | }; |
726 | | class CeilFOp : public Op<CeilFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
727 | | public: |
728 | | using Op::Op; |
729 | | using OperandAdaptor = CeilFOpOperandAdaptor; |
730 | | static StringRef getOperationName(); |
731 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
732 | | Operation::operand_range getODSOperands(unsigned index); |
733 | | Value operand(); |
734 | | ::mlir::MutableOperandRange operandMutable(); |
735 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
736 | | Operation::result_range getODSResults(unsigned index); |
737 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
738 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
739 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
740 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
741 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
742 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
743 | | void print(OpAsmPrinter &p); |
744 | | LogicalResult verify(); |
745 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
746 | | }; |
747 | | |
748 | | //===----------------------------------------------------------------------===// |
749 | | // CmpFOp declarations |
750 | | //===----------------------------------------------------------------------===// |
751 | | |
752 | | class CmpFOpOperandAdaptor { |
753 | | public: |
754 | | CmpFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
755 | | CmpFOpOperandAdaptor(CmpFOp& op); |
756 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
757 | | ValueRange getODSOperands(unsigned index); |
758 | | Value lhs(); |
759 | | Value rhs(); |
760 | | IntegerAttr predicate(); |
761 | | |
762 | | private: |
763 | | ValueRange odsOperands; |
764 | | DictionaryAttr odsAttrs; |
765 | | }; |
766 | | class CmpFOp : public Op<CmpFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameTypeOperands, OpTrait::SameOperandsAndResultShape> { |
767 | | public: |
768 | | using Op::Op; |
769 | | using OperandAdaptor = CmpFOpOperandAdaptor; |
770 | | static StringRef getOperationName(); |
771 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
772 | | Operation::operand_range getODSOperands(unsigned index); |
773 | | Value lhs(); |
774 | | Value rhs(); |
775 | | ::mlir::MutableOperandRange lhsMutable(); |
776 | | ::mlir::MutableOperandRange rhsMutable(); |
777 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
778 | | Operation::result_range getODSResults(unsigned index); |
779 | | Value result(); |
780 | | IntegerAttr predicateAttr(); |
781 | | ::mlir::CmpFPredicate predicate(); |
782 | | void predicateAttr(IntegerAttr attr); |
783 | | static void build(OpBuilder &builder, OperationState &result, CmpFPredicate predicate,Value lhs, Value rhs); |
784 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr predicate, Value lhs, Value rhs); |
785 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr predicate, Value lhs, Value rhs); |
786 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::CmpFPredicate predicate, Value lhs, Value rhs); |
787 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::CmpFPredicate predicate, Value lhs, Value rhs); |
788 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
789 | | LogicalResult verify(); |
790 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
791 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
792 | | void print(OpAsmPrinter &p); |
793 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
794 | | |
795 | 0 | static StringRef getPredicateAttrName() { return "predicate"; } |
796 | | static CmpFPredicate getPredicateByName(StringRef name); |
797 | | |
798 | 0 | CmpFPredicate getPredicate() { |
799 | 0 | return (CmpFPredicate)getAttrOfType<IntegerAttr>(getPredicateAttrName()) |
800 | 0 | .getInt(); |
801 | 0 | } |
802 | | |
803 | | }; |
804 | | |
805 | | //===----------------------------------------------------------------------===// |
806 | | // CmpIOp declarations |
807 | | //===----------------------------------------------------------------------===// |
808 | | |
809 | | class CmpIOpOperandAdaptor { |
810 | | public: |
811 | | CmpIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
812 | | CmpIOpOperandAdaptor(CmpIOp& op); |
813 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
814 | | ValueRange getODSOperands(unsigned index); |
815 | | Value lhs(); |
816 | | Value rhs(); |
817 | | IntegerAttr predicate(); |
818 | | |
819 | | private: |
820 | | ValueRange odsOperands; |
821 | | DictionaryAttr odsAttrs; |
822 | | }; |
823 | | class CmpIOp : public Op<CmpIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameTypeOperands, OpTrait::SameOperandsAndResultShape> { |
824 | | public: |
825 | | using Op::Op; |
826 | | using OperandAdaptor = CmpIOpOperandAdaptor; |
827 | | static StringRef getOperationName(); |
828 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
829 | | Operation::operand_range getODSOperands(unsigned index); |
830 | | Value lhs(); |
831 | | Value rhs(); |
832 | | ::mlir::MutableOperandRange lhsMutable(); |
833 | | ::mlir::MutableOperandRange rhsMutable(); |
834 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
835 | | Operation::result_range getODSResults(unsigned index); |
836 | | Value result(); |
837 | | IntegerAttr predicateAttr(); |
838 | | ::mlir::CmpIPredicate predicate(); |
839 | | void predicateAttr(IntegerAttr attr); |
840 | | static void build(OpBuilder &builder, OperationState &result, CmpIPredicate predicate,Value lhs, Value rhs); |
841 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, IntegerAttr predicate, Value lhs, Value rhs); |
842 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, IntegerAttr predicate, Value lhs, Value rhs); |
843 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, ::mlir::CmpIPredicate predicate, Value lhs, Value rhs); |
844 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ::mlir::CmpIPredicate predicate, Value lhs, Value rhs); |
845 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
846 | | LogicalResult verify(); |
847 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
848 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
849 | | void print(OpAsmPrinter &p); |
850 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
851 | | |
852 | 0 | static StringRef getPredicateAttrName() { return "predicate"; } |
853 | | static CmpIPredicate getPredicateByName(StringRef name); |
854 | | |
855 | 0 | CmpIPredicate getPredicate() { |
856 | 0 | return (CmpIPredicate)getAttrOfType<IntegerAttr>(getPredicateAttrName()) |
857 | 0 | .getInt(); |
858 | 0 | } |
859 | | |
860 | | }; |
861 | | |
862 | | //===----------------------------------------------------------------------===// |
863 | | // CondBranchOp declarations |
864 | | //===----------------------------------------------------------------------===// |
865 | | |
866 | | class CondBranchOpOperandAdaptor { |
867 | | public: |
868 | | CondBranchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs); |
869 | | CondBranchOpOperandAdaptor(CondBranchOp& op); |
870 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
871 | | ValueRange getODSOperands(unsigned index); |
872 | | Value condition(); |
873 | | ValueRange trueDestOperands(); |
874 | | ValueRange falseDestOperands(); |
875 | | |
876 | | private: |
877 | | ValueRange odsOperands; |
878 | | DictionaryAttr odsAttrs; |
879 | | }; |
880 | | class CondBranchOp : public Op<CondBranchOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::NSuccessors<2>::Impl, OpTrait::AtLeastNOperands<1>::Impl, OpTrait::AttrSizedOperandSegments, BranchOpInterface::Trait, MemoryEffectOpInterface::Trait, OpTrait::IsTerminator> { |
881 | | public: |
882 | | using Op::Op; |
883 | | using OperandAdaptor = CondBranchOpOperandAdaptor; |
884 | | static StringRef getOperationName(); |
885 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
886 | | Operation::operand_range getODSOperands(unsigned index); |
887 | | Value condition(); |
888 | | Operation::operand_range trueDestOperands(); |
889 | | Operation::operand_range falseDestOperands(); |
890 | | ::mlir::MutableOperandRange conditionMutable(); |
891 | | ::mlir::MutableOperandRange trueDestOperandsMutable(); |
892 | | ::mlir::MutableOperandRange falseDestOperandsMutable(); |
893 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
894 | | Operation::result_range getODSResults(unsigned index); |
895 | | Block *trueDest(); |
896 | | Block *falseDest(); |
897 | | static void build(OpBuilder &builder, OperationState &result, Value condition,Block *trueDest, ValueRange trueOperands,Block *falseDest, ValueRange falseOperands); |
898 | | static void build(OpBuilder &builder, OperationState &result, Value condition,Block *trueDest, Block *falseDest, ValueRange falseOperands = {}); |
899 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value condition, ValueRange trueDestOperands, ValueRange falseDestOperands, Block *trueDest, Block *falseDest); |
900 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value condition, ValueRange trueDestOperands, ValueRange falseDestOperands, Block *trueDest, Block *falseDest); |
901 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
902 | | LogicalResult verify(); |
903 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
904 | | Optional<MutableOperandRange> getMutableSuccessorOperands(unsigned index); |
905 | | Block *getSuccessorForOperands(ArrayRef<Attribute> operands); |
906 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
907 | | void print(OpAsmPrinter &p); |
908 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
909 | | |
910 | | // These are the indices into the dests list. |
911 | | enum { trueIndex = 0, falseIndex = 1 }; |
912 | | |
913 | | // The condition operand is the first operand in the list. |
914 | 0 | Value getCondition() { return getOperand(0); } |
915 | | |
916 | | /// Return the destination if the condition is true. |
917 | 0 | Block *getTrueDest() { |
918 | 0 | return getSuccessor(trueIndex); |
919 | 0 | } |
920 | | |
921 | | /// Return the destination if the condition is false. |
922 | 0 | Block *getFalseDest() { |
923 | 0 | return getSuccessor(falseIndex); |
924 | 0 | } |
925 | | |
926 | | // Accessors for operands to the 'true' destination. |
927 | 0 | Value getTrueOperand(unsigned idx) { |
928 | 0 | assert(idx < getNumTrueOperands()); |
929 | 0 | return getOperand(getTrueDestOperandIndex() + idx); |
930 | 0 | } |
931 | | |
932 | 0 | void setTrueOperand(unsigned idx, Value value) { |
933 | 0 | assert(idx < getNumTrueOperands()); |
934 | 0 | setOperand(getTrueDestOperandIndex() + idx, value); |
935 | 0 | } |
936 | | |
937 | 0 | operand_range getTrueOperands() { return trueDestOperands(); } |
938 | | |
939 | 0 | unsigned getNumTrueOperands() { return getTrueOperands().size(); } |
940 | | |
941 | | /// Erase the operand at 'index' from the true operand list. |
942 | 0 | void eraseTrueOperand(unsigned index) { |
943 | 0 | trueDestOperandsMutable().erase(index); |
944 | 0 | } |
945 | | |
946 | | // Accessors for operands to the 'false' destination. |
947 | 0 | Value getFalseOperand(unsigned idx) { |
948 | 0 | assert(idx < getNumFalseOperands()); |
949 | 0 | return getOperand(getFalseDestOperandIndex() + idx); |
950 | 0 | } |
951 | 0 | void setFalseOperand(unsigned idx, Value value) { |
952 | 0 | assert(idx < getNumFalseOperands()); |
953 | 0 | setOperand(getFalseDestOperandIndex() + idx, value); |
954 | 0 | } |
955 | | |
956 | 0 | operand_range getFalseOperands() { return falseDestOperands(); } |
957 | | |
958 | 0 | unsigned getNumFalseOperands() { return getFalseOperands().size(); } |
959 | | |
960 | | /// Erase the operand at 'index' from the false operand list. |
961 | 0 | void eraseFalseOperand(unsigned index) { |
962 | 0 | falseDestOperandsMutable().erase(index); |
963 | 0 | } |
964 | | |
965 | | private: |
966 | | /// Get the index of the first true destination operand. |
967 | 0 | unsigned getTrueDestOperandIndex() { return 1; } |
968 | | |
969 | | /// Get the index of the first false destination operand. |
970 | 0 | unsigned getFalseDestOperandIndex() { |
971 | 0 | return getTrueDestOperandIndex() + getNumTrueOperands(); |
972 | 0 | } |
973 | | |
974 | | }; |
975 | | |
976 | | //===----------------------------------------------------------------------===// |
977 | | // ConstantOp declarations |
978 | | //===----------------------------------------------------------------------===// |
979 | | |
980 | | class ConstantOpOperandAdaptor { |
981 | | public: |
982 | | ConstantOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
983 | | ConstantOpOperandAdaptor(ConstantOp& op); |
984 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
985 | | ValueRange getODSOperands(unsigned index); |
986 | | Attribute value(); |
987 | | |
988 | | private: |
989 | | ValueRange odsOperands; |
990 | | DictionaryAttr odsAttrs; |
991 | | }; |
992 | | class ConstantOp : public Op<ConstantOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::ZeroOperands, OpTrait::ConstantLike, MemoryEffectOpInterface::Trait, OpAsmOpInterface::Trait> { |
993 | | public: |
994 | | using Op::Op; |
995 | | using OperandAdaptor = ConstantOpOperandAdaptor; |
996 | | static StringRef getOperationName(); |
997 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
998 | | Operation::operand_range getODSOperands(unsigned index); |
999 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1000 | | Operation::result_range getODSResults(unsigned index); |
1001 | | Attribute valueAttr(); |
1002 | | Attribute value(); |
1003 | | void valueAttr(Attribute attr); |
1004 | | static void build(OpBuilder &builder, OperationState &result, Attribute value); |
1005 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Attribute value); |
1006 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Attribute value); |
1007 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1008 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1009 | | void print(OpAsmPrinter &p); |
1010 | | LogicalResult verify(); |
1011 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1012 | | void getAsmResultNames(OpAsmSetValueNameFn setNameFn); |
1013 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1014 | | |
1015 | 0 | Attribute getValue() { return getAttr("value"); } |
1016 | | |
1017 | | /// Returns true if a constant operation can be built with the given value |
1018 | | /// and result type. |
1019 | | static bool isBuildableWith(Attribute value, Type type); |
1020 | | |
1021 | | }; |
1022 | | |
1023 | | //===----------------------------------------------------------------------===// |
1024 | | // CopySignOp declarations |
1025 | | //===----------------------------------------------------------------------===// |
1026 | | |
1027 | | class CopySignOpOperandAdaptor { |
1028 | | public: |
1029 | | CopySignOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1030 | | CopySignOpOperandAdaptor(CopySignOp& op); |
1031 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1032 | | ValueRange getODSOperands(unsigned index); |
1033 | | Value lhs(); |
1034 | | Value rhs(); |
1035 | | |
1036 | | private: |
1037 | | ValueRange odsOperands; |
1038 | | DictionaryAttr odsAttrs; |
1039 | | }; |
1040 | | class CopySignOp : public Op<CopySignOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
1041 | | public: |
1042 | | using Op::Op; |
1043 | | using OperandAdaptor = CopySignOpOperandAdaptor; |
1044 | | static StringRef getOperationName(); |
1045 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1046 | | Operation::operand_range getODSOperands(unsigned index); |
1047 | | Value lhs(); |
1048 | | Value rhs(); |
1049 | | ::mlir::MutableOperandRange lhsMutable(); |
1050 | | ::mlir::MutableOperandRange rhsMutable(); |
1051 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1052 | | Operation::result_range getODSResults(unsigned index); |
1053 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
1054 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
1055 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1056 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
1057 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1058 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1059 | | void print(OpAsmPrinter &p); |
1060 | | LogicalResult verify(); |
1061 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1062 | | }; |
1063 | | |
1064 | | //===----------------------------------------------------------------------===// |
1065 | | // CosOp declarations |
1066 | | //===----------------------------------------------------------------------===// |
1067 | | |
1068 | | class CosOpOperandAdaptor { |
1069 | | public: |
1070 | | CosOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1071 | | CosOpOperandAdaptor(CosOp& op); |
1072 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1073 | | ValueRange getODSOperands(unsigned index); |
1074 | | Value operand(); |
1075 | | |
1076 | | private: |
1077 | | ValueRange odsOperands; |
1078 | | DictionaryAttr odsAttrs; |
1079 | | }; |
1080 | | class CosOp : public Op<CosOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1081 | | public: |
1082 | | using Op::Op; |
1083 | | using OperandAdaptor = CosOpOperandAdaptor; |
1084 | | static StringRef getOperationName(); |
1085 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1086 | | Operation::operand_range getODSOperands(unsigned index); |
1087 | | Value operand(); |
1088 | | ::mlir::MutableOperandRange operandMutable(); |
1089 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1090 | | Operation::result_range getODSResults(unsigned index); |
1091 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1092 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1093 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1094 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1095 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1096 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1097 | | void print(OpAsmPrinter &p); |
1098 | | LogicalResult verify(); |
1099 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1100 | | }; |
1101 | | |
1102 | | //===----------------------------------------------------------------------===// |
1103 | | // CreateComplexOp declarations |
1104 | | //===----------------------------------------------------------------------===// |
1105 | | |
1106 | | class CreateComplexOpOperandAdaptor { |
1107 | | public: |
1108 | | CreateComplexOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1109 | | CreateComplexOpOperandAdaptor(CreateComplexOp& op); |
1110 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1111 | | ValueRange getODSOperands(unsigned index); |
1112 | | Value real(); |
1113 | | Value imaginary(); |
1114 | | |
1115 | | private: |
1116 | | ValueRange odsOperands; |
1117 | | DictionaryAttr odsAttrs; |
1118 | | }; |
1119 | | class CreateComplexOp : public Op<CreateComplexOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait> { |
1120 | | public: |
1121 | | using Op::Op; |
1122 | | using OperandAdaptor = CreateComplexOpOperandAdaptor; |
1123 | | static StringRef getOperationName(); |
1124 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1125 | | Operation::operand_range getODSOperands(unsigned index); |
1126 | | Value real(); |
1127 | | Value imaginary(); |
1128 | | ::mlir::MutableOperandRange realMutable(); |
1129 | | ::mlir::MutableOperandRange imaginaryMutable(); |
1130 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1131 | | Operation::result_range getODSResults(unsigned index); |
1132 | | Value complex(); |
1133 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type complex, Value real, Value imaginary); |
1134 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value real, Value imaginary); |
1135 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1136 | | LogicalResult verify(); |
1137 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1138 | | void print(OpAsmPrinter &p); |
1139 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1140 | | }; |
1141 | | |
1142 | | //===----------------------------------------------------------------------===// |
1143 | | // DeallocOp declarations |
1144 | | //===----------------------------------------------------------------------===// |
1145 | | |
1146 | | class DeallocOpOperandAdaptor { |
1147 | | public: |
1148 | | DeallocOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1149 | | DeallocOpOperandAdaptor(DeallocOp& op); |
1150 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1151 | | ValueRange getODSOperands(unsigned index); |
1152 | | Value memref(); |
1153 | | |
1154 | | private: |
1155 | | ValueRange odsOperands; |
1156 | | DictionaryAttr odsAttrs; |
1157 | | }; |
1158 | | class DeallocOp : public Op<DeallocOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1159 | | public: |
1160 | | using Op::Op; |
1161 | | using OperandAdaptor = DeallocOpOperandAdaptor; |
1162 | | static StringRef getOperationName(); |
1163 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1164 | | Operation::operand_range getODSOperands(unsigned index); |
1165 | | Value memref(); |
1166 | | ::mlir::MutableOperandRange memrefMutable(); |
1167 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1168 | | Operation::result_range getODSResults(unsigned index); |
1169 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref); |
1170 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref); |
1171 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1172 | | LogicalResult verify(); |
1173 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
1174 | | LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results); |
1175 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1176 | | void print(OpAsmPrinter &p); |
1177 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1178 | | }; |
1179 | | |
1180 | | //===----------------------------------------------------------------------===// |
1181 | | // DimOp declarations |
1182 | | //===----------------------------------------------------------------------===// |
1183 | | |
1184 | | class DimOpOperandAdaptor { |
1185 | | public: |
1186 | | DimOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1187 | | DimOpOperandAdaptor(DimOp& op); |
1188 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1189 | | ValueRange getODSOperands(unsigned index); |
1190 | | Value memrefOrTensor(); |
1191 | | IntegerAttr index(); |
1192 | | |
1193 | | private: |
1194 | | ValueRange odsOperands; |
1195 | | DictionaryAttr odsAttrs; |
1196 | | }; |
1197 | | class DimOp : public Op<DimOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1198 | | public: |
1199 | | using Op::Op; |
1200 | | using OperandAdaptor = DimOpOperandAdaptor; |
1201 | | static StringRef getOperationName(); |
1202 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1203 | | Operation::operand_range getODSOperands(unsigned index); |
1204 | | Value memrefOrTensor(); |
1205 | | ::mlir::MutableOperandRange memrefOrTensorMutable(); |
1206 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1207 | | Operation::result_range getODSResults(unsigned index); |
1208 | | IntegerAttr indexAttr(); |
1209 | | APInt index(); |
1210 | | void indexAttr(IntegerAttr attr); |
1211 | | static void build(OpBuilder &builder, OperationState &result, Value memrefOrTensor,unsigned index); |
1212 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value memrefOrTensor, IntegerAttr index); |
1213 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memrefOrTensor, IntegerAttr index); |
1214 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1215 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1216 | | void print(OpAsmPrinter &p); |
1217 | | LogicalResult verify(); |
1218 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1219 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1220 | | |
1221 | 0 | unsigned getIndex() { |
1222 | 0 | return getAttrOfType<IntegerAttr>("index").getValue().getZExtValue(); |
1223 | 0 | } |
1224 | | |
1225 | | }; |
1226 | | |
1227 | | //===----------------------------------------------------------------------===// |
1228 | | // DivFOp declarations |
1229 | | //===----------------------------------------------------------------------===// |
1230 | | |
1231 | | class DivFOpOperandAdaptor { |
1232 | | public: |
1233 | | DivFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1234 | | DivFOpOperandAdaptor(DivFOp& op); |
1235 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1236 | | ValueRange getODSOperands(unsigned index); |
1237 | | Value lhs(); |
1238 | | Value rhs(); |
1239 | | |
1240 | | private: |
1241 | | ValueRange odsOperands; |
1242 | | DictionaryAttr odsAttrs; |
1243 | | }; |
1244 | | class DivFOp : public Op<DivFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
1245 | | public: |
1246 | | using Op::Op; |
1247 | | using OperandAdaptor = DivFOpOperandAdaptor; |
1248 | | static StringRef getOperationName(); |
1249 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1250 | | Operation::operand_range getODSOperands(unsigned index); |
1251 | | Value lhs(); |
1252 | | Value rhs(); |
1253 | | ::mlir::MutableOperandRange lhsMutable(); |
1254 | | ::mlir::MutableOperandRange rhsMutable(); |
1255 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1256 | | Operation::result_range getODSResults(unsigned index); |
1257 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
1258 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
1259 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1260 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
1261 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1262 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1263 | | void print(OpAsmPrinter &p); |
1264 | | LogicalResult verify(); |
1265 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1266 | | }; |
1267 | | |
1268 | | //===----------------------------------------------------------------------===// |
1269 | | // Exp2Op declarations |
1270 | | //===----------------------------------------------------------------------===// |
1271 | | |
1272 | | class Exp2OpOperandAdaptor { |
1273 | | public: |
1274 | | Exp2OpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1275 | | Exp2OpOperandAdaptor(Exp2Op& op); |
1276 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1277 | | ValueRange getODSOperands(unsigned index); |
1278 | | Value operand(); |
1279 | | |
1280 | | private: |
1281 | | ValueRange odsOperands; |
1282 | | DictionaryAttr odsAttrs; |
1283 | | }; |
1284 | | class Exp2Op : public Op<Exp2Op, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1285 | | public: |
1286 | | using Op::Op; |
1287 | | using OperandAdaptor = Exp2OpOperandAdaptor; |
1288 | | static StringRef getOperationName(); |
1289 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1290 | | Operation::operand_range getODSOperands(unsigned index); |
1291 | | Value operand(); |
1292 | | ::mlir::MutableOperandRange operandMutable(); |
1293 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1294 | | Operation::result_range getODSResults(unsigned index); |
1295 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1296 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1297 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1298 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1299 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1300 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1301 | | void print(OpAsmPrinter &p); |
1302 | | LogicalResult verify(); |
1303 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1304 | | }; |
1305 | | |
1306 | | //===----------------------------------------------------------------------===// |
1307 | | // ExpOp declarations |
1308 | | //===----------------------------------------------------------------------===// |
1309 | | |
1310 | | class ExpOpOperandAdaptor { |
1311 | | public: |
1312 | | ExpOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1313 | | ExpOpOperandAdaptor(ExpOp& op); |
1314 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1315 | | ValueRange getODSOperands(unsigned index); |
1316 | | Value operand(); |
1317 | | |
1318 | | private: |
1319 | | ValueRange odsOperands; |
1320 | | DictionaryAttr odsAttrs; |
1321 | | }; |
1322 | | class ExpOp : public Op<ExpOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1323 | | public: |
1324 | | using Op::Op; |
1325 | | using OperandAdaptor = ExpOpOperandAdaptor; |
1326 | | static StringRef getOperationName(); |
1327 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1328 | | Operation::operand_range getODSOperands(unsigned index); |
1329 | | Value operand(); |
1330 | | ::mlir::MutableOperandRange operandMutable(); |
1331 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1332 | | Operation::result_range getODSResults(unsigned index); |
1333 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1334 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1335 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1336 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1337 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1338 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1339 | | void print(OpAsmPrinter &p); |
1340 | | LogicalResult verify(); |
1341 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1342 | | }; |
1343 | | |
1344 | | //===----------------------------------------------------------------------===// |
1345 | | // ExtractElementOp declarations |
1346 | | //===----------------------------------------------------------------------===// |
1347 | | |
1348 | | class ExtractElementOpOperandAdaptor { |
1349 | | public: |
1350 | | ExtractElementOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1351 | | ExtractElementOpOperandAdaptor(ExtractElementOp& op); |
1352 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1353 | | ValueRange getODSOperands(unsigned index); |
1354 | | Value aggregate(); |
1355 | | ValueRange indices(); |
1356 | | |
1357 | | private: |
1358 | | ValueRange odsOperands; |
1359 | | DictionaryAttr odsAttrs; |
1360 | | }; |
1361 | | class ExtractElementOp : public Op<ExtractElementOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, MemoryEffectOpInterface::Trait> { |
1362 | | public: |
1363 | | using Op::Op; |
1364 | | using OperandAdaptor = ExtractElementOpOperandAdaptor; |
1365 | | static StringRef getOperationName(); |
1366 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1367 | | Operation::operand_range getODSOperands(unsigned index); |
1368 | | Value aggregate(); |
1369 | | Operation::operand_range indices(); |
1370 | | ::mlir::MutableOperandRange aggregateMutable(); |
1371 | | ::mlir::MutableOperandRange indicesMutable(); |
1372 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1373 | | Operation::result_range getODSResults(unsigned index); |
1374 | | Value result(); |
1375 | | static void build(OpBuilder &builder, OperationState &result, Value aggregate,ValueRange indices = {}); |
1376 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value aggregate, ValueRange indices); |
1377 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value aggregate, ValueRange indices); |
1378 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1379 | | LogicalResult verify(); |
1380 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1381 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1382 | | void print(OpAsmPrinter &p); |
1383 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1384 | | |
1385 | 0 | Value getAggregate() { return getOperand(0); } |
1386 | | |
1387 | 0 | operand_range getIndices() { |
1388 | 0 | return {operand_begin() + 1, operand_end()}; |
1389 | 0 | } |
1390 | | |
1391 | | }; |
1392 | | |
1393 | | //===----------------------------------------------------------------------===// |
1394 | | // FPExtOp declarations |
1395 | | //===----------------------------------------------------------------------===// |
1396 | | |
1397 | | class FPExtOpOperandAdaptor { |
1398 | | public: |
1399 | | FPExtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1400 | | FPExtOpOperandAdaptor(FPExtOp& op); |
1401 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1402 | | ValueRange getODSOperands(unsigned index); |
1403 | | Value in(); |
1404 | | |
1405 | | private: |
1406 | | ValueRange odsOperands; |
1407 | | DictionaryAttr odsAttrs; |
1408 | | }; |
1409 | | class FPExtOp : public Op<FPExtOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1410 | | public: |
1411 | | using Op::Op; |
1412 | | using OperandAdaptor = FPExtOpOperandAdaptor; |
1413 | | static StringRef getOperationName(); |
1414 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1415 | | Operation::operand_range getODSOperands(unsigned index); |
1416 | | Value in(); |
1417 | | ::mlir::MutableOperandRange inMutable(); |
1418 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1419 | | Operation::result_range getODSResults(unsigned index); |
1420 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
1421 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in); |
1422 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in); |
1423 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1424 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1425 | | void print(OpAsmPrinter &p); |
1426 | | LogicalResult verify(); |
1427 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1428 | | |
1429 | | /// Return true if `a` and `b` are valid operand and result pairs for |
1430 | | /// the operation. |
1431 | | static bool areCastCompatible(Type a, Type b); |
1432 | | |
1433 | | }; |
1434 | | |
1435 | | //===----------------------------------------------------------------------===// |
1436 | | // FPToSIOp declarations |
1437 | | //===----------------------------------------------------------------------===// |
1438 | | |
1439 | | class FPToSIOpOperandAdaptor { |
1440 | | public: |
1441 | | FPToSIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1442 | | FPToSIOpOperandAdaptor(FPToSIOp& op); |
1443 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1444 | | ValueRange getODSOperands(unsigned index); |
1445 | | Value in(); |
1446 | | |
1447 | | private: |
1448 | | ValueRange odsOperands; |
1449 | | DictionaryAttr odsAttrs; |
1450 | | }; |
1451 | | class FPToSIOp : public Op<FPToSIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1452 | | public: |
1453 | | using Op::Op; |
1454 | | using OperandAdaptor = FPToSIOpOperandAdaptor; |
1455 | | static StringRef getOperationName(); |
1456 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1457 | | Operation::operand_range getODSOperands(unsigned index); |
1458 | | Value in(); |
1459 | | ::mlir::MutableOperandRange inMutable(); |
1460 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1461 | | Operation::result_range getODSResults(unsigned index); |
1462 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
1463 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in); |
1464 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in); |
1465 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1466 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1467 | | void print(OpAsmPrinter &p); |
1468 | | LogicalResult verify(); |
1469 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1470 | | |
1471 | | /// Return true if `a` and `b` are valid operand and result pairs for |
1472 | | /// the operation. |
1473 | | static bool areCastCompatible(Type a, Type b); |
1474 | | |
1475 | | }; |
1476 | | |
1477 | | //===----------------------------------------------------------------------===// |
1478 | | // FPTruncOp declarations |
1479 | | //===----------------------------------------------------------------------===// |
1480 | | |
1481 | | class FPTruncOpOperandAdaptor { |
1482 | | public: |
1483 | | FPTruncOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1484 | | FPTruncOpOperandAdaptor(FPTruncOp& op); |
1485 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1486 | | ValueRange getODSOperands(unsigned index); |
1487 | | Value in(); |
1488 | | |
1489 | | private: |
1490 | | ValueRange odsOperands; |
1491 | | DictionaryAttr odsAttrs; |
1492 | | }; |
1493 | | class FPTruncOp : public Op<FPTruncOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1494 | | public: |
1495 | | using Op::Op; |
1496 | | using OperandAdaptor = FPTruncOpOperandAdaptor; |
1497 | | static StringRef getOperationName(); |
1498 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1499 | | Operation::operand_range getODSOperands(unsigned index); |
1500 | | Value in(); |
1501 | | ::mlir::MutableOperandRange inMutable(); |
1502 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1503 | | Operation::result_range getODSResults(unsigned index); |
1504 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
1505 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in); |
1506 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in); |
1507 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1508 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1509 | | void print(OpAsmPrinter &p); |
1510 | | LogicalResult verify(); |
1511 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1512 | | |
1513 | | /// Return true if `a` and `b` are valid operand and result pairs for |
1514 | | /// the operation. |
1515 | | static bool areCastCompatible(Type a, Type b); |
1516 | | |
1517 | | }; |
1518 | | |
1519 | | //===----------------------------------------------------------------------===// |
1520 | | // GenericAtomicRMWOp declarations |
1521 | | //===----------------------------------------------------------------------===// |
1522 | | |
1523 | | class GenericAtomicRMWOpOperandAdaptor { |
1524 | | public: |
1525 | | GenericAtomicRMWOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1526 | | GenericAtomicRMWOpOperandAdaptor(GenericAtomicRMWOp& op); |
1527 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1528 | | ValueRange getODSOperands(unsigned index); |
1529 | | Value memref(); |
1530 | | ValueRange indices(); |
1531 | | |
1532 | | private: |
1533 | | ValueRange odsOperands; |
1534 | | DictionaryAttr odsAttrs; |
1535 | | }; |
1536 | | class GenericAtomicRMWOp : public Op<GenericAtomicRMWOp, OpTrait::OneRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, OpTrait::SingleBlockImplicitTerminator<AtomicYieldOp>::Impl> { |
1537 | | public: |
1538 | | using Op::Op; |
1539 | | using OperandAdaptor = GenericAtomicRMWOpOperandAdaptor; |
1540 | | static StringRef getOperationName(); |
1541 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1542 | | Operation::operand_range getODSOperands(unsigned index); |
1543 | | Value memref(); |
1544 | | Operation::operand_range indices(); |
1545 | | ::mlir::MutableOperandRange memrefMutable(); |
1546 | | ::mlir::MutableOperandRange indicesMutable(); |
1547 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1548 | | Operation::result_range getODSResults(unsigned index); |
1549 | | Value result(); |
1550 | | Region &body(); |
1551 | | static void build(OpBuilder &builder, OperationState &result, Value memref, ValueRange ivs); |
1552 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1553 | | void print(OpAsmPrinter &p); |
1554 | | LogicalResult verify(); |
1555 | | |
1556 | | // The value stored in memref[ivs]. |
1557 | 0 | Value getCurrentValue() { |
1558 | 0 | return body().front().getArgument(0); |
1559 | 0 | } |
1560 | 0 | MemRefType getMemRefType() { |
1561 | 0 | return memref().getType().cast<MemRefType>(); |
1562 | 0 | } |
1563 | | |
1564 | | }; |
1565 | | |
1566 | | //===----------------------------------------------------------------------===// |
1567 | | // ImOp declarations |
1568 | | //===----------------------------------------------------------------------===// |
1569 | | |
1570 | | class ImOpOperandAdaptor { |
1571 | | public: |
1572 | | ImOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1573 | | ImOpOperandAdaptor(ImOp& op); |
1574 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1575 | | ValueRange getODSOperands(unsigned index); |
1576 | | Value complex(); |
1577 | | |
1578 | | private: |
1579 | | ValueRange odsOperands; |
1580 | | DictionaryAttr odsAttrs; |
1581 | | }; |
1582 | | class ImOp : public Op<ImOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1583 | | public: |
1584 | | using Op::Op; |
1585 | | using OperandAdaptor = ImOpOperandAdaptor; |
1586 | | static StringRef getOperationName(); |
1587 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1588 | | Operation::operand_range getODSOperands(unsigned index); |
1589 | | Value complex(); |
1590 | | ::mlir::MutableOperandRange complexMutable(); |
1591 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1592 | | Operation::result_range getODSResults(unsigned index); |
1593 | | Value imaginary(); |
1594 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type imaginary, Value complex); |
1595 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value complex); |
1596 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1597 | | LogicalResult verify(); |
1598 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1599 | | void print(OpAsmPrinter &p); |
1600 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1601 | | }; |
1602 | | |
1603 | | //===----------------------------------------------------------------------===// |
1604 | | // IndexCastOp declarations |
1605 | | //===----------------------------------------------------------------------===// |
1606 | | |
1607 | | class IndexCastOpOperandAdaptor { |
1608 | | public: |
1609 | | IndexCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1610 | | IndexCastOpOperandAdaptor(IndexCastOp& op); |
1611 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1612 | | ValueRange getODSOperands(unsigned index); |
1613 | | Value in(); |
1614 | | |
1615 | | private: |
1616 | | ValueRange odsOperands; |
1617 | | DictionaryAttr odsAttrs; |
1618 | | }; |
1619 | | class IndexCastOp : public Op<IndexCastOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1620 | | public: |
1621 | | using Op::Op; |
1622 | | using OperandAdaptor = IndexCastOpOperandAdaptor; |
1623 | | static StringRef getOperationName(); |
1624 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1625 | | Operation::operand_range getODSOperands(unsigned index); |
1626 | | Value in(); |
1627 | | ::mlir::MutableOperandRange inMutable(); |
1628 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1629 | | Operation::result_range getODSResults(unsigned index); |
1630 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
1631 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in); |
1632 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in); |
1633 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1634 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1635 | | void print(OpAsmPrinter &p); |
1636 | | LogicalResult verify(); |
1637 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1638 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1639 | | |
1640 | | /// Return true if `a` and `b` are valid operand and result pairs for |
1641 | | /// the operation. |
1642 | | static bool areCastCompatible(Type a, Type b); |
1643 | | |
1644 | | }; |
1645 | | |
1646 | | //===----------------------------------------------------------------------===// |
1647 | | // LoadOp declarations |
1648 | | //===----------------------------------------------------------------------===// |
1649 | | |
1650 | | class LoadOpOperandAdaptor { |
1651 | | public: |
1652 | | LoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1653 | | LoadOpOperandAdaptor(LoadOp& op); |
1654 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1655 | | ValueRange getODSOperands(unsigned index); |
1656 | | Value memref(); |
1657 | | ValueRange indices(); |
1658 | | |
1659 | | private: |
1660 | | ValueRange odsOperands; |
1661 | | DictionaryAttr odsAttrs; |
1662 | | }; |
1663 | | class LoadOp : public Op<LoadOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, MemoryEffectOpInterface::Trait> { |
1664 | | public: |
1665 | | using Op::Op; |
1666 | | using OperandAdaptor = LoadOpOperandAdaptor; |
1667 | | static StringRef getOperationName(); |
1668 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1669 | | Operation::operand_range getODSOperands(unsigned index); |
1670 | | Value memref(); |
1671 | | Operation::operand_range indices(); |
1672 | | ::mlir::MutableOperandRange memrefMutable(); |
1673 | | ::mlir::MutableOperandRange indicesMutable(); |
1674 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1675 | | Operation::result_range getODSResults(unsigned index); |
1676 | | Value result(); |
1677 | | static void build(OpBuilder &, OperationState &result, Value memref,ValueRange indices = {}); |
1678 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices); |
1679 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices); |
1680 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1681 | | LogicalResult verify(); |
1682 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1683 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1684 | | void print(OpAsmPrinter &p); |
1685 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1686 | | |
1687 | 0 | Value getMemRef() { return getOperand(0); } |
1688 | 0 | void setMemRef(Value value) { setOperand(0, value); } |
1689 | 0 | MemRefType getMemRefType() { |
1690 | 0 | return getMemRef().getType().cast<MemRefType>(); |
1691 | 0 | } |
1692 | | |
1693 | 0 | operand_range getIndices() { return {operand_begin() + 1, operand_end()}; } |
1694 | | |
1695 | | }; |
1696 | | |
1697 | | //===----------------------------------------------------------------------===// |
1698 | | // Log10Op declarations |
1699 | | //===----------------------------------------------------------------------===// |
1700 | | |
1701 | | class Log10OpOperandAdaptor { |
1702 | | public: |
1703 | | Log10OpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1704 | | Log10OpOperandAdaptor(Log10Op& op); |
1705 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1706 | | ValueRange getODSOperands(unsigned index); |
1707 | | Value operand(); |
1708 | | |
1709 | | private: |
1710 | | ValueRange odsOperands; |
1711 | | DictionaryAttr odsAttrs; |
1712 | | }; |
1713 | | class Log10Op : public Op<Log10Op, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1714 | | public: |
1715 | | using Op::Op; |
1716 | | using OperandAdaptor = Log10OpOperandAdaptor; |
1717 | | static StringRef getOperationName(); |
1718 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1719 | | Operation::operand_range getODSOperands(unsigned index); |
1720 | | Value operand(); |
1721 | | ::mlir::MutableOperandRange operandMutable(); |
1722 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1723 | | Operation::result_range getODSResults(unsigned index); |
1724 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1725 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1726 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1727 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1728 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1729 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1730 | | void print(OpAsmPrinter &p); |
1731 | | LogicalResult verify(); |
1732 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1733 | | }; |
1734 | | |
1735 | | //===----------------------------------------------------------------------===// |
1736 | | // Log2Op declarations |
1737 | | //===----------------------------------------------------------------------===// |
1738 | | |
1739 | | class Log2OpOperandAdaptor { |
1740 | | public: |
1741 | | Log2OpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1742 | | Log2OpOperandAdaptor(Log2Op& op); |
1743 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1744 | | ValueRange getODSOperands(unsigned index); |
1745 | | Value operand(); |
1746 | | |
1747 | | private: |
1748 | | ValueRange odsOperands; |
1749 | | DictionaryAttr odsAttrs; |
1750 | | }; |
1751 | | class Log2Op : public Op<Log2Op, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1752 | | public: |
1753 | | using Op::Op; |
1754 | | using OperandAdaptor = Log2OpOperandAdaptor; |
1755 | | static StringRef getOperationName(); |
1756 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1757 | | Operation::operand_range getODSOperands(unsigned index); |
1758 | | Value operand(); |
1759 | | ::mlir::MutableOperandRange operandMutable(); |
1760 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1761 | | Operation::result_range getODSResults(unsigned index); |
1762 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1763 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1764 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1765 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1766 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1767 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1768 | | void print(OpAsmPrinter &p); |
1769 | | LogicalResult verify(); |
1770 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1771 | | }; |
1772 | | |
1773 | | //===----------------------------------------------------------------------===// |
1774 | | // LogOp declarations |
1775 | | //===----------------------------------------------------------------------===// |
1776 | | |
1777 | | class LogOpOperandAdaptor { |
1778 | | public: |
1779 | | LogOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1780 | | LogOpOperandAdaptor(LogOp& op); |
1781 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1782 | | ValueRange getODSOperands(unsigned index); |
1783 | | Value operand(); |
1784 | | |
1785 | | private: |
1786 | | ValueRange odsOperands; |
1787 | | DictionaryAttr odsAttrs; |
1788 | | }; |
1789 | | class LogOp : public Op<LogOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1790 | | public: |
1791 | | using Op::Op; |
1792 | | using OperandAdaptor = LogOpOperandAdaptor; |
1793 | | static StringRef getOperationName(); |
1794 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1795 | | Operation::operand_range getODSOperands(unsigned index); |
1796 | | Value operand(); |
1797 | | ::mlir::MutableOperandRange operandMutable(); |
1798 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1799 | | Operation::result_range getODSResults(unsigned index); |
1800 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1801 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1802 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1803 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1804 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1805 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1806 | | void print(OpAsmPrinter &p); |
1807 | | LogicalResult verify(); |
1808 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1809 | | }; |
1810 | | |
1811 | | //===----------------------------------------------------------------------===// |
1812 | | // MemRefCastOp declarations |
1813 | | //===----------------------------------------------------------------------===// |
1814 | | |
1815 | | class MemRefCastOpOperandAdaptor { |
1816 | | public: |
1817 | | MemRefCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1818 | | MemRefCastOpOperandAdaptor(MemRefCastOp& op); |
1819 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1820 | | ValueRange getODSOperands(unsigned index); |
1821 | | Value source(); |
1822 | | |
1823 | | private: |
1824 | | ValueRange odsOperands; |
1825 | | DictionaryAttr odsAttrs; |
1826 | | }; |
1827 | | class MemRefCastOp : public Op<MemRefCastOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
1828 | | public: |
1829 | | using Op::Op; |
1830 | | using OperandAdaptor = MemRefCastOpOperandAdaptor; |
1831 | | static StringRef getOperationName(); |
1832 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1833 | | Operation::operand_range getODSOperands(unsigned index); |
1834 | | Value source(); |
1835 | | ::mlir::MutableOperandRange sourceMutable(); |
1836 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1837 | | Operation::result_range getODSResults(unsigned index); |
1838 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
1839 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value source); |
1840 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source); |
1841 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1842 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1843 | | void print(OpAsmPrinter &p); |
1844 | | LogicalResult verify(); |
1845 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1846 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1847 | | |
1848 | | /// Return true if `a` and `b` are valid operand and result pairs for |
1849 | | /// the operation. |
1850 | | static bool areCastCompatible(Type a, Type b); |
1851 | | |
1852 | | /// The result of a memref_cast is always a memref. |
1853 | 0 | Type getType() { return getResult().getType(); } |
1854 | | |
1855 | | }; |
1856 | | |
1857 | | //===----------------------------------------------------------------------===// |
1858 | | // MulFOp declarations |
1859 | | //===----------------------------------------------------------------------===// |
1860 | | |
1861 | | class MulFOpOperandAdaptor { |
1862 | | public: |
1863 | | MulFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1864 | | MulFOpOperandAdaptor(MulFOp& op); |
1865 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1866 | | ValueRange getODSOperands(unsigned index); |
1867 | | Value lhs(); |
1868 | | Value rhs(); |
1869 | | |
1870 | | private: |
1871 | | ValueRange odsOperands; |
1872 | | DictionaryAttr odsAttrs; |
1873 | | }; |
1874 | | class MulFOp : public Op<MulFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
1875 | | public: |
1876 | | using Op::Op; |
1877 | | using OperandAdaptor = MulFOpOperandAdaptor; |
1878 | | static StringRef getOperationName(); |
1879 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1880 | | Operation::operand_range getODSOperands(unsigned index); |
1881 | | Value lhs(); |
1882 | | Value rhs(); |
1883 | | ::mlir::MutableOperandRange lhsMutable(); |
1884 | | ::mlir::MutableOperandRange rhsMutable(); |
1885 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1886 | | Operation::result_range getODSResults(unsigned index); |
1887 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
1888 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
1889 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1890 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
1891 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1892 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1893 | | void print(OpAsmPrinter &p); |
1894 | | LogicalResult verify(); |
1895 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1896 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1897 | | }; |
1898 | | |
1899 | | //===----------------------------------------------------------------------===// |
1900 | | // MulIOp declarations |
1901 | | //===----------------------------------------------------------------------===// |
1902 | | |
1903 | | class MulIOpOperandAdaptor { |
1904 | | public: |
1905 | | MulIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1906 | | MulIOpOperandAdaptor(MulIOp& op); |
1907 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1908 | | ValueRange getODSOperands(unsigned index); |
1909 | | Value lhs(); |
1910 | | Value rhs(); |
1911 | | |
1912 | | private: |
1913 | | ValueRange odsOperands; |
1914 | | DictionaryAttr odsAttrs; |
1915 | | }; |
1916 | | class MulIOp : public Op<MulIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::IsCommutative, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
1917 | | public: |
1918 | | using Op::Op; |
1919 | | using OperandAdaptor = MulIOpOperandAdaptor; |
1920 | | static StringRef getOperationName(); |
1921 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1922 | | Operation::operand_range getODSOperands(unsigned index); |
1923 | | Value lhs(); |
1924 | | Value rhs(); |
1925 | | ::mlir::MutableOperandRange lhsMutable(); |
1926 | | ::mlir::MutableOperandRange rhsMutable(); |
1927 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1928 | | Operation::result_range getODSResults(unsigned index); |
1929 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
1930 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
1931 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1932 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
1933 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1934 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1935 | | void print(OpAsmPrinter &p); |
1936 | | LogicalResult verify(); |
1937 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
1938 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1939 | | }; |
1940 | | |
1941 | | //===----------------------------------------------------------------------===// |
1942 | | // NegFOp declarations |
1943 | | //===----------------------------------------------------------------------===// |
1944 | | |
1945 | | class NegFOpOperandAdaptor { |
1946 | | public: |
1947 | | NegFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1948 | | NegFOpOperandAdaptor(NegFOp& op); |
1949 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1950 | | ValueRange getODSOperands(unsigned index); |
1951 | | Value operand(); |
1952 | | |
1953 | | private: |
1954 | | ValueRange odsOperands; |
1955 | | DictionaryAttr odsAttrs; |
1956 | | }; |
1957 | | class NegFOp : public Op<NegFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
1958 | | public: |
1959 | | using Op::Op; |
1960 | | using OperandAdaptor = NegFOpOperandAdaptor; |
1961 | | static StringRef getOperationName(); |
1962 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1963 | | Operation::operand_range getODSOperands(unsigned index); |
1964 | | Value operand(); |
1965 | | ::mlir::MutableOperandRange operandMutable(); |
1966 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
1967 | | Operation::result_range getODSResults(unsigned index); |
1968 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
1969 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
1970 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1971 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
1972 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
1973 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
1974 | | void print(OpAsmPrinter &p); |
1975 | | LogicalResult verify(); |
1976 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
1977 | | }; |
1978 | | |
1979 | | //===----------------------------------------------------------------------===// |
1980 | | // OrOp declarations |
1981 | | //===----------------------------------------------------------------------===// |
1982 | | |
1983 | | class OrOpOperandAdaptor { |
1984 | | public: |
1985 | | OrOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
1986 | | OrOpOperandAdaptor(OrOp& op); |
1987 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
1988 | | ValueRange getODSOperands(unsigned index); |
1989 | | Value lhs(); |
1990 | | Value rhs(); |
1991 | | |
1992 | | private: |
1993 | | ValueRange odsOperands; |
1994 | | DictionaryAttr odsAttrs; |
1995 | | }; |
1996 | | class OrOp : public Op<OrOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::IsCommutative, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
1997 | | public: |
1998 | | using Op::Op; |
1999 | | using OperandAdaptor = OrOpOperandAdaptor; |
2000 | | static StringRef getOperationName(); |
2001 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2002 | | Operation::operand_range getODSOperands(unsigned index); |
2003 | | Value lhs(); |
2004 | | Value rhs(); |
2005 | | ::mlir::MutableOperandRange lhsMutable(); |
2006 | | ::mlir::MutableOperandRange rhsMutable(); |
2007 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2008 | | Operation::result_range getODSResults(unsigned index); |
2009 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2010 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2011 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2012 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2013 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2014 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2015 | | void print(OpAsmPrinter &p); |
2016 | | LogicalResult verify(); |
2017 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2018 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2019 | | }; |
2020 | | |
2021 | | //===----------------------------------------------------------------------===// |
2022 | | // PrefetchOp declarations |
2023 | | //===----------------------------------------------------------------------===// |
2024 | | |
2025 | | class PrefetchOpOperandAdaptor { |
2026 | | public: |
2027 | | PrefetchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2028 | | PrefetchOpOperandAdaptor(PrefetchOp& op); |
2029 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2030 | | ValueRange getODSOperands(unsigned index); |
2031 | | Value memref(); |
2032 | | ValueRange indices(); |
2033 | | BoolAttr isWrite(); |
2034 | | IntegerAttr localityHint(); |
2035 | | BoolAttr isDataCache(); |
2036 | | |
2037 | | private: |
2038 | | ValueRange odsOperands; |
2039 | | DictionaryAttr odsAttrs; |
2040 | | }; |
2041 | | class PrefetchOp : public Op<PrefetchOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl> { |
2042 | | public: |
2043 | | using Op::Op; |
2044 | | using OperandAdaptor = PrefetchOpOperandAdaptor; |
2045 | | static StringRef getOperationName(); |
2046 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2047 | | Operation::operand_range getODSOperands(unsigned index); |
2048 | | Value memref(); |
2049 | | Operation::operand_range indices(); |
2050 | | ::mlir::MutableOperandRange memrefMutable(); |
2051 | | ::mlir::MutableOperandRange indicesMutable(); |
2052 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2053 | | Operation::result_range getODSResults(unsigned index); |
2054 | | BoolAttr isWriteAttr(); |
2055 | | bool isWrite(); |
2056 | | IntegerAttr localityHintAttr(); |
2057 | | APInt localityHint(); |
2058 | | BoolAttr isDataCacheAttr(); |
2059 | | bool isDataCache(); |
2060 | | void isWriteAttr(BoolAttr attr); |
2061 | | void localityHintAttr(IntegerAttr attr); |
2062 | | void isDataCacheAttr(BoolAttr attr); |
2063 | | static void build(OpBuilder &builder, OperationState &result, Value memref,ArrayRef<Value> indices, bool isWrite, unsigned hint, bool isData); |
2064 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache); |
2065 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache); |
2066 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache); |
2067 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache); |
2068 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2069 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2070 | | void print(OpAsmPrinter &p); |
2071 | | LogicalResult verify(); |
2072 | | LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results); |
2073 | | |
2074 | 0 | MemRefType getMemRefType() { |
2075 | 0 | return memref().getType().cast<MemRefType>(); |
2076 | 0 | } |
2077 | 0 | static StringRef getLocalityHintAttrName() { return "localityHint"; } |
2078 | 0 | static StringRef getIsWriteAttrName() { return "isWrite"; } |
2079 | 0 | static StringRef getIsDataCacheAttrName() { return "isDataCache"; } |
2080 | | |
2081 | | }; |
2082 | | |
2083 | | //===----------------------------------------------------------------------===// |
2084 | | // RankOp declarations |
2085 | | //===----------------------------------------------------------------------===// |
2086 | | |
2087 | | class RankOpOperandAdaptor { |
2088 | | public: |
2089 | | RankOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2090 | | RankOpOperandAdaptor(RankOp& op); |
2091 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2092 | | ValueRange getODSOperands(unsigned index); |
2093 | | |
2094 | | private: |
2095 | | ValueRange odsOperands; |
2096 | | DictionaryAttr odsAttrs; |
2097 | | }; |
2098 | | class RankOp : public Op<RankOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
2099 | | public: |
2100 | | using Op::Op; |
2101 | | using OperandAdaptor = RankOpOperandAdaptor; |
2102 | | static StringRef getOperationName(); |
2103 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2104 | | Operation::operand_range getODSOperands(unsigned index); |
2105 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2106 | | Operation::result_range getODSResults(unsigned index); |
2107 | | static void build(OpBuilder &builder, OperationState &result, Value tensor); |
2108 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value odsArg_0); |
2109 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value odsArg_0); |
2110 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2111 | | LogicalResult verify(); |
2112 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2113 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2114 | | void print(OpAsmPrinter &p); |
2115 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2116 | | }; |
2117 | | |
2118 | | //===----------------------------------------------------------------------===// |
2119 | | // ReOp declarations |
2120 | | //===----------------------------------------------------------------------===// |
2121 | | |
2122 | | class ReOpOperandAdaptor { |
2123 | | public: |
2124 | | ReOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2125 | | ReOpOperandAdaptor(ReOp& op); |
2126 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2127 | | ValueRange getODSOperands(unsigned index); |
2128 | | Value complex(); |
2129 | | |
2130 | | private: |
2131 | | ValueRange odsOperands; |
2132 | | DictionaryAttr odsAttrs; |
2133 | | }; |
2134 | | class ReOp : public Op<ReOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
2135 | | public: |
2136 | | using Op::Op; |
2137 | | using OperandAdaptor = ReOpOperandAdaptor; |
2138 | | static StringRef getOperationName(); |
2139 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2140 | | Operation::operand_range getODSOperands(unsigned index); |
2141 | | Value complex(); |
2142 | | ::mlir::MutableOperandRange complexMutable(); |
2143 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2144 | | Operation::result_range getODSResults(unsigned index); |
2145 | | Value real(); |
2146 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type real, Value complex); |
2147 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value complex); |
2148 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2149 | | LogicalResult verify(); |
2150 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2151 | | void print(OpAsmPrinter &p); |
2152 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2153 | | }; |
2154 | | |
2155 | | //===----------------------------------------------------------------------===// |
2156 | | // RemFOp declarations |
2157 | | //===----------------------------------------------------------------------===// |
2158 | | |
2159 | | class RemFOpOperandAdaptor { |
2160 | | public: |
2161 | | RemFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2162 | | RemFOpOperandAdaptor(RemFOp& op); |
2163 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2164 | | ValueRange getODSOperands(unsigned index); |
2165 | | Value lhs(); |
2166 | | Value rhs(); |
2167 | | |
2168 | | private: |
2169 | | ValueRange odsOperands; |
2170 | | DictionaryAttr odsAttrs; |
2171 | | }; |
2172 | | class RemFOp : public Op<RemFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2173 | | public: |
2174 | | using Op::Op; |
2175 | | using OperandAdaptor = RemFOpOperandAdaptor; |
2176 | | static StringRef getOperationName(); |
2177 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2178 | | Operation::operand_range getODSOperands(unsigned index); |
2179 | | Value lhs(); |
2180 | | Value rhs(); |
2181 | | ::mlir::MutableOperandRange lhsMutable(); |
2182 | | ::mlir::MutableOperandRange rhsMutable(); |
2183 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2184 | | Operation::result_range getODSResults(unsigned index); |
2185 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2186 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2187 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2188 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2189 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2190 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2191 | | void print(OpAsmPrinter &p); |
2192 | | LogicalResult verify(); |
2193 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2194 | | }; |
2195 | | |
2196 | | //===----------------------------------------------------------------------===// |
2197 | | // ReturnOp declarations |
2198 | | //===----------------------------------------------------------------------===// |
2199 | | |
2200 | | class ReturnOpOperandAdaptor { |
2201 | | public: |
2202 | | ReturnOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2203 | | ReturnOpOperandAdaptor(ReturnOp& op); |
2204 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2205 | | ValueRange getODSOperands(unsigned index); |
2206 | | ValueRange operands(); |
2207 | | |
2208 | | private: |
2209 | | ValueRange odsOperands; |
2210 | | DictionaryAttr odsAttrs; |
2211 | | }; |
2212 | | class ReturnOp : public Op<ReturnOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait, OpTrait::HasParent<FuncOp>::Impl, OpTrait::ReturnLike, OpTrait::IsTerminator> { |
2213 | | public: |
2214 | | using Op::Op; |
2215 | | using OperandAdaptor = ReturnOpOperandAdaptor; |
2216 | | static StringRef getOperationName(); |
2217 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2218 | | Operation::operand_range getODSOperands(unsigned index); |
2219 | | Operation::operand_range operands(); |
2220 | | ::mlir::MutableOperandRange operandsMutable(); |
2221 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2222 | | Operation::result_range getODSResults(unsigned index); |
2223 | | static void build(OpBuilder &b, OperationState &result); |
2224 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands); |
2225 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands); |
2226 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2227 | | LogicalResult verify(); |
2228 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2229 | | void print(OpAsmPrinter &p); |
2230 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2231 | | }; |
2232 | | |
2233 | | //===----------------------------------------------------------------------===// |
2234 | | // RsqrtOp declarations |
2235 | | //===----------------------------------------------------------------------===// |
2236 | | |
2237 | | class RsqrtOpOperandAdaptor { |
2238 | | public: |
2239 | | RsqrtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2240 | | RsqrtOpOperandAdaptor(RsqrtOp& op); |
2241 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2242 | | ValueRange getODSOperands(unsigned index); |
2243 | | Value operand(); |
2244 | | |
2245 | | private: |
2246 | | ValueRange odsOperands; |
2247 | | DictionaryAttr odsAttrs; |
2248 | | }; |
2249 | | class RsqrtOp : public Op<RsqrtOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
2250 | | public: |
2251 | | using Op::Op; |
2252 | | using OperandAdaptor = RsqrtOpOperandAdaptor; |
2253 | | static StringRef getOperationName(); |
2254 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2255 | | Operation::operand_range getODSOperands(unsigned index); |
2256 | | Value operand(); |
2257 | | ::mlir::MutableOperandRange operandMutable(); |
2258 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2259 | | Operation::result_range getODSResults(unsigned index); |
2260 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
2261 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
2262 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2263 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
2264 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2265 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2266 | | void print(OpAsmPrinter &p); |
2267 | | LogicalResult verify(); |
2268 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2269 | | }; |
2270 | | |
2271 | | //===----------------------------------------------------------------------===// |
2272 | | // SIToFPOp declarations |
2273 | | //===----------------------------------------------------------------------===// |
2274 | | |
2275 | | class SIToFPOpOperandAdaptor { |
2276 | | public: |
2277 | | SIToFPOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2278 | | SIToFPOpOperandAdaptor(SIToFPOp& op); |
2279 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2280 | | ValueRange getODSOperands(unsigned index); |
2281 | | Value in(); |
2282 | | |
2283 | | private: |
2284 | | ValueRange odsOperands; |
2285 | | DictionaryAttr odsAttrs; |
2286 | | }; |
2287 | | class SIToFPOp : public Op<SIToFPOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
2288 | | public: |
2289 | | using Op::Op; |
2290 | | using OperandAdaptor = SIToFPOpOperandAdaptor; |
2291 | | static StringRef getOperationName(); |
2292 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2293 | | Operation::operand_range getODSOperands(unsigned index); |
2294 | | Value in(); |
2295 | | ::mlir::MutableOperandRange inMutable(); |
2296 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2297 | | Operation::result_range getODSResults(unsigned index); |
2298 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
2299 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value in); |
2300 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value in); |
2301 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2302 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2303 | | void print(OpAsmPrinter &p); |
2304 | | LogicalResult verify(); |
2305 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2306 | | |
2307 | | /// Return true if `a` and `b` are valid operand and result pairs for |
2308 | | /// the operation. |
2309 | | static bool areCastCompatible(Type a, Type b); |
2310 | | |
2311 | | }; |
2312 | | |
2313 | | //===----------------------------------------------------------------------===// |
2314 | | // SelectOp declarations |
2315 | | //===----------------------------------------------------------------------===// |
2316 | | |
2317 | | class SelectOpOperandAdaptor { |
2318 | | public: |
2319 | | SelectOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2320 | | SelectOpOperandAdaptor(SelectOp& op); |
2321 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2322 | | ValueRange getODSOperands(unsigned index); |
2323 | | Value condition(); |
2324 | | Value true_value(); |
2325 | | Value false_value(); |
2326 | | |
2327 | | private: |
2328 | | ValueRange odsOperands; |
2329 | | DictionaryAttr odsAttrs; |
2330 | | }; |
2331 | | class SelectOp : public Op<SelectOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<3>::Impl, MemoryEffectOpInterface::Trait> { |
2332 | | public: |
2333 | | using Op::Op; |
2334 | | using OperandAdaptor = SelectOpOperandAdaptor; |
2335 | | static StringRef getOperationName(); |
2336 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2337 | | Operation::operand_range getODSOperands(unsigned index); |
2338 | | Value condition(); |
2339 | | Value true_value(); |
2340 | | Value false_value(); |
2341 | | ::mlir::MutableOperandRange conditionMutable(); |
2342 | | ::mlir::MutableOperandRange true_valueMutable(); |
2343 | | ::mlir::MutableOperandRange false_valueMutable(); |
2344 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2345 | | Operation::result_range getODSResults(unsigned index); |
2346 | | Value result(); |
2347 | | static void build(OpBuilder &builder, OperationState &result, Value condition,Value trueValue, Value falseValue); |
2348 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value condition, Value true_value, Value false_value); |
2349 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value condition, Value true_value, Value false_value); |
2350 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2351 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2352 | | void print(OpAsmPrinter &p); |
2353 | | LogicalResult verify(); |
2354 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2355 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2356 | | |
2357 | 0 | Value getCondition() { return condition(); } |
2358 | 0 | Value getTrueValue() { return true_value(); } |
2359 | 0 | Value getFalseValue() { return false_value(); } |
2360 | | |
2361 | | }; |
2362 | | |
2363 | | //===----------------------------------------------------------------------===// |
2364 | | // ShiftLeftOp declarations |
2365 | | //===----------------------------------------------------------------------===// |
2366 | | |
2367 | | class ShiftLeftOpOperandAdaptor { |
2368 | | public: |
2369 | | ShiftLeftOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2370 | | ShiftLeftOpOperandAdaptor(ShiftLeftOp& op); |
2371 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2372 | | ValueRange getODSOperands(unsigned index); |
2373 | | Value lhs(); |
2374 | | Value rhs(); |
2375 | | |
2376 | | private: |
2377 | | ValueRange odsOperands; |
2378 | | DictionaryAttr odsAttrs; |
2379 | | }; |
2380 | | class ShiftLeftOp : public Op<ShiftLeftOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2381 | | public: |
2382 | | using Op::Op; |
2383 | | using OperandAdaptor = ShiftLeftOpOperandAdaptor; |
2384 | | static StringRef getOperationName(); |
2385 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2386 | | Operation::operand_range getODSOperands(unsigned index); |
2387 | | Value lhs(); |
2388 | | Value rhs(); |
2389 | | ::mlir::MutableOperandRange lhsMutable(); |
2390 | | ::mlir::MutableOperandRange rhsMutable(); |
2391 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2392 | | Operation::result_range getODSResults(unsigned index); |
2393 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2394 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2395 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2396 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2397 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2398 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2399 | | void print(OpAsmPrinter &p); |
2400 | | LogicalResult verify(); |
2401 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2402 | | }; |
2403 | | |
2404 | | //===----------------------------------------------------------------------===// |
2405 | | // SignExtendIOp declarations |
2406 | | //===----------------------------------------------------------------------===// |
2407 | | |
2408 | | class SignExtendIOpOperandAdaptor { |
2409 | | public: |
2410 | | SignExtendIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2411 | | SignExtendIOpOperandAdaptor(SignExtendIOp& op); |
2412 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2413 | | ValueRange getODSOperands(unsigned index); |
2414 | | Value value(); |
2415 | | |
2416 | | private: |
2417 | | ValueRange odsOperands; |
2418 | | DictionaryAttr odsAttrs; |
2419 | | }; |
2420 | | class SignExtendIOp : public Op<SignExtendIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultShape> { |
2421 | | public: |
2422 | | using Op::Op; |
2423 | | using OperandAdaptor = SignExtendIOpOperandAdaptor; |
2424 | | static StringRef getOperationName(); |
2425 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2426 | | Operation::operand_range getODSOperands(unsigned index); |
2427 | | Value value(); |
2428 | | ::mlir::MutableOperandRange valueMutable(); |
2429 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2430 | | Operation::result_range getODSResults(unsigned index); |
2431 | | static void build(OpBuilder &builder, OperationState &result, Value value, Type destType); |
2432 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value); |
2433 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value); |
2434 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2435 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2436 | | void print(OpAsmPrinter &p); |
2437 | | LogicalResult verify(); |
2438 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2439 | | }; |
2440 | | |
2441 | | //===----------------------------------------------------------------------===// |
2442 | | // SignedDivIOp declarations |
2443 | | //===----------------------------------------------------------------------===// |
2444 | | |
2445 | | class SignedDivIOpOperandAdaptor { |
2446 | | public: |
2447 | | SignedDivIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2448 | | SignedDivIOpOperandAdaptor(SignedDivIOp& op); |
2449 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2450 | | ValueRange getODSOperands(unsigned index); |
2451 | | Value lhs(); |
2452 | | Value rhs(); |
2453 | | |
2454 | | private: |
2455 | | ValueRange odsOperands; |
2456 | | DictionaryAttr odsAttrs; |
2457 | | }; |
2458 | | class SignedDivIOp : public Op<SignedDivIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2459 | | public: |
2460 | | using Op::Op; |
2461 | | using OperandAdaptor = SignedDivIOpOperandAdaptor; |
2462 | | static StringRef getOperationName(); |
2463 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2464 | | Operation::operand_range getODSOperands(unsigned index); |
2465 | | Value lhs(); |
2466 | | Value rhs(); |
2467 | | ::mlir::MutableOperandRange lhsMutable(); |
2468 | | ::mlir::MutableOperandRange rhsMutable(); |
2469 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2470 | | Operation::result_range getODSResults(unsigned index); |
2471 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2472 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2473 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2474 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2475 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2476 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2477 | | void print(OpAsmPrinter &p); |
2478 | | LogicalResult verify(); |
2479 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2480 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2481 | | }; |
2482 | | |
2483 | | //===----------------------------------------------------------------------===// |
2484 | | // SignedRemIOp declarations |
2485 | | //===----------------------------------------------------------------------===// |
2486 | | |
2487 | | class SignedRemIOpOperandAdaptor { |
2488 | | public: |
2489 | | SignedRemIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2490 | | SignedRemIOpOperandAdaptor(SignedRemIOp& op); |
2491 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2492 | | ValueRange getODSOperands(unsigned index); |
2493 | | Value lhs(); |
2494 | | Value rhs(); |
2495 | | |
2496 | | private: |
2497 | | ValueRange odsOperands; |
2498 | | DictionaryAttr odsAttrs; |
2499 | | }; |
2500 | | class SignedRemIOp : public Op<SignedRemIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2501 | | public: |
2502 | | using Op::Op; |
2503 | | using OperandAdaptor = SignedRemIOpOperandAdaptor; |
2504 | | static StringRef getOperationName(); |
2505 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2506 | | Operation::operand_range getODSOperands(unsigned index); |
2507 | | Value lhs(); |
2508 | | Value rhs(); |
2509 | | ::mlir::MutableOperandRange lhsMutable(); |
2510 | | ::mlir::MutableOperandRange rhsMutable(); |
2511 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2512 | | Operation::result_range getODSResults(unsigned index); |
2513 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2514 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2515 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2516 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2517 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2518 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2519 | | void print(OpAsmPrinter &p); |
2520 | | LogicalResult verify(); |
2521 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2522 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2523 | | }; |
2524 | | |
2525 | | //===----------------------------------------------------------------------===// |
2526 | | // SignedShiftRightOp declarations |
2527 | | //===----------------------------------------------------------------------===// |
2528 | | |
2529 | | class SignedShiftRightOpOperandAdaptor { |
2530 | | public: |
2531 | | SignedShiftRightOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2532 | | SignedShiftRightOpOperandAdaptor(SignedShiftRightOp& op); |
2533 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2534 | | ValueRange getODSOperands(unsigned index); |
2535 | | Value lhs(); |
2536 | | Value rhs(); |
2537 | | |
2538 | | private: |
2539 | | ValueRange odsOperands; |
2540 | | DictionaryAttr odsAttrs; |
2541 | | }; |
2542 | | class SignedShiftRightOp : public Op<SignedShiftRightOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2543 | | public: |
2544 | | using Op::Op; |
2545 | | using OperandAdaptor = SignedShiftRightOpOperandAdaptor; |
2546 | | static StringRef getOperationName(); |
2547 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2548 | | Operation::operand_range getODSOperands(unsigned index); |
2549 | | Value lhs(); |
2550 | | Value rhs(); |
2551 | | ::mlir::MutableOperandRange lhsMutable(); |
2552 | | ::mlir::MutableOperandRange rhsMutable(); |
2553 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2554 | | Operation::result_range getODSResults(unsigned index); |
2555 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2556 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2557 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2558 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2559 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2560 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2561 | | void print(OpAsmPrinter &p); |
2562 | | LogicalResult verify(); |
2563 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2564 | | }; |
2565 | | |
2566 | | //===----------------------------------------------------------------------===// |
2567 | | // SinOp declarations |
2568 | | //===----------------------------------------------------------------------===// |
2569 | | |
2570 | | class SinOpOperandAdaptor { |
2571 | | public: |
2572 | | SinOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2573 | | SinOpOperandAdaptor(SinOp& op); |
2574 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2575 | | ValueRange getODSOperands(unsigned index); |
2576 | | Value operand(); |
2577 | | |
2578 | | private: |
2579 | | ValueRange odsOperands; |
2580 | | DictionaryAttr odsAttrs; |
2581 | | }; |
2582 | | class SinOp : public Op<SinOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
2583 | | public: |
2584 | | using Op::Op; |
2585 | | using OperandAdaptor = SinOpOperandAdaptor; |
2586 | | static StringRef getOperationName(); |
2587 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2588 | | Operation::operand_range getODSOperands(unsigned index); |
2589 | | Value operand(); |
2590 | | ::mlir::MutableOperandRange operandMutable(); |
2591 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2592 | | Operation::result_range getODSResults(unsigned index); |
2593 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
2594 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
2595 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2596 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
2597 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2598 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2599 | | void print(OpAsmPrinter &p); |
2600 | | LogicalResult verify(); |
2601 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2602 | | }; |
2603 | | |
2604 | | //===----------------------------------------------------------------------===// |
2605 | | // SplatOp declarations |
2606 | | //===----------------------------------------------------------------------===// |
2607 | | |
2608 | | class SplatOpOperandAdaptor { |
2609 | | public: |
2610 | | SplatOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2611 | | SplatOpOperandAdaptor(SplatOp& op); |
2612 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2613 | | ValueRange getODSOperands(unsigned index); |
2614 | | Value input(); |
2615 | | |
2616 | | private: |
2617 | | ValueRange odsOperands; |
2618 | | DictionaryAttr odsAttrs; |
2619 | | }; |
2620 | | class SplatOp : public Op<SplatOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
2621 | | public: |
2622 | | using Op::Op; |
2623 | | using OperandAdaptor = SplatOpOperandAdaptor; |
2624 | | static StringRef getOperationName(); |
2625 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2626 | | Operation::operand_range getODSOperands(unsigned index); |
2627 | | Value input(); |
2628 | | ::mlir::MutableOperandRange inputMutable(); |
2629 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2630 | | Operation::result_range getODSResults(unsigned index); |
2631 | | Value aggregate(); |
2632 | | static void build(OpBuilder &builder, OperationState &result, Value element, Type aggregateType); |
2633 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type aggregate, Value input); |
2634 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value input); |
2635 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2636 | | LogicalResult verify(); |
2637 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2638 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2639 | | void print(OpAsmPrinter &p); |
2640 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2641 | | }; |
2642 | | |
2643 | | //===----------------------------------------------------------------------===// |
2644 | | // SqrtOp declarations |
2645 | | //===----------------------------------------------------------------------===// |
2646 | | |
2647 | | class SqrtOpOperandAdaptor { |
2648 | | public: |
2649 | | SqrtOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2650 | | SqrtOpOperandAdaptor(SqrtOp& op); |
2651 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2652 | | ValueRange getODSOperands(unsigned index); |
2653 | | Value operand(); |
2654 | | |
2655 | | private: |
2656 | | ValueRange odsOperands; |
2657 | | DictionaryAttr odsAttrs; |
2658 | | }; |
2659 | | class SqrtOp : public Op<SqrtOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
2660 | | public: |
2661 | | using Op::Op; |
2662 | | using OperandAdaptor = SqrtOpOperandAdaptor; |
2663 | | static StringRef getOperationName(); |
2664 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2665 | | Operation::operand_range getODSOperands(unsigned index); |
2666 | | Value operand(); |
2667 | | ::mlir::MutableOperandRange operandMutable(); |
2668 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2669 | | Operation::result_range getODSResults(unsigned index); |
2670 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
2671 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
2672 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2673 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
2674 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2675 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2676 | | void print(OpAsmPrinter &p); |
2677 | | LogicalResult verify(); |
2678 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2679 | | }; |
2680 | | |
2681 | | //===----------------------------------------------------------------------===// |
2682 | | // StoreOp declarations |
2683 | | //===----------------------------------------------------------------------===// |
2684 | | |
2685 | | class StoreOpOperandAdaptor { |
2686 | | public: |
2687 | | StoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2688 | | StoreOpOperandAdaptor(StoreOp& op); |
2689 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2690 | | ValueRange getODSOperands(unsigned index); |
2691 | | Value value(); |
2692 | | Value memref(); |
2693 | | ValueRange indices(); |
2694 | | |
2695 | | private: |
2696 | | ValueRange odsOperands; |
2697 | | DictionaryAttr odsAttrs; |
2698 | | }; |
2699 | | class StoreOp : public Op<StoreOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<2>::Impl, MemoryEffectOpInterface::Trait> { |
2700 | | public: |
2701 | | using Op::Op; |
2702 | | using OperandAdaptor = StoreOpOperandAdaptor; |
2703 | | static StringRef getOperationName(); |
2704 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2705 | | Operation::operand_range getODSOperands(unsigned index); |
2706 | | Value value(); |
2707 | | Value memref(); |
2708 | | Operation::operand_range indices(); |
2709 | | ::mlir::MutableOperandRange valueMutable(); |
2710 | | ::mlir::MutableOperandRange memrefMutable(); |
2711 | | ::mlir::MutableOperandRange indicesMutable(); |
2712 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2713 | | Operation::result_range getODSResults(unsigned index); |
2714 | | static void build(OpBuilder &, OperationState &result, Value valueToStore, Value memref); |
2715 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value value, Value memref, ValueRange indices); |
2716 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value, Value memref, ValueRange indices); |
2717 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2718 | | LogicalResult verify(); |
2719 | | LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results); |
2720 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2721 | | void print(OpAsmPrinter &p); |
2722 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2723 | | |
2724 | 0 | Value getValueToStore() { return getOperand(0); } |
2725 | | |
2726 | 0 | Value getMemRef() { return getOperand(1); } |
2727 | 0 | void setMemRef(Value value) { setOperand(1, value); } |
2728 | 0 | MemRefType getMemRefType() { |
2729 | 0 | return getMemRef().getType().cast<MemRefType>(); |
2730 | 0 | } |
2731 | | |
2732 | 0 | operand_range getIndices() { |
2733 | 0 | return {operand_begin() + 2, operand_end()}; |
2734 | 0 | } |
2735 | | |
2736 | | }; |
2737 | | |
2738 | | //===----------------------------------------------------------------------===// |
2739 | | // SubCFOp declarations |
2740 | | //===----------------------------------------------------------------------===// |
2741 | | |
2742 | | class SubCFOpOperandAdaptor { |
2743 | | public: |
2744 | | SubCFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2745 | | SubCFOpOperandAdaptor(SubCFOp& op); |
2746 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2747 | | ValueRange getODSOperands(unsigned index); |
2748 | | Value lhs(); |
2749 | | Value rhs(); |
2750 | | |
2751 | | private: |
2752 | | ValueRange odsOperands; |
2753 | | DictionaryAttr odsAttrs; |
2754 | | }; |
2755 | | class SubCFOp : public Op<SubCFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2756 | | public: |
2757 | | using Op::Op; |
2758 | | using OperandAdaptor = SubCFOpOperandAdaptor; |
2759 | | static StringRef getOperationName(); |
2760 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2761 | | Operation::operand_range getODSOperands(unsigned index); |
2762 | | Value lhs(); |
2763 | | Value rhs(); |
2764 | | ::mlir::MutableOperandRange lhsMutable(); |
2765 | | ::mlir::MutableOperandRange rhsMutable(); |
2766 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2767 | | Operation::result_range getODSResults(unsigned index); |
2768 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2769 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2770 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2771 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2772 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2773 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2774 | | void print(OpAsmPrinter &p); |
2775 | | LogicalResult verify(); |
2776 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2777 | | }; |
2778 | | |
2779 | | //===----------------------------------------------------------------------===// |
2780 | | // SubFOp declarations |
2781 | | //===----------------------------------------------------------------------===// |
2782 | | |
2783 | | class SubFOpOperandAdaptor { |
2784 | | public: |
2785 | | SubFOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2786 | | SubFOpOperandAdaptor(SubFOp& op); |
2787 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2788 | | ValueRange getODSOperands(unsigned index); |
2789 | | Value lhs(); |
2790 | | Value rhs(); |
2791 | | |
2792 | | private: |
2793 | | ValueRange odsOperands; |
2794 | | DictionaryAttr odsAttrs; |
2795 | | }; |
2796 | | class SubFOp : public Op<SubFOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2797 | | public: |
2798 | | using Op::Op; |
2799 | | using OperandAdaptor = SubFOpOperandAdaptor; |
2800 | | static StringRef getOperationName(); |
2801 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2802 | | Operation::operand_range getODSOperands(unsigned index); |
2803 | | Value lhs(); |
2804 | | Value rhs(); |
2805 | | ::mlir::MutableOperandRange lhsMutable(); |
2806 | | ::mlir::MutableOperandRange rhsMutable(); |
2807 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2808 | | Operation::result_range getODSResults(unsigned index); |
2809 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2810 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2811 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2812 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2813 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2814 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2815 | | void print(OpAsmPrinter &p); |
2816 | | LogicalResult verify(); |
2817 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2818 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2819 | | }; |
2820 | | |
2821 | | //===----------------------------------------------------------------------===// |
2822 | | // SubIOp declarations |
2823 | | //===----------------------------------------------------------------------===// |
2824 | | |
2825 | | class SubIOpOperandAdaptor { |
2826 | | public: |
2827 | | SubIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
2828 | | SubIOpOperandAdaptor(SubIOp& op); |
2829 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2830 | | ValueRange getODSOperands(unsigned index); |
2831 | | Value lhs(); |
2832 | | Value rhs(); |
2833 | | |
2834 | | private: |
2835 | | ValueRange odsOperands; |
2836 | | DictionaryAttr odsAttrs; |
2837 | | }; |
2838 | | class SubIOp : public Op<SubIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
2839 | | public: |
2840 | | using Op::Op; |
2841 | | using OperandAdaptor = SubIOpOperandAdaptor; |
2842 | | static StringRef getOperationName(); |
2843 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2844 | | Operation::operand_range getODSOperands(unsigned index); |
2845 | | Value lhs(); |
2846 | | Value rhs(); |
2847 | | ::mlir::MutableOperandRange lhsMutable(); |
2848 | | ::mlir::MutableOperandRange rhsMutable(); |
2849 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2850 | | Operation::result_range getODSResults(unsigned index); |
2851 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
2852 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
2853 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2854 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
2855 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2856 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2857 | | void print(OpAsmPrinter &p); |
2858 | | LogicalResult verify(); |
2859 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
2860 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2861 | | }; |
2862 | | |
2863 | | //===----------------------------------------------------------------------===// |
2864 | | // SubViewOp declarations |
2865 | | //===----------------------------------------------------------------------===// |
2866 | | |
2867 | | class SubViewOpOperandAdaptor { |
2868 | | public: |
2869 | | SubViewOpOperandAdaptor(ValueRange values, DictionaryAttr attrs); |
2870 | | SubViewOpOperandAdaptor(SubViewOp& op); |
2871 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2872 | | ValueRange getODSOperands(unsigned index); |
2873 | | Value source(); |
2874 | | ValueRange offsets(); |
2875 | | ValueRange sizes(); |
2876 | | ValueRange strides(); |
2877 | | ArrayAttr static_offsets(); |
2878 | | ArrayAttr static_sizes(); |
2879 | | ArrayAttr static_strides(); |
2880 | | |
2881 | | private: |
2882 | | ValueRange odsOperands; |
2883 | | DictionaryAttr odsAttrs; |
2884 | | }; |
2885 | | class SubViewOp : public Op<SubViewOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, OpTrait::AttrSizedOperandSegments, ViewLikeOpInterface::Trait, MemoryEffectOpInterface::Trait> { |
2886 | | public: |
2887 | | using Op::Op; |
2888 | | using OperandAdaptor = SubViewOpOperandAdaptor; |
2889 | | static StringRef getOperationName(); |
2890 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
2891 | | Operation::operand_range getODSOperands(unsigned index); |
2892 | | Value source(); |
2893 | | Operation::operand_range offsets(); |
2894 | | Operation::operand_range sizes(); |
2895 | | Operation::operand_range strides(); |
2896 | | ::mlir::MutableOperandRange sourceMutable(); |
2897 | | ::mlir::MutableOperandRange offsetsMutable(); |
2898 | | ::mlir::MutableOperandRange sizesMutable(); |
2899 | | ::mlir::MutableOperandRange stridesMutable(); |
2900 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
2901 | | Operation::result_range getODSResults(unsigned index); |
2902 | | Value result(); |
2903 | | ArrayAttr static_offsetsAttr(); |
2904 | | ArrayAttr static_offsets(); |
2905 | | ArrayAttr static_sizesAttr(); |
2906 | | ArrayAttr static_sizes(); |
2907 | | ArrayAttr static_stridesAttr(); |
2908 | | ArrayAttr static_strides(); |
2909 | | void static_offsetsAttr(ArrayAttr attr); |
2910 | | void static_sizesAttr(ArrayAttr attr); |
2911 | | void static_stridesAttr(ArrayAttr attr); |
2912 | | static void build(OpBuilder &b, OperationState &result, Value source, ArrayRef<int64_t> staticOffsets, ArrayRef<int64_t> staticSizes,ArrayRef<int64_t> staticStrides, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayRef<NamedAttribute> attrs = {}); |
2913 | | static void build(OpBuilder &b, OperationState &result, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayRef<NamedAttribute> attrs = {}); |
2914 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayAttr static_offsets, ArrayAttr static_sizes, ArrayAttr static_strides); |
2915 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, ArrayAttr static_offsets, ArrayAttr static_sizes, ArrayAttr static_strides); |
2916 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
2917 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
2918 | | void print(OpAsmPrinter &p); |
2919 | | LogicalResult verify(); |
2920 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
2921 | | Value getViewSource(); |
2922 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
2923 | | |
2924 | | /// Returns the type of the base memref operand. |
2925 | 0 | MemRefType getBaseMemRefType() { |
2926 | 0 | return source().getType().cast<MemRefType>(); |
2927 | 0 | } |
2928 | | |
2929 | | /// The result of a subview is always a memref. |
2930 | 0 | MemRefType getType() { return getResult().getType().cast<MemRefType>(); } |
2931 | | |
2932 | | /// Returns as integer value the number of offset operands. |
2933 | 0 | int64_t getNumOffsets() { return llvm::size(offsets()); } |
2934 | | |
2935 | | /// Returns as integer value the number of size operands. |
2936 | 0 | int64_t getNumSizes() { return llvm::size(sizes()); } |
2937 | | |
2938 | | /// Returns as integer value the number of stride operands. |
2939 | 0 | int64_t getNumStrides() { return llvm::size(strides()); } |
2940 | | |
2941 | | /// Returns the dynamic sizes for this subview operation if specified. |
2942 | 0 | operand_range getDynamicSizes() { return sizes(); } |
2943 | | |
2944 | | /// Returns in `staticStrides` the static value of the stride |
2945 | | /// operands. Returns failure() if the static value of the stride |
2946 | | /// operands could not be retrieved. |
2947 | | LogicalResult getStaticStrides(SmallVectorImpl<int64_t> &staticStrides); |
2948 | | |
2949 | | /// Auxiliary range data structure and helper function that unpacks the |
2950 | | /// offset, size and stride operands of the SubViewOp into a list of triples. |
2951 | | /// Such a list of triple is sometimes more convenient to manipulate. |
2952 | | struct Range { |
2953 | | Value offset, size, stride; |
2954 | | }; |
2955 | | /// Return the list of SubViewOp::Range (i.e. offset, size, stride). Each |
2956 | | /// Range entry contains either the dynamic value or a ConstantIndexOp |
2957 | | /// constructed with `b` at location `loc`. |
2958 | | SmallVector<Range, 8> getOrCreateRanges(OpBuilder &b, Location loc); |
2959 | | |
2960 | | /// Return the offsets as Values. Each Value is either the dynamic |
2961 | | /// value specified in the op or a ConstantIndexOp constructed |
2962 | | /// with `b` at location `loc` |
2963 | | SmallVector<Value, 4> getOrCreateOffsets(OpBuilder &b, Location loc); |
2964 | | |
2965 | | /// Return the sizes as Values. Each Value is either the dynamic |
2966 | | /// value specified in the op or a ConstantIndexOp constructed |
2967 | | /// with `b` at location `loc` |
2968 | | SmallVector<Value, 4> getOrCreateSizes(OpBuilder &b, Location loc); |
2969 | | |
2970 | | /// Return the strides as Values. Each Value is either the dynamic |
2971 | | /// value specified in the op or a ConstantIndexOp constructed with |
2972 | | /// `b` at location `loc` |
2973 | | SmallVector<Value, 4> getOrCreateStrides(OpBuilder &b, Location loc); |
2974 | | |
2975 | | /// A subview result type can be fully inferred from the source type and the |
2976 | | /// static representation of offsets, sizes and strides. Special sentinels |
2977 | | /// encode the dynamic case. |
2978 | | static Type inferSubViewResultType(MemRefType sourceMemRefType, |
2979 | | ArrayRef<int64_t> staticOffsets, |
2980 | | ArrayRef<int64_t> staticSizes, |
2981 | | ArrayRef<int64_t> staticStrides); |
2982 | | |
2983 | | /// Return the rank of the result MemRefType. |
2984 | 0 | unsigned getRank() { return getType().getRank(); } |
2985 | | |
2986 | | /// Return true if the offset `idx` is a static constant. |
2987 | | bool isDynamicOffset(unsigned idx); |
2988 | | /// Return true if the size `idx` is a static constant. |
2989 | | bool isDynamicSize(unsigned idx); |
2990 | | /// Return true if the stride `idx` is a static constant. |
2991 | | bool isDynamicStride(unsigned idx); |
2992 | | |
2993 | | /// Assert the offset `idx` is a static constant and return its value. |
2994 | 0 | int64_t getStaticOffset(unsigned idx) { |
2995 | 0 | assert(!isDynamicOffset(idx) && "expected static offset"); |
2996 | 0 | return |
2997 | 0 | static_offsets().cast<ArrayAttr>()[idx].cast<IntegerAttr>().getInt(); |
2998 | 0 | } |
2999 | | /// Assert the size `idx` is a static constant and return its value. |
3000 | 0 | int64_t getStaticSize(unsigned idx) { |
3001 | 0 | assert(!isDynamicSize(idx) && "expected static size"); |
3002 | 0 | return static_sizes().cast<ArrayAttr>()[idx].cast<IntegerAttr>().getInt(); |
3003 | 0 | } |
3004 | | /// Assert the stride `idx` is a static constant and return its value. |
3005 | 0 | int64_t getStaticStride(unsigned idx) { |
3006 | 0 | assert(!isDynamicStride(idx) && "expected static stride"); |
3007 | 0 | return |
3008 | 0 | static_strides().cast<ArrayAttr>()[idx].cast<IntegerAttr>().getInt(); |
3009 | 0 | } |
3010 | | |
3011 | | /// Assert the offset `idx` is dynamic and return the position of the |
3012 | | /// corresponding operand. |
3013 | | unsigned getIndexOfDynamicOffset(unsigned idx); |
3014 | | /// Assert the size `idx` is dynamic and return the position of the |
3015 | | /// corresponding operand. |
3016 | | unsigned getIndexOfDynamicSize(unsigned idx); |
3017 | | /// Assert the stride `idx` is dynamic and return the position of the |
3018 | | /// corresponding operand. |
3019 | | unsigned getIndexOfDynamicStride(unsigned idx); |
3020 | | |
3021 | | /// Assert the offset `idx` is dynamic and return its value. |
3022 | 0 | Value getDynamicOffset(unsigned idx) { |
3023 | 0 | return getOperand(getIndexOfDynamicOffset(idx)); |
3024 | 0 | } |
3025 | | /// Assert the size `idx` is dynamic and return its value. |
3026 | 0 | Value getDynamicSize(unsigned idx) { |
3027 | 0 | return getOperand(getIndexOfDynamicSize(idx)); |
3028 | 0 | } |
3029 | | /// Assert the stride `idx` is dynamic and return its value. |
3030 | 0 | Value getDynamicStride(unsigned idx) { |
3031 | 0 | return getOperand(getIndexOfDynamicStride(idx)); |
3032 | 0 | } |
3033 | | |
3034 | 0 | static StringRef getStaticOffsetsAttrName() { |
3035 | 0 | return "static_offsets"; |
3036 | 0 | } |
3037 | 0 | static StringRef getStaticSizesAttrName() { |
3038 | 0 | return "static_sizes"; |
3039 | 0 | } |
3040 | 0 | static StringRef getStaticStridesAttrName() { |
3041 | 0 | return "static_strides"; |
3042 | 0 | } |
3043 | 0 | static ArrayRef<StringRef> getSpecialAttrNames() { |
3044 | 0 | static SmallVector<StringRef, 4> names{ |
3045 | 0 | getStaticOffsetsAttrName(), |
3046 | 0 | getStaticSizesAttrName(), |
3047 | 0 | getStaticStridesAttrName(), |
3048 | 0 | getOperandSegmentSizeAttr()}; |
3049 | 0 | return names; |
3050 | 0 | } |
3051 | | |
3052 | | }; |
3053 | | |
3054 | | //===----------------------------------------------------------------------===// |
3055 | | // TanhOp declarations |
3056 | | //===----------------------------------------------------------------------===// |
3057 | | |
3058 | | class TanhOpOperandAdaptor { |
3059 | | public: |
3060 | | TanhOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3061 | | TanhOpOperandAdaptor(TanhOp& op); |
3062 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3063 | | ValueRange getODSOperands(unsigned index); |
3064 | | Value operand(); |
3065 | | |
3066 | | private: |
3067 | | ValueRange odsOperands; |
3068 | | DictionaryAttr odsAttrs; |
3069 | | }; |
3070 | | class TanhOp : public Op<TanhOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultType, MemoryEffectOpInterface::Trait> { |
3071 | | public: |
3072 | | using Op::Op; |
3073 | | using OperandAdaptor = TanhOpOperandAdaptor; |
3074 | | static StringRef getOperationName(); |
3075 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3076 | | Operation::operand_range getODSOperands(unsigned index); |
3077 | | Value operand(); |
3078 | | ::mlir::MutableOperandRange operandMutable(); |
3079 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3080 | | Operation::result_range getODSResults(unsigned index); |
3081 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value operand); |
3082 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value operand); |
3083 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3084 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value operand); |
3085 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3086 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3087 | | void print(OpAsmPrinter &p); |
3088 | | LogicalResult verify(); |
3089 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3090 | | }; |
3091 | | |
3092 | | //===----------------------------------------------------------------------===// |
3093 | | // TensorCastOp declarations |
3094 | | //===----------------------------------------------------------------------===// |
3095 | | |
3096 | | class TensorCastOpOperandAdaptor { |
3097 | | public: |
3098 | | TensorCastOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3099 | | TensorCastOpOperandAdaptor(TensorCastOp& op); |
3100 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3101 | | ValueRange getODSOperands(unsigned index); |
3102 | | |
3103 | | private: |
3104 | | ValueRange odsOperands; |
3105 | | DictionaryAttr odsAttrs; |
3106 | | }; |
3107 | | class TensorCastOp : public Op<TensorCastOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait> { |
3108 | | public: |
3109 | | using Op::Op; |
3110 | | using OperandAdaptor = TensorCastOpOperandAdaptor; |
3111 | | static StringRef getOperationName(); |
3112 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3113 | | Operation::operand_range getODSOperands(unsigned index); |
3114 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3115 | | Operation::result_range getODSResults(unsigned index); |
3116 | | static void build(OpBuilder &builder, OperationState &result, Value source, Type destType); |
3117 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value odsArg_0); |
3118 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value odsArg_0); |
3119 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3120 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3121 | | void print(OpAsmPrinter &p); |
3122 | | LogicalResult verify(); |
3123 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
3124 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3125 | | |
3126 | | /// Return true if `a` and `b` are valid operand and result pairs for |
3127 | | /// the operation. |
3128 | | static bool areCastCompatible(Type a, Type b); |
3129 | | |
3130 | | /// The result of a tensor_cast is always a tensor. |
3131 | 0 | TensorType getType() { return getResult().getType().cast<TensorType>(); } |
3132 | | |
3133 | | }; |
3134 | | |
3135 | | //===----------------------------------------------------------------------===// |
3136 | | // TensorFromElementsOp declarations |
3137 | | //===----------------------------------------------------------------------===// |
3138 | | |
3139 | | class TensorFromElementsOpOperandAdaptor { |
3140 | | public: |
3141 | | TensorFromElementsOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3142 | | TensorFromElementsOpOperandAdaptor(TensorFromElementsOp& op); |
3143 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3144 | | ValueRange getODSOperands(unsigned index); |
3145 | | ValueRange elements(); |
3146 | | |
3147 | | private: |
3148 | | ValueRange odsOperands; |
3149 | | DictionaryAttr odsAttrs; |
3150 | | }; |
3151 | | class TensorFromElementsOp : public Op<TensorFromElementsOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultElementType> { |
3152 | | public: |
3153 | | using Op::Op; |
3154 | | using OperandAdaptor = TensorFromElementsOpOperandAdaptor; |
3155 | | static StringRef getOperationName(); |
3156 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3157 | | Operation::operand_range getODSOperands(unsigned index); |
3158 | | Operation::operand_range elements(); |
3159 | | ::mlir::MutableOperandRange elementsMutable(); |
3160 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3161 | | Operation::result_range getODSResults(unsigned index); |
3162 | | Value result(); |
3163 | | static void build(OpBuilder &builder, OperationState &result, ValueRange elements); |
3164 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3165 | | void print(OpAsmPrinter &p); |
3166 | | LogicalResult verify(); |
3167 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
3168 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3169 | | }; |
3170 | | |
3171 | | //===----------------------------------------------------------------------===// |
3172 | | // TensorLoadOp declarations |
3173 | | //===----------------------------------------------------------------------===// |
3174 | | |
3175 | | class TensorLoadOpOperandAdaptor { |
3176 | | public: |
3177 | | TensorLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3178 | | TensorLoadOpOperandAdaptor(TensorLoadOp& op); |
3179 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3180 | | ValueRange getODSOperands(unsigned index); |
3181 | | Value memref(); |
3182 | | |
3183 | | private: |
3184 | | ValueRange odsOperands; |
3185 | | DictionaryAttr odsAttrs; |
3186 | | }; |
3187 | | class TensorLoadOp : public Op<TensorLoadOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, OpTrait::SameOperandsAndResultShape, OpTrait::SameOperandsAndResultElementType, MemoryEffectOpInterface::Trait> { |
3188 | | public: |
3189 | | using Op::Op; |
3190 | | using OperandAdaptor = TensorLoadOpOperandAdaptor; |
3191 | | static StringRef getOperationName(); |
3192 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3193 | | Operation::operand_range getODSOperands(unsigned index); |
3194 | | Value memref(); |
3195 | | ::mlir::MutableOperandRange memrefMutable(); |
3196 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3197 | | Operation::result_range getODSResults(unsigned index); |
3198 | | Value result(); |
3199 | | static void build(OpBuilder &builder, OperationState &result, Value memref); |
3200 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref); |
3201 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref); |
3202 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3203 | | LogicalResult verify(); |
3204 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3205 | | void print(OpAsmPrinter &p); |
3206 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3207 | | |
3208 | | /// The result of a tensor_load is always a tensor. |
3209 | 0 | TensorType getType() { return getResult().getType().cast<TensorType>(); } |
3210 | | |
3211 | | }; |
3212 | | |
3213 | | //===----------------------------------------------------------------------===// |
3214 | | // TensorStoreOp declarations |
3215 | | //===----------------------------------------------------------------------===// |
3216 | | |
3217 | | class TensorStoreOpOperandAdaptor { |
3218 | | public: |
3219 | | TensorStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3220 | | TensorStoreOpOperandAdaptor(TensorStoreOp& op); |
3221 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3222 | | ValueRange getODSOperands(unsigned index); |
3223 | | Value tensor(); |
3224 | | Value memref(); |
3225 | | |
3226 | | private: |
3227 | | ValueRange odsOperands; |
3228 | | DictionaryAttr odsAttrs; |
3229 | | }; |
3230 | | class TensorStoreOp : public Op<TensorStoreOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::SameOperandsShape, OpTrait::SameOperandsElementType, MemoryEffectOpInterface::Trait> { |
3231 | | public: |
3232 | | using Op::Op; |
3233 | | using OperandAdaptor = TensorStoreOpOperandAdaptor; |
3234 | | static StringRef getOperationName(); |
3235 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3236 | | Operation::operand_range getODSOperands(unsigned index); |
3237 | | Value tensor(); |
3238 | | Value memref(); |
3239 | | ::mlir::MutableOperandRange tensorMutable(); |
3240 | | ::mlir::MutableOperandRange memrefMutable(); |
3241 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3242 | | Operation::result_range getODSResults(unsigned index); |
3243 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value tensor, Value memref); |
3244 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value tensor, Value memref); |
3245 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3246 | | LogicalResult verify(); |
3247 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3248 | | void print(OpAsmPrinter &p); |
3249 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3250 | | }; |
3251 | | |
3252 | | //===----------------------------------------------------------------------===// |
3253 | | // TruncateIOp declarations |
3254 | | //===----------------------------------------------------------------------===// |
3255 | | |
3256 | | class TruncateIOpOperandAdaptor { |
3257 | | public: |
3258 | | TruncateIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3259 | | TruncateIOpOperandAdaptor(TruncateIOp& op); |
3260 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3261 | | ValueRange getODSOperands(unsigned index); |
3262 | | Value value(); |
3263 | | |
3264 | | private: |
3265 | | ValueRange odsOperands; |
3266 | | DictionaryAttr odsAttrs; |
3267 | | }; |
3268 | | class TruncateIOp : public Op<TruncateIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultShape> { |
3269 | | public: |
3270 | | using Op::Op; |
3271 | | using OperandAdaptor = TruncateIOpOperandAdaptor; |
3272 | | static StringRef getOperationName(); |
3273 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3274 | | Operation::operand_range getODSOperands(unsigned index); |
3275 | | Value value(); |
3276 | | ::mlir::MutableOperandRange valueMutable(); |
3277 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3278 | | Operation::result_range getODSResults(unsigned index); |
3279 | | static void build(OpBuilder &builder, OperationState &result, Value value, Type destType); |
3280 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value); |
3281 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value); |
3282 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3283 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3284 | | void print(OpAsmPrinter &p); |
3285 | | LogicalResult verify(); |
3286 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3287 | | }; |
3288 | | |
3289 | | //===----------------------------------------------------------------------===// |
3290 | | // UnsignedDivIOp declarations |
3291 | | //===----------------------------------------------------------------------===// |
3292 | | |
3293 | | class UnsignedDivIOpOperandAdaptor { |
3294 | | public: |
3295 | | UnsignedDivIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3296 | | UnsignedDivIOpOperandAdaptor(UnsignedDivIOp& op); |
3297 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3298 | | ValueRange getODSOperands(unsigned index); |
3299 | | Value lhs(); |
3300 | | Value rhs(); |
3301 | | |
3302 | | private: |
3303 | | ValueRange odsOperands; |
3304 | | DictionaryAttr odsAttrs; |
3305 | | }; |
3306 | | class UnsignedDivIOp : public Op<UnsignedDivIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
3307 | | public: |
3308 | | using Op::Op; |
3309 | | using OperandAdaptor = UnsignedDivIOpOperandAdaptor; |
3310 | | static StringRef getOperationName(); |
3311 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3312 | | Operation::operand_range getODSOperands(unsigned index); |
3313 | | Value lhs(); |
3314 | | Value rhs(); |
3315 | | ::mlir::MutableOperandRange lhsMutable(); |
3316 | | ::mlir::MutableOperandRange rhsMutable(); |
3317 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3318 | | Operation::result_range getODSResults(unsigned index); |
3319 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
3320 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
3321 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3322 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
3323 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3324 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3325 | | void print(OpAsmPrinter &p); |
3326 | | LogicalResult verify(); |
3327 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
3328 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3329 | | }; |
3330 | | |
3331 | | //===----------------------------------------------------------------------===// |
3332 | | // UnsignedRemIOp declarations |
3333 | | //===----------------------------------------------------------------------===// |
3334 | | |
3335 | | class UnsignedRemIOpOperandAdaptor { |
3336 | | public: |
3337 | | UnsignedRemIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3338 | | UnsignedRemIOpOperandAdaptor(UnsignedRemIOp& op); |
3339 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3340 | | ValueRange getODSOperands(unsigned index); |
3341 | | Value lhs(); |
3342 | | Value rhs(); |
3343 | | |
3344 | | private: |
3345 | | ValueRange odsOperands; |
3346 | | DictionaryAttr odsAttrs; |
3347 | | }; |
3348 | | class UnsignedRemIOp : public Op<UnsignedRemIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
3349 | | public: |
3350 | | using Op::Op; |
3351 | | using OperandAdaptor = UnsignedRemIOpOperandAdaptor; |
3352 | | static StringRef getOperationName(); |
3353 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3354 | | Operation::operand_range getODSOperands(unsigned index); |
3355 | | Value lhs(); |
3356 | | Value rhs(); |
3357 | | ::mlir::MutableOperandRange lhsMutable(); |
3358 | | ::mlir::MutableOperandRange rhsMutable(); |
3359 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3360 | | Operation::result_range getODSResults(unsigned index); |
3361 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
3362 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
3363 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3364 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
3365 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3366 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3367 | | void print(OpAsmPrinter &p); |
3368 | | LogicalResult verify(); |
3369 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
3370 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3371 | | }; |
3372 | | |
3373 | | //===----------------------------------------------------------------------===// |
3374 | | // UnsignedShiftRightOp declarations |
3375 | | //===----------------------------------------------------------------------===// |
3376 | | |
3377 | | class UnsignedShiftRightOpOperandAdaptor { |
3378 | | public: |
3379 | | UnsignedShiftRightOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3380 | | UnsignedShiftRightOpOperandAdaptor(UnsignedShiftRightOp& op); |
3381 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3382 | | ValueRange getODSOperands(unsigned index); |
3383 | | Value lhs(); |
3384 | | Value rhs(); |
3385 | | |
3386 | | private: |
3387 | | ValueRange odsOperands; |
3388 | | DictionaryAttr odsAttrs; |
3389 | | }; |
3390 | | class UnsignedShiftRightOp : public Op<UnsignedShiftRightOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
3391 | | public: |
3392 | | using Op::Op; |
3393 | | using OperandAdaptor = UnsignedShiftRightOpOperandAdaptor; |
3394 | | static StringRef getOperationName(); |
3395 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3396 | | Operation::operand_range getODSOperands(unsigned index); |
3397 | | Value lhs(); |
3398 | | Value rhs(); |
3399 | | ::mlir::MutableOperandRange lhsMutable(); |
3400 | | ::mlir::MutableOperandRange rhsMutable(); |
3401 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3402 | | Operation::result_range getODSResults(unsigned index); |
3403 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
3404 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
3405 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3406 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
3407 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3408 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3409 | | void print(OpAsmPrinter &p); |
3410 | | LogicalResult verify(); |
3411 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3412 | | }; |
3413 | | |
3414 | | //===----------------------------------------------------------------------===// |
3415 | | // ViewOp declarations |
3416 | | //===----------------------------------------------------------------------===// |
3417 | | |
3418 | | class ViewOpOperandAdaptor { |
3419 | | public: |
3420 | | ViewOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3421 | | ViewOpOperandAdaptor(ViewOp& op); |
3422 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3423 | | ValueRange getODSOperands(unsigned index); |
3424 | | Value source(); |
3425 | | Value byte_shift(); |
3426 | | ValueRange sizes(); |
3427 | | |
3428 | | private: |
3429 | | ValueRange odsOperands; |
3430 | | DictionaryAttr odsAttrs; |
3431 | | }; |
3432 | | class ViewOp : public Op<ViewOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<2>::Impl, ViewLikeOpInterface::Trait, MemoryEffectOpInterface::Trait> { |
3433 | | public: |
3434 | | using Op::Op; |
3435 | | using OperandAdaptor = ViewOpOperandAdaptor; |
3436 | | static StringRef getOperationName(); |
3437 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3438 | | Operation::operand_range getODSOperands(unsigned index); |
3439 | | Value source(); |
3440 | | Value byte_shift(); |
3441 | | Operation::operand_range sizes(); |
3442 | | ::mlir::MutableOperandRange sourceMutable(); |
3443 | | ::mlir::MutableOperandRange byte_shiftMutable(); |
3444 | | ::mlir::MutableOperandRange sizesMutable(); |
3445 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3446 | | Operation::result_range getODSResults(unsigned index); |
3447 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value source, Value byte_shift, ValueRange sizes); |
3448 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value source, Value byte_shift, ValueRange sizes); |
3449 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3450 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3451 | | void print(OpAsmPrinter &p); |
3452 | | LogicalResult verify(); |
3453 | | static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context); |
3454 | | Value getViewSource(); |
3455 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3456 | | |
3457 | | /// The result of a view is always a memref. |
3458 | 0 | MemRefType getType() { return getResult().getType().cast<MemRefType>(); } |
3459 | | |
3460 | | /// Returns the dynamic sizes for this view operation. This is redundant |
3461 | | /// with `sizes` but needed in template implementations. More specifically: |
3462 | | /// ``` |
3463 | | /// template <typename AnyMemRefDefOp> |
3464 | | /// bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index, |
3465 | | /// Region *region) |
3466 | | /// ``` |
3467 | 0 | operand_range getDynamicSizes() { |
3468 | 0 | return {sizes().begin(), sizes().end()}; |
3469 | 0 | } |
3470 | | |
3471 | | }; |
3472 | | |
3473 | | //===----------------------------------------------------------------------===// |
3474 | | // XOrOp declarations |
3475 | | //===----------------------------------------------------------------------===// |
3476 | | |
3477 | | class XOrOpOperandAdaptor { |
3478 | | public: |
3479 | | XOrOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3480 | | XOrOpOperandAdaptor(XOrOp& op); |
3481 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3482 | | ValueRange getODSOperands(unsigned index); |
3483 | | Value lhs(); |
3484 | | Value rhs(); |
3485 | | |
3486 | | private: |
3487 | | ValueRange odsOperands; |
3488 | | DictionaryAttr odsAttrs; |
3489 | | }; |
3490 | | class XOrOp : public Op<XOrOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::NOperands<2>::Impl, OpTrait::IsCommutative, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultType> { |
3491 | | public: |
3492 | | using Op::Op; |
3493 | | using OperandAdaptor = XOrOpOperandAdaptor; |
3494 | | static StringRef getOperationName(); |
3495 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3496 | | Operation::operand_range getODSOperands(unsigned index); |
3497 | | Value lhs(); |
3498 | | Value rhs(); |
3499 | | ::mlir::MutableOperandRange lhsMutable(); |
3500 | | ::mlir::MutableOperandRange rhsMutable(); |
3501 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3502 | | Operation::result_range getODSResults(unsigned index); |
3503 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value lhs, Value rhs); |
3504 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value lhs, Value rhs); |
3505 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3506 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Value lhs, Value rhs); |
3507 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3508 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3509 | | void print(OpAsmPrinter &p); |
3510 | | LogicalResult verify(); |
3511 | | OpFoldResult fold(ArrayRef<Attribute> operands); |
3512 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3513 | | }; |
3514 | | |
3515 | | //===----------------------------------------------------------------------===// |
3516 | | // ZeroExtendIOp declarations |
3517 | | //===----------------------------------------------------------------------===// |
3518 | | |
3519 | | class ZeroExtendIOpOperandAdaptor { |
3520 | | public: |
3521 | | ZeroExtendIOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr); |
3522 | | ZeroExtendIOpOperandAdaptor(ZeroExtendIOp& op); |
3523 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3524 | | ValueRange getODSOperands(unsigned index); |
3525 | | Value value(); |
3526 | | |
3527 | | private: |
3528 | | ValueRange odsOperands; |
3529 | | DictionaryAttr odsAttrs; |
3530 | | }; |
3531 | | class ZeroExtendIOp : public Op<ZeroExtendIOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::OneOperand, MemoryEffectOpInterface::Trait, OpTrait::SameOperandsAndResultShape> { |
3532 | | public: |
3533 | | using Op::Op; |
3534 | | using OperandAdaptor = ZeroExtendIOpOperandAdaptor; |
3535 | | static StringRef getOperationName(); |
3536 | | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
3537 | | Operation::operand_range getODSOperands(unsigned index); |
3538 | | Value value(); |
3539 | | ::mlir::MutableOperandRange valueMutable(); |
3540 | | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
3541 | | Operation::result_range getODSResults(unsigned index); |
3542 | | static void build(OpBuilder &builder, OperationState &result, Value value, Type destType); |
3543 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, Value value); |
3544 | | static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value); |
3545 | | static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes); |
3546 | | static ParseResult parse(OpAsmParser &parser, OperationState &result); |
3547 | | void print(OpAsmPrinter &p); |
3548 | | LogicalResult verify(); |
3549 | | void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects); |
3550 | | }; |
3551 | | |
3552 | | #endif // GET_OP_CLASSES |
3553 | | |