@@ -63,11 +63,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
63
63
64
64
mlir::Value getConstAPInt (mlir::Location loc, mlir::Type typ,
65
65
const llvm::APInt &val) {
66
- return create< cir::ConstantOp>( loc, cir::IntAttr::get (typ, val));
66
+ return cir::ConstantOp::create (* this , loc, cir::IntAttr::get (typ, val));
67
67
}
68
68
69
69
cir::ConstantOp getConstant (mlir::Location loc, mlir::TypedAttr attr) {
70
- return create< cir::ConstantOp>( loc, attr);
70
+ return cir::ConstantOp::create (* this , loc, attr);
71
71
}
72
72
73
73
cir::ConstantOp getConstantInt (mlir::Location loc, mlir::Type ty,
@@ -119,7 +119,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
119
119
}
120
120
121
121
cir::ConstantOp getBool (bool state, mlir::Location loc) {
122
- return create< cir::ConstantOp>( loc, getCIRBoolAttr (state));
122
+ return cir::ConstantOp::create (* this , loc, getCIRBoolAttr (state));
123
123
}
124
124
cir::ConstantOp getFalse (mlir::Location loc) { return getBool (false , loc); }
125
125
cir::ConstantOp getTrue (mlir::Location loc) { return getBool (true , loc); }
@@ -144,17 +144,20 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
144
144
mlir::Value createComplexCreate (mlir::Location loc, mlir::Value real,
145
145
mlir::Value imag) {
146
146
auto resultComplexTy = cir::ComplexType::get (real.getType ());
147
- return create<cir::ComplexCreateOp>(loc, resultComplexTy, real, imag);
147
+ return cir::ComplexCreateOp::create (*this , loc, resultComplexTy, real,
148
+ imag);
148
149
}
149
150
150
151
mlir::Value createComplexReal (mlir::Location loc, mlir::Value operand) {
151
152
auto operandTy = mlir::cast<cir::ComplexType>(operand.getType ());
152
- return create<cir::ComplexRealOp>(loc, operandTy.getElementType (), operand);
153
+ return cir::ComplexRealOp::create (*this , loc, operandTy.getElementType (),
154
+ operand);
153
155
}
154
156
155
157
mlir::Value createComplexImag (mlir::Location loc, mlir::Value operand) {
156
158
auto operandTy = mlir::cast<cir::ComplexType>(operand.getType ());
157
- return create<cir::ComplexImagOp>(loc, operandTy.getElementType (), operand);
159
+ return cir::ComplexImagOp::create (*this , loc, operandTy.getElementType (),
160
+ operand);
158
161
}
159
162
160
163
cir::LoadOp createLoad (mlir::Location loc, mlir::Value ptr,
@@ -171,7 +174,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
171
174
}
172
175
173
176
mlir::Value createNot (mlir::Value value) {
174
- return create< cir::UnaryOp>( value.getLoc (), value.getType (),
177
+ return cir::UnaryOp::create (* this , value.getLoc (), value.getType (),
175
178
cir::UnaryOpKind::Not, value);
176
179
}
177
180
@@ -180,15 +183,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
180
183
mlir::Location loc,
181
184
llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
182
185
llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> bodyBuilder) {
183
- return create< cir::DoWhileOp>( loc, condBuilder, bodyBuilder);
186
+ return cir::DoWhileOp::create (* this , loc, condBuilder, bodyBuilder);
184
187
}
185
188
186
189
// / Create a while operation.
187
190
cir::WhileOp createWhile (
188
191
mlir::Location loc,
189
192
llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
190
193
llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> bodyBuilder) {
191
- return create< cir::WhileOp>( loc, condBuilder, bodyBuilder);
194
+ return cir::WhileOp::create (* this , loc, condBuilder, bodyBuilder);
192
195
}
193
196
194
197
// / Create a for operation.
@@ -197,22 +200,23 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
197
200
llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
198
201
llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> bodyBuilder,
199
202
llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> stepBuilder) {
200
- return create<cir::ForOp>(loc, condBuilder, bodyBuilder, stepBuilder);
203
+ return cir::ForOp::create (*this , loc, condBuilder, bodyBuilder,
204
+ stepBuilder);
201
205
}
202
206
203
207
// / Create a break operation.
204
208
cir::BreakOp createBreak (mlir::Location loc) {
205
- return create< cir::BreakOp>( loc);
209
+ return cir::BreakOp::create (* this , loc);
206
210
}
207
211
208
212
// / Create a continue operation.
209
213
cir::ContinueOp createContinue (mlir::Location loc) {
210
- return create< cir::ContinueOp>( loc);
214
+ return cir::ContinueOp::create (* this , loc);
211
215
}
212
216
213
217
mlir::Value createUnaryOp (mlir::Location loc, cir::UnaryOpKind kind,
214
218
mlir::Value operand) {
215
- return create< cir::UnaryOp>( loc, kind, operand);
219
+ return cir::UnaryOp::create (* this , loc, kind, operand);
216
220
}
217
221
218
222
mlir::TypedAttr getConstPtrAttr (mlir::Type type, int64_t value) {
@@ -222,7 +226,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
222
226
mlir::Value createAlloca (mlir::Location loc, cir::PointerType addrType,
223
227
mlir::Type type, llvm::StringRef name,
224
228
mlir::IntegerAttr alignment) {
225
- return create< cir::AllocaOp>( loc, addrType, type, name, alignment);
229
+ return cir::AllocaOp::create (* this , loc, addrType, type, name, alignment);
226
230
}
227
231
228
232
// / Get constant address of a global variable as an MLIR attribute.
@@ -235,8 +239,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
235
239
236
240
mlir::Value createGetGlobal (mlir::Location loc, cir::GlobalOp global) {
237
241
assert (!cir::MissingFeatures::addressSpace ());
238
- return create< cir::GetGlobalOp>(loc, getPointerTo (global. getSymType ()),
239
- global.getSymName ());
242
+ return cir::GetGlobalOp::create (
243
+ * this , loc, getPointerTo (global. getSymType ()), global.getSymName ());
240
244
}
241
245
242
246
mlir::Value createGetGlobal (cir::GlobalOp global) {
@@ -263,7 +267,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
263
267
cir::GetMemberOp createGetMember (mlir::Location loc, mlir::Type resultTy,
264
268
mlir::Value base, llvm::StringRef name,
265
269
unsigned index) {
266
- return create< cir::GetMemberOp>( loc, resultTy, base, name, index);
270
+ return cir::GetMemberOp::create (* this , loc, resultTy, base, name, index);
267
271
}
268
272
269
273
mlir::Value createDummyValue (mlir::Location loc, mlir::Type type,
@@ -276,7 +280,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
276
280
277
281
cir::PtrStrideOp createPtrStride (mlir::Location loc, mlir::Value base,
278
282
mlir::Value stride) {
279
- return create< cir::PtrStrideOp>( loc, base.getType (), base, stride);
283
+ return cir::PtrStrideOp::create (* this , loc, base.getType (), base, stride);
280
284
}
281
285
282
286
// ===--------------------------------------------------------------------===//
@@ -286,7 +290,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
286
290
cir::CallOp createCallOp (mlir::Location loc, mlir::SymbolRefAttr callee,
287
291
mlir::Type returnType, mlir::ValueRange operands,
288
292
llvm::ArrayRef<mlir::NamedAttribute> attrs = {}) {
289
- auto op = create< cir::CallOp>( loc, callee, returnType, operands);
293
+ auto op = cir::CallOp::create (* this , loc, callee, returnType, operands);
290
294
op->setAttrs (attrs);
291
295
return op;
292
296
}
@@ -317,7 +321,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
317
321
mlir::Value src, mlir::Type newTy) {
318
322
if (newTy == src.getType ())
319
323
return src;
320
- return create< cir::CastOp>( loc, newTy, kind, src);
324
+ return cir::CastOp::create (* this , loc, newTy, kind, src);
321
325
}
322
326
323
327
mlir::Value createCast (cir::CastKind kind, mlir::Value src,
@@ -367,7 +371,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
367
371
368
372
mlir::Value createBinop (mlir::Location loc, mlir::Value lhs,
369
373
cir::BinOpKind kind, mlir::Value rhs) {
370
- return create< cir::BinOp>( loc, lhs.getType (), kind, lhs, rhs);
374
+ return cir::BinOp::create (* this , loc, lhs.getType (), kind, lhs, rhs);
371
375
}
372
376
373
377
mlir::Value createLowBitsSet (mlir::Location loc, unsigned size,
@@ -389,8 +393,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
389
393
mlir::Value trueValue, mlir::Value falseValue) {
390
394
assert (trueValue.getType () == falseValue.getType () &&
391
395
" trueValue and falseValue should have the same type" );
392
- return create< cir::SelectOp>( loc, trueValue.getType (), condition, trueValue ,
393
- falseValue);
396
+ return cir::SelectOp::create (* this , loc, trueValue.getType (), condition,
397
+ trueValue, falseValue);
394
398
}
395
399
396
400
mlir::Value createLogicalAnd (mlir::Location loc, mlir::Value lhs,
@@ -405,8 +409,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
405
409
406
410
mlir::Value createMul (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
407
411
OverflowBehavior ob = OverflowBehavior::None) {
408
- auto op =
409
- create<cir::BinOp>(loc, lhs. getType (), cir::BinOpKind::Mul, lhs, rhs);
412
+ auto op = cir::BinOp::create (* this , loc, lhs. getType (), cir::BinOpKind::Mul,
413
+ lhs, rhs);
410
414
op.setNoUnsignedWrap (
411
415
llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
412
416
op.setNoSignedWrap (
@@ -424,8 +428,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
424
428
425
429
mlir::Value createSub (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
426
430
OverflowBehavior ob = OverflowBehavior::Saturated) {
427
- auto op =
428
- create<cir::BinOp>(loc, lhs. getType (), cir::BinOpKind::Sub, lhs, rhs);
431
+ auto op = cir::BinOp::create (* this , loc, lhs. getType (), cir::BinOpKind::Sub,
432
+ lhs, rhs);
429
433
op.setNoUnsignedWrap (
430
434
llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
431
435
op.setNoSignedWrap (
@@ -446,8 +450,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
446
450
447
451
mlir::Value createAdd (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
448
452
OverflowBehavior ob = OverflowBehavior::None) {
449
- auto op =
450
- create<cir::BinOp>(loc, lhs. getType (), cir::BinOpKind::Add, lhs, rhs);
453
+ auto op = cir::BinOp::create (* this , loc, lhs. getType (), cir::BinOpKind::Add,
454
+ lhs, rhs);
451
455
op.setNoUnsignedWrap (
452
456
llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
453
457
op.setNoSignedWrap (
@@ -468,7 +472,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
468
472
469
473
cir::CmpOp createCompare (mlir::Location loc, cir::CmpOpKind kind,
470
474
mlir::Value lhs, mlir::Value rhs) {
471
- return create< cir::CmpOp>( loc, getBoolTy (), kind, lhs, rhs);
475
+ return cir::CmpOp::create (* this , loc, getBoolTy (), kind, lhs, rhs);
472
476
}
473
477
474
478
mlir::Value createIsNaN (mlir::Location loc, mlir::Value operand) {
@@ -477,7 +481,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
477
481
478
482
mlir::Value createShift (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
479
483
bool isShiftLeft) {
480
- return create<cir::ShiftOp>(loc, lhs.getType (), lhs, rhs, isShiftLeft);
484
+ return cir::ShiftOp::create (*this , loc, lhs.getType (), lhs, rhs,
485
+ isShiftLeft);
481
486
}
482
487
483
488
mlir::Value createShift (mlir::Location loc, mlir::Value lhs,
@@ -555,12 +560,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
555
560
556
561
// / Create a loop condition.
557
562
cir::ConditionOp createCondition (mlir::Value condition) {
558
- return create< cir::ConditionOp>( condition.getLoc (), condition);
563
+ return cir::ConditionOp::create (* this , condition.getLoc (), condition);
559
564
}
560
565
561
566
// / Create a yield operation.
562
567
cir::YieldOp createYield (mlir::Location loc, mlir::ValueRange value = {}) {
563
- return create< cir::YieldOp>( loc, value);
568
+ return cir::YieldOp::create (* this , loc, value);
564
569
}
565
570
};
566
571
0 commit comments