@@ -78,8 +78,8 @@ struct ErrorManager {
7878 statExpr && errMsgExpr
7979 ? builder.createBox (loc,
8080 converter.genExprAddr (loc, errMsgExpr, stmtCtx))
81- : builder. create < fir::AbsentOp> (
82- loc,
81+ : fir::AbsentOp::create (
82+ builder, loc,
8383 fir::BoxType::get (mlir::NoneType::get (builder.getContext ())));
8484 sourceFile = fir::factory::locationToFilename (builder, loc);
8585 sourceLine = fir::factory::locationToLineNo (builder, loc,
@@ -92,10 +92,10 @@ struct ErrorManager {
9292 if (statValue) {
9393 mlir::Value zero =
9494 builder.createIntegerConstant (loc, statValue.getType (), 0 );
95- auto cmp = builder. create < mlir::arith::CmpIOp> (
96- loc, mlir::arith::CmpIPredicate::eq, statValue, zero);
97- auto ifOp = builder. create < fir::IfOp>( loc, cmp,
98- /* withElseRegion=*/ false );
95+ auto cmp = mlir::arith::CmpIOp::create (
96+ builder, loc, mlir::arith::CmpIPredicate::eq, statValue, zero);
97+ auto ifOp = fir::IfOp::create (builder, loc, cmp,
98+ /* withElseRegion=*/ false );
9999 builder.setInsertionPointToStart (&ifOp.getThenRegion ().front ());
100100 }
101101 }
@@ -106,7 +106,7 @@ struct ErrorManager {
106106 assert (stat && " missing stat value" );
107107 mlir::Value castStat = builder.createConvert (
108108 loc, fir::dyn_cast_ptrEleTy (statAddr.getType ()), stat);
109- builder. create < fir::StoreOp>( loc, castStat, statAddr);
109+ fir::StoreOp::create (builder, loc, castStat, statAddr);
110110 statValue = stat;
111111 }
112112 }
@@ -141,7 +141,7 @@ static void genRuntimeSetBounds(fir::FirOpBuilder &builder, mlir::Location loc,
141141 const auto args = fir::runtime::createArguments (
142142 builder, loc, callee.getFunctionType (), box.getAddr (), dimIndex,
143143 lowerBound, upperBound);
144- builder. create < fir::CallOp>( loc, callee, args);
144+ fir::CallOp::create (builder, loc, callee, args);
145145}
146146
147147// / Generate runtime call to set the lengths of a character allocatable or
@@ -171,7 +171,7 @@ static void genRuntimeInitCharacter(fir::FirOpBuilder &builder,
171171 args.push_back (builder.createIntegerConstant (loc, inputTypes[4 ], corank));
172172 const auto convertedArgs = fir::runtime::createArguments (
173173 builder, loc, callee.getFunctionType (), args);
174- builder. create < fir::CallOp>( loc, callee, convertedArgs);
174+ fir::CallOp::create (builder, loc, callee, convertedArgs);
175175}
176176
177177// / Generate a sequence of runtime calls to allocate memory.
@@ -194,7 +194,7 @@ static mlir::Value genRuntimeAllocate(fir::FirOpBuilder &builder,
194194 args.push_back (errorManager.sourceLine );
195195 const auto convertedArgs = fir::runtime::createArguments (
196196 builder, loc, callee.getFunctionType (), args);
197- return builder. create < fir::CallOp>( loc, callee, convertedArgs).getResult (0 );
197+ return fir::CallOp::create (builder, loc, callee, convertedArgs).getResult (0 );
198198}
199199
200200// / Generate a sequence of runtime calls to allocate memory and assign with the
@@ -214,7 +214,7 @@ static mlir::Value genRuntimeAllocateSource(fir::FirOpBuilder &builder,
214214 builder, loc, callee.getFunctionType (), box.getAddr (),
215215 fir::getBase (source), errorManager.hasStat , errorManager.errMsgAddr ,
216216 errorManager.sourceFile , errorManager.sourceLine );
217- return builder. create < fir::CallOp>( loc, callee, args).getResult (0 );
217+ return fir::CallOp::create (builder, loc, callee, args).getResult (0 );
218218}
219219
220220// / Generate runtime call to apply mold to the descriptor.
@@ -233,7 +233,7 @@ static void genRuntimeAllocateApplyMold(fir::FirOpBuilder &builder,
233233 fir::factory::getMutableIRBox (builder, loc, box), fir::getBase (mold),
234234 builder.createIntegerConstant (
235235 loc, callee.getFunctionType ().getInputs ()[2 ], rank));
236- builder. create < fir::CallOp>( loc, callee, args);
236+ fir::CallOp::create (builder, loc, callee, args);
237237}
238238
239239// / Generate a runtime call to deallocate memory.
@@ -270,7 +270,7 @@ static mlir::Value genRuntimeDeallocate(fir::FirOpBuilder &builder,
270270 errorManager.hasStat , errorManager.errMsgAddr , errorManager.sourceFile ,
271271 errorManager.sourceLine );
272272 }
273- return builder. create < fir::CallOp>( loc, callee, operands).getResult (0 );
273+ return fir::CallOp::create (builder, loc, callee, operands).getResult (0 );
274274}
275275
276276// ===----------------------------------------------------------------------===//
@@ -433,9 +433,9 @@ class AllocateStmtHelper {
433433 loc, Fortran::semantics::GetExpr (std::get<1 >(shapeSpec.t )), stmtCtx));
434434 ub = builder.createConvert (loc, idxTy, ub);
435435 if (lb) {
436- mlir::Value diff = builder. create < mlir::arith::SubIOp>( loc, ub, lb);
436+ mlir::Value diff = mlir::arith::SubIOp::create (builder, loc, ub, lb);
437437 extents.emplace_back (
438- builder. create < mlir::arith::AddIOp>( loc, diff, one));
438+ mlir::arith::AddIOp::create (builder, loc, diff, one));
439439 } else {
440440 extents.emplace_back (ub);
441441 }
@@ -461,7 +461,7 @@ class AllocateStmtHelper {
461461 mlir::Value falseValue = builder.createBool (loc, false );
462462 mlir::Value falseConv = builder.createConvert (
463463 loc, fir::unwrapRefType (pinned.getType ()), falseValue);
464- builder. create < fir::StoreOp>( loc, falseConv, pinned);
464+ fir::StoreOp::create (builder, loc, falseConv, pinned);
465465 }
466466
467467 void genSimpleAllocation (const Allocation &alloc,
@@ -557,7 +557,7 @@ class AllocateStmtHelper {
557557 mlir::Value nullPointer = fir::factory::createUnallocatedBox (
558558 builder, loc, box.getBoxTy (), box.nonDeferredLenParams (),
559559 /* typeSourceBox=*/ {}, allocatorIdx);
560- builder. create < fir::StoreOp>( loc, nullPointer, box.getAddr ());
560+ fir::StoreOp::create (builder, loc, nullPointer, box.getAddr ());
561561 } else {
562562 assert (box.isAllocatable () && " must be an allocatable" );
563563 // For allocatables, sync the MutableBoxValue and descriptor before the
@@ -597,13 +597,14 @@ class AllocateStmtHelper {
597597 assert (sourceBox && " source expression should be lowered to one box" );
598598 for (int i = 0 ; i < sourceExpr->Rank (); ++i) {
599599 auto dimVal = builder.createIntegerConstant (loc, idxTy, i);
600- auto dimInfo = builder. create < fir::BoxDimsOp>(
601- loc, idxTy, idxTy, idxTy, sourceBox->getAddr (), dimVal);
600+ auto dimInfo = fir::BoxDimsOp::create (builder, loc, idxTy, idxTy, idxTy,
601+ sourceBox->getAddr (), dimVal);
602602 mlir::Value lb =
603603 fir::factory::readLowerBound (builder, loc, sourceExv, i, one);
604604 mlir::Value extent = dimInfo.getResult (1 );
605- mlir::Value ub = builder.create <mlir::arith::SubIOp>(
606- loc, builder.create <mlir::arith::AddIOp>(loc, extent, lb), one);
605+ mlir::Value ub = mlir::arith::SubIOp::create (
606+ builder, loc, mlir::arith::AddIOp::create (builder, loc, extent, lb),
607+ one);
607608 mlir::Value dimIndex = builder.createIntegerConstant (loc, i32Ty, i);
608609 genRuntimeSetBounds (builder, loc, box, dimIndex, lb, ub);
609610 }
@@ -668,7 +669,7 @@ class AllocateStmtHelper {
668669 const auto args = fir::runtime::createArguments (
669670 builder, loc, callee.getFunctionType (), box.getAddr (), typeDescAddr,
670671 rankValue, corankValue);
671- builder. create < fir::CallOp>( loc, callee, args);
672+ fir::CallOp::create (builder, loc, callee, args);
672673 }
673674
674675 // / Generate call to PointerNullifyIntrinsic or AllocatableInitIntrinsic to
@@ -697,7 +698,7 @@ class AllocateStmtHelper {
697698 const auto args = fir::runtime::createArguments (
698699 builder, loc, callee.getFunctionType (), box.getAddr (), categoryValue,
699700 kindValue, rankValue, corankValue);
700- builder. create < fir::CallOp>( loc, callee, args);
701+ fir::CallOp::create (builder, loc, callee, args);
701702 }
702703
703704 // / Generate call to the AllocatableInitDerived to set up the type descriptor
@@ -909,8 +910,8 @@ void Fortran::lower::genDeallocateIfAllocated(
909910 .genThen ([&]() {
910911 if (mlir::Type eleType = box.getEleTy ();
911912 mlir::isa<fir::RecordType>(eleType) && box.isPolymorphic ()) {
912- mlir::Value declaredTypeDesc = builder. create < fir::TypeDescOp> (
913- loc, mlir::TypeAttr::get (eleType));
913+ mlir::Value declaredTypeDesc = fir::TypeDescOp::create (
914+ builder, loc, mlir::TypeAttr::get (eleType));
914915 genDeallocateBox (converter, box, loc, sym, declaredTypeDesc);
915916 } else {
916917 genDeallocateBox (converter, box, loc, sym);
@@ -1151,7 +1152,7 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
11511152 // here).
11521153 auto readLength = [&]() {
11531154 fir::BoxValue boxLoad =
1154- builder. create < fir::LoadOp>( loc, fir::getBase (box)).getResult ();
1155+ fir::LoadOp::create (builder, loc, fir::getBase (box)).getResult ();
11551156 return fir::factory::readCharLen (builder, loc, boxLoad);
11561157 };
11571158 if (Fortran::semantics::IsOptional (sym)) {
@@ -1160,15 +1161,15 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
11601161 // they are absents. According to 15.5.2.12 3 (9), it is illegal to
11611162 // inquire the length of absent optional, even if non deferred, so
11621163 // it's fine to use undefOp in this case.
1163- auto isPresent = builder. create < fir::IsPresentOp>( loc, builder.getI1Type (),
1164- fir::getBase (box));
1164+ auto isPresent = fir::IsPresentOp::create (builder, loc, builder.getI1Type (),
1165+ fir::getBase (box));
11651166 mlir::Value len =
11661167 builder.genIfOp (loc, {idxTy}, isPresent, true )
11671168 .genThen (
1168- [&]() { builder. create < fir::ResultOp>( loc, readLength ()); })
1169+ [&]() { fir::ResultOp::create (builder, loc, readLength ()); })
11691170 .genElse ([&]() {
1170- auto undef = builder. create < fir::UndefOp>( loc, idxTy);
1171- builder. create < fir::ResultOp>( loc, undef.getResult ());
1171+ auto undef = fir::UndefOp::create (builder, loc, idxTy);
1172+ fir::ResultOp::create (builder, loc, undef.getResult ());
11721173 })
11731174 .getResults ()[0 ];
11741175 return len;
@@ -1183,5 +1184,5 @@ mlir::Value Fortran::lower::getTypeDescAddr(
11831184 mlir::Type typeDesc =
11841185 Fortran::lower::translateDerivedTypeToFIRType (converter, typeSpec);
11851186 fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
1186- return builder. create < fir::TypeDescOp>( loc, mlir::TypeAttr::get (typeDesc));
1187+ return fir::TypeDescOp::create (builder, loc, mlir::TypeAttr::get (typeDesc));
11871188}
0 commit comments