@@ -71,7 +71,7 @@ inline AddrAndBoundsInfo getDataOperandBaseAddr(fir::FirOpBuilder &builder,
71
71
mlir::Value isPresent;
72
72
if (isOptional)
73
73
isPresent =
74
- builder. create < fir::IsPresentOp>( loc, builder.getI1Type (), rawInput);
74
+ fir::IsPresentOp::create (builder, loc, builder.getI1Type (), rawInput);
75
75
76
76
if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(
77
77
fir::unwrapRefType (symAddr.getType ()))) {
@@ -82,7 +82,7 @@ inline AddrAndBoundsInfo getDataOperandBaseAddr(fir::FirOpBuilder &builder,
82
82
// if branches.
83
83
if (unwrapFirBox && mlir::isa<fir::ReferenceType>(symAddr.getType ()) &&
84
84
!isOptional) {
85
- mlir::Value addr = builder. create < fir::LoadOp>( loc, symAddr);
85
+ mlir::Value addr = fir::LoadOp::create (builder, loc, symAddr);
86
86
return AddrAndBoundsInfo (addr, rawInput, isPresent, boxTy);
87
87
}
88
88
@@ -94,7 +94,7 @@ inline AddrAndBoundsInfo getDataOperandBaseAddr(fir::FirOpBuilder &builder,
94
94
if (auto boxCharType = mlir::dyn_cast<fir::BoxCharType>(
95
95
fir::unwrapRefType ((symAddr.getType ())))) {
96
96
if (!isOptional && mlir::isa<fir::ReferenceType>(symAddr.getType ())) {
97
- mlir::Value boxChar = builder. create < fir::LoadOp>( loc, symAddr);
97
+ mlir::Value boxChar = fir::LoadOp::create (builder, loc, symAddr);
98
98
return AddrAndBoundsInfo (boxChar, rawInput, isPresent);
99
99
}
100
100
}
@@ -117,10 +117,10 @@ gatherBoundsOrBoundValues(fir::FirOpBuilder &builder, mlir::Location loc,
117
117
mlir::Value baseLb =
118
118
fir::factory::readLowerBound (builder, loc, dataExv, dim, one);
119
119
auto dimInfo =
120
- builder. create < fir::BoxDimsOp>( loc, idxTy, idxTy, idxTy, box, d);
120
+ fir::BoxDimsOp::create (builder, loc, idxTy, idxTy, idxTy, box, d);
121
121
mlir::Value lb = builder.createIntegerConstant (loc, idxTy, 0 );
122
122
mlir::Value ub =
123
- builder. create < mlir::arith::SubIOp>( loc, dimInfo.getExtent (), one);
123
+ mlir::arith::SubIOp::create (builder, loc, dimInfo.getExtent (), one);
124
124
if (dim == 0 ) // First stride is the element size.
125
125
byteStride = dimInfo.getByteStride ();
126
126
if (collectValuesOnly) {
@@ -130,12 +130,12 @@ gatherBoundsOrBoundValues(fir::FirOpBuilder &builder, mlir::Location loc,
130
130
values.push_back (byteStride);
131
131
values.push_back (baseLb);
132
132
} else {
133
- mlir::Value bound = builder. create < BoundsOp>(
133
+ mlir::Value bound = BoundsOp::create (builder,
134
134
loc, boundTy, lb, ub, dimInfo.getExtent (), byteStride, true , baseLb);
135
135
values.push_back (bound);
136
136
}
137
137
// Compute the stride for the next dimension.
138
- byteStride = builder. create < mlir::arith::MulIOp>( loc, byteStride,
138
+ byteStride = mlir::arith::MulIOp::create (builder, loc, byteStride,
139
139
dimInfo.getExtent ());
140
140
}
141
141
return values;
@@ -162,40 +162,40 @@ genBoundsOpFromBoxChar(fir::FirOpBuilder &builder, mlir::Location loc,
162
162
.genThen ([&]() {
163
163
mlir::Value boxChar =
164
164
fir::isa_ref_type (info.addr .getType ())
165
- ? builder. create < fir::LoadOp>( loc, info.addr )
165
+ ? fir::LoadOp::create (builder, loc, info.addr )
166
166
: info.addr ;
167
167
fir::BoxCharType boxCharType =
168
168
mlir::cast<fir::BoxCharType>(boxChar.getType ());
169
169
mlir::Type refType = builder.getRefType (boxCharType.getEleTy ());
170
- auto unboxed = builder. create < fir::UnboxCharOp>(
170
+ auto unboxed = fir::UnboxCharOp::create (builder,
171
171
loc, refType, lenType, boxChar);
172
172
mlir::SmallVector<mlir::Value> results = {unboxed.getResult (1 ),
173
173
one};
174
- builder. create < fir::ResultOp>( loc, results);
174
+ fir::ResultOp::create (builder, loc, results);
175
175
})
176
176
.genElse ([&]() {
177
177
mlir::SmallVector<mlir::Value> results = {zero, zero};
178
- builder. create < fir::ResultOp>( loc, results);
178
+ fir::ResultOp::create (builder, loc, results);
179
179
})
180
180
.getResults ();
181
181
return {ifRes[0 ], ifRes[1 ]};
182
182
}
183
183
// We have already established that info.addr.getType() is a boxchar
184
184
// or a boxchar address. If an address, load the boxchar.
185
185
mlir::Value boxChar = fir::isa_ref_type (info.addr .getType ())
186
- ? builder. create < fir::LoadOp>( loc, info.addr )
186
+ ? fir::LoadOp::create (builder, loc, info.addr )
187
187
: info.addr ;
188
188
fir::BoxCharType boxCharType =
189
189
mlir::cast<fir::BoxCharType>(boxChar.getType ());
190
190
mlir::Type refType = builder.getRefType (boxCharType.getEleTy ());
191
191
auto unboxed =
192
- builder. create < fir::UnboxCharOp>( loc, refType, lenType, boxChar);
192
+ fir::UnboxCharOp::create (builder, loc, refType, lenType, boxChar);
193
193
return {unboxed.getResult (1 ), one};
194
194
}();
195
195
196
- mlir::Value ub = builder. create < mlir::arith::SubIOp>( loc, extent, one);
196
+ mlir::Value ub = mlir::arith::SubIOp::create (builder, loc, extent, one);
197
197
mlir::Type boundTy = builder.getType <BoundsType>();
198
- return builder. create < BoundsOp>( loc, boundTy,
198
+ return BoundsOp::create (builder, loc, boundTy,
199
199
/* lower_bound=*/ zero,
200
200
/* upper_bound=*/ ub,
201
201
/* extent=*/ extent,
@@ -230,12 +230,12 @@ genBoundsOpsFromBox(fir::FirOpBuilder &builder, mlir::Location loc,
230
230
mlir::Value box =
231
231
!fir::isBoxAddress (info.addr .getType ())
232
232
? info.addr
233
- : builder. create < fir::LoadOp>( loc, info.addr );
233
+ : fir::LoadOp::create (builder, loc, info.addr );
234
234
llvm::SmallVector<mlir::Value> boundValues =
235
235
gatherBoundsOrBoundValues<BoundsOp, BoundsType>(
236
236
builder, loc, dataExv, box,
237
237
/* collectValuesOnly=*/ true );
238
- builder. create < fir::ResultOp>( loc, boundValues);
238
+ fir::ResultOp::create (builder, loc, boundValues);
239
239
})
240
240
.genElse ([&] {
241
241
// Box is not present. Populate bound values with default values.
@@ -249,21 +249,21 @@ genBoundsOpsFromBox(fir::FirOpBuilder &builder, mlir::Location loc,
249
249
boundValues.push_back (zero); // byteStride
250
250
boundValues.push_back (zero); // baseLb
251
251
}
252
- builder. create < fir::ResultOp>( loc, boundValues);
252
+ fir::ResultOp::create (builder, loc, boundValues);
253
253
})
254
254
.getResults ();
255
255
// Create the bound operations outside the if-then-else with the if op
256
256
// results.
257
257
for (unsigned i = 0 ; i < ifRes.size (); i += nbValuesPerBound) {
258
- mlir::Value bound = builder. create < BoundsOp>(
258
+ mlir::Value bound = BoundsOp::create (builder,
259
259
loc, boundTy, ifRes[i], ifRes[i + 1 ], ifRes[i + 2 ], ifRes[i + 3 ],
260
260
true , ifRes[i + 4 ]);
261
261
bounds.push_back (bound);
262
262
}
263
263
} else {
264
264
mlir::Value box = !fir::isBoxAddress (info.addr .getType ())
265
265
? info.addr
266
- : builder. create < fir::LoadOp>( loc, info.addr );
266
+ : fir::LoadOp::create (builder, loc, info.addr );
267
267
bounds = gatherBoundsOrBoundValues<BoundsOp, BoundsType>(builder, loc,
268
268
dataExv, box);
269
269
}
@@ -299,7 +299,7 @@ genBaseBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc,
299
299
ub = lb;
300
300
} else {
301
301
// ub = extent - 1
302
- ub = builder. create < mlir::arith::SubIOp>( loc, extent, one);
302
+ ub = mlir::arith::SubIOp::create (builder, loc, extent, one);
303
303
}
304
304
mlir::Value stride = one;
305
305
if (strideIncludeLowerExtent) {
@@ -308,7 +308,7 @@ genBaseBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc,
308
308
loc, cumulativeExtent, extent);
309
309
}
310
310
311
- mlir::Value bound = builder. create < BoundsOp>( loc, boundTy, lb, ub, extent,
311
+ mlir::Value bound = BoundsOp::create (builder, loc, boundTy, lb, ub, extent,
312
312
stride, false , baseLb);
313
313
bounds.push_back (bound);
314
314
}
0 commit comments