[all-commits] [llvm/llvm-project] c373f5: [flang] Lower procedure pointer components (#75453)

jeanPerier via All-commits all-commits at lists.llvm.org
Tue Dec 19 08:17:23 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c373f58134997a6d037f0143f13f97451278700f
      https://github.com/llvm/llvm-project/commit/c373f58134997a6d037f0143f13f97451278700f
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2023-12-19 (Tue, 19 Dec 2023)

  Changed paths:
    M flang/include/flang/Lower/AbstractConverter.h
    M flang/include/flang/Lower/CallInterface.h
    M flang/include/flang/Lower/ConvertProcedureDesignator.h
    M flang/include/flang/Optimizer/Support/InternalNames.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/CallInterface.cpp
    M flang/lib/Lower/ConvertCall.cpp
    M flang/lib/Lower/ConvertConstant.cpp
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Lower/ConvertExprToHLFIR.cpp
    M flang/lib/Lower/ConvertProcedureDesignator.cpp
    M flang/lib/Lower/ConvertType.cpp
    M flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
    M flang/lib/Optimizer/CodeGen/TypeConverter.cpp
    M flang/lib/Optimizer/Support/InternalNames.cpp
    A flang/test/Lower/HLFIR/proc-pointer-comp-nopass.f90
    A flang/test/Lower/HLFIR/proc-pointer-comp-pass.f90
    M flang/test/Lower/HLFIR/procedure-designators.f90
    M flang/test/Lower/HLFIR/procedure-pointer.f90

  Log Message:
  -----------
  [flang] Lower procedure pointer components (#75453)

Lower procedure pointer components, except in the context of structure
constructor (left TODO).

Procedure pointer components lowering share most of the lowering logic
of procedure poionters with the following particularities:
- They are components, so an hlfir.designate must be generated to
retrieve the procedure pointer address from its derived type base.
- They may have a PASS argument. While there is no dispatching as with
type bound procedure, special care must be taken to retrieve the derived
type component base in this case since semantics placed it in the
argument list and not in the evaluate::ProcedureDesignator.

These components also bring a new level of recursive MLIR types since a
fir.type may now contain a component with an MLIR function type where
one of the argument is the fir.type itself. This required moving the
"derived type in construction" stackto the converter so that the object
and function type lowering utilities share the same state (currently the
function type utilty would end-up creating a new stack when lowering its
arguments, leading to infinite loops). The BoxedProcedurePass also
needed an update to deal with this recursive aspect.




More information about the All-commits mailing list