@@ -78,8 +78,8 @@ struct ErrorManager {
78
78
statExpr && errMsgExpr
79
79
? builder.createBox (loc,
80
80
converter.genExprAddr (loc, errMsgExpr, stmtCtx))
81
- : builder. create < fir::AbsentOp> (
82
- loc,
81
+ : fir::AbsentOp::create (
82
+ builder, loc,
83
83
fir::BoxType::get (mlir::NoneType::get (builder.getContext ())));
84
84
sourceFile = fir::factory::locationToFilename (builder, loc);
85
85
sourceLine = fir::factory::locationToLineNo (builder, loc,
@@ -92,10 +92,10 @@ 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> (
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 );
99
99
builder.setInsertionPointToStart (&ifOp.getThenRegion ().front ());
100
100
}
101
101
}
@@ -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,14 @@ 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>(
601
- loc, idxTy, idxTy, idxTy, sourceBox->getAddr (), dimVal);
600
+ auto dimInfo = fir::BoxDimsOp::create (builder, loc, idxTy, idxTy, idxTy,
601
+ 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 (
606
+ builder, loc, mlir::arith::AddIOp::create (builder, loc, extent, lb),
607
+ one);
607
608
mlir::Value dimIndex = builder.createIntegerConstant (loc, i32Ty, i);
608
609
genRuntimeSetBounds (builder, loc, box, dimIndex, lb, ub);
609
610
}
@@ -668,7 +669,7 @@ class AllocateStmtHelper {
668
669
const auto args = fir::runtime::createArguments (
669
670
builder, loc, callee.getFunctionType (), box.getAddr (), typeDescAddr,
670
671
rankValue, corankValue);
671
- builder. create < fir::CallOp>( loc, callee, args);
672
+ fir::CallOp::create (builder, loc, callee, args);
672
673
}
673
674
674
675
// / Generate call to PointerNullifyIntrinsic or AllocatableInitIntrinsic to
@@ -697,7 +698,7 @@ class AllocateStmtHelper {
697
698
const auto args = fir::runtime::createArguments (
698
699
builder, loc, callee.getFunctionType (), box.getAddr (), categoryValue,
699
700
kindValue, rankValue, corankValue);
700
- builder. create < fir::CallOp>( loc, callee, args);
701
+ fir::CallOp::create (builder, loc, callee, args);
701
702
}
702
703
703
704
// / Generate call to the AllocatableInitDerived to set up the type descriptor
@@ -909,8 +910,8 @@ void Fortran::lower::genDeallocateIfAllocated(
909
910
.genThen ([&]() {
910
911
if (mlir::Type eleType = box.getEleTy ();
911
912
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));
914
915
genDeallocateBox (converter, box, loc, sym, declaredTypeDesc);
915
916
} else {
916
917
genDeallocateBox (converter, box, loc, sym);
@@ -1151,7 +1152,7 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
1151
1152
// here).
1152
1153
auto readLength = [&]() {
1153
1154
fir::BoxValue boxLoad =
1154
- builder. create < fir::LoadOp>( loc, fir::getBase (box)).getResult ();
1155
+ fir::LoadOp::create (builder, loc, fir::getBase (box)).getResult ();
1155
1156
return fir::factory::readCharLen (builder, loc, boxLoad);
1156
1157
};
1157
1158
if (Fortran::semantics::IsOptional (sym)) {
@@ -1160,15 +1161,15 @@ mlir::Value Fortran::lower::getAssumedCharAllocatableOrPointerLen(
1160
1161
// they are absents. According to 15.5.2.12 3 (9), it is illegal to
1161
1162
// inquire the length of absent optional, even if non deferred, so
1162
1163
// 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));
1165
1166
mlir::Value len =
1166
1167
builder.genIfOp (loc, {idxTy}, isPresent, true )
1167
1168
.genThen (
1168
- [&]() { builder. create < fir::ResultOp>( loc, readLength ()); })
1169
+ [&]() { fir::ResultOp::create (builder, loc, readLength ()); })
1169
1170
.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 ());
1172
1173
})
1173
1174
.getResults ()[0 ];
1174
1175
return len;
@@ -1183,5 +1184,5 @@ mlir::Value Fortran::lower::getTypeDescAddr(
1183
1184
mlir::Type typeDesc =
1184
1185
Fortran::lower::translateDerivedTypeToFIRType (converter, typeSpec);
1185
1186
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));
1187
1188
}
0 commit comments