[flang-commits] [PATCH] D143585: [flang][hlfir] Lower procedure designators to HLFIR

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Feb 8 07:17:33 PST 2023


jeanPerier created this revision.
jeanPerier added a reviewer: clementval.
jeanPerier added a project: Flang.
Herald added subscribers: bzcheeseman, sunshaoce, mehdi_amini, rriddle, jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
jeanPerier requested review of this revision.
Herald added a subscriber: stephenneuendorffer.

- 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143585

Files:
  flang/include/flang/Lower/CallInterface.h
  flang/include/flang/Lower/ConvertExprToHLFIR.h
  flang/include/flang/Lower/ConvertProcedureDesignator.h
  flang/include/flang/Optimizer/Builder/Character.h
  flang/include/flang/Optimizer/Builder/HLFIRTools.h
  flang/lib/Lower/Bridge.cpp
  flang/lib/Lower/CallInterface.cpp
  flang/lib/Lower/ConvertCall.cpp
  flang/lib/Lower/ConvertExprToHLFIR.cpp
  flang/lib/Lower/ConvertProcedureDesignator.cpp
  flang/lib/Lower/ConvertVariable.cpp
  flang/lib/Optimizer/Builder/Character.cpp
  flang/lib/Optimizer/Builder/HLFIRTools.cpp
  flang/test/Lower/HLFIR/procedure-designators.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143585.495838.patch
Type: text/x-patch
Size: 28901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230208/c436dd8b/attachment-0001.bin>


More information about the flang-commits mailing list