[flang-commits] [PATCH] D142695: [flang][hlfir] Lower post f77 user calls

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jan 27 01:24:25 PST 2023


jeanPerier created this revision.
jeanPerier added reviewers: PeteSteinfeld, clementval.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
Herald added a reviewer: nicolasvasilache.

In lowering to HLFIR, deal with user calls involving a mix of:

- dummy with VALUE
- Polymorphism
- contiguous dummy
- assumed shape dummy
- OPTIONAL arguments
- NULL() passed to OPTIONAL arguments.
- elemental calls

Does not deal with assumed ranked dummy arguments.

This patch unifies the preparation of all arguments that must be passed
in memory and are not passed as allocatable/pointers.

For optionals, the same argument preparation is done, except the utility
that generates the IR for the argument preparation is called inside a
fir.if.

The addressing of array arguments in elemental calls is delayed so that
it can also happen during this argument preparation, and be placed in
the fir.if when the array may be absent.

Structure helpers are added to convey a prepared dummy argument and the
data that may be needed to do the clean-up after the call (temporary
storage deallocation or copy-out). And a utility is added to wrap
the preparation code inside a fir.if and convey these values through
the fir.if.

Certain aspects of this patch brings the HLFIR lowering support beyond
what the current lowering to FIR supports (e.g. handling of NULL(), handling
of optional in elemental calls, handling of copy-in/copy-out involving
polymorphic entities).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142695

Files:
  flang/include/flang/Lower/CallInterface.h
  flang/include/flang/Optimizer/Builder/HLFIRTools.h
  flang/lib/Lower/CallInterface.cpp
  flang/lib/Lower/ConvertCall.cpp
  flang/lib/Lower/ConvertExprToHLFIR.cpp
  flang/lib/Optimizer/Builder/HLFIRTools.cpp
  flang/lib/Optimizer/Dialect/FIROps.cpp
  flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
  flang/test/Lower/HLFIR/calls-assumed-shape.f90
  flang/test/Lower/HLFIR/calls-optional.f90
  flang/test/Lower/HLFIR/elemental-intrinsics.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142695.492662.patch
Type: text/x-patch
Size: 60717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230127/1dbc907e/attachment-0001.bin>


More information about the flang-commits mailing list