@@ -142,8 +142,8 @@ static mlir::LLVM::LLVMFuncOp getOmpTargetAlloc(mlir::Operation *op) {
142
142
/* isVarArg=*/ false ));
143
143
}
144
144
145
- static mlir::Type
146
- convertObjectType ( const fir::LLVMTypeConverter &converter, mlir::Type firType) {
145
+ static mlir::Type convertObjectType ( const fir::LLVMTypeConverter &converter,
146
+ mlir::Type firType) {
147
147
if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(firType))
148
148
return converter.convertBoxTypeAsStruct (boxTy);
149
149
return converter.convertType (firType);
@@ -189,8 +189,9 @@ computeElementDistance(mlir::Location loc, mlir::Type llvmObjectType,
189
189
}
190
190
191
191
static mlir::Value genTypeSizeInBytes (mlir::Location loc, mlir::Type idxTy,
192
- mlir::ConversionPatternRewriter &rewriter,
193
- mlir::Type llTy, const mlir::DataLayout &dataLayout) {
192
+ mlir::ConversionPatternRewriter &rewriter,
193
+ mlir::Type llTy,
194
+ const mlir::DataLayout &dataLayout) {
194
195
return computeElementDistance (loc, llTy, idxTy, rewriter, dataLayout);
195
196
}
196
197
@@ -224,8 +225,10 @@ genAllocationScaleSize(OP op, mlir::Type ity,
224
225
}
225
226
226
227
static mlir::Value integerCast (const fir::LLVMTypeConverter &converter,
227
- mlir::Location loc, mlir::ConversionPatternRewriter &rewriter,
228
- mlir::Type ty, mlir::Value val, bool fold = false ) {
228
+ mlir::Location loc,
229
+ mlir::ConversionPatternRewriter &rewriter,
230
+ mlir::Type ty, mlir::Value val,
231
+ bool fold = false ) {
229
232
auto valTy = val.getType ();
230
233
// If the value was not yet lowered, lower its type so that it can
231
234
// be used in getPrimitiveTypeSizeInBits.
@@ -261,11 +264,13 @@ struct TargetAllocMemOpConversion
261
264
auto ity = lowerTy ().indexType ();
262
265
mlir::Type dataTy = fir::unwrapRefType (heapTy);
263
266
mlir::Type llvmObjectTy = convertObjectType (lowerTy (), dataTy);
264
- mlir::Type llvmPtrTy = mlir::LLVM::LLVMPointerType::get (allocmemOp.getContext (), 0 );
267
+ mlir::Type llvmPtrTy =
268
+ mlir::LLVM::LLVMPointerType::get (allocmemOp.getContext (), 0 );
265
269
if (fir::isRecordWithTypeParameters (fir::unwrapSequenceType (dataTy)))
266
270
TODO (loc, " omp.target_allocmem codegen of derived type with length "
267
271
" parameters" );
268
- mlir::Value size = genTypeSizeInBytes (loc, ity, rewriter, llvmObjectTy, lowerTy ().getDataLayout ());
272
+ mlir::Value size = genTypeSizeInBytes (loc, ity, rewriter, llvmObjectTy,
273
+ lowerTy ().getDataLayout ());
269
274
if (auto scaleSize = genAllocationScaleSize (allocmemOp, ity, rewriter))
270
275
size = rewriter.create <mlir::LLVM::MulOp>(loc, ity, size, scaleSize);
271
276
for (mlir::Value opnd : adaptor.getOperands ().drop_front ())
@@ -281,7 +286,8 @@ struct TargetAllocMemOpConversion
281
286
loc, llvmPtrTy,
282
287
mlir::SmallVector<mlir::Value, 2 >({size, allocmemOp.getDevice ()}),
283
288
addLLVMOpBundleAttrs (rewriter, allocmemOp->getAttrs (), 2 ));
284
- rewriter.replaceOpWithNewOp <mlir::LLVM::PtrToIntOp>(allocmemOp, rewriter.getIntegerType (64 ), callOp.getResult ());
289
+ rewriter.replaceOpWithNewOp <mlir::LLVM::PtrToIntOp>(
290
+ allocmemOp, rewriter.getIntegerType (64 ), callOp.getResult ());
285
291
return mlir::success ();
286
292
}
287
293
};
0 commit comments