This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add hlfir.declare operation
ClosedPublic

Authored by jeanPerier on Nov 10 2022, 4:59 AM.

Details

Summary

This operation will be used to declare named variables in HLFIR.
See the added description in HLFIROpBase.td for more info about it.

The motivation behind this operation is described in https://reviews.llvm.org/D137634.

The FortranVariableInterface verifier is changed a bit. It used to
operate using the result type to verify the provided shape and length
parameters. This is a bit incorrect because what matters to verify the
information is the input address (This worked OK with fir.declare where
the input memref type is the same as the output result). Also, not all
operation defining variables will have an input memref with the same
meaning (hlfir.designate and hlfir.associate for instance).
Hence, this verifier is now optional and must be provided a memref to
operate.

Diff Detail

Event Timeline

jeanPerier created this revision.Nov 10 2022, 4:59 AM
Herald added a project: Restricted Project. · View Herald Transcript
jeanPerier requested review of this revision.Nov 10 2022, 4:59 AM
clementval accepted this revision.Nov 10 2022, 9:05 AM

LGTM

flang/include/flang/Optimizer/HLFIR/HLFIROps.td
44

is there a , missing between address and bounds?

This revision is now accepted and ready to land.Nov 10 2022, 9:05 AM
jeanPerier marked an inline comment as done.Nov 14 2022, 1:28 AM
jeanPerier added inline comments.
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
44

Yes, thanks

This revision was automatically updated to reflect the committed changes.
jeanPerier marked an inline comment as done.