[fir] Add !fir.ptr type conversion

This patch is part of the upstreaming effort for fir-dev.

Differential Revision: https://reviews.llvm.org/D113559

Co-authored-by: Jean Perier <jperier@nvidia.com>
This commit is contained in:
Diana Picus 2021-11-09 16:36:24 +00:00
parent aaea92e1cd
commit deafc6fc6d
2 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,8 @@ public:
return mlir::IntegerType::get(
&getContext(), kindMapping.getLogicalBitsize(boolTy.getFKind()));
});
addConversion(
[&](fir::PointerType pointer) { return convertPointerLike(pointer); });
addConversion(
[&](fir::RecordType derived) { return convertRecordType(derived); });
addConversion(

View File

@ -31,6 +31,18 @@ func private @foo1(%arg0: !fir.ref<!fir.array<10xf32>>)
// -----
// Test pointer types `!fir.ptr`
func private @foo0(%arg0: !fir.ptr<i32>)
// CHECK-LABEL: foo0
// CHECK-SAME: !llvm.ptr<i32>
func private @foo1(%arg0: !fir.ptr<!fir.array<10xf32>>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.ptr<array<10 x f32>>
// -----
// Test box types `!fir.box`
func private @foo0(%arg0: !fir.box<!fir.array<?xf32>>)