forked from OSchip/llvm-project
[fir] Add !fir.len type conversion
This patch adds the !fir.len type conversion. The type is converted to the a 32 bits integer. This patch is part of the upstreaming effort from fir-dev branch. Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D113658
This commit is contained in:
parent
599ea3e73f
commit
6c8eecd676
|
@ -73,6 +73,11 @@ public:
|
||||||
// Convert to i32 because of LLVM GEP indexing restriction.
|
// Convert to i32 because of LLVM GEP indexing restriction.
|
||||||
return mlir::IntegerType::get(field.getContext(), 32);
|
return mlir::IntegerType::get(field.getContext(), 32);
|
||||||
});
|
});
|
||||||
|
addConversion([&](fir::LenType field) {
|
||||||
|
// Get size of len paramter from the descriptor.
|
||||||
|
return getModel<Fortran::runtime::typeInfo::TypeParameterValue>()(
|
||||||
|
&getContext());
|
||||||
|
});
|
||||||
addConversion(
|
addConversion(
|
||||||
[&](fir::ComplexType cmplx) { return convertComplexType(cmplx); });
|
[&](fir::ComplexType cmplx) { return convertComplexType(cmplx); });
|
||||||
addConversion(
|
addConversion(
|
||||||
|
|
|
@ -293,3 +293,11 @@ func private @foo1(%arg0: !fir.boxchar<2>)
|
||||||
func private @foo0(%arg0: !fir.field)
|
func private @foo0(%arg0: !fir.field)
|
||||||
// CHECK-LABEL: foo0
|
// CHECK-LABEL: foo0
|
||||||
// CHECK-SAME: i32
|
// CHECK-SAME: i32
|
||||||
|
|
||||||
|
// -----
|
||||||
|
|
||||||
|
// Test `!fir.len` conversion.
|
||||||
|
|
||||||
|
func private @foo0(%arg0: !fir.len)
|
||||||
|
// CHECK-LABEL: foo0
|
||||||
|
// CHECK-SAME: i64
|
||||||
|
|
Loading…
Reference in New Issue