[flang-commits] [PATCH] D136254: [flang] add fir.declare codegen support

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Oct 21 07:18:07 PDT 2022


jeanPerier added a comment.

In D136254#3873494 <https://reviews.llvm.org/D136254#3873494>, @peixin wrote:

> Will `fir.declare` be used for procedure pointer, too? I am looking at the procedure pointer. It seems the codegen has been supported (check the following example). Should the lowering support be delayed until HLFIR is ready? It seems that `fir.declare` only targets on Fortran variables as `HighLevelFIR.md` mentioned.
>
>   func.func private @foo(!fir.ref<(!fir.ref<i32>) -> f32>)
>   
>   func.func @func() -> ((!fir.ref<i32>) -> f32) {
>     %0 = fir.alloca (!fir.ref<i32>) -> f32
>     %1 = fir.load %0 : !fir.ref<(!fir.ref<i32>) -> f32>
>     fir.call @foo(%0) : (!fir.ref<(!fir.ref<i32>) -> f32>) -> ()
>     return %1 : (!fir.ref<i32>) -> f32
>   }

Yes, fir.declare will support them. I do not see huge reason to wait though. I think however that the FIR design intention was rather to use fir.ref<fir.boxproc<FunctType>> to abstract the detail of what procedure are in lowering.
Also, I think procedure pointers will deserve a small doc to summarize in what kind of context they should appear, what are the constraints and what will be done in lowering.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136254/new/

https://reviews.llvm.org/D136254



More information about the flang-commits mailing list