[flang-commits] [PATCH] D142124: [flang][hlfir] Lower pointer and allocatable sub-part references
Jean Perier via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Jan 19 08:09:08 PST 2023
jeanPerier created this revision.
jeanPerier added reviewers: clementval, PeteSteinfeld.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.
The previous patches dealt with allocatable and pointer symbol
and component whole references.
This one deals with the remaining sub-part case where a dereference
must be created before applying the sub-part reference on the target.
With this patch the support to designate allocatable and pointer in
HLFIR is complete, but some use points will need to be updated to
use HLFIR designator lowering (at least allocate/deallocate statement
and whole allocatable assignment).
The partInfo.base had to be turned into an std::optional<hlfir::Entity>
because loads of allocatable/pointers do create a
fir::FortranVariableOpInterface (there is no need to). The optional part
comes from the fact that the partInfo.base is not set when creating the
partInfo, but later when visiting the designator parts.
They are three cases when dereferences must be inserted:
- The pointer/allocatable is a symbol followed by a sub-part that is not
a component ref. This is done in visit(Symbol).
- The pointer/allocatable is a component followed by a sub-part that is
not another component ref. This is done in visit(Component).
- The pointer/allocatable is followed by a component ref. This case is
special since it does not call the above "visit" but instead calls "gen"
to break the visit and generate an hlfir.designate for the component
base (since one hlfir.designate can only represent one Fortran part-ref,
and must be chained to implement a Fortran designator with several part
refs). This is done in visitComponentImpl().
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142124
Files:
flang/include/flang/Optimizer/Builder/HLFIRTools.h
flang/lib/Lower/ConvertExprToHLFIR.cpp
flang/test/Lower/HLFIR/allocatable-and-pointer-subparts.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142124.490526.patch
Type: text/x-patch
Size: 14598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230119/e389474d/attachment-0001.bin>
More information about the flang-commits
mailing list