Coverage Report

Created: 2020-06-26 05:44

/home/arjun/llvm-project/build/tools/mlir/include/mlir/Dialect/Affine/IR/AffineOps.cpp.inc
Line
Count
Source (jump to first uncovered line)
1
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2
|*                                                                            *|
3
|* Op Definitions                                                             *|
4
|*                                                                            *|
5
|* Automatically generated file, do not edit!                                 *|
6
|*                                                                            *|
7
\*===----------------------------------------------------------------------===*/
8
9
#ifdef GET_OP_LIST
10
#undef GET_OP_LIST
11
12
AffineApplyOp,
13
AffineForOp,
14
AffineIfOp,
15
AffineLoadOp,
16
AffineMaxOp,
17
AffineMinOp,
18
AffineParallelOp,
19
AffinePrefetchOp,
20
AffineStoreOp,
21
AffineTerminatorOp,
22
AffineVectorLoadOp,
23
AffineVectorStoreOp
24
#endif  // GET_OP_LIST
25
26
#ifdef GET_OP_CLASSES
27
#undef GET_OP_CLASSES
28
29
30
//===----------------------------------------------------------------------===//
31
// AffineApplyOp definitions
32
//===----------------------------------------------------------------------===//
33
34
0
AffineApplyOpOperandAdaptor::AffineApplyOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
35
0
36
0
}
37
38
0
AffineApplyOpOperandAdaptor::AffineApplyOpOperandAdaptor(AffineApplyOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
39
0
40
0
}
41
42
0
std::pair<unsigned, unsigned> AffineApplyOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
43
0
  bool isVariadic[] = {true};
44
0
  int prevVariadicCount = 0;
45
0
  for (unsigned i = 0; i < index; ++i)
46
0
    if (isVariadic[i]) ++prevVariadicCount;
47
0
48
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
49
0
  // This assumes all static variadic operands have the same dynamic value count.
50
0
  int variadicSize = (odsOperands.size() - 0) / 1;
51
0
  // `index` passed in as the parameter is the static index which counts each
52
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
53
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
54
0
  // value pack for this static operand starts.
55
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
56
0
  int size = isVariadic[index] ? variadicSize : 1;
57
0
  return {start, size};
58
0
}
59
60
0
ValueRange AffineApplyOpOperandAdaptor::getODSOperands(unsigned index) {
61
0
  auto valueRange = getODSOperandIndexAndLength(index);
62
0
  return {std::next(odsOperands.begin(), valueRange.first),
63
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
64
0
}
65
66
0
ValueRange AffineApplyOpOperandAdaptor::mapOperands() {
67
0
  return getODSOperands(0);
68
0
}
69
70
0
AffineMapAttr AffineApplyOpOperandAdaptor::map() {
71
0
  assert(odsAttrs && "no attributes when constructing adapter");
72
0
  AffineMapAttr attr = odsAttrs.get("map").cast<AffineMapAttr>();
73
0
  return attr;
74
0
}
75
76
0
StringRef AffineApplyOp::getOperationName() {
77
0
  return "affine.apply";
78
0
}
79
80
0
std::pair<unsigned, unsigned> AffineApplyOp::getODSOperandIndexAndLength(unsigned index) {
81
0
  bool isVariadic[] = {true};
82
0
  int prevVariadicCount = 0;
83
0
  for (unsigned i = 0; i < index; ++i)
84
0
    if (isVariadic[i]) ++prevVariadicCount;
85
0
86
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
87
0
  // This assumes all static variadic operands have the same dynamic value count.
88
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
89
0
  // `index` passed in as the parameter is the static index which counts each
90
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
91
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
92
0
  // value pack for this static operand starts.
93
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
94
0
  int size = isVariadic[index] ? variadicSize : 1;
95
0
  return {start, size};
96
0
}
97
98
0
Operation::operand_range AffineApplyOp::getODSOperands(unsigned index) {
99
0
  auto valueRange = getODSOperandIndexAndLength(index);
100
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
101
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
102
0
}
103
104
0
Operation::operand_range AffineApplyOp::mapOperands() {
105
0
  return getODSOperands(0);
106
0
}
107
108
0
::mlir::MutableOperandRange AffineApplyOp::mapOperandsMutable() {
109
0
  auto range = getODSOperandIndexAndLength(0);
110
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
111
0
}
112
113
0
std::pair<unsigned, unsigned> AffineApplyOp::getODSResultIndexAndLength(unsigned index) {
114
0
  return {index, 1};
115
0
}
116
117
0
Operation::result_range AffineApplyOp::getODSResults(unsigned index) {
118
0
  auto valueRange = getODSResultIndexAndLength(index);
119
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
120
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
121
0
}
122
123
0
AffineMapAttr AffineApplyOp::mapAttr() {
124
0
  return this->getAttr("map").cast<AffineMapAttr>();
125
0
}
126
127
0
AffineMap AffineApplyOp::map() {
128
0
  auto attr = mapAttr();
129
0
  return attr.getValue();
130
0
}
131
132
0
void AffineApplyOp::mapAttr(AffineMapAttr attr) {
133
0
  this->getOperation()->setAttr("map", attr);
134
0
}
135
136
0
void AffineApplyOp::build(OpBuilder &builder, OperationState &result, AffineMap map, ValueRange mapOperands) {
137
0
      build(builder, result, builder.getIndexType(), map, mapOperands);
138
0
    
139
0
}
140
141
0
void AffineApplyOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange mapOperands) {
142
0
  odsState.addOperands(mapOperands);
143
0
  odsState.addAttribute("map", map);
144
0
  odsState.addTypes(resultType0);
145
0
}
146
147
0
void AffineApplyOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange mapOperands) {
148
0
  odsState.addOperands(mapOperands);
149
0
  odsState.addAttribute("map", map);
150
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
151
0
  odsState.addTypes(resultTypes);
152
0
}
153
154
0
void AffineApplyOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange mapOperands) {
155
0
  odsState.addOperands(mapOperands);
156
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
157
0
  odsState.addTypes(resultType0);
158
0
}
159
160
0
void AffineApplyOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange mapOperands) {
161
0
  odsState.addOperands(mapOperands);
162
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
163
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
164
0
  odsState.addTypes(resultTypes);
165
0
}
166
167
0
void AffineApplyOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
168
0
  odsState.addOperands(operands);
169
0
  odsState.addAttributes(attributes);
170
0
  assert(resultTypes.size() == 1u && "mismatched number of return types");
171
0
  odsState.addTypes(resultTypes);
172
0
}
173
174
0
ParseResult AffineApplyOp::parse(OpAsmParser &parser, OperationState &result) {
175
0
  return ::parseAffineApplyOp(parser, result);
176
0
}
177
178
0
void AffineApplyOp::print(OpAsmPrinter &p) {
179
0
  return ::print(p, *this);
180
0
}
181
182
0
LogicalResult AffineApplyOp::verify() {
183
0
  auto tblgen_map = this->getAttr("map");
184
0
  if (!tblgen_map) return emitOpError("requires attribute 'map'");
185
0
  {
186
0
    if (!((tblgen_map.isa<AffineMapAttr>()))) return emitOpError("attribute 'map' failed to satisfy constraint: AffineMap attribute");
187
0
  }
188
0
  {
189
0
    unsigned index = 0; (void)index;
190
0
    auto valueGroup0 = getODSOperands(0);
191
0
    for (Value v : valueGroup0) {
192
0
      (void)v;
193
0
      if (!((v.getType().isa<IndexType>()))) {
194
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
195
0
      }
196
0
      ++index;
197
0
    }
198
0
  }
199
0
  {
200
0
    unsigned index = 0; (void)index;
201
0
    auto valueGroup0 = getODSResults(0);
202
0
    for (Value v : valueGroup0) {
203
0
      (void)v;
204
0
      if (!((v.getType().isa<IndexType>()))) {
205
0
        return emitOpError("result #") << index << " must be index, but got " << v.getType();
206
0
      }
207
0
      ++index;
208
0
    }
209
0
  }
210
0
  return ::verify(*this);
211
0
}
212
213
214
215
216
217
0
void AffineApplyOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
218
0
219
0
}
220
221
222
//===----------------------------------------------------------------------===//
223
// AffineForOp definitions
224
//===----------------------------------------------------------------------===//
225
226
0
AffineForOpOperandAdaptor::AffineForOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
227
0
228
0
}
229
230
0
AffineForOpOperandAdaptor::AffineForOpOperandAdaptor(AffineForOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
231
0
232
0
}
233
234
0
std::pair<unsigned, unsigned> AffineForOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
235
0
  bool isVariadic[] = {true};
236
0
  int prevVariadicCount = 0;
237
0
  for (unsigned i = 0; i < index; ++i)
238
0
    if (isVariadic[i]) ++prevVariadicCount;
239
0
240
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
241
0
  // This assumes all static variadic operands have the same dynamic value count.
242
0
  int variadicSize = (odsOperands.size() - 0) / 1;
243
0
  // `index` passed in as the parameter is the static index which counts each
244
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
245
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
246
0
  // value pack for this static operand starts.
247
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
248
0
  int size = isVariadic[index] ? variadicSize : 1;
249
0
  return {start, size};
250
0
}
251
252
0
ValueRange AffineForOpOperandAdaptor::getODSOperands(unsigned index) {
253
0
  auto valueRange = getODSOperandIndexAndLength(index);
254
0
  return {std::next(odsOperands.begin(), valueRange.first),
255
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
256
0
}
257
258
0
StringRef AffineForOp::getOperationName() {
259
0
  return "affine.for";
260
0
}
261
262
0
std::pair<unsigned, unsigned> AffineForOp::getODSOperandIndexAndLength(unsigned index) {
263
0
  bool isVariadic[] = {true};
264
0
  int prevVariadicCount = 0;
265
0
  for (unsigned i = 0; i < index; ++i)
266
0
    if (isVariadic[i]) ++prevVariadicCount;
267
0
268
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
269
0
  // This assumes all static variadic operands have the same dynamic value count.
270
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
271
0
  // `index` passed in as the parameter is the static index which counts each
272
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
273
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
274
0
  // value pack for this static operand starts.
275
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
276
0
  int size = isVariadic[index] ? variadicSize : 1;
277
0
  return {start, size};
278
0
}
279
280
0
Operation::operand_range AffineForOp::getODSOperands(unsigned index) {
281
0
  auto valueRange = getODSOperandIndexAndLength(index);
282
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
283
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
284
0
}
285
286
0
std::pair<unsigned, unsigned> AffineForOp::getODSResultIndexAndLength(unsigned index) {
287
0
  return {index, 1};
288
0
}
289
290
0
Operation::result_range AffineForOp::getODSResults(unsigned index) {
291
0
  auto valueRange = getODSResultIndexAndLength(index);
292
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
293
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
294
0
}
295
296
0
Region &AffineForOp::region() {
297
0
  return this->getOperation()->getRegion(0);
298
0
}
299
300
301
302
303
304
0
ParseResult AffineForOp::parse(OpAsmParser &parser, OperationState &result) {
305
0
  return ::parseAffineForOp(parser, result);
306
0
}
307
308
0
void AffineForOp::print(OpAsmPrinter &p) {
309
0
  return ::print(p, *this);
310
0
}
311
312
0
LogicalResult AffineForOp::verify() {
313
0
  {
314
0
    unsigned index = 0; (void)index;
315
0
    auto valueGroup0 = getODSOperands(0);
316
0
    for (Value v : valueGroup0) {
317
0
      (void)v;
318
0
      if (!((true))) {
319
0
        return emitOpError("operand #") << index << " must be any type, but got " << v.getType();
320
0
      }
321
0
      ++index;
322
0
    }
323
0
  }
324
0
  {
325
0
    unsigned index = 0; (void)index;
326
0
  }
327
0
{
328
0
    unsigned index = 0; (void)index;
329
0
    for (Region &region : MutableArrayRef<Region>(this->getOperation()->getRegion(0))) {
330
0
      (void)region;
331
0
      if (!((region.getBlocks().size() == 1))) {
332
0
        return emitOpError("region #") << index << " ('region') failed to verify constraint: region with 1 blocks";
333
0
      }
334
0
      ++index;
335
0
    }
336
0
  }
337
0
  return ::verify(*this);
338
0
}
339
340
341
342
343
344
345
346
347
348
349
350
351
//===----------------------------------------------------------------------===//
352
// AffineIfOp definitions
353
//===----------------------------------------------------------------------===//
354
355
0
AffineIfOpOperandAdaptor::AffineIfOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
356
0
357
0
}
358
359
0
AffineIfOpOperandAdaptor::AffineIfOpOperandAdaptor(AffineIfOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
360
0
361
0
}
362
363
0
std::pair<unsigned, unsigned> AffineIfOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
364
0
  bool isVariadic[] = {true};
365
0
  int prevVariadicCount = 0;
366
0
  for (unsigned i = 0; i < index; ++i)
367
0
    if (isVariadic[i]) ++prevVariadicCount;
368
0
369
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
370
0
  // This assumes all static variadic operands have the same dynamic value count.
371
0
  int variadicSize = (odsOperands.size() - 0) / 1;
372
0
  // `index` passed in as the parameter is the static index which counts each
373
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
374
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
375
0
  // value pack for this static operand starts.
376
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
377
0
  int size = isVariadic[index] ? variadicSize : 1;
378
0
  return {start, size};
379
0
}
380
381
0
ValueRange AffineIfOpOperandAdaptor::getODSOperands(unsigned index) {
382
0
  auto valueRange = getODSOperandIndexAndLength(index);
383
0
  return {std::next(odsOperands.begin(), valueRange.first),
384
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
385
0
}
386
387
0
StringRef AffineIfOp::getOperationName() {
388
0
  return "affine.if";
389
0
}
390
391
0
std::pair<unsigned, unsigned> AffineIfOp::getODSOperandIndexAndLength(unsigned index) {
392
0
  bool isVariadic[] = {true};
393
0
  int prevVariadicCount = 0;
394
0
  for (unsigned i = 0; i < index; ++i)
395
0
    if (isVariadic[i]) ++prevVariadicCount;
396
0
397
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
398
0
  // This assumes all static variadic operands have the same dynamic value count.
399
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
400
0
  // `index` passed in as the parameter is the static index which counts each
401
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
402
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
403
0
  // value pack for this static operand starts.
404
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
405
0
  int size = isVariadic[index] ? variadicSize : 1;
406
0
  return {start, size};
407
0
}
408
409
0
Operation::operand_range AffineIfOp::getODSOperands(unsigned index) {
410
0
  auto valueRange = getODSOperandIndexAndLength(index);
411
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
412
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
413
0
}
414
415
0
std::pair<unsigned, unsigned> AffineIfOp::getODSResultIndexAndLength(unsigned index) {
416
0
  return {index, 1};
417
0
}
418
419
0
Operation::result_range AffineIfOp::getODSResults(unsigned index) {
420
0
  auto valueRange = getODSResultIndexAndLength(index);
421
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
422
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
423
0
}
424
425
0
Region &AffineIfOp::thenRegion() {
426
0
  return this->getOperation()->getRegion(0);
427
0
}
428
429
0
Region &AffineIfOp::elseRegion() {
430
0
  return this->getOperation()->getRegion(1);
431
0
}
432
433
434
435
0
ParseResult AffineIfOp::parse(OpAsmParser &parser, OperationState &result) {
436
0
  return ::parseAffineIfOp(parser, result);
437
0
}
438
439
0
void AffineIfOp::print(OpAsmPrinter &p) {
440
0
  return ::print(p, *this);
441
0
}
442
443
0
LogicalResult AffineIfOp::verify() {
444
0
  {
445
0
    unsigned index = 0; (void)index;
446
0
    auto valueGroup0 = getODSOperands(0);
447
0
    for (Value v : valueGroup0) {
448
0
      (void)v;
449
0
      if (!((true))) {
450
0
        return emitOpError("operand #") << index << " must be any type, but got " << v.getType();
451
0
      }
452
0
      ++index;
453
0
    }
454
0
  }
455
0
  {
456
0
    unsigned index = 0; (void)index;
457
0
  }
458
0
{
459
0
    unsigned index = 0; (void)index;
460
0
    for (Region &region : MutableArrayRef<Region>(this->getOperation()->getRegion(0))) {
461
0
      (void)region;
462
0
      if (!((region.getBlocks().size() == 1))) {
463
0
        return emitOpError("region #") << index << " ('thenRegion') failed to verify constraint: region with 1 blocks";
464
0
      }
465
0
      ++index;
466
0
    }
467
0
    for (Region &region : MutableArrayRef<Region>(this->getOperation()->getRegion(1))) {
468
0
      (void)region;
469
0
      if (!((true))) {
470
0
        return emitOpError("region #") << index << " ('elseRegion') failed to verify constraint: any region";
471
0
      }
472
0
      ++index;
473
0
    }
474
0
  }
475
0
  return ::verify(*this);
476
0
}
477
478
479
480
481
482
483
//===----------------------------------------------------------------------===//
484
// AffineLoadOp definitions
485
//===----------------------------------------------------------------------===//
486
487
0
AffineLoadOpOperandAdaptor::AffineLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
488
0
489
0
}
490
491
0
AffineLoadOpOperandAdaptor::AffineLoadOpOperandAdaptor(AffineLoadOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
492
0
493
0
}
494
495
0
std::pair<unsigned, unsigned> AffineLoadOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
496
0
  bool isVariadic[] = {false, true};
497
0
  int prevVariadicCount = 0;
498
0
  for (unsigned i = 0; i < index; ++i)
499
0
    if (isVariadic[i]) ++prevVariadicCount;
500
0
501
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
502
0
  // This assumes all static variadic operands have the same dynamic value count.
503
0
  int variadicSize = (odsOperands.size() - 1) / 1;
504
0
  // `index` passed in as the parameter is the static index which counts each
505
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
506
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
507
0
  // value pack for this static operand starts.
508
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
509
0
  int size = isVariadic[index] ? variadicSize : 1;
510
0
  return {start, size};
511
0
}
512
513
0
ValueRange AffineLoadOpOperandAdaptor::getODSOperands(unsigned index) {
514
0
  auto valueRange = getODSOperandIndexAndLength(index);
515
0
  return {std::next(odsOperands.begin(), valueRange.first),
516
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
517
0
}
518
519
0
Value AffineLoadOpOperandAdaptor::memref() {
520
0
  return *getODSOperands(0).begin();
521
0
}
522
523
0
ValueRange AffineLoadOpOperandAdaptor::indices() {
524
0
  return getODSOperands(1);
525
0
}
526
527
0
StringRef AffineLoadOp::getOperationName() {
528
0
  return "affine.load";
529
0
}
530
531
0
std::pair<unsigned, unsigned> AffineLoadOp::getODSOperandIndexAndLength(unsigned index) {
532
0
  bool isVariadic[] = {false, true};
533
0
  int prevVariadicCount = 0;
534
0
  for (unsigned i = 0; i < index; ++i)
535
0
    if (isVariadic[i]) ++prevVariadicCount;
536
0
537
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
538
0
  // This assumes all static variadic operands have the same dynamic value count.
539
0
  int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
540
0
  // `index` passed in as the parameter is the static index which counts each
541
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
542
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
543
0
  // value pack for this static operand starts.
544
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
545
0
  int size = isVariadic[index] ? variadicSize : 1;
546
0
  return {start, size};
547
0
}
548
549
0
Operation::operand_range AffineLoadOp::getODSOperands(unsigned index) {
550
0
  auto valueRange = getODSOperandIndexAndLength(index);
551
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
552
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
553
0
}
554
555
0
Value AffineLoadOp::memref() {
556
0
  return *getODSOperands(0).begin();
557
0
}
558
559
0
Operation::operand_range AffineLoadOp::indices() {
560
0
  return getODSOperands(1);
561
0
}
562
563
0
::mlir::MutableOperandRange AffineLoadOp::memrefMutable() {
564
0
  auto range = getODSOperandIndexAndLength(0);
565
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
566
0
}
567
568
0
::mlir::MutableOperandRange AffineLoadOp::indicesMutable() {
569
0
  auto range = getODSOperandIndexAndLength(1);
570
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
571
0
}
572
573
0
std::pair<unsigned, unsigned> AffineLoadOp::getODSResultIndexAndLength(unsigned index) {
574
0
  return {index, 1};
575
0
}
576
577
0
Operation::result_range AffineLoadOp::getODSResults(unsigned index) {
578
0
  auto valueRange = getODSResultIndexAndLength(index);
579
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
580
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
581
0
}
582
583
0
Value AffineLoadOp::result() {
584
0
  return *getODSResults(0).begin();
585
0
}
586
587
588
589
590
591
592
593
0
void AffineLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices) {
594
0
  odsState.addOperands(memref);
595
0
  odsState.addOperands(indices);
596
0
  odsState.addTypes(result);
597
0
}
598
599
0
void AffineLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices) {
600
0
  odsState.addOperands(memref);
601
0
  odsState.addOperands(indices);
602
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
603
0
  odsState.addTypes(resultTypes);
604
0
}
605
606
0
void AffineLoadOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
607
0
  assert(operands.size() >= 1u && "mismatched number of parameters");
608
0
  odsState.addOperands(operands);
609
0
  odsState.addAttributes(attributes);
610
0
  assert(resultTypes.size() == 1u && "mismatched number of return types");
611
0
  odsState.addTypes(resultTypes);
612
0
}
613
614
0
ParseResult AffineLoadOp::parse(OpAsmParser &parser, OperationState &result) {
615
0
  return ::parseAffineLoadOp(parser, result);
616
0
}
617
618
0
void AffineLoadOp::print(OpAsmPrinter &p) {
619
0
  return ::print(p, *this);
620
0
}
621
622
0
LogicalResult AffineLoadOp::verify() {
623
0
  {
624
0
    unsigned index = 0; (void)index;
625
0
    auto valueGroup0 = getODSOperands(0);
626
0
    for (Value v : valueGroup0) {
627
0
      (void)v;
628
0
      if (!(((v.getType().isa<MemRefType>())) && ((true)))) {
629
0
        return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType();
630
0
      }
631
0
      ++index;
632
0
    }
633
0
    auto valueGroup1 = getODSOperands(1);
634
0
    for (Value v : valueGroup1) {
635
0
      (void)v;
636
0
      if (!((v.getType().isa<IndexType>()))) {
637
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
638
0
      }
639
0
      ++index;
640
0
    }
641
0
  }
642
0
  {
643
0
    unsigned index = 0; (void)index;
644
0
    auto valueGroup0 = getODSResults(0);
645
0
    for (Value v : valueGroup0) {
646
0
      (void)v;
647
0
      if (!((true))) {
648
0
        return emitOpError("result #") << index << " must be any type, but got " << v.getType();
649
0
      }
650
0
      ++index;
651
0
    }
652
0
  }
653
0
  return ::verify(*this);
654
0
}
655
656
657
658
659
660
0
void AffineLoadOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
661
0
  for (Value value : getODSOperands(0))
662
0
    effects.emplace_back(MemoryEffects::Read::get(), value, ::mlir::SideEffects::DefaultResource::get());
663
0
}
664
665
666
//===----------------------------------------------------------------------===//
667
// AffineMaxOp definitions
668
//===----------------------------------------------------------------------===//
669
670
0
AffineMaxOpOperandAdaptor::AffineMaxOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
671
0
672
0
}
673
674
0
AffineMaxOpOperandAdaptor::AffineMaxOpOperandAdaptor(AffineMaxOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
675
0
676
0
}
677
678
0
std::pair<unsigned, unsigned> AffineMaxOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
679
0
  bool isVariadic[] = {true};
680
0
  int prevVariadicCount = 0;
681
0
  for (unsigned i = 0; i < index; ++i)
682
0
    if (isVariadic[i]) ++prevVariadicCount;
683
0
684
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
685
0
  // This assumes all static variadic operands have the same dynamic value count.
686
0
  int variadicSize = (odsOperands.size() - 0) / 1;
687
0
  // `index` passed in as the parameter is the static index which counts each
688
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
689
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
690
0
  // value pack for this static operand starts.
691
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
692
0
  int size = isVariadic[index] ? variadicSize : 1;
693
0
  return {start, size};
694
0
}
695
696
0
ValueRange AffineMaxOpOperandAdaptor::getODSOperands(unsigned index) {
697
0
  auto valueRange = getODSOperandIndexAndLength(index);
698
0
  return {std::next(odsOperands.begin(), valueRange.first),
699
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
700
0
}
701
702
0
ValueRange AffineMaxOpOperandAdaptor::operands() {
703
0
  return getODSOperands(0);
704
0
}
705
706
0
AffineMapAttr AffineMaxOpOperandAdaptor::map() {
707
0
  assert(odsAttrs && "no attributes when constructing adapter");
708
0
  AffineMapAttr attr = odsAttrs.get("map").cast<AffineMapAttr>();
709
0
  return attr;
710
0
}
711
712
0
StringRef AffineMaxOp::getOperationName() {
713
0
  return "affine.max";
714
0
}
715
716
0
std::pair<unsigned, unsigned> AffineMaxOp::getODSOperandIndexAndLength(unsigned index) {
717
0
  bool isVariadic[] = {true};
718
0
  int prevVariadicCount = 0;
719
0
  for (unsigned i = 0; i < index; ++i)
720
0
    if (isVariadic[i]) ++prevVariadicCount;
721
0
722
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
723
0
  // This assumes all static variadic operands have the same dynamic value count.
724
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
725
0
  // `index` passed in as the parameter is the static index which counts each
726
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
727
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
728
0
  // value pack for this static operand starts.
729
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
730
0
  int size = isVariadic[index] ? variadicSize : 1;
731
0
  return {start, size};
732
0
}
733
734
0
Operation::operand_range AffineMaxOp::getODSOperands(unsigned index) {
735
0
  auto valueRange = getODSOperandIndexAndLength(index);
736
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
737
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
738
0
}
739
740
0
Operation::operand_range AffineMaxOp::operands() {
741
0
  return getODSOperands(0);
742
0
}
743
744
0
::mlir::MutableOperandRange AffineMaxOp::operandsMutable() {
745
0
  auto range = getODSOperandIndexAndLength(0);
746
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
747
0
}
748
749
0
std::pair<unsigned, unsigned> AffineMaxOp::getODSResultIndexAndLength(unsigned index) {
750
0
  return {index, 1};
751
0
}
752
753
0
Operation::result_range AffineMaxOp::getODSResults(unsigned index) {
754
0
  auto valueRange = getODSResultIndexAndLength(index);
755
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
756
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
757
0
}
758
759
0
AffineMapAttr AffineMaxOp::mapAttr() {
760
0
  return this->getAttr("map").cast<AffineMapAttr>();
761
0
}
762
763
0
AffineMap AffineMaxOp::map() {
764
0
  auto attr = mapAttr();
765
0
  return attr.getValue();
766
0
}
767
768
0
void AffineMaxOp::mapAttr(AffineMapAttr attr) {
769
0
  this->getOperation()->setAttr("map", attr);
770
0
}
771
772
0
void AffineMaxOp::build(OpBuilder &builder, OperationState &result, AffineMap affineMap, ValueRange mapOperands) {
773
0
      build(builder, result, builder.getIndexType(), affineMap, mapOperands);
774
0
    
775
0
}
776
777
0
void AffineMaxOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange operands) {
778
0
  odsState.addOperands(operands);
779
0
  odsState.addAttribute("map", map);
780
0
  odsState.addTypes(resultType0);
781
0
}
782
783
0
void AffineMaxOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange operands) {
784
0
  odsState.addOperands(operands);
785
0
  odsState.addAttribute("map", map);
786
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
787
0
  odsState.addTypes(resultTypes);
788
0
}
789
790
0
void AffineMaxOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange operands) {
791
0
  odsState.addOperands(operands);
792
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
793
0
  odsState.addTypes(resultType0);
794
0
}
795
796
0
void AffineMaxOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange operands) {
797
0
  odsState.addOperands(operands);
798
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
799
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
800
0
  odsState.addTypes(resultTypes);
801
0
}
802
803
0
void AffineMaxOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
804
0
  odsState.addOperands(operands);
805
0
  odsState.addAttributes(attributes);
806
0
  assert(resultTypes.size() == 1u && "mismatched number of return types");
807
0
  odsState.addTypes(resultTypes);
808
0
}
809
810
0
ParseResult AffineMaxOp::parse(OpAsmParser &parser, OperationState &result) {
811
0
  return ::parseAffineMinMaxOp<AffineMaxOp>(parser, result);
812
0
}
813
814
0
void AffineMaxOp::print(OpAsmPrinter &p) {
815
0
  return ::printAffineMinMaxOp(p, *this);
816
0
}
817
818
0
LogicalResult AffineMaxOp::verify() {
819
0
  auto tblgen_map = this->getAttr("map");
820
0
  if (!tblgen_map) return emitOpError("requires attribute 'map'");
821
0
  {
822
0
    if (!((tblgen_map.isa<AffineMapAttr>()))) return emitOpError("attribute 'map' failed to satisfy constraint: AffineMap attribute");
823
0
  }
824
0
  {
825
0
    unsigned index = 0; (void)index;
826
0
    auto valueGroup0 = getODSOperands(0);
827
0
    for (Value v : valueGroup0) {
828
0
      (void)v;
829
0
      if (!((v.getType().isa<IndexType>()))) {
830
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
831
0
      }
832
0
      ++index;
833
0
    }
834
0
  }
835
0
  {
836
0
    unsigned index = 0; (void)index;
837
0
    auto valueGroup0 = getODSResults(0);
838
0
    for (Value v : valueGroup0) {
839
0
      (void)v;
840
0
      if (!((v.getType().isa<IndexType>()))) {
841
0
        return emitOpError("result #") << index << " must be index, but got " << v.getType();
842
0
      }
843
0
      ++index;
844
0
    }
845
0
  }
846
0
  return ::verifyAffineMinMaxOp(*this);
847
0
}
848
849
850
851
852
853
0
void AffineMaxOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
854
0
855
0
}
856
857
858
//===----------------------------------------------------------------------===//
859
// AffineMinOp definitions
860
//===----------------------------------------------------------------------===//
861
862
0
AffineMinOpOperandAdaptor::AffineMinOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
863
0
864
0
}
865
866
0
AffineMinOpOperandAdaptor::AffineMinOpOperandAdaptor(AffineMinOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
867
0
868
0
}
869
870
0
std::pair<unsigned, unsigned> AffineMinOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
871
0
  bool isVariadic[] = {true};
872
0
  int prevVariadicCount = 0;
873
0
  for (unsigned i = 0; i < index; ++i)
874
0
    if (isVariadic[i]) ++prevVariadicCount;
875
0
876
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
877
0
  // This assumes all static variadic operands have the same dynamic value count.
878
0
  int variadicSize = (odsOperands.size() - 0) / 1;
879
0
  // `index` passed in as the parameter is the static index which counts each
880
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
881
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
882
0
  // value pack for this static operand starts.
883
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
884
0
  int size = isVariadic[index] ? variadicSize : 1;
885
0
  return {start, size};
886
0
}
887
888
0
ValueRange AffineMinOpOperandAdaptor::getODSOperands(unsigned index) {
889
0
  auto valueRange = getODSOperandIndexAndLength(index);
890
0
  return {std::next(odsOperands.begin(), valueRange.first),
891
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
892
0
}
893
894
0
ValueRange AffineMinOpOperandAdaptor::operands() {
895
0
  return getODSOperands(0);
896
0
}
897
898
0
AffineMapAttr AffineMinOpOperandAdaptor::map() {
899
0
  assert(odsAttrs && "no attributes when constructing adapter");
900
0
  AffineMapAttr attr = odsAttrs.get("map").cast<AffineMapAttr>();
901
0
  return attr;
902
0
}
903
904
0
StringRef AffineMinOp::getOperationName() {
905
0
  return "affine.min";
906
0
}
907
908
0
std::pair<unsigned, unsigned> AffineMinOp::getODSOperandIndexAndLength(unsigned index) {
909
0
  bool isVariadic[] = {true};
910
0
  int prevVariadicCount = 0;
911
0
  for (unsigned i = 0; i < index; ++i)
912
0
    if (isVariadic[i]) ++prevVariadicCount;
913
0
914
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
915
0
  // This assumes all static variadic operands have the same dynamic value count.
916
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
917
0
  // `index` passed in as the parameter is the static index which counts each
918
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
919
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
920
0
  // value pack for this static operand starts.
921
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
922
0
  int size = isVariadic[index] ? variadicSize : 1;
923
0
  return {start, size};
924
0
}
925
926
0
Operation::operand_range AffineMinOp::getODSOperands(unsigned index) {
927
0
  auto valueRange = getODSOperandIndexAndLength(index);
928
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
929
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
930
0
}
931
932
0
Operation::operand_range AffineMinOp::operands() {
933
0
  return getODSOperands(0);
934
0
}
935
936
0
::mlir::MutableOperandRange AffineMinOp::operandsMutable() {
937
0
  auto range = getODSOperandIndexAndLength(0);
938
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
939
0
}
940
941
0
std::pair<unsigned, unsigned> AffineMinOp::getODSResultIndexAndLength(unsigned index) {
942
0
  return {index, 1};
943
0
}
944
945
0
Operation::result_range AffineMinOp::getODSResults(unsigned index) {
946
0
  auto valueRange = getODSResultIndexAndLength(index);
947
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
948
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
949
0
}
950
951
0
AffineMapAttr AffineMinOp::mapAttr() {
952
0
  return this->getAttr("map").cast<AffineMapAttr>();
953
0
}
954
955
0
AffineMap AffineMinOp::map() {
956
0
  auto attr = mapAttr();
957
0
  return attr.getValue();
958
0
}
959
960
0
void AffineMinOp::mapAttr(AffineMapAttr attr) {
961
0
  this->getOperation()->setAttr("map", attr);
962
0
}
963
964
0
void AffineMinOp::build(OpBuilder &builder, OperationState &result, AffineMap affineMap, ValueRange mapOperands) {
965
0
      build(builder, result, builder.getIndexType(), affineMap, mapOperands);
966
0
    
967
0
}
968
969
0
void AffineMinOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMapAttr map, ValueRange operands) {
970
0
  odsState.addOperands(operands);
971
0
  odsState.addAttribute("map", map);
972
0
  odsState.addTypes(resultType0);
973
0
}
974
975
0
void AffineMinOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr map, ValueRange operands) {
976
0
  odsState.addOperands(operands);
977
0
  odsState.addAttribute("map", map);
978
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
979
0
  odsState.addTypes(resultTypes);
980
0
}
981
982
0
void AffineMinOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type resultType0, AffineMap map, ValueRange operands) {
983
0
  odsState.addOperands(operands);
984
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
985
0
  odsState.addTypes(resultType0);
986
0
}
987
988
0
void AffineMinOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap map, ValueRange operands) {
989
0
  odsState.addOperands(operands);
990
0
  odsState.addAttribute("map", AffineMapAttr::get(map));
991
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
992
0
  odsState.addTypes(resultTypes);
993
0
}
994
995
0
void AffineMinOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
996
0
  odsState.addOperands(operands);
997
0
  odsState.addAttributes(attributes);
998
0
  assert(resultTypes.size() == 1u && "mismatched number of return types");
999
0
  odsState.addTypes(resultTypes);
1000
0
}
1001
1002
0
ParseResult AffineMinOp::parse(OpAsmParser &parser, OperationState &result) {
1003
0
  return ::parseAffineMinMaxOp<AffineMinOp>(parser, result);
1004
0
}
1005
1006
0
void AffineMinOp::print(OpAsmPrinter &p) {
1007
0
  return ::printAffineMinMaxOp(p, *this);
1008
0
}
1009
1010
0
LogicalResult AffineMinOp::verify() {
1011
0
  auto tblgen_map = this->getAttr("map");
1012
0
  if (!tblgen_map) return emitOpError("requires attribute 'map'");
1013
0
  {
1014
0
    if (!((tblgen_map.isa<AffineMapAttr>()))) return emitOpError("attribute 'map' failed to satisfy constraint: AffineMap attribute");
1015
0
  }
1016
0
  {
1017
0
    unsigned index = 0; (void)index;
1018
0
    auto valueGroup0 = getODSOperands(0);
1019
0
    for (Value v : valueGroup0) {
1020
0
      (void)v;
1021
0
      if (!((v.getType().isa<IndexType>()))) {
1022
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
1023
0
      }
1024
0
      ++index;
1025
0
    }
1026
0
  }
1027
0
  {
1028
0
    unsigned index = 0; (void)index;
1029
0
    auto valueGroup0 = getODSResults(0);
1030
0
    for (Value v : valueGroup0) {
1031
0
      (void)v;
1032
0
      if (!((v.getType().isa<IndexType>()))) {
1033
0
        return emitOpError("result #") << index << " must be index, but got " << v.getType();
1034
0
      }
1035
0
      ++index;
1036
0
    }
1037
0
  }
1038
0
  return ::verifyAffineMinMaxOp(*this);
1039
0
}
1040
1041
1042
1043
1044
1045
0
void AffineMinOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
1046
0
1047
0
}
1048
1049
1050
//===----------------------------------------------------------------------===//
1051
// AffineParallelOp definitions
1052
//===----------------------------------------------------------------------===//
1053
1054
0
AffineParallelOpOperandAdaptor::AffineParallelOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1055
0
1056
0
}
1057
1058
0
AffineParallelOpOperandAdaptor::AffineParallelOpOperandAdaptor(AffineParallelOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
1059
0
1060
0
}
1061
1062
0
std::pair<unsigned, unsigned> AffineParallelOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
1063
0
  bool isVariadic[] = {true};
1064
0
  int prevVariadicCount = 0;
1065
0
  for (unsigned i = 0; i < index; ++i)
1066
0
    if (isVariadic[i]) ++prevVariadicCount;
1067
0
1068
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1069
0
  // This assumes all static variadic operands have the same dynamic value count.
1070
0
  int variadicSize = (odsOperands.size() - 0) / 1;
1071
0
  // `index` passed in as the parameter is the static index which counts each
1072
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1073
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1074
0
  // value pack for this static operand starts.
1075
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1076
0
  int size = isVariadic[index] ? variadicSize : 1;
1077
0
  return {start, size};
1078
0
}
1079
1080
0
ValueRange AffineParallelOpOperandAdaptor::getODSOperands(unsigned index) {
1081
0
  auto valueRange = getODSOperandIndexAndLength(index);
1082
0
  return {std::next(odsOperands.begin(), valueRange.first),
1083
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1084
0
}
1085
1086
0
ValueRange AffineParallelOpOperandAdaptor::mapOperands() {
1087
0
  return getODSOperands(0);
1088
0
}
1089
1090
0
AffineMapAttr AffineParallelOpOperandAdaptor::lowerBoundsMap() {
1091
0
  assert(odsAttrs && "no attributes when constructing adapter");
1092
0
  AffineMapAttr attr = odsAttrs.get("lowerBoundsMap").cast<AffineMapAttr>();
1093
0
  return attr;
1094
0
}
1095
1096
0
AffineMapAttr AffineParallelOpOperandAdaptor::upperBoundsMap() {
1097
0
  assert(odsAttrs && "no attributes when constructing adapter");
1098
0
  AffineMapAttr attr = odsAttrs.get("upperBoundsMap").cast<AffineMapAttr>();
1099
0
  return attr;
1100
0
}
1101
1102
0
ArrayAttr AffineParallelOpOperandAdaptor::steps() {
1103
0
  assert(odsAttrs && "no attributes when constructing adapter");
1104
0
  ArrayAttr attr = odsAttrs.get("steps").cast<ArrayAttr>();
1105
0
  return attr;
1106
0
}
1107
1108
0
StringRef AffineParallelOp::getOperationName() {
1109
0
  return "affine.parallel";
1110
0
}
1111
1112
0
std::pair<unsigned, unsigned> AffineParallelOp::getODSOperandIndexAndLength(unsigned index) {
1113
0
  bool isVariadic[] = {true};
1114
0
  int prevVariadicCount = 0;
1115
0
  for (unsigned i = 0; i < index; ++i)
1116
0
    if (isVariadic[i]) ++prevVariadicCount;
1117
0
1118
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1119
0
  // This assumes all static variadic operands have the same dynamic value count.
1120
0
  int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
1121
0
  // `index` passed in as the parameter is the static index which counts each
1122
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1123
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1124
0
  // value pack for this static operand starts.
1125
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1126
0
  int size = isVariadic[index] ? variadicSize : 1;
1127
0
  return {start, size};
1128
0
}
1129
1130
0
Operation::operand_range AffineParallelOp::getODSOperands(unsigned index) {
1131
0
  auto valueRange = getODSOperandIndexAndLength(index);
1132
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
1133
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1134
0
}
1135
1136
0
Operation::operand_range AffineParallelOp::mapOperands() {
1137
0
  return getODSOperands(0);
1138
0
}
1139
1140
0
::mlir::MutableOperandRange AffineParallelOp::mapOperandsMutable() {
1141
0
  auto range = getODSOperandIndexAndLength(0);
1142
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1143
0
}
1144
1145
0
std::pair<unsigned, unsigned> AffineParallelOp::getODSResultIndexAndLength(unsigned index) {
1146
0
  return {index, 1};
1147
0
}
1148
1149
0
Operation::result_range AffineParallelOp::getODSResults(unsigned index) {
1150
0
  auto valueRange = getODSResultIndexAndLength(index);
1151
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
1152
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1153
0
}
1154
1155
0
Region &AffineParallelOp::region() {
1156
0
  return this->getOperation()->getRegion(0);
1157
0
}
1158
1159
0
AffineMapAttr AffineParallelOp::lowerBoundsMapAttr() {
1160
0
  return this->getAttr("lowerBoundsMap").cast<AffineMapAttr>();
1161
0
}
1162
1163
0
AffineMap AffineParallelOp::lowerBoundsMap() {
1164
0
  auto attr = lowerBoundsMapAttr();
1165
0
  return attr.getValue();
1166
0
}
1167
1168
0
AffineMapAttr AffineParallelOp::upperBoundsMapAttr() {
1169
0
  return this->getAttr("upperBoundsMap").cast<AffineMapAttr>();
1170
0
}
1171
1172
0
AffineMap AffineParallelOp::upperBoundsMap() {
1173
0
  auto attr = upperBoundsMapAttr();
1174
0
  return attr.getValue();
1175
0
}
1176
1177
0
ArrayAttr AffineParallelOp::stepsAttr() {
1178
0
  return this->getAttr("steps").cast<ArrayAttr>();
1179
0
}
1180
1181
0
ArrayAttr AffineParallelOp::steps() {
1182
0
  auto attr = stepsAttr();
1183
0
  return attr;
1184
0
}
1185
1186
0
void AffineParallelOp::lowerBoundsMapAttr(AffineMapAttr attr) {
1187
0
  this->getOperation()->setAttr("lowerBoundsMap", attr);
1188
0
}
1189
1190
0
void AffineParallelOp::upperBoundsMapAttr(AffineMapAttr attr) {
1191
0
  this->getOperation()->setAttr("upperBoundsMap", attr);
1192
0
}
1193
1194
0
void AffineParallelOp::stepsAttr(ArrayAttr attr) {
1195
0
  this->getOperation()->setAttr("steps", attr);
1196
0
}
1197
1198
1199
1200
1201
1202
1203
1204
0
void AffineParallelOp::build(OpBuilder &odsBuilder, OperationState &odsState, AffineMapAttr lowerBoundsMap, AffineMapAttr upperBoundsMap, ArrayAttr steps, ValueRange mapOperands) {
1205
0
  odsState.addOperands(mapOperands);
1206
0
  odsState.addAttribute("lowerBoundsMap", lowerBoundsMap);
1207
0
  odsState.addAttribute("upperBoundsMap", upperBoundsMap);
1208
0
  odsState.addAttribute("steps", steps);
1209
0
  (void)odsState.addRegion();
1210
0
}
1211
1212
0
void AffineParallelOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMapAttr lowerBoundsMap, AffineMapAttr upperBoundsMap, ArrayAttr steps, ValueRange mapOperands) {
1213
0
  odsState.addOperands(mapOperands);
1214
0
  odsState.addAttribute("lowerBoundsMap", lowerBoundsMap);
1215
0
  odsState.addAttribute("upperBoundsMap", upperBoundsMap);
1216
0
  odsState.addAttribute("steps", steps);
1217
0
  (void)odsState.addRegion();
1218
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
1219
0
  odsState.addTypes(resultTypes);
1220
0
}
1221
1222
0
void AffineParallelOp::build(OpBuilder &odsBuilder, OperationState &odsState, AffineMap lowerBoundsMap, AffineMap upperBoundsMap, ArrayAttr steps, ValueRange mapOperands) {
1223
0
  odsState.addOperands(mapOperands);
1224
0
  odsState.addAttribute("lowerBoundsMap", AffineMapAttr::get(lowerBoundsMap));
1225
0
  odsState.addAttribute("upperBoundsMap", AffineMapAttr::get(upperBoundsMap));
1226
0
  odsState.addAttribute("steps", steps);
1227
0
  (void)odsState.addRegion();
1228
0
}
1229
1230
0
void AffineParallelOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, AffineMap lowerBoundsMap, AffineMap upperBoundsMap, ArrayAttr steps, ValueRange mapOperands) {
1231
0
  odsState.addOperands(mapOperands);
1232
0
  odsState.addAttribute("lowerBoundsMap", AffineMapAttr::get(lowerBoundsMap));
1233
0
  odsState.addAttribute("upperBoundsMap", AffineMapAttr::get(upperBoundsMap));
1234
0
  odsState.addAttribute("steps", steps);
1235
0
  (void)odsState.addRegion();
1236
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
1237
0
  odsState.addTypes(resultTypes);
1238
0
}
1239
1240
0
void AffineParallelOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
1241
0
  odsState.addOperands(operands);
1242
0
  odsState.addAttributes(attributes);
1243
0
  for (unsigned i = 0; i != 1; ++i)
1244
0
    (void)odsState.addRegion();
1245
0
  assert(resultTypes.size() == 0u && "mismatched number of return types");
1246
0
  odsState.addTypes(resultTypes);
1247
0
}
1248
1249
0
ParseResult AffineParallelOp::parse(OpAsmParser &parser, OperationState &result) {
1250
0
  return ::parseAffineParallelOp(parser, result);
1251
0
}
1252
1253
0
void AffineParallelOp::print(OpAsmPrinter &p) {
1254
0
  return ::print(p, *this);
1255
0
}
1256
1257
0
LogicalResult AffineParallelOp::verify() {
1258
0
  auto tblgen_lowerBoundsMap = this->getAttr("lowerBoundsMap");
1259
0
  if (!tblgen_lowerBoundsMap) return emitOpError("requires attribute 'lowerBoundsMap'");
1260
0
  {
1261
0
    if (!((tblgen_lowerBoundsMap.isa<AffineMapAttr>()))) return emitOpError("attribute 'lowerBoundsMap' failed to satisfy constraint: AffineMap attribute");
1262
0
  }
1263
0
  auto tblgen_upperBoundsMap = this->getAttr("upperBoundsMap");
1264
0
  if (!tblgen_upperBoundsMap) return emitOpError("requires attribute 'upperBoundsMap'");
1265
0
  {
1266
0
    if (!((tblgen_upperBoundsMap.isa<AffineMapAttr>()))) return emitOpError("attribute 'upperBoundsMap' failed to satisfy constraint: AffineMap attribute");
1267
0
  }
1268
0
  auto tblgen_steps = this->getAttr("steps");
1269
0
  if (!tblgen_steps) return emitOpError("requires attribute 'steps'");
1270
0
  {
1271
0
    if (!(((tblgen_steps.isa<ArrayAttr>())) && (llvm::all_of(tblgen_steps.cast<ArrayAttr>(), [](Attribute attr) { return ((attr.isa<IntegerAttr>())) && ((attr.cast<IntegerAttr>().getType().isSignlessInteger(64))); })))) return emitOpError("attribute 'steps' failed to satisfy constraint: 64-bit integer array attribute");
1272
0
  }
1273
0
  {
1274
0
    unsigned index = 0; (void)index;
1275
0
    auto valueGroup0 = getODSOperands(0);
1276
0
    for (Value v : valueGroup0) {
1277
0
      (void)v;
1278
0
      if (!((v.getType().isa<IndexType>()))) {
1279
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
1280
0
      }
1281
0
      ++index;
1282
0
    }
1283
0
  }
1284
0
  {
1285
0
    unsigned index = 0; (void)index;
1286
0
  }
1287
0
{
1288
0
    unsigned index = 0; (void)index;
1289
0
    for (Region &region : MutableArrayRef<Region>(this->getOperation()->getRegion(0))) {
1290
0
      (void)region;
1291
0
      if (!((region.getBlocks().size() == 1))) {
1292
0
        return emitOpError("region #") << index << " ('region') failed to verify constraint: region with 1 blocks";
1293
0
      }
1294
0
      ++index;
1295
0
    }
1296
0
  }
1297
0
  return ::verify(*this);
1298
0
}
1299
1300
1301
//===----------------------------------------------------------------------===//
1302
// AffinePrefetchOp definitions
1303
//===----------------------------------------------------------------------===//
1304
1305
0
AffinePrefetchOpOperandAdaptor::AffinePrefetchOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1306
0
1307
0
}
1308
1309
0
AffinePrefetchOpOperandAdaptor::AffinePrefetchOpOperandAdaptor(AffinePrefetchOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
1310
0
1311
0
}
1312
1313
0
std::pair<unsigned, unsigned> AffinePrefetchOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
1314
0
  bool isVariadic[] = {false, true};
1315
0
  int prevVariadicCount = 0;
1316
0
  for (unsigned i = 0; i < index; ++i)
1317
0
    if (isVariadic[i]) ++prevVariadicCount;
1318
0
1319
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1320
0
  // This assumes all static variadic operands have the same dynamic value count.
1321
0
  int variadicSize = (odsOperands.size() - 1) / 1;
1322
0
  // `index` passed in as the parameter is the static index which counts each
1323
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1324
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1325
0
  // value pack for this static operand starts.
1326
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1327
0
  int size = isVariadic[index] ? variadicSize : 1;
1328
0
  return {start, size};
1329
0
}
1330
1331
0
ValueRange AffinePrefetchOpOperandAdaptor::getODSOperands(unsigned index) {
1332
0
  auto valueRange = getODSOperandIndexAndLength(index);
1333
0
  return {std::next(odsOperands.begin(), valueRange.first),
1334
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1335
0
}
1336
1337
0
Value AffinePrefetchOpOperandAdaptor::memref() {
1338
0
  return *getODSOperands(0).begin();
1339
0
}
1340
1341
0
ValueRange AffinePrefetchOpOperandAdaptor::indices() {
1342
0
  return getODSOperands(1);
1343
0
}
1344
1345
0
BoolAttr AffinePrefetchOpOperandAdaptor::isWrite() {
1346
0
  assert(odsAttrs && "no attributes when constructing adapter");
1347
0
  BoolAttr attr = odsAttrs.get("isWrite").cast<BoolAttr>();
1348
0
  return attr;
1349
0
}
1350
1351
0
IntegerAttr AffinePrefetchOpOperandAdaptor::localityHint() {
1352
0
  assert(odsAttrs && "no attributes when constructing adapter");
1353
0
  IntegerAttr attr = odsAttrs.get("localityHint").cast<IntegerAttr>();
1354
0
  return attr;
1355
0
}
1356
1357
0
BoolAttr AffinePrefetchOpOperandAdaptor::isDataCache() {
1358
0
  assert(odsAttrs && "no attributes when constructing adapter");
1359
0
  BoolAttr attr = odsAttrs.get("isDataCache").cast<BoolAttr>();
1360
0
  return attr;
1361
0
}
1362
1363
0
StringRef AffinePrefetchOp::getOperationName() {
1364
0
  return "affine.prefetch";
1365
0
}
1366
1367
0
std::pair<unsigned, unsigned> AffinePrefetchOp::getODSOperandIndexAndLength(unsigned index) {
1368
0
  bool isVariadic[] = {false, true};
1369
0
  int prevVariadicCount = 0;
1370
0
  for (unsigned i = 0; i < index; ++i)
1371
0
    if (isVariadic[i]) ++prevVariadicCount;
1372
0
1373
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1374
0
  // This assumes all static variadic operands have the same dynamic value count.
1375
0
  int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1376
0
  // `index` passed in as the parameter is the static index which counts each
1377
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1378
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1379
0
  // value pack for this static operand starts.
1380
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1381
0
  int size = isVariadic[index] ? variadicSize : 1;
1382
0
  return {start, size};
1383
0
}
1384
1385
0
Operation::operand_range AffinePrefetchOp::getODSOperands(unsigned index) {
1386
0
  auto valueRange = getODSOperandIndexAndLength(index);
1387
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
1388
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1389
0
}
1390
1391
0
Value AffinePrefetchOp::memref() {
1392
0
  return *getODSOperands(0).begin();
1393
0
}
1394
1395
0
Operation::operand_range AffinePrefetchOp::indices() {
1396
0
  return getODSOperands(1);
1397
0
}
1398
1399
0
::mlir::MutableOperandRange AffinePrefetchOp::memrefMutable() {
1400
0
  auto range = getODSOperandIndexAndLength(0);
1401
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1402
0
}
1403
1404
0
::mlir::MutableOperandRange AffinePrefetchOp::indicesMutable() {
1405
0
  auto range = getODSOperandIndexAndLength(1);
1406
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1407
0
}
1408
1409
0
std::pair<unsigned, unsigned> AffinePrefetchOp::getODSResultIndexAndLength(unsigned index) {
1410
0
  return {index, 1};
1411
0
}
1412
1413
0
Operation::result_range AffinePrefetchOp::getODSResults(unsigned index) {
1414
0
  auto valueRange = getODSResultIndexAndLength(index);
1415
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
1416
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1417
0
}
1418
1419
0
BoolAttr AffinePrefetchOp::isWriteAttr() {
1420
0
  return this->getAttr("isWrite").cast<BoolAttr>();
1421
0
}
1422
1423
0
bool AffinePrefetchOp::isWrite() {
1424
0
  auto attr = isWriteAttr();
1425
0
  return attr.getValue();
1426
0
}
1427
1428
0
IntegerAttr AffinePrefetchOp::localityHintAttr() {
1429
0
  return this->getAttr("localityHint").cast<IntegerAttr>();
1430
0
}
1431
1432
0
APInt AffinePrefetchOp::localityHint() {
1433
0
  auto attr = localityHintAttr();
1434
0
  return attr.getValue();
1435
0
}
1436
1437
0
BoolAttr AffinePrefetchOp::isDataCacheAttr() {
1438
0
  return this->getAttr("isDataCache").cast<BoolAttr>();
1439
0
}
1440
1441
0
bool AffinePrefetchOp::isDataCache() {
1442
0
  auto attr = isDataCacheAttr();
1443
0
  return attr.getValue();
1444
0
}
1445
1446
0
void AffinePrefetchOp::isWriteAttr(BoolAttr attr) {
1447
0
  this->getOperation()->setAttr("isWrite", attr);
1448
0
}
1449
1450
0
void AffinePrefetchOp::localityHintAttr(IntegerAttr attr) {
1451
0
  this->getOperation()->setAttr("localityHint", attr);
1452
0
}
1453
1454
0
void AffinePrefetchOp::isDataCacheAttr(BoolAttr attr) {
1455
0
  this->getOperation()->setAttr("isDataCache", attr);
1456
0
}
1457
1458
0
void AffinePrefetchOp::build(OpBuilder &builder, OperationState &result, Value memref,AffineMap map, ArrayRef<Value> mapOperands, bool isWrite,unsigned localityHint, bool isDataCache) {
1459
0
      assert(map.getNumInputs() == mapOperands.size()
1460
0
             && "inconsistent index info");
1461
0
      auto localityHintAttr = builder.getI32IntegerAttr(localityHint);
1462
0
      auto isWriteAttr = builder.getBoolAttr(isWrite);
1463
0
      auto isDataCacheAttr = builder.getBoolAttr(isDataCache);
1464
0
      result.addOperands(memref);
1465
0
      result.addAttribute(getMapAttrName(), AffineMapAttr::get(map));
1466
0
      result.addOperands(mapOperands);
1467
0
      result.addAttribute(getLocalityHintAttrName(), localityHintAttr);
1468
0
      result.addAttribute(getIsWriteAttrName(), isWriteAttr);
1469
0
      result.addAttribute(getIsDataCacheAttrName(), isDataCacheAttr);
1470
0
    
1471
0
}
1472
1473
0
void AffinePrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache) {
1474
0
  odsState.addOperands(memref);
1475
0
  odsState.addOperands(indices);
1476
0
  odsState.addAttribute("isWrite", isWrite);
1477
0
  odsState.addAttribute("localityHint", localityHint);
1478
0
  odsState.addAttribute("isDataCache", isDataCache);
1479
0
}
1480
1481
0
void AffinePrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, BoolAttr isWrite, IntegerAttr localityHint, BoolAttr isDataCache) {
1482
0
  odsState.addOperands(memref);
1483
0
  odsState.addOperands(indices);
1484
0
  odsState.addAttribute("isWrite", isWrite);
1485
0
  odsState.addAttribute("localityHint", localityHint);
1486
0
  odsState.addAttribute("isDataCache", isDataCache);
1487
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
1488
0
  odsState.addTypes(resultTypes);
1489
0
}
1490
1491
0
void AffinePrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache) {
1492
0
  odsState.addOperands(memref);
1493
0
  odsState.addOperands(indices);
1494
0
  odsState.addAttribute("isWrite", odsBuilder.getBoolAttr(isWrite));
1495
0
  odsState.addAttribute("localityHint", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint));
1496
0
  odsState.addAttribute("isDataCache", odsBuilder.getBoolAttr(isDataCache));
1497
0
}
1498
1499
0
void AffinePrefetchOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices, bool isWrite, APInt localityHint, bool isDataCache) {
1500
0
  odsState.addOperands(memref);
1501
0
  odsState.addOperands(indices);
1502
0
  odsState.addAttribute("isWrite", odsBuilder.getBoolAttr(isWrite));
1503
0
  odsState.addAttribute("localityHint", odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), localityHint));
1504
0
  odsState.addAttribute("isDataCache", odsBuilder.getBoolAttr(isDataCache));
1505
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
1506
0
  odsState.addTypes(resultTypes);
1507
0
}
1508
1509
0
void AffinePrefetchOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
1510
0
  assert(operands.size() >= 1u && "mismatched number of parameters");
1511
0
  odsState.addOperands(operands);
1512
0
  odsState.addAttributes(attributes);
1513
0
  assert(resultTypes.size() == 0u && "mismatched number of return types");
1514
0
  odsState.addTypes(resultTypes);
1515
0
}
1516
1517
0
ParseResult AffinePrefetchOp::parse(OpAsmParser &parser, OperationState &result) {
1518
0
  return ::parseAffinePrefetchOp(parser, result);
1519
0
}
1520
1521
0
void AffinePrefetchOp::print(OpAsmPrinter &p) {
1522
0
  return ::print(p, *this);
1523
0
}
1524
1525
0
LogicalResult AffinePrefetchOp::verify() {
1526
0
  auto tblgen_isWrite = this->getAttr("isWrite");
1527
0
  if (!tblgen_isWrite) return emitOpError("requires attribute 'isWrite'");
1528
0
  {
1529
0
    if (!((tblgen_isWrite.isa<BoolAttr>()))) return emitOpError("attribute 'isWrite' failed to satisfy constraint: bool attribute");
1530
0
  }
1531
0
  auto tblgen_localityHint = this->getAttr("localityHint");
1532
0
  if (!tblgen_localityHint) return emitOpError("requires attribute 'localityHint'");
1533
0
  {
1534
0
    if (!((((tblgen_localityHint.isa<IntegerAttr>())) && ((tblgen_localityHint.cast<IntegerAttr>().getType().isSignlessInteger(32)))) && ((tblgen_localityHint.cast<IntegerAttr>().getInt() >= 0)) && ((tblgen_localityHint.cast<IntegerAttr>().getInt() <= 3)))) return emitOpError("attribute 'localityHint' failed to satisfy constraint: 32-bit signless integer attribute whose minimum value is 0 whose maximum value is 3");
1535
0
  }
1536
0
  auto tblgen_isDataCache = this->getAttr("isDataCache");
1537
0
  if (!tblgen_isDataCache) return emitOpError("requires attribute 'isDataCache'");
1538
0
  {
1539
0
    if (!((tblgen_isDataCache.isa<BoolAttr>()))) return emitOpError("attribute 'isDataCache' failed to satisfy constraint: bool attribute");
1540
0
  }
1541
0
  {
1542
0
    unsigned index = 0; (void)index;
1543
0
    auto valueGroup0 = getODSOperands(0);
1544
0
    for (Value v : valueGroup0) {
1545
0
      (void)v;
1546
0
      if (!(((v.getType().isa<MemRefType>())) && ((true)))) {
1547
0
        return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType();
1548
0
      }
1549
0
      ++index;
1550
0
    }
1551
0
    auto valueGroup1 = getODSOperands(1);
1552
0
    for (Value v : valueGroup1) {
1553
0
      (void)v;
1554
0
      if (!((v.getType().isa<IndexType>()))) {
1555
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
1556
0
      }
1557
0
      ++index;
1558
0
    }
1559
0
  }
1560
0
  {
1561
0
    unsigned index = 0; (void)index;
1562
0
  }
1563
0
  return ::verify(*this);
1564
0
}
1565
1566
1567
1568
1569
1570
1571
//===----------------------------------------------------------------------===//
1572
// AffineStoreOp definitions
1573
//===----------------------------------------------------------------------===//
1574
1575
0
AffineStoreOpOperandAdaptor::AffineStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1576
0
1577
0
}
1578
1579
0
AffineStoreOpOperandAdaptor::AffineStoreOpOperandAdaptor(AffineStoreOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
1580
0
1581
0
}
1582
1583
0
std::pair<unsigned, unsigned> AffineStoreOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
1584
0
  bool isVariadic[] = {false, false, true};
1585
0
  int prevVariadicCount = 0;
1586
0
  for (unsigned i = 0; i < index; ++i)
1587
0
    if (isVariadic[i]) ++prevVariadicCount;
1588
0
1589
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1590
0
  // This assumes all static variadic operands have the same dynamic value count.
1591
0
  int variadicSize = (odsOperands.size() - 2) / 1;
1592
0
  // `index` passed in as the parameter is the static index which counts each
1593
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1594
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1595
0
  // value pack for this static operand starts.
1596
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1597
0
  int size = isVariadic[index] ? variadicSize : 1;
1598
0
  return {start, size};
1599
0
}
1600
1601
0
ValueRange AffineStoreOpOperandAdaptor::getODSOperands(unsigned index) {
1602
0
  auto valueRange = getODSOperandIndexAndLength(index);
1603
0
  return {std::next(odsOperands.begin(), valueRange.first),
1604
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1605
0
}
1606
1607
0
Value AffineStoreOpOperandAdaptor::value() {
1608
0
  return *getODSOperands(0).begin();
1609
0
}
1610
1611
0
Value AffineStoreOpOperandAdaptor::memref() {
1612
0
  return *getODSOperands(1).begin();
1613
0
}
1614
1615
0
ValueRange AffineStoreOpOperandAdaptor::indices() {
1616
0
  return getODSOperands(2);
1617
0
}
1618
1619
0
StringRef AffineStoreOp::getOperationName() {
1620
0
  return "affine.store";
1621
0
}
1622
1623
0
std::pair<unsigned, unsigned> AffineStoreOp::getODSOperandIndexAndLength(unsigned index) {
1624
0
  bool isVariadic[] = {false, false, true};
1625
0
  int prevVariadicCount = 0;
1626
0
  for (unsigned i = 0; i < index; ++i)
1627
0
    if (isVariadic[i]) ++prevVariadicCount;
1628
0
1629
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1630
0
  // This assumes all static variadic operands have the same dynamic value count.
1631
0
  int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
1632
0
  // `index` passed in as the parameter is the static index which counts each
1633
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1634
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1635
0
  // value pack for this static operand starts.
1636
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1637
0
  int size = isVariadic[index] ? variadicSize : 1;
1638
0
  return {start, size};
1639
0
}
1640
1641
0
Operation::operand_range AffineStoreOp::getODSOperands(unsigned index) {
1642
0
  auto valueRange = getODSOperandIndexAndLength(index);
1643
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
1644
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1645
0
}
1646
1647
0
Value AffineStoreOp::value() {
1648
0
  return *getODSOperands(0).begin();
1649
0
}
1650
1651
0
Value AffineStoreOp::memref() {
1652
0
  return *getODSOperands(1).begin();
1653
0
}
1654
1655
0
Operation::operand_range AffineStoreOp::indices() {
1656
0
  return getODSOperands(2);
1657
0
}
1658
1659
0
::mlir::MutableOperandRange AffineStoreOp::valueMutable() {
1660
0
  auto range = getODSOperandIndexAndLength(0);
1661
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1662
0
}
1663
1664
0
::mlir::MutableOperandRange AffineStoreOp::memrefMutable() {
1665
0
  auto range = getODSOperandIndexAndLength(1);
1666
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1667
0
}
1668
1669
0
::mlir::MutableOperandRange AffineStoreOp::indicesMutable() {
1670
0
  auto range = getODSOperandIndexAndLength(2);
1671
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1672
0
}
1673
1674
0
std::pair<unsigned, unsigned> AffineStoreOp::getODSResultIndexAndLength(unsigned index) {
1675
0
  return {index, 1};
1676
0
}
1677
1678
0
Operation::result_range AffineStoreOp::getODSResults(unsigned index) {
1679
0
  auto valueRange = getODSResultIndexAndLength(index);
1680
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
1681
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1682
0
}
1683
1684
1685
1686
1687
1688
0
ParseResult AffineStoreOp::parse(OpAsmParser &parser, OperationState &result) {
1689
0
  return ::parseAffineStoreOp(parser, result);
1690
0
}
1691
1692
0
void AffineStoreOp::print(OpAsmPrinter &p) {
1693
0
  return ::print(p, *this);
1694
0
}
1695
1696
0
LogicalResult AffineStoreOp::verify() {
1697
0
  {
1698
0
    unsigned index = 0; (void)index;
1699
0
    auto valueGroup0 = getODSOperands(0);
1700
0
    for (Value v : valueGroup0) {
1701
0
      (void)v;
1702
0
      if (!((true))) {
1703
0
        return emitOpError("operand #") << index << " must be any type, but got " << v.getType();
1704
0
      }
1705
0
      ++index;
1706
0
    }
1707
0
    auto valueGroup1 = getODSOperands(1);
1708
0
    for (Value v : valueGroup1) {
1709
0
      (void)v;
1710
0
      if (!(((v.getType().isa<MemRefType>())) && ((true)))) {
1711
0
        return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType();
1712
0
      }
1713
0
      ++index;
1714
0
    }
1715
0
    auto valueGroup2 = getODSOperands(2);
1716
0
    for (Value v : valueGroup2) {
1717
0
      (void)v;
1718
0
      if (!((v.getType().isa<IndexType>()))) {
1719
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
1720
0
      }
1721
0
      ++index;
1722
0
    }
1723
0
  }
1724
0
  {
1725
0
    unsigned index = 0; (void)index;
1726
0
  }
1727
0
  return ::verify(*this);
1728
0
}
1729
1730
1731
1732
1733
1734
0
void AffineStoreOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
1735
0
  for (Value value : getODSOperands(1))
1736
0
    effects.emplace_back(MemoryEffects::Write::get(), value, ::mlir::SideEffects::DefaultResource::get());
1737
0
}
1738
1739
1740
//===----------------------------------------------------------------------===//
1741
// AffineTerminatorOp definitions
1742
//===----------------------------------------------------------------------===//
1743
1744
0
AffineTerminatorOpOperandAdaptor::AffineTerminatorOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1745
0
1746
0
}
1747
1748
0
AffineTerminatorOpOperandAdaptor::AffineTerminatorOpOperandAdaptor(AffineTerminatorOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
1749
0
1750
0
}
1751
1752
0
std::pair<unsigned, unsigned> AffineTerminatorOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
1753
0
  return {index, 1};
1754
0
}
1755
1756
0
ValueRange AffineTerminatorOpOperandAdaptor::getODSOperands(unsigned index) {
1757
0
  auto valueRange = getODSOperandIndexAndLength(index);
1758
0
  return {std::next(odsOperands.begin(), valueRange.first),
1759
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1760
0
}
1761
1762
0
StringRef AffineTerminatorOp::getOperationName() {
1763
0
  return "affine.terminator";
1764
0
}
1765
1766
0
std::pair<unsigned, unsigned> AffineTerminatorOp::getODSOperandIndexAndLength(unsigned index) {
1767
0
  return {index, 1};
1768
0
}
1769
1770
0
Operation::operand_range AffineTerminatorOp::getODSOperands(unsigned index) {
1771
0
  auto valueRange = getODSOperandIndexAndLength(index);
1772
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
1773
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1774
0
}
1775
1776
0
std::pair<unsigned, unsigned> AffineTerminatorOp::getODSResultIndexAndLength(unsigned index) {
1777
0
  return {index, 1};
1778
0
}
1779
1780
0
Operation::result_range AffineTerminatorOp::getODSResults(unsigned index) {
1781
0
  auto valueRange = getODSResultIndexAndLength(index);
1782
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
1783
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1784
0
}
1785
1786
0
void AffineTerminatorOp::build(OpBuilder &odsBuilder, OperationState &odsState) {
1787
0
1788
0
}
1789
1790
0
void AffineTerminatorOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes) {
1791
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
1792
0
  odsState.addTypes(resultTypes);
1793
0
}
1794
1795
0
void AffineTerminatorOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
1796
0
  assert(operands.size() == 0u && "mismatched number of parameters");
1797
0
  odsState.addOperands(operands);
1798
0
  odsState.addAttributes(attributes);
1799
0
  assert(resultTypes.size() == 0u && "mismatched number of return types");
1800
0
  odsState.addTypes(resultTypes);
1801
0
}
1802
1803
0
LogicalResult AffineTerminatorOp::verify() {
1804
0
  {
1805
0
    unsigned index = 0; (void)index;
1806
0
  }
1807
0
  {
1808
0
    unsigned index = 0; (void)index;
1809
0
  }
1810
0
  return mlir::success();
1811
0
}
1812
1813
0
void AffineTerminatorOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
1814
0
1815
0
}
1816
1817
1818
//===----------------------------------------------------------------------===//
1819
// AffineVectorLoadOp definitions
1820
//===----------------------------------------------------------------------===//
1821
1822
0
AffineVectorLoadOpOperandAdaptor::AffineVectorLoadOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1823
0
1824
0
}
1825
1826
0
AffineVectorLoadOpOperandAdaptor::AffineVectorLoadOpOperandAdaptor(AffineVectorLoadOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
1827
0
1828
0
}
1829
1830
0
std::pair<unsigned, unsigned> AffineVectorLoadOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
1831
0
  bool isVariadic[] = {false, true};
1832
0
  int prevVariadicCount = 0;
1833
0
  for (unsigned i = 0; i < index; ++i)
1834
0
    if (isVariadic[i]) ++prevVariadicCount;
1835
0
1836
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1837
0
  // This assumes all static variadic operands have the same dynamic value count.
1838
0
  int variadicSize = (odsOperands.size() - 1) / 1;
1839
0
  // `index` passed in as the parameter is the static index which counts each
1840
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1841
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1842
0
  // value pack for this static operand starts.
1843
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1844
0
  int size = isVariadic[index] ? variadicSize : 1;
1845
0
  return {start, size};
1846
0
}
1847
1848
0
ValueRange AffineVectorLoadOpOperandAdaptor::getODSOperands(unsigned index) {
1849
0
  auto valueRange = getODSOperandIndexAndLength(index);
1850
0
  return {std::next(odsOperands.begin(), valueRange.first),
1851
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
1852
0
}
1853
1854
0
Value AffineVectorLoadOpOperandAdaptor::memref() {
1855
0
  return *getODSOperands(0).begin();
1856
0
}
1857
1858
0
ValueRange AffineVectorLoadOpOperandAdaptor::indices() {
1859
0
  return getODSOperands(1);
1860
0
}
1861
1862
0
StringRef AffineVectorLoadOp::getOperationName() {
1863
0
  return "affine.vector_load";
1864
0
}
1865
1866
0
std::pair<unsigned, unsigned> AffineVectorLoadOp::getODSOperandIndexAndLength(unsigned index) {
1867
0
  bool isVariadic[] = {false, true};
1868
0
  int prevVariadicCount = 0;
1869
0
  for (unsigned i = 0; i < index; ++i)
1870
0
    if (isVariadic[i]) ++prevVariadicCount;
1871
0
1872
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
1873
0
  // This assumes all static variadic operands have the same dynamic value count.
1874
0
  int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
1875
0
  // `index` passed in as the parameter is the static index which counts each
1876
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
1877
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1878
0
  // value pack for this static operand starts.
1879
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
1880
0
  int size = isVariadic[index] ? variadicSize : 1;
1881
0
  return {start, size};
1882
0
}
1883
1884
0
Operation::operand_range AffineVectorLoadOp::getODSOperands(unsigned index) {
1885
0
  auto valueRange = getODSOperandIndexAndLength(index);
1886
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
1887
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1888
0
}
1889
1890
0
Value AffineVectorLoadOp::memref() {
1891
0
  return *getODSOperands(0).begin();
1892
0
}
1893
1894
0
Operation::operand_range AffineVectorLoadOp::indices() {
1895
0
  return getODSOperands(1);
1896
0
}
1897
1898
0
::mlir::MutableOperandRange AffineVectorLoadOp::memrefMutable() {
1899
0
  auto range = getODSOperandIndexAndLength(0);
1900
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1901
0
}
1902
1903
0
::mlir::MutableOperandRange AffineVectorLoadOp::indicesMutable() {
1904
0
  auto range = getODSOperandIndexAndLength(1);
1905
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1906
0
}
1907
1908
0
std::pair<unsigned, unsigned> AffineVectorLoadOp::getODSResultIndexAndLength(unsigned index) {
1909
0
  return {index, 1};
1910
0
}
1911
1912
0
Operation::result_range AffineVectorLoadOp::getODSResults(unsigned index) {
1913
0
  auto valueRange = getODSResultIndexAndLength(index);
1914
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
1915
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1916
0
}
1917
1918
0
Value AffineVectorLoadOp::result() {
1919
0
  return *getODSResults(0).begin();
1920
0
}
1921
1922
0
void AffineVectorLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, Type result, Value memref, ValueRange indices) {
1923
0
  odsState.addOperands(memref);
1924
0
  odsState.addOperands(indices);
1925
0
  odsState.addTypes(result);
1926
0
}
1927
1928
0
void AffineVectorLoadOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value memref, ValueRange indices) {
1929
0
  odsState.addOperands(memref);
1930
0
  odsState.addOperands(indices);
1931
0
  assert(resultTypes.size() == 1u && "mismatched number of results");
1932
0
  odsState.addTypes(resultTypes);
1933
0
}
1934
1935
0
void AffineVectorLoadOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
1936
0
  assert(operands.size() >= 1u && "mismatched number of parameters");
1937
0
  odsState.addOperands(operands);
1938
0
  odsState.addAttributes(attributes);
1939
0
  assert(resultTypes.size() == 1u && "mismatched number of return types");
1940
0
  odsState.addTypes(resultTypes);
1941
0
}
1942
1943
0
ParseResult AffineVectorLoadOp::parse(OpAsmParser &parser, OperationState &result) {
1944
0
  return ::parseAffineVectorLoadOp(parser, result);
1945
0
}
1946
1947
0
void AffineVectorLoadOp::print(OpAsmPrinter &p) {
1948
0
  return ::print(p, *this);
1949
0
}
1950
1951
0
LogicalResult AffineVectorLoadOp::verify() {
1952
0
  {
1953
0
    unsigned index = 0; (void)index;
1954
0
    auto valueGroup0 = getODSOperands(0);
1955
0
    for (Value v : valueGroup0) {
1956
0
      (void)v;
1957
0
      if (!(((v.getType().isa<MemRefType>())) && ((true)))) {
1958
0
        return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType();
1959
0
      }
1960
0
      ++index;
1961
0
    }
1962
0
    auto valueGroup1 = getODSOperands(1);
1963
0
    for (Value v : valueGroup1) {
1964
0
      (void)v;
1965
0
      if (!((v.getType().isa<IndexType>()))) {
1966
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
1967
0
      }
1968
0
      ++index;
1969
0
    }
1970
0
  }
1971
0
  {
1972
0
    unsigned index = 0; (void)index;
1973
0
    auto valueGroup0 = getODSResults(0);
1974
0
    for (Value v : valueGroup0) {
1975
0
      (void)v;
1976
0
      if (!(((v.getType().isa<VectorType>())) && ((true)))) {
1977
0
        return emitOpError("result #") << index << " must be vector of any type values, but got " << v.getType();
1978
0
      }
1979
0
      ++index;
1980
0
    }
1981
0
  }
1982
0
  return ::verify(*this);
1983
0
}
1984
1985
0
void AffineVectorLoadOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
1986
0
  for (Value value : getODSOperands(0))
1987
0
    effects.emplace_back(MemoryEffects::Read::get(), value, ::mlir::SideEffects::DefaultResource::get());
1988
0
}
1989
1990
1991
//===----------------------------------------------------------------------===//
1992
// AffineVectorStoreOp definitions
1993
//===----------------------------------------------------------------------===//
1994
1995
0
AffineVectorStoreOpOperandAdaptor::AffineVectorStoreOpOperandAdaptor(ValueRange values, DictionaryAttr attrs )  : odsOperands(values), odsAttrs(attrs) {
1996
0
1997
0
}
1998
1999
0
AffineVectorStoreOpOperandAdaptor::AffineVectorStoreOpOperandAdaptor(AffineVectorStoreOp& op)  : odsOperands(op.getOperation()->getOperands()), odsAttrs(op.getOperation()->getAttrDictionary()) {
2000
0
2001
0
}
2002
2003
0
std::pair<unsigned, unsigned> AffineVectorStoreOpOperandAdaptor::getODSOperandIndexAndLength(unsigned index) {
2004
0
  bool isVariadic[] = {false, false, true};
2005
0
  int prevVariadicCount = 0;
2006
0
  for (unsigned i = 0; i < index; ++i)
2007
0
    if (isVariadic[i]) ++prevVariadicCount;
2008
0
2009
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
2010
0
  // This assumes all static variadic operands have the same dynamic value count.
2011
0
  int variadicSize = (odsOperands.size() - 2) / 1;
2012
0
  // `index` passed in as the parameter is the static index which counts each
2013
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
2014
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
2015
0
  // value pack for this static operand starts.
2016
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
2017
0
  int size = isVariadic[index] ? variadicSize : 1;
2018
0
  return {start, size};
2019
0
}
2020
2021
0
ValueRange AffineVectorStoreOpOperandAdaptor::getODSOperands(unsigned index) {
2022
0
  auto valueRange = getODSOperandIndexAndLength(index);
2023
0
  return {std::next(odsOperands.begin(), valueRange.first),
2024
0
           std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
2025
0
}
2026
2027
0
Value AffineVectorStoreOpOperandAdaptor::value() {
2028
0
  return *getODSOperands(0).begin();
2029
0
}
2030
2031
0
Value AffineVectorStoreOpOperandAdaptor::memref() {
2032
0
  return *getODSOperands(1).begin();
2033
0
}
2034
2035
0
ValueRange AffineVectorStoreOpOperandAdaptor::indices() {
2036
0
  return getODSOperands(2);
2037
0
}
2038
2039
0
StringRef AffineVectorStoreOp::getOperationName() {
2040
0
  return "affine.vector_store";
2041
0
}
2042
2043
0
std::pair<unsigned, unsigned> AffineVectorStoreOp::getODSOperandIndexAndLength(unsigned index) {
2044
0
  bool isVariadic[] = {false, false, true};
2045
0
  int prevVariadicCount = 0;
2046
0
  for (unsigned i = 0; i < index; ++i)
2047
0
    if (isVariadic[i]) ++prevVariadicCount;
2048
0
2049
0
  // Calculate how many dynamic values a static variadic operand corresponds to.
2050
0
  // This assumes all static variadic operands have the same dynamic value count.
2051
0
  int variadicSize = (getOperation()->getNumOperands() - 2) / 1;
2052
0
  // `index` passed in as the parameter is the static index which counts each
2053
0
  // operand (variadic or not) as size 1. So here for each previous static variadic
2054
0
  // operand, we need to offset by (variadicSize - 1) to get where the dynamic
2055
0
  // value pack for this static operand starts.
2056
0
  int start = index + (variadicSize - 1) * prevVariadicCount;
2057
0
  int size = isVariadic[index] ? variadicSize : 1;
2058
0
  return {start, size};
2059
0
}
2060
2061
0
Operation::operand_range AffineVectorStoreOp::getODSOperands(unsigned index) {
2062
0
  auto valueRange = getODSOperandIndexAndLength(index);
2063
0
  return {std::next(getOperation()->operand_begin(), valueRange.first),
2064
0
           std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
2065
0
}
2066
2067
0
Value AffineVectorStoreOp::value() {
2068
0
  return *getODSOperands(0).begin();
2069
0
}
2070
2071
0
Value AffineVectorStoreOp::memref() {
2072
0
  return *getODSOperands(1).begin();
2073
0
}
2074
2075
0
Operation::operand_range AffineVectorStoreOp::indices() {
2076
0
  return getODSOperands(2);
2077
0
}
2078
2079
0
::mlir::MutableOperandRange AffineVectorStoreOp::valueMutable() {
2080
0
  auto range = getODSOperandIndexAndLength(0);
2081
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2082
0
}
2083
2084
0
::mlir::MutableOperandRange AffineVectorStoreOp::memrefMutable() {
2085
0
  auto range = getODSOperandIndexAndLength(1);
2086
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2087
0
}
2088
2089
0
::mlir::MutableOperandRange AffineVectorStoreOp::indicesMutable() {
2090
0
  auto range = getODSOperandIndexAndLength(2);
2091
0
  return ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
2092
0
}
2093
2094
0
std::pair<unsigned, unsigned> AffineVectorStoreOp::getODSResultIndexAndLength(unsigned index) {
2095
0
  return {index, 1};
2096
0
}
2097
2098
0
Operation::result_range AffineVectorStoreOp::getODSResults(unsigned index) {
2099
0
  auto valueRange = getODSResultIndexAndLength(index);
2100
0
  return {std::next(getOperation()->result_begin(), valueRange.first),
2101
0
           std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
2102
0
}
2103
2104
0
void AffineVectorStoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, Value value, Value memref, ValueRange indices) {
2105
0
  odsState.addOperands(value);
2106
0
  odsState.addOperands(memref);
2107
0
  odsState.addOperands(indices);
2108
0
}
2109
2110
0
void AffineVectorStoreOp::build(OpBuilder &odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes, Value value, Value memref, ValueRange indices) {
2111
0
  odsState.addOperands(value);
2112
0
  odsState.addOperands(memref);
2113
0
  odsState.addOperands(indices);
2114
0
  assert(resultTypes.size() == 0u && "mismatched number of results");
2115
0
  odsState.addTypes(resultTypes);
2116
0
}
2117
2118
0
void AffineVectorStoreOp::build(OpBuilder &, OperationState &odsState, ArrayRef<Type> resultTypes, ValueRange operands, ArrayRef<NamedAttribute> attributes) {
2119
0
  assert(operands.size() >= 2u && "mismatched number of parameters");
2120
0
  odsState.addOperands(operands);
2121
0
  odsState.addAttributes(attributes);
2122
0
  assert(resultTypes.size() == 0u && "mismatched number of return types");
2123
0
  odsState.addTypes(resultTypes);
2124
0
}
2125
2126
0
ParseResult AffineVectorStoreOp::parse(OpAsmParser &parser, OperationState &result) {
2127
0
  return ::parseAffineVectorStoreOp(parser, result);
2128
0
}
2129
2130
0
void AffineVectorStoreOp::print(OpAsmPrinter &p) {
2131
0
  return ::print(p, *this);
2132
0
}
2133
2134
0
LogicalResult AffineVectorStoreOp::verify() {
2135
0
  {
2136
0
    unsigned index = 0; (void)index;
2137
0
    auto valueGroup0 = getODSOperands(0);
2138
0
    for (Value v : valueGroup0) {
2139
0
      (void)v;
2140
0
      if (!(((v.getType().isa<VectorType>())) && ((true)))) {
2141
0
        return emitOpError("operand #") << index << " must be vector of any type values, but got " << v.getType();
2142
0
      }
2143
0
      ++index;
2144
0
    }
2145
0
    auto valueGroup1 = getODSOperands(1);
2146
0
    for (Value v : valueGroup1) {
2147
0
      (void)v;
2148
0
      if (!(((v.getType().isa<MemRefType>())) && ((true)))) {
2149
0
        return emitOpError("operand #") << index << " must be memref of any type values, but got " << v.getType();
2150
0
      }
2151
0
      ++index;
2152
0
    }
2153
0
    auto valueGroup2 = getODSOperands(2);
2154
0
    for (Value v : valueGroup2) {
2155
0
      (void)v;
2156
0
      if (!((v.getType().isa<IndexType>()))) {
2157
0
        return emitOpError("operand #") << index << " must be index, but got " << v.getType();
2158
0
      }
2159
0
      ++index;
2160
0
    }
2161
0
  }
2162
0
  {
2163
0
    unsigned index = 0; (void)index;
2164
0
  }
2165
0
  return ::verify(*this);
2166
0
}
2167
2168
0
void AffineVectorStoreOp::getEffects(SmallVectorImpl<SideEffects::EffectInstance<MemoryEffects::Effect>> &effects) {
2169
0
  for (Value value : getODSOperands(1))
2170
0
    effects.emplace_back(MemoryEffects::Write::get(), value, ::mlir::SideEffects::DefaultResource::get());
2171
0
}
2172
2173
2174
#endif  // GET_OP_CLASSES
2175