@@ -63,11 +63,11 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
6363
6464 mlir::Value getConstAPInt (mlir::Location loc, mlir::Type typ,
6565 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));
6767 }
6868
6969 cir::ConstantOp getConstant (mlir::Location loc, mlir::TypedAttr attr) {
70- return create< cir::ConstantOp>( loc, attr);
70+ return cir::ConstantOp::create (* this , loc, attr);
7171 }
7272
7373 cir::ConstantOp getConstantInt (mlir::Location loc, mlir::Type ty,
@@ -119,7 +119,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
119119 }
120120
121121 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));
123123 }
124124 cir::ConstantOp getFalse (mlir::Location loc) { return getBool (false , loc); }
125125 cir::ConstantOp getTrue (mlir::Location loc) { return getBool (true , loc); }
@@ -144,17 +144,20 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
144144 mlir::Value createComplexCreate (mlir::Location loc, mlir::Value real,
145145 mlir::Value imag) {
146146 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);
148149 }
149150
150151 mlir::Value createComplexReal (mlir::Location loc, mlir::Value operand) {
151152 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);
153155 }
154156
155157 mlir::Value createComplexImag (mlir::Location loc, mlir::Value operand) {
156158 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);
158161 }
159162
160163 cir::LoadOp createLoad (mlir::Location loc, mlir::Value ptr,
@@ -171,7 +174,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
171174 }
172175
173176 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 (),
175178 cir::UnaryOpKind::Not, value);
176179 }
177180
@@ -180,15 +183,15 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
180183 mlir::Location loc,
181184 llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
182185 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);
184187 }
185188
186189 // / Create a while operation.
187190 cir::WhileOp createWhile (
188191 mlir::Location loc,
189192 llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
190193 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);
192195 }
193196
194197 // / Create a for operation.
@@ -197,22 +200,23 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
197200 llvm::function_ref<void (mlir::OpBuilder &, mlir::Location)> condBuilder,
198201 llvm::function_ref<void(mlir::OpBuilder &, mlir::Location)> bodyBuilder,
199202 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);
201205 }
202206
203207 // / Create a break operation.
204208 cir::BreakOp createBreak (mlir::Location loc) {
205- return create< cir::BreakOp>( loc);
209+ return cir::BreakOp::create (* this , loc);
206210 }
207211
208212 // / Create a continue operation.
209213 cir::ContinueOp createContinue (mlir::Location loc) {
210- return create< cir::ContinueOp>( loc);
214+ return cir::ContinueOp::create (* this , loc);
211215 }
212216
213217 mlir::Value createUnaryOp (mlir::Location loc, cir::UnaryOpKind kind,
214218 mlir::Value operand) {
215- return create< cir::UnaryOp>( loc, kind, operand);
219+ return cir::UnaryOp::create (* this , loc, kind, operand);
216220 }
217221
218222 mlir::TypedAttr getConstPtrAttr (mlir::Type type, int64_t value) {
@@ -222,7 +226,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
222226 mlir::Value createAlloca (mlir::Location loc, cir::PointerType addrType,
223227 mlir::Type type, llvm::StringRef name,
224228 mlir::IntegerAttr alignment) {
225- return create< cir::AllocaOp>( loc, addrType, type, name, alignment);
229+ return cir::AllocaOp::create (* this , loc, addrType, type, name, alignment);
226230 }
227231
228232 // / Get constant address of a global variable as an MLIR attribute.
@@ -235,8 +239,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
235239
236240 mlir::Value createGetGlobal (mlir::Location loc, cir::GlobalOp global) {
237241 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 ());
240244 }
241245
242246 mlir::Value createGetGlobal (cir::GlobalOp global) {
@@ -263,7 +267,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
263267 cir::GetMemberOp createGetMember (mlir::Location loc, mlir::Type resultTy,
264268 mlir::Value base, llvm::StringRef name,
265269 unsigned index) {
266- return create< cir::GetMemberOp>( loc, resultTy, base, name, index);
270+ return cir::GetMemberOp::create (* this , loc, resultTy, base, name, index);
267271 }
268272
269273 mlir::Value createDummyValue (mlir::Location loc, mlir::Type type,
@@ -276,7 +280,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
276280
277281 cir::PtrStrideOp createPtrStride (mlir::Location loc, mlir::Value base,
278282 mlir::Value stride) {
279- return create< cir::PtrStrideOp>( loc, base.getType (), base, stride);
283+ return cir::PtrStrideOp::create (* this , loc, base.getType (), base, stride);
280284 }
281285
282286 // ===--------------------------------------------------------------------===//
@@ -286,7 +290,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
286290 cir::CallOp createCallOp (mlir::Location loc, mlir::SymbolRefAttr callee,
287291 mlir::Type returnType, mlir::ValueRange operands,
288292 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);
290294 op->setAttrs (attrs);
291295 return op;
292296 }
@@ -317,7 +321,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
317321 mlir::Value src, mlir::Type newTy) {
318322 if (newTy == src.getType ())
319323 return src;
320- return create< cir::CastOp>( loc, newTy, kind, src);
324+ return cir::CastOp::create (* this , loc, newTy, kind, src);
321325 }
322326
323327 mlir::Value createCast (cir::CastKind kind, mlir::Value src,
@@ -367,7 +371,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
367371
368372 mlir::Value createBinop (mlir::Location loc, mlir::Value lhs,
369373 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);
371375 }
372376
373377 mlir::Value createLowBitsSet (mlir::Location loc, unsigned size,
@@ -389,8 +393,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
389393 mlir::Value trueValue, mlir::Value falseValue) {
390394 assert (trueValue.getType () == falseValue.getType () &&
391395 " 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);
394398 }
395399
396400 mlir::Value createLogicalAnd (mlir::Location loc, mlir::Value lhs,
@@ -405,8 +409,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
405409
406410 mlir::Value createMul (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
407411 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);
410414 op.setNoUnsignedWrap (
411415 llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
412416 op.setNoSignedWrap (
@@ -424,8 +428,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
424428
425429 mlir::Value createSub (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
426430 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);
429433 op.setNoUnsignedWrap (
430434 llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
431435 op.setNoSignedWrap (
@@ -446,8 +450,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
446450
447451 mlir::Value createAdd (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
448452 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);
451455 op.setNoUnsignedWrap (
452456 llvm::to_underlying (ob & OverflowBehavior::NoUnsignedWrap));
453457 op.setNoSignedWrap (
@@ -468,7 +472,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
468472
469473 cir::CmpOp createCompare (mlir::Location loc, cir::CmpOpKind kind,
470474 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);
472476 }
473477
474478 mlir::Value createIsNaN (mlir::Location loc, mlir::Value operand) {
@@ -477,7 +481,8 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
477481
478482 mlir::Value createShift (mlir::Location loc, mlir::Value lhs, mlir::Value rhs,
479483 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);
481486 }
482487
483488 mlir::Value createShift (mlir::Location loc, mlir::Value lhs,
@@ -555,12 +560,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
555560
556561 // / Create a loop condition.
557562 cir::ConditionOp createCondition (mlir::Value condition) {
558- return create< cir::ConditionOp>( condition.getLoc (), condition);
563+ return cir::ConditionOp::create (* this , condition.getLoc (), condition);
559564 }
560565
561566 // / Create a yield operation.
562567 cir::YieldOp createYield (mlir::Location loc, mlir::ValueRange value = {}) {
563- return create< cir::YieldOp>( loc, value);
568+ return cir::YieldOp::create (* this , loc, value);
564569 }
565570};
566571
0 commit comments