[PATCH] D113879: [Flang] Add the typeconversion to llvm for the FIR boxproc type
Kiran Chandramohan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 05:30:37 PST 2021
kiranchandramohan added inline comments.
================
Comment at: flang/test/Fir/types-to-llvm.fir:78
+// CHECK-LABEL: foo0
+// CHECK-SAME: !llvm.struct<(ptr<ptr<func<void ()>>>, ptr<i8>)>
+
----------------
rovka wrote:
> Why does this have to be ptr<ptr>? Isn't one level of indirection enough? (Sorry about the ignoramus question)
That is a good question. I don't know the exact reason. I guess it is the following.
1. Boxes are always references. I think this is modelled by the outer ptr.
2. The Fortran construct it models is a procedure pointer and this is the inner ptr.
If we consider a function that takes in a procedure pointer as argument, I think in LLVM IR this would require one load to get the value corresponding to the procedure (captured by a procedure pointer) and then an indirect call to call the loaded procedure.
WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113879/new/
https://reviews.llvm.org/D113879
More information about the llvm-commits
mailing list