@@ -72,15 +72,15 @@ static RValue emitUnaryMaybeConstrainedFPBuiltin(CIRGenFunction &CGF,
7272 llvm_unreachable (" constraint FP operations are NYI" );
7373
7474 auto Call =
75- CGF.getBuilder (). create <Operation>( Arg.getLoc (), Arg.getType (), Arg);
75+ Operation::create ( CGF.getBuilder (), Arg.getLoc (), Arg.getType (), Arg);
7676 return RValue::get (Call->getResult (0 ));
7777}
7878
7979template <class Operation >
8080static RValue emitUnaryFPBuiltin (CIRGenFunction &CGF, const CallExpr &E) {
8181 auto Arg = CGF.emitScalarExpr (E.getArg (0 ));
8282 auto Call =
83- CGF.getBuilder (). create <Operation>( Arg.getLoc (), Arg.getType (), Arg);
83+ Operation::create ( CGF.getBuilder (), Arg.getLoc (), Arg.getType (), Arg);
8484 return RValue::get (Call->getResult (0 ));
8585}
8686
@@ -93,7 +93,7 @@ static RValue emitUnaryMaybeConstrainedFPToIntBuiltin(CIRGenFunction &CGF,
9393 if (CGF.getBuilder ().getIsFPConstrained ())
9494 llvm_unreachable (" constraint FP operations are NYI" );
9595
96- auto Call = CGF.getBuilder (). create <Op>( Src.getLoc (), ResultType, Src);
96+ auto Call = Op::create ( CGF.getBuilder (), Src.getLoc (), ResultType, Src);
9797 return RValue::get (Call->getResult (0 ));
9898}
9999
@@ -104,7 +104,7 @@ static RValue emitBinaryFPBuiltin(CIRGenFunction &CGF, const CallExpr &E) {
104104
105105 auto Loc = CGF.getLoc (E.getExprLoc ());
106106 auto Ty = CGF.convertType (E.getType ());
107- auto Call = CGF.getBuilder (). create <Op>( Loc, Ty, Arg0, Arg1);
107+ auto Call = Op::create ( CGF.getBuilder (), Loc, Ty, Arg0, Arg1);
108108
109109 return RValue::get (Call->getResult (0 ));
110110}
@@ -122,7 +122,7 @@ static mlir::Value emitBinaryMaybeConstrainedFPBuiltin(CIRGenFunction &CGF,
122122 CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII (CGF, &E);
123123 llvm_unreachable (" constrained FP operations are NYI" );
124124 } else {
125- auto Call = CGF.getBuilder (). create <Op>( Loc, Ty, Arg0, Arg1);
125+ auto Call = Op::create ( CGF.getBuilder (), Loc, Ty, Arg0, Arg1);
126126 return Call->getResult (0 );
127127 }
128128}
@@ -141,10 +141,10 @@ static RValue emitBuiltinBitOp(
141141 Op op;
142142 if constexpr (std::is_same_v<Op, cir::BitClzOp> ||
143143 std::is_same_v<Op, cir::BitCtzOp>) {
144- op = CGF.getBuilder (). create <Op>( CGF.getLoc (E->getExprLoc ()), arg,
144+ op = Op::create ( CGF.getBuilder (), CGF.getLoc (E->getExprLoc ()), arg,
145145 isZeroPoison);
146146 } else {
147- op = CGF.getBuilder (). create <Op>( CGF.getLoc (E->getExprLoc ()), arg);
147+ op = Op::create ( CGF.getBuilder (), CGF.getLoc (E->getExprLoc ()), arg);
148148 }
149149 const mlir::Value result = op.getResult ();
150150 if (const mlir::Type resultType = CGF.convertType (E->getType ());
@@ -299,7 +299,7 @@ static mlir::Value makeBinaryAtomicValue(
299299 *neededValP = val;
300300 *neededValT = valueType;
301301 }
302- auto rmwi = builder. create < cir::AtomicFetch>(
302+ auto rmwi = cir::AtomicFetch::create (builder,
303303 cgf.getLoc (expr->getSourceRange ()), destAddr.emitRawPointer (), val, kind,
304304 ordering, false , /* is volatile */
305305 true ); /* fetch first */
@@ -339,9 +339,9 @@ static RValue emitBinaryAtomicPost(CIRGenFunction &cgf,
339339 mlir::Value result =
340340 makeBinaryAtomicValue (cgf, atomicOpkind, e, &val, &valueType);
341341 clang::CIRGen::CIRGenBuilderTy &builder = cgf.getBuilder ();
342- result = builder. create < cir::BinOp>( result.getLoc (), binopKind, result, val);
342+ result = cir::BinOp::create (builder, result.getLoc (), binopKind, result, val);
343343 if (invert)
344- result = builder. create < cir::UnaryOp>( result.getLoc (),
344+ result = cir::UnaryOp::create (builder, result.getLoc (),
345345 cir::UnaryOpKind::Not, result);
346346 result = emitFromInt (cgf, result, typ, valueType);
347347 return RValue::get (result);
@@ -363,7 +363,7 @@ static mlir::Value makeAtomicCmpXchgValue(CIRGenFunction &cgf,
363363 auto newVal =
364364 emitToInt (cgf, cgf.emitScalarExpr (expr->getArg (2 )), typ, intType);
365365
366- auto op = builder. create < cir::AtomicCmpXchg>(
366+ auto op = cir::AtomicCmpXchg::create (builder,
367367 cgf.getLoc (expr->getSourceRange ()), cmpVal.getType (), builder.getBoolTy (),
368368 destAddr.getPointer (), cmpVal, newVal,
369369 MemOrderAttr::get (&cgf.getMLIRContext (),
@@ -390,7 +390,7 @@ static mlir::Value makeAtomicFenceValue(CIRGenFunction &cgf,
390390 cir::MemOrder ordering =
391391 static_cast <cir::MemOrder>(constOrderingAttr.getUInt ());
392392
393- builder. create < cir::AtomicFence>(
393+ cir::AtomicFence::create (builder,
394394 cgf.getLoc (expr->getSourceRange ()), ordering,
395395 MemScopeKindAttr::get (&cgf.getMLIRContext (), syncScope));
396396 }
@@ -1163,7 +1163,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
11631163 case Builtin::BI__builtin_va_copy: {
11641164 auto dstPtr = emitVAListRef (E->getArg (0 )).getPointer ();
11651165 auto srcPtr = emitVAListRef (E->getArg (1 )).getPointer ();
1166- builder. create < cir::VACopyOp>( dstPtr.getLoc (), dstPtr, srcPtr);
1166+ cir::VACopyOp::create (builder, dstPtr.getLoc (), dstPtr, srcPtr);
11671167 return {};
11681168 }
11691169
@@ -1178,14 +1178,14 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
11781178 mlir::Value Result;
11791179 switch (getLangOpts ().getSignedOverflowBehavior ()) {
11801180 case LangOptions::SOB_Defined: {
1181- auto Call = getBuilder (). create < cir::AbsOp>( getLoc (E->getExprLoc ()),
1181+ auto Call = cir::AbsOp::create ( getBuilder (), getLoc (E->getExprLoc ()),
11821182 Arg.getType (), Arg, false );
11831183 Result = Call->getResult (0 );
11841184 break ;
11851185 }
11861186 case LangOptions::SOB_Undefined: {
11871187 if (!SanitizeOverflow) {
1188- auto Call = getBuilder (). create < cir::AbsOp>( getLoc (E->getExprLoc ()),
1188+ auto Call = cir::AbsOp::create ( getBuilder (), getLoc (E->getExprLoc ()),
11891189 Arg.getType (), Arg, true );
11901190 Result = Call->getResult (0 );
11911191 break ;
@@ -1328,7 +1328,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13281328 Probability);
13291329 }
13301330
1331- auto result = builder. create < cir::ExpectOp>( getLoc (E->getSourceRange ()),
1331+ auto result = cir::ExpectOp::create (builder, getLoc (E->getSourceRange ()),
13321332 ArgValue.getType (), ArgValue,
13331333 ExpectedValue, ProbAttr);
13341334
@@ -1357,7 +1357,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13571357 return RValue::get (nullptr );
13581358
13591359 mlir::Value argValue = emitCheckedArgForAssume (E->getArg (0 ));
1360- builder. create < cir::AssumeOp>( getLoc (E->getExprLoc ()), argValue);
1360+ cir::AssumeOp::create (builder, getLoc (E->getExprLoc ()), argValue);
13611361 return RValue::get (nullptr );
13621362 }
13631363
@@ -1368,7 +1368,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13681368 mlir::Value value0 = emitScalarExpr (arg0);
13691369 mlir::Value value1 = emitScalarExpr (arg1);
13701370
1371- builder. create < cir::AssumeSepStorageOp>( getLoc (E->getExprLoc ()), value0,
1371+ cir::AssumeSepStorageOp::create (builder, getLoc (E->getExprLoc ()), value0,
13721372 value1);
13731373 return RValue::get (nullptr );
13741374 }
@@ -1387,7 +1387,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13871387 case Builtin::BI_byteswap_uint64: {
13881388 auto arg = emitScalarExpr (E->getArg (0 ));
13891389 return RValue::get (
1390- builder. create < cir::ByteswapOp>( getLoc (E->getSourceRange ()), arg));
1390+ cir::ByteswapOp::create (builder, getLoc (E->getSourceRange ()), arg));
13911391 }
13921392
13931393 case Builtin::BI__builtin_bitreverse8:
@@ -1396,7 +1396,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
13961396 case Builtin::BI__builtin_bitreverse64: {
13971397 mlir::Value arg = emitScalarExpr (E->getArg (0 ));
13981398 return RValue::get (
1399- builder. create < cir::BitReverseOp>( getLoc (E->getSourceRange ()), arg));
1399+ cir::BitReverseOp::create (builder, getLoc (E->getSourceRange ()), arg));
14001400 }
14011401
14021402 case Builtin::BI__builtin_rotateleft8:
@@ -1450,7 +1450,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
14501450 ArgType = CGM.getASTContext ().getObjCIdType ();
14511451 ArgValue = builder.createBitcast (ArgValue, convertType (ArgType));
14521452
1453- mlir::Value Result = builder. create < cir::IsConstantOp>(
1453+ mlir::Value Result = cir::IsConstantOp::create (builder,
14541454 getLoc (E->getSourceRange ()), ArgValue);
14551455 if (Result.getType () != ResultType)
14561456 Result = builder.createBoolToInt (Result, ResultType);
@@ -1492,7 +1492,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
14921492 Locality = evaluateOperandAsInt (E->getArg (2 ));
14931493
14941494 mlir::Value Address = emitScalarExpr (E->getArg (0 ));
1495- builder. create < cir::PrefetchOp>( getLoc (E->getSourceRange ()), Address,
1495+ cir::PrefetchOp::create (builder, getLoc (E->getSourceRange ()), Address,
14961496 Locality, IsWrite);
14971497 return RValue::get (nullptr );
14981498 }
@@ -1507,11 +1507,11 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
15071507 builder.createPtrBitcast (emitScalarExpr (E->getArg (0 )), voidTy);
15081508 mlir::Value end =
15091509 builder.createPtrBitcast (emitScalarExpr (E->getArg (1 )), voidTy);
1510- builder. create < cir::ClearCacheOp>( getLoc (E->getSourceRange ()), begin, end);
1510+ cir::ClearCacheOp::create (builder, getLoc (E->getSourceRange ()), begin, end);
15111511 return RValue::get (nullptr );
15121512 }
15131513 case Builtin::BI__builtin_trap: {
1514- builder. create < cir::TrapOp>( getLoc (E->getExprLoc ()));
1514+ cir::TrapOp::create (builder, getLoc (E->getExprLoc ()));
15151515
15161516 // Note that cir.trap is a terminator so we need to start a new block to
15171517 // preserve the insertion point.
@@ -1561,7 +1561,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
15611561 return emitUnaryFPBuiltin<cir::FAbsOp>(*this , *E);
15621562 }
15631563 mlir::Value arg = emitScalarExpr (E->getArg (0 ));
1564- auto call = getBuilder (). create < cir::AbsOp>( getLoc (E->getExprLoc ()),
1564+ auto call = cir::AbsOp::create ( getBuilder (), getLoc (E->getExprLoc ()),
15651565 arg.getType (), arg, false );
15661566 mlir::Value result = call->getResult (0 );
15671567 return RValue::get (result);
@@ -1673,7 +1673,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
16731673 CIRGenFunction::CIRGenFPOptionsRAII FPOptsRAII (*this , E);
16741674 mlir::Location Loc = getLoc (E->getBeginLoc ());
16751675 mlir::Value Arg = emitScalarExpr (E->getArg (0 ));
1676- mlir::Value AbsArg = builder. create < cir::FAbsOp>( Loc, Arg.getType (), Arg);
1676+ mlir::Value AbsArg = cir::FAbsOp::create (builder, Loc, Arg.getType (), Arg);
16771677 mlir::Value IsInf =
16781678 builder.createIsFPClass (Loc, AbsArg, FPClassTest::fcInf);
16791679 mlir::Value IsNeg = emitSignBit (Loc, *this , Arg);
@@ -1796,7 +1796,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
17961796 E->getArg (1 )->getExprLoc (), FD, 1 );
17971797 uint64_t size =
17981798 E->getArg (2 )->EvaluateKnownConstInt (getContext ()).getZExtValue ();
1799- builder. create < cir::MemCpyInlineOp>( getLoc (E->getSourceRange ()),
1799+ cir::MemCpyInlineOp::create (builder, getLoc (E->getSourceRange ()),
18001800 dest.getPointer (), src.getPointer (),
18011801 builder.getI64IntegerAttr (size));
18021802 // __builtin_memcpy_inline has no return value
@@ -1811,7 +1811,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
18111811 mlir::Value pattern = emitScalarExpr (E->getArg (1 ));
18121812 mlir::Value len = emitScalarExpr (E->getArg (2 ));
18131813 mlir::Value res =
1814- builder. create < MemChrOp>( getLoc (E->getExprLoc ()), src, pattern, len);
1814+ MemChrOp::create (builder, getLoc (E->getExprLoc ()), src, pattern, len);
18151815 return RValue::get (res);
18161816 }
18171817
@@ -1913,11 +1913,11 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
19131913 E->getArg (0 ), E->getArg (0 )->getType ());
19141914 uint64_t level = mlir::cast<cir::IntAttr>(levelAttr).getUInt ();
19151915 if (BuiltinID == Builtin::BI__builtin_return_address) {
1916- return RValue::get (builder. create < cir::ReturnAddrOp>(
1916+ return RValue::get ( cir::ReturnAddrOp::create (builder,
19171917 loc, builder.getUInt32 (level, loc)));
19181918 }
19191919 return RValue::get (
1920- builder. create < cir::FrameAddrOp>( loc, builder.getUInt32 (level, loc)));
1920+ cir::FrameAddrOp::create (builder, loc, builder.getUInt32 (level, loc)));
19211921 }
19221922 case Builtin::BI_ReturnAddress:
19231923 llvm_unreachable (" BI_ReturnAddress NYI" );
@@ -1968,7 +1968,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
19681968 mlir::Location loc = getLoc (E->getExprLoc ());
19691969
19701970 cir::EhLongjmpOp::create (builder, loc, buf);
1971- builder. create < cir::UnreachableOp>( loc);
1971+ cir::UnreachableOp::create (builder, loc);
19721972 return RValue::get (nullptr );
19731973 }
19741974 case Builtin::BI__builtin_launder: {
@@ -2798,7 +2798,7 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
27982798 args.push_back (argValue);
27992799 }
28002800
2801- auto intrinsicCall = builder. create < cir::LLVMIntrinsicCallOp>(
2801+ auto intrinsicCall = cir::LLVMIntrinsicCallOp::create (builder,
28022802 getLoc (E->getExprLoc ()), builder.getStringAttr (name),
28032803 intrinsicType.getReturnType (), args);
28042804
@@ -2958,9 +2958,9 @@ void CIRGenFunction::emitVAStartEnd(mlir::Value ArgValue, bool IsStart) {
29582958 // LLVM codegen casts to *i8, no real gain on doing this for CIRGen this
29592959 // early, defer to LLVM lowering.
29602960 if (IsStart)
2961- builder. create < cir::VAStartOp>( ArgValue.getLoc (), ArgValue);
2961+ cir::VAStartOp::create (builder, ArgValue.getLoc (), ArgValue);
29622962 else
2963- builder. create < cir::VAEndOp>( ArgValue.getLoc (), ArgValue);
2963+ cir::VAEndOp::create (builder, ArgValue.getLoc (), ArgValue);
29642964}
29652965
29662966// / Checks if using the result of __builtin_object_size(p, @p From) in place of
0 commit comments