@@ -78,7 +78,7 @@ struct ErrorManager {
78
78
statExpr && errMsgExpr
79
79
? builder.createBox (loc,
80
80
converter.genExprAddr (loc, errMsgExpr, stmtCtx))
81
- : builder. create < fir::AbsentOp>(
81
+ : fir::AbsentOp::create (builder,
82
82
loc,
83
83
fir::BoxType::get (mlir::NoneType::get (builder.getContext ())));
84
84
sourceFile = fir::factory::locationToFilename (builder, loc);
@@ -92,9 +92,9 @@ struct ErrorManager {
92
92
if (statValue) {
93
93
mlir::Value zero =
94
94
builder.createIntegerConstant (loc, statValue.getType (), 0 );
95
- auto cmp = builder. create < mlir::arith::CmpIOp>(
95
+ auto cmp = mlir::arith::CmpIOp::create (builder,
96
96
loc, mlir::arith::CmpIPredicate::eq, statValue, zero);
97
- auto ifOp = builder. create < fir::IfOp>( loc, cmp,
97
+ auto ifOp = fir::IfOp::create (builder, loc, cmp,
98
98
/* withElseRegion=*/ false );
99
99
builder.setInsertionPointToStart (&ifOp.getThenRegion ().front ());
100
100
}
@@ -106,7 +106,7 @@ struct ErrorManager {
106
106
assert (stat && " missing stat value" );
107
107
mlir::Value castStat = builder.createConvert (
108
108
loc, fir::dyn_cast_ptrEleTy (statAddr.getType ()), stat);
109
- builder. create < fir::StoreOp>( loc, castStat, statAddr);
109
+ fir::StoreOp::create (builder, loc, castStat, statAddr);
110
110
statValue = stat;
111
111
}
112
112
}
@@ -141,7 +141,7 @@ static void genRuntimeSetBounds(fir::FirOpBuilder &builder, mlir::Location loc,
141
141
const auto args = fir::runtime::createArguments (
142
142
builder, loc, callee.getFunctionType (), box.getAddr (), dimIndex,
143
143
lowerBound, upperBound);
144
- builder. create < fir::CallOp>( loc, callee, args);
144
+ fir::CallOp::create (builder, loc, callee, args);
145
145
}
146
146
147
147
// / Generate runtime call to set the lengths of a character allocatable or
@@ -171,7 +171,7 @@ static void genRuntimeInitCharacter(fir::FirOpBuilder &builder,
171
171
args.push_back (builder.createIntegerConstant (loc, inputTypes[4 ], corank));
172
172
const auto convertedArgs = fir::runtime::createArguments (
173
173
builder, loc, callee.getFunctionType (), args);
174
- builder. create < fir::CallOp>( loc, callee, convertedArgs);
174
+ fir::CallOp::create (builder, loc, callee, convertedArgs);
175
175
}
176
176
177
177
// / Generate a sequence of runtime calls to allocate memory.
@@ -194,7 +194,7 @@ static mlir::Value genRuntimeAllocate(fir::FirOpBuilder &builder,
194
194
args.push_back (errorManager.sourceLine );
195
195
const auto convertedArgs = fir::runtime::createArguments (
196
196
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 );
198
198
}
199
199
200
200
// / Generate a sequence of runtime calls to allocate memory and assign with the
@@ -214,7 +214,7 @@ static mlir::Value genRuntimeAllocateSource(fir::FirOpBuilder &builder,
214
214
builder, loc, callee.getFunctionType (), box.getAddr (),
215
215
fir::getBase (source), errorManager.hasStat , errorManager.errMsgAddr ,
216
216
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 );
218
218
}
219
219
220
220
// / Generate runtime call to apply mold to the descriptor.
@@ -233,7 +233,7 @@ static void genRuntimeAllocateApplyMold(fir::FirOpBuilder &builder,
233
233
fir::factory::getMutableIRBox (builder, loc, box), fir::getBase (mold),
234
234
builder.createIntegerConstant (
235
235
loc, callee.getFunctionType ().getInputs ()[2 ], rank));
236
- builder. create < fir::CallOp>( loc, callee, args);
236
+ fir::CallOp::create (builder, loc, callee, args);
237
237
}
238
238
239
239
// / Generate a runtime call to deallocate memory.
@@ -270,7 +270,7 @@ static mlir::Value genRuntimeDeallocate(fir::FirOpBuilder &builder,
270
270
errorManager.hasStat , errorManager.errMsgAddr , errorManager.sourceFile ,
271
271
errorManager.sourceLine );
272
272
}
273
- return builder. create < fir::CallOp>( loc, callee, operands).getResult (0 );
273
+ return fir::CallOp::create (builder, loc, callee, operands).getResult (0 );
274
274
}
275
275
276
276
// ===----------------------------------------------------------------------===//
@@ -433,9 +433,9 @@ class AllocateStmtHelper {
433
433
loc, Fortran::semantics::GetExpr (std::get<1 >(shapeSpec.t )), stmtCtx));
434
434
ub = builder.createConvert (loc, idxTy, ub);
435
435
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);
437
437
extents.emplace_back (
438
- builder. create < mlir::arith::AddIOp>( loc, diff, one));
438
+ mlir::arith::AddIOp::create (builder, loc, diff, one));
439
439
} else {
440
440
extents.emplace_back (ub);
441
441
}
@@ -461,7 +461,7 @@ class AllocateStmtHelper {
461
461
mlir::Value falseValue = builder.createBool (loc, false );
462
462
mlir::Value falseConv = builder.createConvert (
463
463
loc, fir::unwrapRefType (pinned.getType ()), falseValue);
464
- builder. create < fir::StoreOp>( loc, falseConv, pinned);
464
+ fir::StoreOp::create (builder, loc, falseConv, pinned);
465
465
}
466
466
467
467
void genSimpleAllocation (const Allocation &alloc,
@@ -557,7 +557,7 @@ class AllocateStmtHelper {
557
557
mlir::Value nullPointer = fir::factory::createUnallocatedBox (
558
558
builder, loc, box.getBoxTy (), box.nonDeferredLenParams (),
559
559
/* typeSourceBox=*/ {}, allocatorIdx);
560
- builder. create < fir::StoreOp>( loc, nullPointer, box.getAddr ());
560
+ fir::StoreOp::create (builder, loc, nullPointer, box.getAddr ());
561
561
} else {
562
562
assert (box.isAllocatable () && " must be an allocatable" );
563
563
// For allocatables, sync the MutableBoxValue and descriptor before the
@@ -597,13 +597,13 @@ class AllocateStmtHelper {
597
597
assert (sourceBox && " source expression should be lowered to one box" );
598
598
for (int i = 0 ; i < sourceExpr->Rank (); ++i) {
599
599
auto dimVal = builder.createIntegerConstant (loc, idxTy, i);
600
- auto dimInfo = builder. create < fir::BoxDimsOp>(
600
+ auto dimInfo = fir::BoxDimsOp::create (builder,
601
601
loc, idxTy, idxTy, idxTy, sourceBox->getAddr (), dimVal);
602
602
mlir::Value lb =
603
603
fir::factory::readLowerBound (builder, loc, sourceExv, i, one);
604
604
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 (builder,
606
+ loc, mlir::arith::AddIOp::create (builder, loc, extent, lb), one);
607
607
mlir::Value dimIndex = builder.createIntegerConstant (loc, i32Ty, i);
608
608
genRuntimeSetBounds (builder, loc, box, dimIndex, lb, ub);
609
609
}
@@ -668,7 +668,7 @@ class AllocateStmtHelper {
668
668
const auto args = fir::runtime::createArguments (
669
669
builder, loc, callee.getFunctionType (), box.getAddr (), typeDescAddr,
670
670
rankValue, corankValue);
671
- builder. create < fir::CallOp>( loc, callee, args);
671
+ fir::CallOp::create (builder, loc, callee, args);
672
672
}
673
673
674
674
// / Generate call to PointerNullifyIntrinsic or AllocatableInitIntrinsic to
@@ -697,7 +697,7 @@ class AllocateStmtHelper {
697
697
const auto args = fir::runtime::createArguments (
698
698
builder, loc, callee.getFunctionType (), box.getAddr (), categoryValue,
699
699
kindValue, rankValue, corankValue);
700
- builder. create < fir::CallOp>( loc, callee, args);
700
+ fir::CallOp::create (builder, loc, callee, args);
701
701
}
702
702
703
703
// / Generate call to the AllocatableInitDerived to set up the type descriptor
@@ -909,7 +909,7 @@ void Fortran::lower::genDeallocateIfAllocated(
909
909
.genThen ([&]() {
910
910
if (mlir::Type eleType = box.getEleTy ();
911
911
mlir::isa<fir::RecordType>(eleType) && box.isPolymorphic ()) {
912
- mlir::Value declaredTypeDesc = builder. create < fir::TypeDescOp>(
912
+ mlir::Value declaredTypeDesc = fir::TypeDescOp::create (builder,
913
913
loc, mlir::TypeAttr::get (eleType));
914
914
genDeallocateBox (converter, box, loc, sym, declaredTypeDesc);
915
915
} else {
@@ -1151,7 +1151,7 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
1151
1151
// here).
1152
1152
auto readLength = [&]() {
1153
1153
fir::BoxValue boxLoad =
1154
- builder. create < fir::LoadOp>( loc, fir::getBase (box)).getResult ();
1154
+ fir::LoadOp::create (builder, loc, fir::getBase (box)).getResult ();
1155
1155
return fir::factory::readCharLen (builder, loc, boxLoad);
1156
1156
};
1157
1157
if (Fortran::semantics::IsOptional (sym)) {
@@ -1160,15 +1160,15 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
1160
1160
// they are absents. According to 15.5.2.12 3 (9), it is illegal to
1161
1161
// inquire the length of absent optional, even if non deferred, so
1162
1162
// it's fine to use undefOp in this case.
1163
- auto isPresent = builder. create < fir::IsPresentOp>( loc, builder.getI1Type (),
1163
+ auto isPresent = fir::IsPresentOp::create (builder, loc, builder.getI1Type (),
1164
1164
fir::getBase (box));
1165
1165
mlir::Value len =
1166
1166
builder.genIfOp (loc, {idxTy}, isPresent, true )
1167
1167
.genThen (
1168
- [&]() { builder. create < fir::ResultOp>( loc, readLength ()); })
1168
+ [&]() { fir::ResultOp::create (builder, loc, readLength ()); })
1169
1169
.genElse ([&]() {
1170
- auto undef = builder. create < fir::UndefOp>( loc, idxTy);
1171
- builder. create < fir::ResultOp>( loc, undef.getResult ());
1170
+ auto undef = fir::UndefOp::create (builder, loc, idxTy);
1171
+ fir::ResultOp::create (builder, loc, undef.getResult ());
1172
1172
})
1173
1173
.getResults ()[0 ];
1174
1174
return len;
@@ -1183,5 +1183,5 @@ mlir::Value Fortran::lower::getTypeDescAddr(
1183
1183
mlir::Type typeDesc =
1184
1184
Fortran::lower::translateDerivedTypeToFIRType (converter, typeSpec);
1185
1185
fir::FirOpBuilder &builder = converter.getFirOpBuilder ();
1186
- return builder. create < fir::TypeDescOp>( loc, mlir::TypeAttr::get (typeDesc));
1186
+ return fir::TypeDescOp::create (builder, loc, mlir::TypeAttr::get (typeDesc));
1187
1187
}
0 commit comments