Coverage Report

Created: 2020-06-26 05:44

/home/arjun/llvm-project/build/tools/mlir/include/mlir/Dialect/Affine/IR/AffineOps.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 AffineApplyOp;
13
class AffineForOp;
14
class AffineIfOp;
15
class AffineLoadOp;
16
class AffineMaxOp;
17
class AffineMinOp;
18
class AffineParallelOp;
19
class AffinePrefetchOp;
20
class AffineStoreOp;
21
class AffineTerminatorOp;
22
class AffineVectorLoadOp;
23
class AffineVectorStoreOp;
24
25
//===----------------------------------------------------------------------===//
26
// AffineApplyOp declarations
27
//===----------------------------------------------------------------------===//
28
29
class AffineApplyOpOperandAdaptor {
30
public:
31
  AffineApplyOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
32
  AffineApplyOpOperandAdaptor(AffineApplyOp& op);
33
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
34
  ValueRange getODSOperands(unsigned index);
35
  ValueRange mapOperands();
36
  AffineMapAttr map();
37
38
private:
39
  ValueRange odsOperands;
40
  DictionaryAttr odsAttrs;
41
};
42
class AffineApplyOp : public Op<AffineApplyOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait> {
43
public:
44
  using Op::Op;
45
  using OperandAdaptor = AffineApplyOpOperandAdaptor;
46
  static StringRef getOperationName();
47
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
48
  Operation::operand_range getODSOperands(unsigned index);
49
  Operation::operand_range mapOperands();
50
  ::mlir::MutableOperandRange mapOperandsMutable();
51
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
52
  Operation::result_range getODSResults(unsigned index);
53
  AffineMapAttr mapAttr();
54
  AffineMap map();
55
  void mapAttr(AffineMapAttr attr);
56
  static void build(OpBuilder &builder, OperationState &result, AffineMap map, ValueRange mapOperands);
57
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange mapOperands);
58
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange mapOperands);
59
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange mapOperands);
60
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange mapOperands);
61
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
62
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
63
  void print(OpAsmPrinter &p);
64
  LogicalResult verify();
65
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
66
  OpFoldResult fold(ArrayRef<Attribute> operands);
67
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
68
69
    /// Returns the affine map to be applied by this operation.
70
0
    AffineMap getAffineMap() { return map(); }
71
72
    /// Returns the affine value map computed from this operation.
73
    AffineValueMap getAffineValueMap();
74
75
    /// Returns true if the result of this operation can be used as dimension id
76
    /// in the region of the closest surrounding op with trait AffineScope.
77
    bool isValidDim();
78
79
    /// Returns true if the result of this operation can be used as dimension id
80
    /// within 'region', i.e., for all its uses with `region`.
81
    bool isValidDim(Region *region);
82
83
    /// Returns true if the result of this operation is a symbol in the region
84
    /// of the closest surrounding op that has the trait AffineScope.
85
    bool isValidSymbol();
86
87
    /// Returns true if the result of this operation is a symbol for all its
88
    /// uses in `region`.
89
    bool isValidSymbol(Region *region);
90
91
0
    operand_range getMapOperands() { return getOperands(); }
92
  
93
};
94
95
//===----------------------------------------------------------------------===//
96
// AffineForOp declarations
97
//===----------------------------------------------------------------------===//
98
99
class AffineForOpOperandAdaptor {
100
public:
101
  AffineForOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
102
  AffineForOpOperandAdaptor(AffineForOp& op);
103
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
104
  ValueRange getODSOperands(unsigned index);
105
106
private:
107
  ValueRange odsOperands;
108
  DictionaryAttr odsAttrs;
109
};
110
class AffineForOp : public Op<AffineForOp, OpTrait::OneRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, OpTrait::SingleBlockImplicitTerminator<AffineTerminatorOp>::Impl, OpTrait::HasRecursiveSideEffects, LoopLikeOpInterface::Trait> {
111
public:
112
  using Op::Op;
113
  using OperandAdaptor = AffineForOpOperandAdaptor;
114
  static StringRef getOperationName();
115
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
116
  Operation::operand_range getODSOperands(unsigned index);
117
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
118
  Operation::result_range getODSResults(unsigned index);
119
  Region &region();
120
  static void build(OpBuilder &builder, OperationState &result, int64_t lowerBound, int64_t upperBound, int64_t step = 1);
121
  static void build(OpBuilder &builder, OperationState &result, ValueRange lbOperands, AffineMap lbMap, ValueRange ubOperands, AffineMap ubMap, int64_t step = 1);
122
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
123
  void print(OpAsmPrinter &p);
124
  LogicalResult verify();
125
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
126
  LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results);
127
  bool isDefinedOutsideOfLoop(Value  value);
128
  Region &getLoopBody();
129
  LogicalResult moveOutOfLoop(ArrayRef<Operation *> ops);
130
131
0
    static StringRef getStepAttrName() { return "step"; }
132
0
    static StringRef getLowerBoundAttrName() { return "lower_bound"; }
133
0
    static StringRef getUpperBoundAttrName() { return "upper_bound"; }
134
135
0
    Value getInductionVar() { return getBody()->getArgument(0); }
136
137
    // TODO: provide iterators for the lower and upper bound operands
138
    // if the current access via getLowerBound(), getUpperBound() is too slow.
139
140
    /// Returns operands for the lower bound map.
141
    operand_range getLowerBoundOperands();
142
143
    /// Returns operands for the upper bound map.
144
    operand_range getUpperBoundOperands();
145
146
    /// Returns information about the lower bound as a single object.
147
    AffineBound getLowerBound();
148
149
    /// Returns information about the upper bound as a single object.
150
    AffineBound getUpperBound();
151
152
    /// Returns loop step.
153
0
    int64_t getStep() {
154
0
      return getAttr(getStepAttrName()).cast<IntegerAttr>().getInt();
155
0
    }
156
157
    /// Returns affine map for the lower bound.
158
0
    AffineMap getLowerBoundMap() { return getLowerBoundMapAttr().getValue(); }
159
0
    AffineMapAttr getLowerBoundMapAttr() {
160
0
      return getAttr(getLowerBoundAttrName()).cast<AffineMapAttr>();
161
0
    }
162
    /// Returns affine map for the upper bound. The upper bound is exclusive.
163
0
    AffineMap getUpperBoundMap() { return getUpperBoundMapAttr().getValue(); }
164
0
    AffineMapAttr getUpperBoundMapAttr() {
165
0
      return getAttr(getUpperBoundAttrName()).cast<AffineMapAttr>();
166
0
    }
167
168
    /// Set lower bound. The new bound must have the same number of operands as
169
    /// the current bound map. Otherwise, 'replaceForLowerBound' should be used.
170
    void setLowerBound(ValueRange operands, AffineMap map);
171
    /// Set upper bound. The new bound must not have more operands than the
172
    /// current bound map. Otherwise, 'replaceForUpperBound' should be used.
173
    void setUpperBound(ValueRange operands, AffineMap map);
174
175
    /// Set the lower bound map without changing operands.
176
    void setLowerBoundMap(AffineMap map);
177
178
    /// Set the upper bound map without changing operands.
179
    void setUpperBoundMap(AffineMap map);
180
181
    /// Set loop step.
182
0
    void setStep(int64_t step) {
183
0
      assert(step > 0 && "step has to be a positive integer constant");
184
0
      auto *context = getLowerBoundMap().getContext();
185
0
      setAttr(Identifier::get(getStepAttrName(), context),
186
0
              IntegerAttr::get(IndexType::get(context), step));
187
0
    }
188
189
    /// Returns true if the lower bound is constant.
190
    bool hasConstantLowerBound();
191
    /// Returns true if the upper bound is constant.
192
    bool hasConstantUpperBound();
193
    /// Returns true if both bounds are constant.
194
0
    bool hasConstantBounds() {
195
0
      return hasConstantLowerBound() && hasConstantUpperBound();
196
0
    }
197
    /// Returns the value of the constant lower bound.
198
    /// Fails assertion if the bound is non-constant.
199
    int64_t getConstantLowerBound();
200
    /// Returns the value of the constant upper bound. The upper bound is
201
    /// exclusive. Fails assertion if the bound is non-constant.
202
    int64_t getConstantUpperBound();
203
    /// Sets the lower bound to the given constant value.
204
    void setConstantLowerBound(int64_t value);
205
    /// Sets the upper bound to the given constant value.
206
    void setConstantUpperBound(int64_t value);
207
208
    /// Returns true if both the lower and upper bound have the same operand
209
    /// lists (same operands in the same order).
210
    bool matchingBoundOperandList();
211
  
212
};
213
214
//===----------------------------------------------------------------------===//
215
// AffineIfOp declarations
216
//===----------------------------------------------------------------------===//
217
218
class AffineIfOpOperandAdaptor {
219
public:
220
  AffineIfOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
221
  AffineIfOpOperandAdaptor(AffineIfOp& op);
222
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
223
  ValueRange getODSOperands(unsigned index);
224
225
private:
226
  ValueRange odsOperands;
227
  DictionaryAttr odsAttrs;
228
};
229
class AffineIfOp : public Op<AffineIfOp, OpTrait::NRegions<2>::Impl, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, OpTrait::SingleBlockImplicitTerminator<AffineTerminatorOp>::Impl, OpTrait::HasRecursiveSideEffects> {
230
public:
231
  using Op::Op;
232
  using OperandAdaptor = AffineIfOpOperandAdaptor;
233
  static StringRef getOperationName();
234
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
235
  Operation::operand_range getODSOperands(unsigned index);
236
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
237
  Operation::result_range getODSResults(unsigned index);
238
  Region &thenRegion();
239
  Region &elseRegion();
240
  static void build(OpBuilder &builder, OperationState &result, IntegerSet set, ValueRange args, bool withElseRegion);
241
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
242
  void print(OpAsmPrinter &p);
243
  LogicalResult verify();
244
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
245
  LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results);
246
247
0
    static StringRef getConditionAttrName() { return "condition"; }
248
249
    IntegerSet getIntegerSet();
250
    void setIntegerSet(IntegerSet newSet);
251
252
    /// Sets the integer set with its operands.
253
    void setConditional(IntegerSet set, ValueRange operands);
254
255
    /// Returns true if an else block exists.
256
0
    bool hasElse() { return !elseRegion().empty(); }
257
258
0
    Block *getThenBlock() {
259
0
      assert(!thenRegion().empty() && "Unexpected empty 'then' region.");
260
0
      return &thenRegion().front();
261
0
    }
262
263
0
    Block *getElseBlock() {
264
0
      assert(hasElse() && "Empty 'else' region.");
265
0
      return &elseRegion().front();
266
0
    }
267
268
0
    OpBuilder getThenBodyBuilder() {
269
0
      assert(!thenRegion().empty() && "Unexpected empty 'then' region.");
270
0
      Block &body = thenRegion().front();
271
0
      return OpBuilder(&body, std::prev(body.end()));
272
0
    }
273
0
    OpBuilder getElseBodyBuilder() {
274
0
      assert(hasElse() && "No 'else' block");
275
0
      Block &body = elseRegion().front();
276
0
      return OpBuilder(&body, std::prev(body.end()));
277
0
    }
278
  
279
};
280
281
//===----------------------------------------------------------------------===//
282
// AffineLoadOp declarations
283
//===----------------------------------------------------------------------===//
284
285
class AffineLoadOpOperandAdaptor {
286
public:
287
  AffineLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
288
  AffineLoadOpOperandAdaptor(AffineLoadOp& op);
289
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
290
  ValueRange getODSOperands(unsigned index);
291
  Value memref();
292
  ValueRange indices();
293
294
private:
295
  ValueRange odsOperands;
296
  DictionaryAttr odsAttrs;
297
};
298
class AffineLoadOp : public Op<AffineLoadOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, AffineReadOpInterface::Trait, MemoryEffectOpInterface::Trait> {
299
public:
300
  using Op::Op;
301
  using OperandAdaptor = AffineLoadOpOperandAdaptor;
302
  static StringRef getOperationName();
303
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
304
  Operation::operand_range getODSOperands(unsigned index);
305
  Value memref();
306
  Operation::operand_range indices();
307
  ::mlir::MutableOperandRange memrefMutable();
308
  ::mlir::MutableOperandRange indicesMutable();
309
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
310
  Operation::result_range getODSResults(unsigned index);
311
  Value result();
312
  static void build(OpBuilder &builder, OperationState &result, AffineMap map, ValueRange operands);
313
  static void build(OpBuilder &builder, OperationState &result, Value memref, ValueRange indices = {});
314
  static void build(OpBuilder &builder, OperationState &result, Value memref, AffineMap map, ValueRange mapOperands);
315
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices);
316
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices);
317
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
318
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
319
  void print(OpAsmPrinter &p);
320
  LogicalResult verify();
321
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
322
  OpFoldResult fold(ArrayRef<Attribute> operands);
323
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
324
325
    /// Returns the operand index of the memref.
326
0
    unsigned getMemRefOperandIndex() { return 0; }
327
328
0
    void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); }
329
330
    /// Returns the affine map used to index the memref for this operation.
331
0
    AffineMapAttr getAffineMapAttr() {
332
0
      return getAttr(getMapAttrName()).cast<AffineMapAttr>();
333
0
    }
334
335
    /// Returns the AffineMapAttr associated with 'memref'.
336
0
    NamedAttribute getAffineMapAttrForMemRef(Value memref) {
337
0
      assert(memref == getMemRef());
338
0
      return {Identifier::get(getMapAttrName(), getContext()),
339
0
              getAffineMapAttr()};
340
0
    }
341
342
0
    static StringRef getMapAttrName() { return "map"; }
343
  
344
};
345
346
//===----------------------------------------------------------------------===//
347
// AffineMaxOp declarations
348
//===----------------------------------------------------------------------===//
349
350
class AffineMaxOpOperandAdaptor {
351
public:
352
  AffineMaxOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
353
  AffineMaxOpOperandAdaptor(AffineMaxOp& op);
354
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
355
  ValueRange getODSOperands(unsigned index);
356
  ValueRange operands();
357
  AffineMapAttr map();
358
359
private:
360
  ValueRange odsOperands;
361
  DictionaryAttr odsAttrs;
362
};
363
class AffineMaxOp : public Op<AffineMaxOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait> {
364
public:
365
  using Op::Op;
366
  using OperandAdaptor = AffineMaxOpOperandAdaptor;
367
  static StringRef getOperationName();
368
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
369
  Operation::operand_range getODSOperands(unsigned index);
370
  Operation::operand_range operands();
371
  ::mlir::MutableOperandRange operandsMutable();
372
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
373
  Operation::result_range getODSResults(unsigned index);
374
  AffineMapAttr mapAttr();
375
  AffineMap map();
376
  void mapAttr(AffineMapAttr attr);
377
  static void build(OpBuilder &builder, OperationState &result, AffineMap affineMap, ValueRange mapOperands);
378
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange operands);
379
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange operands);
380
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange operands);
381
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange operands);
382
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
383
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
384
  void print(OpAsmPrinter &p);
385
  LogicalResult verify();
386
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
387
  OpFoldResult fold(ArrayRef<Attribute> operands);
388
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
389
390
0
    static StringRef getMapAttrName() { return "map"; }
391
0
    AffineMap getAffineMap() { return map(); }
392
0
    ValueRange getMapOperands() { return operands(); }
393
  
394
};
395
396
//===----------------------------------------------------------------------===//
397
// AffineMinOp declarations
398
//===----------------------------------------------------------------------===//
399
400
class AffineMinOpOperandAdaptor {
401
public:
402
  AffineMinOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
403
  AffineMinOpOperandAdaptor(AffineMinOp& op);
404
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
405
  ValueRange getODSOperands(unsigned index);
406
  ValueRange operands();
407
  AffineMapAttr map();
408
409
private:
410
  ValueRange odsOperands;
411
  DictionaryAttr odsAttrs;
412
};
413
class AffineMinOp : public Op<AffineMinOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, MemoryEffectOpInterface::Trait> {
414
public:
415
  using Op::Op;
416
  using OperandAdaptor = AffineMinOpOperandAdaptor;
417
  static StringRef getOperationName();
418
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
419
  Operation::operand_range getODSOperands(unsigned index);
420
  Operation::operand_range operands();
421
  ::mlir::MutableOperandRange operandsMutable();
422
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
423
  Operation::result_range getODSResults(unsigned index);
424
  AffineMapAttr mapAttr();
425
  AffineMap map();
426
  void mapAttr(AffineMapAttr attr);
427
  static void build(OpBuilder &builder, OperationState &result, AffineMap affineMap, ValueRange mapOperands);
428
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange operands);
429
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange operands);
430
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange operands);
431
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange operands);
432
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
433
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
434
  void print(OpAsmPrinter &p);
435
  LogicalResult verify();
436
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
437
  OpFoldResult fold(ArrayRef<Attribute> operands);
438
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
439
440
0
    static StringRef getMapAttrName() { return "map"; }
441
0
    AffineMap getAffineMap() { return map(); }
442
0
    ValueRange getMapOperands() { return operands(); }
443
  
444
};
445
446
//===----------------------------------------------------------------------===//
447
// AffineParallelOp declarations
448
//===----------------------------------------------------------------------===//
449
450
class AffineParallelOpOperandAdaptor {
451
public:
452
  AffineParallelOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
453
  AffineParallelOpOperandAdaptor(AffineParallelOp& op);
454
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
455
  ValueRange getODSOperands(unsigned index);
456
  ValueRange mapOperands();
457
  AffineMapAttr lowerBoundsMap();
458
  AffineMapAttr upperBoundsMap();
459
  ArrayAttr steps();
460
461
private:
462
  ValueRange odsOperands;
463
  DictionaryAttr odsAttrs;
464
};
465
class AffineParallelOp : public Op<AffineParallelOp, OpTrait::OneRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::VariadicOperands, OpTrait::SingleBlockImplicitTerminator<AffineTerminatorOp>::Impl> {
466
public:
467
  using Op::Op;
468
  using OperandAdaptor = AffineParallelOpOperandAdaptor;
469
  static StringRef getOperationName();
470
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
471
  Operation::operand_range getODSOperands(unsigned index);
472
  Operation::operand_range mapOperands();
473
  ::mlir::MutableOperandRange mapOperandsMutable();
474
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
475
  Operation::result_range getODSResults(unsigned index);
476
  Region &region();
477
  AffineMapAttr lowerBoundsMapAttr();
478
  AffineMap lowerBoundsMap();
479
  AffineMapAttr upperBoundsMapAttr();
480
  AffineMap upperBoundsMap();
481
  ArrayAttr stepsAttr();
482
  ArrayAttr steps();
483
  void lowerBoundsMapAttr(AffineMapAttr attr);
484
  void upperBoundsMapAttr(AffineMapAttr attr);
485
  void stepsAttr(ArrayAttr attr);
486
  static void build(OpBuilder &builder, OperationState &result,ArrayRef<int64_t> ranges);
487
  static void build(OpBuilder &builder, OperationState &result, AffineMap lbMap,ValueRange lbArgs, AffineMap ubMap, ValueRange ubArgs);
488
  static void build(OpBuilder &builder, OperationState &result, AffineMap lbMap,ValueRange lbArgs, AffineMap ubMap, ValueRange ubArgs,ArrayRef<int64_t> steps);
489
  static void build(OpBuilder &odsBuilder, OperationState &odsState, AffineMapAttr lowerBoundsMap, AffineMapAttr upperBoundsMap, ArrayAttr steps, ValueRange mapOperands);
490
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr lowerBoundsMap, AffineMapAttr upperBoundsMap, ArrayAttr steps, ValueRange mapOperands);
491
  static void build(OpBuilder &odsBuilder, OperationState &odsState, AffineMap lowerBoundsMap, AffineMap upperBoundsMap, ArrayAttr steps, ValueRange mapOperands);
492
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap lowerBoundsMap, AffineMap upperBoundsMap, ArrayAttr steps, ValueRange mapOperands);
493
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
494
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
495
  void print(OpAsmPrinter &p);
496
  LogicalResult verify();
497
498
    /// Get the number of dimensions.
499
    unsigned getNumDims();
500
501
    operand_range getLowerBoundsOperands();
502
    operand_range getUpperBoundsOperands();
503
504
    AffineValueMap getLowerBoundsValueMap();
505
    AffineValueMap getUpperBoundsValueMap();
506
    AffineValueMap getRangesValueMap();
507
508
    /// Get ranges as constants, may fail in dynamic case.
509
    Optional<SmallVector<int64_t, 8>> getConstantRanges();
510
511
    Block *getBody();
512
    OpBuilder getBodyBuilder();
513
0
    MutableArrayRef<BlockArgument> getIVs() {
514
0
      return getBody()->getArguments();
515
0
    }
516
    void setSteps(ArrayRef<int64_t> newSteps);
517
518
0
    static StringRef getLowerBoundsMapAttrName() { return "lowerBoundsMap"; }
519
0
    static StringRef getUpperBoundsMapAttrName() { return "upperBoundsMap"; }
520
0
    static StringRef getStepsAttrName() { return "steps"; }
521
  
522
};
523
524
//===----------------------------------------------------------------------===//
525
// AffinePrefetchOp declarations
526
//===----------------------------------------------------------------------===//
527
528
class AffinePrefetchOpOperandAdaptor {
529
public:
530
  AffinePrefetchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
531
  AffinePrefetchOpOperandAdaptor(AffinePrefetchOp& op);
532
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
533
  ValueRange getODSOperands(unsigned index);
534
  Value memref();
535
  ValueRange indices();
536
  BoolAttr isWrite();
537
  IntegerAttr localityHint();
538
  BoolAttr isDataCache();
539
540
private:
541
  ValueRange odsOperands;
542
  DictionaryAttr odsAttrs;
543
};
544
class AffinePrefetchOp : public Op<AffinePrefetchOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl> {
545
public:
546
  using Op::Op;
547
  using OperandAdaptor = AffinePrefetchOpOperandAdaptor;
548
  static StringRef getOperationName();
549
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
550
  Operation::operand_range getODSOperands(unsigned index);
551
  Value memref();
552
  Operation::operand_range indices();
553
  ::mlir::MutableOperandRange memrefMutable();
554
  ::mlir::MutableOperandRange indicesMutable();
555
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
556
  Operation::result_range getODSResults(unsigned index);
557
  BoolAttr isWriteAttr();
558
  bool isWrite();
559
  IntegerAttr localityHintAttr();
560
  APInt localityHint();
561
  BoolAttr isDataCacheAttr();
562
  bool isDataCache();
563
  void isWriteAttr(BoolAttr attr);
564
  void localityHintAttr(IntegerAttr attr);
565
  void isDataCacheAttr(BoolAttr attr);
566
  static void build(OpBuilder &builder, OperationState &result, Value memref,AffineMap map, ArrayRef<Value> mapOperands, bool isWrite,unsigned localityHint, bool isDataCache);
567
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache);
568
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache);
569
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache);
570
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache);
571
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
572
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
573
  void print(OpAsmPrinter &p);
574
  LogicalResult verify();
575
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
576
  LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results);
577
578
0
    MemRefType getMemRefType() {
579
0
      return memref().getType().cast<MemRefType>();
580
0
    }
581
582
    /// Returns the affine map used to index the memref for this operation.
583
0
    AffineMap getAffineMap() { return getAffineMapAttr().getValue(); }
584
0
    AffineMapAttr getAffineMapAttr() {
585
0
      return getAttr(getMapAttrName()).cast<AffineMapAttr>();
586
0
    }
587
588
    /// Returns the AffineMapAttr associated with 'memref'.
589
0
    NamedAttribute getAffineMapAttrForMemRef(Value mref) {
590
0
      assert(mref == memref());
591
0
      return {Identifier::get(getMapAttrName(), getContext()),
592
0
        getAffineMapAttr()};
593
0
    }
594
595
    /// Get affine map operands.
596
0
    operand_range getMapOperands() {
597
0
      return {operand_begin() + 1, operand_end()};
598
0
    }
599
600
0
    static StringRef getMapAttrName() { return "map"; }
601
0
    static StringRef getLocalityHintAttrName() { return "localityHint"; }
602
0
    static StringRef getIsWriteAttrName() { return "isWrite"; }
603
0
    static StringRef getIsDataCacheAttrName() { return "isDataCache"; }
604
  
605
};
606
607
//===----------------------------------------------------------------------===//
608
// AffineStoreOp declarations
609
//===----------------------------------------------------------------------===//
610
611
class AffineStoreOpOperandAdaptor {
612
public:
613
  AffineStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
614
  AffineStoreOpOperandAdaptor(AffineStoreOp& op);
615
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
616
  ValueRange getODSOperands(unsigned index);
617
  Value value();
618
  Value memref();
619
  ValueRange indices();
620
621
private:
622
  ValueRange odsOperands;
623
  DictionaryAttr odsAttrs;
624
};
625
class AffineStoreOp : public Op<AffineStoreOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<2>::Impl, AffineWriteOpInterface::Trait, MemoryEffectOpInterface::Trait> {
626
public:
627
  using Op::Op;
628
  using OperandAdaptor = AffineStoreOpOperandAdaptor;
629
  static StringRef getOperationName();
630
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
631
  Operation::operand_range getODSOperands(unsigned index);
632
  Value value();
633
  Value memref();
634
  Operation::operand_range indices();
635
  ::mlir::MutableOperandRange valueMutable();
636
  ::mlir::MutableOperandRange memrefMutable();
637
  ::mlir::MutableOperandRange indicesMutable();
638
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
639
  Operation::result_range getODSResults(unsigned index);
640
  static void build(OpBuilder &builder, OperationState &result, Value valueToStore, Value memref, ValueRange indices);
641
  static void build(OpBuilder &builder, OperationState &result, Value valueToStore, Value memref, AffineMap map, ValueRange mapOperands);
642
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
643
  void print(OpAsmPrinter &p);
644
  LogicalResult verify();
645
  static void getCanonicalizationPatterns(OwningRewritePatternList &results, MLIRContext *context);
646
  LogicalResult fold(ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results);
647
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
648
649
    /// Get value to be stored by store operation.
650
0
    Value getValueToStore() { return getOperand(0); }
651
652
    /// Returns the operand index of the memref.
653
0
    unsigned getMemRefOperandIndex() { return 1; }
654
655
0
    void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); }
656
657
    /// Returns the affine map used to index the memref for this operation.
658
0
    AffineMapAttr getAffineMapAttr() {
659
0
      return getAttr(getMapAttrName()).cast<AffineMapAttr>();
660
0
    }
661
662
    /// Returns the AffineMapAttr associated with 'memref'.
663
0
    NamedAttribute getAffineMapAttrForMemRef(Value memref) {
664
0
      assert(memref == getMemRef());
665
0
      return {Identifier::get(getMapAttrName(), getContext()),
666
0
              getAffineMapAttr()};
667
0
    }
668
669
0
    static StringRef getMapAttrName() { return "map"; }
670
  
671
};
672
673
//===----------------------------------------------------------------------===//
674
// AffineTerminatorOp declarations
675
//===----------------------------------------------------------------------===//
676
677
class AffineTerminatorOpOperandAdaptor {
678
public:
679
  AffineTerminatorOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
680
  AffineTerminatorOpOperandAdaptor(AffineTerminatorOp& op);
681
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
682
  ValueRange getODSOperands(unsigned index);
683
684
private:
685
  ValueRange odsOperands;
686
  DictionaryAttr odsAttrs;
687
};
688
class AffineTerminatorOp : public Op<AffineTerminatorOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::ZeroOperands, MemoryEffectOpInterface::Trait, OpTrait::IsTerminator> {
689
public:
690
  using Op::Op;
691
  using OperandAdaptor = AffineTerminatorOpOperandAdaptor;
692
  static StringRef getOperationName();
693
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
694
  Operation::operand_range getODSOperands(unsigned index);
695
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
696
  Operation::result_range getODSResults(unsigned index);
697
  static void build(OpBuilder &odsBuilder, OperationState &odsState);
698
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes);
699
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
700
  LogicalResult verify();
701
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
702
};
703
704
//===----------------------------------------------------------------------===//
705
// AffineVectorLoadOp declarations
706
//===----------------------------------------------------------------------===//
707
708
class AffineVectorLoadOpOperandAdaptor {
709
public:
710
  AffineVectorLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
711
  AffineVectorLoadOpOperandAdaptor(AffineVectorLoadOp& op);
712
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
713
  ValueRange getODSOperands(unsigned index);
714
  Value memref();
715
  ValueRange indices();
716
717
private:
718
  ValueRange odsOperands;
719
  DictionaryAttr odsAttrs;
720
};
721
class AffineVectorLoadOp : public Op<AffineVectorLoadOp, OpTrait::ZeroRegion, OpTrait::OneResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<1>::Impl, AffineReadOpInterface::Trait, MemoryEffectOpInterface::Trait> {
722
public:
723
  using Op::Op;
724
  using OperandAdaptor = AffineVectorLoadOpOperandAdaptor;
725
  static StringRef getOperationName();
726
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
727
  Operation::operand_range getODSOperands(unsigned index);
728
  Value memref();
729
  Operation::operand_range indices();
730
  ::mlir::MutableOperandRange memrefMutable();
731
  ::mlir::MutableOperandRange indicesMutable();
732
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
733
  Operation::result_range getODSResults(unsigned index);
734
  Value result();
735
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices);
736
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices);
737
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
738
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
739
  void print(OpAsmPrinter &p);
740
  LogicalResult verify();
741
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
742
743
    /// Returns the operand index of the memref.
744
0
    unsigned getMemRefOperandIndex() { return 0; }
745
746
0
    void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); }
747
748
    /// Returns the affine map used to index the memref for this operation.
749
0
    AffineMapAttr getAffineMapAttr() {
750
0
      return getAttr(getMapAttrName()).cast<AffineMapAttr>();
751
0
    }
752
753
    /// Returns the AffineMapAttr associated with 'memref'.
754
0
    NamedAttribute getAffineMapAttrForMemRef(Value memref) {
755
0
      assert(memref == getMemRef());
756
0
      return {Identifier::get(getMapAttrName(), getContext()),
757
0
              getAffineMapAttr()};
758
0
    }
759
760
0
    static StringRef getMapAttrName() { return "map"; }
761
  
762
0
    VectorType getVectorType() {
763
0
      return result().getType().cast<VectorType>();
764
0
    }
765
  
766
};
767
768
//===----------------------------------------------------------------------===//
769
// AffineVectorStoreOp declarations
770
//===----------------------------------------------------------------------===//
771
772
class AffineVectorStoreOpOperandAdaptor {
773
public:
774
  AffineVectorStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs = nullptr);
775
  AffineVectorStoreOpOperandAdaptor(AffineVectorStoreOp& op);
776
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
777
  ValueRange getODSOperands(unsigned index);
778
  Value value();
779
  Value memref();
780
  ValueRange indices();
781
782
private:
783
  ValueRange odsOperands;
784
  DictionaryAttr odsAttrs;
785
};
786
class AffineVectorStoreOp : public Op<AffineVectorStoreOp, OpTrait::ZeroRegion, OpTrait::ZeroResult, OpTrait::ZeroSuccessor, OpTrait::AtLeastNOperands<2>::Impl, AffineWriteOpInterface::Trait, MemoryEffectOpInterface::Trait> {
787
public:
788
  using Op::Op;
789
  using OperandAdaptor = AffineVectorStoreOpOperandAdaptor;
790
  static StringRef getOperationName();
791
  std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index);
792
  Operation::operand_range getODSOperands(unsigned index);
793
  Value value();
794
  Value memref();
795
  Operation::operand_range indices();
796
  ::mlir::MutableOperandRange valueMutable();
797
  ::mlir::MutableOperandRange memrefMutable();
798
  ::mlir::MutableOperandRange indicesMutable();
799
  std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index);
800
  Operation::result_range getODSResults(unsigned index);
801
  static void build(OpBuilder &odsBuilder, OperationState &odsState, Value value, Value memref, ValueRange indices);
802
  static void build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value, Value memref, ValueRange indices);
803
  static void build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes);
804
  static ParseResult parse(OpAsmParser &parser, OperationState &result);
805
  void print(OpAsmPrinter &p);
806
  LogicalResult verify();
807
  void getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects);
808
809
    /// Get value to be stored by store operation.
810
0
    Value getValueToStore() { return getOperand(0); }
811
812
    /// Returns the operand index of the memref.
813
0
    unsigned getMemRefOperandIndex() { return 1; }
814
815
0
    void setMemRef(Value value) { setOperand(getMemRefOperandIndex(), value); }
816
817
    /// Returns the affine map used to index the memref for this operation.
818
0
    AffineMapAttr getAffineMapAttr() {
819
0
      return getAttr(getMapAttrName()).cast<AffineMapAttr>();
820
0
    }
821
822
    /// Returns the AffineMapAttr associated with 'memref'.
823
0
    NamedAttribute getAffineMapAttrForMemRef(Value memref) {
824
0
      assert(memref == getMemRef());
825
0
      return {Identifier::get(getMapAttrName(), getContext()),
826
0
              getAffineMapAttr()};
827
0
    }
828
829
0
    static StringRef getMapAttrName() { return "map"; }
830
  
831
0
    VectorType getVectorType() {
832
0
      return value().getType().cast<VectorType>();
833
0
    }
834
  
835
};
836
837
#endif  // GET_OP_CLASSES
838