@@ -856,7 +856,7 @@ static bool getAdjustedExtents(mlir::Location loc,
856
856
auto idxTy = rewriter.getIndexType ();
857
857
if (isAssumedSize (result)) {
858
858
// Use slice information to compute the extent of the column.
859
- auto one = rewriter. create < mlir::arith::ConstantIndexOp>( loc, 1 );
859
+ auto one = mlir::arith::ConstantIndexOp::create (rewriter, loc, 1 );
860
860
mlir::Value size = one;
861
861
if (mlir::Value sliceArg = arrLoad.getSlice ()) {
862
862
if (auto sliceOp =
@@ -896,14 +896,14 @@ static mlir::Value getOrReadExtentsAndShapeOp(
896
896
mlir::cast<SequenceType>(dyn_cast_ptrOrBoxEleTy (boxTy)).getDimension ();
897
897
auto idxTy = rewriter.getIndexType ();
898
898
for (decltype (rank) dim = 0 ; dim < rank; ++dim) {
899
- auto dimVal = rewriter. create < mlir::arith::ConstantIndexOp>( loc, dim);
900
- auto dimInfo = rewriter. create < BoxDimsOp>( loc, idxTy, idxTy, idxTy,
899
+ auto dimVal = mlir::arith::ConstantIndexOp::create (rewriter, loc, dim);
900
+ auto dimInfo = BoxDimsOp::create (rewriter, loc, idxTy, idxTy, idxTy,
901
901
arrLoad.getMemref (), dimVal);
902
902
result.emplace_back (dimInfo.getResult (1 ));
903
903
}
904
904
if (!arrLoad.getShape ()) {
905
905
auto shapeType = ShapeType::get (rewriter.getContext (), rank);
906
- return rewriter. create < ShapeOp>( loc, shapeType, result);
906
+ return ShapeOp::create (rewriter, loc, shapeType, result);
907
907
}
908
908
auto shiftOp = arrLoad.getShape ().getDefiningOp <ShiftOp>();
909
909
auto shapeShiftType = ShapeShiftType::get (rewriter.getContext (), rank);
@@ -912,7 +912,7 @@ static mlir::Value getOrReadExtentsAndShapeOp(
912
912
shapeShiftOperands.push_back (lb);
913
913
shapeShiftOperands.push_back (extent);
914
914
}
915
- return rewriter. create < ShapeShiftOp>( loc, shapeShiftType,
915
+ return ShapeShiftOp::create (rewriter, loc, shapeShiftType,
916
916
shapeShiftOperands);
917
917
}
918
918
copyUsingSlice =
@@ -952,12 +952,12 @@ static mlir::Value genCoorOp(mlir::PatternRewriter &rewriter,
952
952
auto module = load->getParentOfType <mlir::ModuleOp>();
953
953
FirOpBuilder builder (rewriter, module );
954
954
auto typeparams = getTypeParamsIfRawData (loc, builder, load, alloc.getType ());
955
- mlir::Value result = rewriter. create < ArrayCoorOp>(
955
+ mlir::Value result = ArrayCoorOp::create (rewriter,
956
956
loc, eleTy, alloc, shape, slice,
957
957
llvm::ArrayRef<mlir::Value>{originated}.take_front (dimension),
958
958
typeparams);
959
959
if (dimension < originated.size ())
960
- result = rewriter. create < fir::CoordinateOp>(
960
+ result = fir::CoordinateOp::create (rewriter,
961
961
loc, resTy, result,
962
962
llvm::ArrayRef<mlir::Value>{originated}.drop_front (dimension));
963
963
return result;
@@ -971,12 +971,12 @@ static mlir::Value getCharacterLen(mlir::Location loc, FirOpBuilder &builder,
971
971
// The loaded array is an emboxed value. Get the CHARACTER length from
972
972
// the box value.
973
973
auto eleSzInBytes =
974
- builder. create < BoxEleSizeOp>( loc, charLenTy, load.getMemref ());
974
+ BoxEleSizeOp::create (builder, loc, charLenTy, load.getMemref ());
975
975
auto kindSize =
976
976
builder.getKindMap ().getCharacterBitsize (charTy.getFKind ());
977
977
auto kindByteSize =
978
978
builder.createIntegerConstant (loc, charLenTy, kindSize / 8 );
979
- return builder. create < mlir::arith::DivSIOp>( loc, eleSzInBytes,
979
+ return mlir::arith::DivSIOp::create (builder, loc, eleSzInBytes,
980
980
kindByteSize);
981
981
}
982
982
// The loaded array is a (set of) unboxed values. If the CHARACTER's
@@ -1003,24 +1003,24 @@ void genArrayCopy(mlir::Location loc, mlir::PatternRewriter &rewriter,
1003
1003
auto idxTy = rewriter.getIndexType ();
1004
1004
// Build loop nest from column to row.
1005
1005
for (auto sh : llvm::reverse (extents)) {
1006
- auto ubi = rewriter. create < ConvertOp>( loc, idxTy, sh);
1007
- auto zero = rewriter. create < mlir::arith::ConstantIndexOp>( loc, 0 );
1008
- auto one = rewriter. create < mlir::arith::ConstantIndexOp>( loc, 1 );
1009
- auto ub = rewriter. create < mlir::arith::SubIOp>( loc, idxTy, ubi, one);
1010
- auto loop = rewriter. create < DoLoopOp>( loc, zero, ub, one);
1006
+ auto ubi = ConvertOp::create (rewriter, loc, idxTy, sh);
1007
+ auto zero = mlir::arith::ConstantIndexOp::create (rewriter, loc, 0 );
1008
+ auto one = mlir::arith::ConstantIndexOp::create (rewriter, loc, 1 );
1009
+ auto ub = mlir::arith::SubIOp::create (rewriter, loc, idxTy, ubi, one);
1010
+ auto loop = DoLoopOp::create (rewriter, loc, zero, ub, one);
1011
1011
rewriter.setInsertionPointToStart (loop.getBody ());
1012
1012
indices.push_back (loop.getInductionVar ());
1013
1013
}
1014
1014
// Reverse the indices so they are in column-major order.
1015
1015
std::reverse (indices.begin (), indices.end ());
1016
1016
auto module = arrLoad->getParentOfType <mlir::ModuleOp>();
1017
1017
FirOpBuilder builder (rewriter, module );
1018
- auto fromAddr = rewriter. create < ArrayCoorOp>(
1018
+ auto fromAddr = ArrayCoorOp::create (rewriter,
1019
1019
loc, getEleTy (src.getType ()), src, shapeOp,
1020
1020
CopyIn && copyUsingSlice ? sliceOp : mlir::Value{},
1021
1021
factory::originateIndices (loc, rewriter, src.getType (), shapeOp, indices),
1022
1022
getTypeParamsIfRawData (loc, builder, arrLoad, src.getType ()));
1023
- auto toAddr = rewriter. create < ArrayCoorOp>(
1023
+ auto toAddr = ArrayCoorOp::create (rewriter,
1024
1024
loc, getEleTy (dst.getType ()), dst, shapeOp,
1025
1025
!CopyIn && copyUsingSlice ? sliceOp : mlir::Value{},
1026
1026
factory::originateIndices (loc, rewriter, dst.getType (), shapeOp, indices),
@@ -1093,14 +1093,14 @@ allocateArrayTemp(mlir::Location loc, mlir::PatternRewriter &rewriter,
1093
1093
findNonconstantExtents (baseType, extents);
1094
1094
llvm::SmallVector<mlir::Value> typeParams =
1095
1095
genArrayLoadTypeParameters (loc, rewriter, load);
1096
- mlir::Value allocmem = rewriter. create < AllocMemOp>(
1096
+ mlir::Value allocmem = AllocMemOp::create (rewriter,
1097
1097
loc, dyn_cast_ptrOrBoxEleTy (baseType), typeParams, nonconstantExtents);
1098
1098
mlir::Type eleType =
1099
1099
fir::unwrapSequenceType (fir::unwrapPassByRefType (baseType));
1100
1100
if (fir::isRecordWithAllocatableMember (eleType)) {
1101
1101
// The allocatable component descriptors need to be set to a clean
1102
1102
// deallocated status before anything is done with them.
1103
- mlir::Value box = rewriter. create < fir::EmboxOp>(
1103
+ mlir::Value box = fir::EmboxOp::create (rewriter,
1104
1104
loc, fir::BoxType::get (allocmem.getType ()), allocmem, shape,
1105
1105
/* slice=*/ mlir::Value{}, typeParams);
1106
1106
auto module = load->getParentOfType <mlir::ModuleOp>();
@@ -1111,12 +1111,12 @@ allocateArrayTemp(mlir::Location loc, mlir::PatternRewriter &rewriter,
1111
1111
auto cleanup = [=](mlir::PatternRewriter &r) {
1112
1112
FirOpBuilder builder (r, module );
1113
1113
runtime::genDerivedTypeDestroy (builder, loc, box);
1114
- r. create < FreeMemOp>( loc, allocmem);
1114
+ FreeMemOp::create (r, loc, allocmem);
1115
1115
};
1116
1116
return {allocmem, cleanup};
1117
1117
}
1118
1118
auto cleanup = [=](mlir::PatternRewriter &r) {
1119
- r. create < FreeMemOp>( loc, allocmem);
1119
+ FreeMemOp::create (r, loc, allocmem);
1120
1120
};
1121
1121
return {allocmem, cleanup};
1122
1122
}
@@ -1257,7 +1257,7 @@ class ArrayUpdateConversion : public ArrayUpdateConversionBase<ArrayUpdateOp> {
1257
1257
if (auto inEleTy = dyn_cast_ptrEleTy (input.getType ())) {
1258
1258
emitFatalError (loc, " array_update on references not supported" );
1259
1259
} else {
1260
- rewriter. create < fir::StoreOp>( loc, input, coor);
1260
+ fir::StoreOp::create (rewriter, loc, input, coor);
1261
1261
}
1262
1262
};
1263
1263
auto lhsEltRefType = toRefType (update.getMerge ().getType ());
@@ -1368,7 +1368,7 @@ class ArrayAmendConversion : public mlir::OpRewritePattern<ArrayAmendOp> {
1368
1368
auto *op = amend.getOperation ();
1369
1369
rewriter.setInsertionPoint (op);
1370
1370
auto loc = amend.getLoc ();
1371
- auto undef = rewriter. create < UndefOp>( loc, amend.getType ());
1371
+ auto undef = UndefOp::create (rewriter, loc, amend.getType ());
1372
1372
rewriter.replaceOp (amend, undef.getResult ());
1373
1373
return mlir::success ();
1374
1374
}
0 commit comments