[PATCH] D113658: [fir] Add !fir.len type conversion
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 05:18:30 PST 2021
clementval updated this revision to Diff 386816.
clementval added a comment.
Get size from the descriptor + rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113658/new/
https://reviews.llvm.org/D113658
Files:
flang/lib/Optimizer/CodeGen/TypeConverter.h
flang/test/Fir/types-to-llvm.fir
Index: flang/test/Fir/types-to-llvm.fir
===================================================================
--- flang/test/Fir/types-to-llvm.fir
+++ flang/test/Fir/types-to-llvm.fir
@@ -293,3 +293,11 @@
func private @foo0(%arg0: !fir.field)
// CHECK-LABEL: foo0
// CHECK-SAME: i32
+
+// -----
+
+// Test `!fir.len` conversion.
+
+func private @foo0(%arg0: !fir.len)
+// CHECK-LABEL: foo0
+// CHECK-SAME: i64
Index: flang/lib/Optimizer/CodeGen/TypeConverter.h
===================================================================
--- flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -73,6 +73,11 @@
// Convert to i32 because of LLVM GEP indexing restriction.
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(
[&](fir::ComplexType cmplx) { return convertComplexType(cmplx); });
addConversion(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113658.386816.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211112/1711584d/attachment.bin>
More information about the llvm-commits
mailing list