This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Lower procedure designators to HLFIR
ClosedPublic

Authored by jeanPerier on Feb 8 2023, 7:17 AM.

Details

Summary
  • Add a convertProcedureDesignatorToHLFIR that converts the fir::ExtendedValue from the current lowering to a fir.boxproc/tuple<fir.boxproc, len> mlir::Value.
  • Allow fir.boxproc/tuple<fir.boxproc, len> as hlfir::Entity values (a function is an address, but from a Fortran entity point of view, procedure that are not procedure pointers cannot be assigned to, so it makes a lot more sense to consider those as values).
  • Modify symbol association to not generate an hlfir.declare for dummy procedures. They are not needed and allowing hlfir.declare to declare function values would make its verifier and handling overly complex for little benefits (maybe an hlfir.declare_proc could be added if it turnout out useful later for debug info and attributes storing purposes).
  • Allow translation from hlfir::Entity to fir::ExtendedValue. convertToBox return type had to be relaxed because some intrinsics handles both object and procedure arguments and need to lower their object arguments "asBox". fir::BoxValue is not intended to carry dummy procedures (all its member functions would make little sense and its verifier does not accept such type). Note that AsAddr, AsValue and AsBox will always return the same MLIR value for procedure designators because they are always handled the same way in FIR.

Diff Detail

Event Timeline

jeanPerier created this revision.Feb 8 2023, 7:17 AM
jeanPerier requested review of this revision.Feb 8 2023, 7:17 AM
This revision is now accepted and ready to land.Feb 8 2023, 9:15 AM
This revision was automatically updated to reflect the committed changes.