@@ -49,8 +49,8 @@ void genCharacterCopy(mlir::Value src, mlir::Value srcLen, mlir::Value dst,
4949 if (!srcLen && !dstLen && srcTy.getFKind () == dstTy.getFKind () &&
5050 srcTy.getLen () == dstTy.getLen ()) {
5151 // same size, so just use load and store
52- auto load = builder. template create < fir::LoadOp>( loc, src);
53- builder. template create < fir::StoreOp>( loc, load, dst);
52+ auto load = fir::LoadOp::create (builder, loc, src);
53+ fir::StoreOp::create (builder, loc, load, dst);
5454 return ;
5555 }
5656 auto zero = builder.template create <mlir::arith::ConstantIndexOp>(loc, 0 );
@@ -70,75 +70,72 @@ void genCharacterCopy(mlir::Value src, mlir::Value srcLen, mlir::Value dst,
7070 if (!srcLen && !dstLen && srcTy.getLen () >= dstTy.getLen ()) {
7171 auto upper = builder.template create <mlir::arith::ConstantIndexOp>(
7272 loc, dstTy.getLen () - 1 );
73- auto loop = builder. template create < fir::DoLoopOp>( loc, zero, upper, one);
73+ auto loop = fir::DoLoopOp::create (builder, loc, zero, upper, one);
7474 auto insPt = builder.saveInsertionPoint ();
7575 builder.setInsertionPointToStart (loop.getBody ());
7676 auto csrcTy = toArrayTy (srcTy);
77- auto csrc = builder. template create < fir::ConvertOp>( loc, csrcTy, src);
78- auto in = builder. template create < fir::CoordinateOp>(
79- loc, toCoorTy (csrcTy), csrc, loop.getInductionVar ());
80- auto load = builder. template create < fir::LoadOp>( loc, in);
77+ auto csrc = fir::ConvertOp::create (builder, loc, csrcTy, src);
78+ auto in = fir::CoordinateOp::create (builder, loc, toCoorTy (csrcTy), csrc,
79+ loop.getInductionVar ());
80+ auto load = fir::LoadOp::create (builder, loc, in);
8181 auto cdstTy = toArrayTy (dstTy);
82- auto cdst = builder. template create < fir::ConvertOp>( loc, cdstTy, dst);
83- auto out = builder. template create < fir::CoordinateOp>(
84- loc, toCoorTy (cdstTy), cdst, loop.getInductionVar ());
82+ auto cdst = fir::ConvertOp::create (builder, loc, cdstTy, dst);
83+ auto out = fir::CoordinateOp::create (builder, loc, toCoorTy (cdstTy), cdst,
84+ loop.getInductionVar ());
8585 mlir::Value cast =
8686 srcTy.getFKind () == dstTy.getFKind ()
8787 ? load.getResult ()
88- : builder
89- .template create <fir::ConvertOp>(loc, toEleTy (cdstTy), load)
88+ : fir::ConvertOp::create (builder, loc, toEleTy (cdstTy), load)
9089 .getResult ();
91- builder. template create < fir::StoreOp>( loc, cast, out);
90+ fir::StoreOp::create (builder, loc, cast, out);
9291 builder.restoreInsertionPoint (insPt);
9392 return ;
9493 }
9594 auto minusOne = [&](mlir::Value v) -> mlir::Value {
9695 return builder.template create <mlir::arith::SubIOp>(
97- loc, builder.template create <fir::ConvertOp>(loc, one.getType (), v),
98- one);
96+ loc, fir::ConvertOp::create (builder, loc, one.getType (), v), one);
9997 };
10098 mlir::Value len = dstLen ? minusOne (dstLen)
10199 : builder
102100 .template create <mlir::arith::ConstantIndexOp>(
103101 loc, dstTy.getLen () - 1 )
104102 .getResult ();
105- auto loop = builder. template create < fir::DoLoopOp>( loc, zero, len, one);
103+ auto loop = fir::DoLoopOp::create (builder, loc, zero, len, one);
106104 auto insPt = builder.saveInsertionPoint ();
107105 builder.setInsertionPointToStart (loop.getBody ());
108106 mlir::Value slen =
109- srcLen
110- ? builder.template create <fir::ConvertOp>(loc, one.getType (), srcLen)
111- .getResult ()
112- : builder
113- .template create <mlir::arith::ConstantIndexOp>(loc,
114- srcTy.getLen ())
115- .getResult ();
107+ srcLen ? fir::ConvertOp::create (builder, loc, one.getType (), srcLen)
108+ .getResult ()
109+ : builder
110+ .template create <mlir::arith::ConstantIndexOp>(
111+ loc, srcTy.getLen ())
112+ .getResult ();
116113 auto cond = builder.template create <mlir::arith::CmpIOp>(
117114 loc, mlir::arith::CmpIPredicate::slt, loop.getInductionVar (), slen);
118- auto ifOp = builder. template create < fir::IfOp>( loc, cond, /* withElse=*/ true );
115+ auto ifOp = fir::IfOp::create (builder, loc, cond, /* withElse=*/ true );
119116 builder.setInsertionPointToStart (&ifOp.getThenRegion ().front ());
120117 auto csrcTy = toArrayTy (srcTy);
121- auto csrc = builder. template create < fir::ConvertOp>( loc, csrcTy, src);
122- auto in = builder. template create < fir::CoordinateOp>(
123- loc, toCoorTy (csrcTy), csrc, loop.getInductionVar ());
124- auto load = builder. template create < fir::LoadOp>( loc, in);
118+ auto csrc = fir::ConvertOp::create (builder, loc, csrcTy, src);
119+ auto in = fir::CoordinateOp::create (builder, loc, toCoorTy (csrcTy), csrc,
120+ loop.getInductionVar ());
121+ auto load = fir::LoadOp::create (builder, loc, in);
125122 auto cdstTy = toArrayTy (dstTy);
126- auto cdst = builder. template create < fir::ConvertOp>( loc, cdstTy, dst);
127- auto out = builder. template create < fir::CoordinateOp>(
128- loc, toCoorTy (cdstTy), cdst, loop.getInductionVar ());
123+ auto cdst = fir::ConvertOp::create (builder, loc, cdstTy, dst);
124+ auto out = fir::CoordinateOp::create (builder, loc, toCoorTy (cdstTy), cdst,
125+ loop.getInductionVar ());
129126 mlir::Value cast =
130127 srcTy.getFKind () == dstTy.getFKind ()
131128 ? load.getResult ()
132- : builder. template create < fir::ConvertOp>( loc, toEleTy (cdstTy), load)
129+ : fir::ConvertOp::create (builder, loc, toEleTy (cdstTy), load)
133130 .getResult ();
134- builder. template create < fir::StoreOp>( loc, cast, out);
131+ fir::StoreOp::create (builder, loc, cast, out);
135132 builder.setInsertionPointToStart (&ifOp.getElseRegion ().front ());
136- auto space = builder. template create < fir::StringLitOp>(
137- loc, toEleTy (cdstTy), llvm::ArrayRef<char >{' ' });
138- auto cdst2 = builder. template create < fir::ConvertOp>( loc, cdstTy, dst);
139- auto out2 = builder. template create < fir::CoordinateOp>(
140- loc, toCoorTy (cdstTy), cdst2, loop.getInductionVar ());
141- builder. template create < fir::StoreOp>( loc, space, out2);
133+ auto space = fir::StringLitOp::create (builder, loc, toEleTy (cdstTy),
134+ llvm::ArrayRef<char >{' ' });
135+ auto cdst2 = fir::ConvertOp::create (builder, loc, cdstTy, dst);
136+ auto out2 = fir::CoordinateOp::create (builder, loc, toCoorTy (cdstTy), cdst2,
137+ loop.getInductionVar ());
138+ fir::StoreOp::create (builder, loc, space, out2);
142139 builder.restoreInsertionPoint (insPt);
143140}
144141
0 commit comments