This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Lower intrinsic module procedures to HLFIR
ClosedPublic

Authored by jeanPerier on Mar 6 2023, 12:28 AM.

Details

Summary

Intrinsic module procedures are a bit different from intrinsic
procedures: they are defined in intrinsic module files, but their
signature and representation in semantics is the same as user
procedures.
The code to lower them in lowering (when they are not implemented in
Fortran) is the same as for intrinsic procedures
(Optimizer/Builder/IntrinsicCall.cpp).

The dispatching in in HLFIR procedure reference lowering must be
slightly modified so that these evaluate::ProcRef that have a
semantics::Symbol instead of an evaluate::SpecificIntrinsic can
be dispatched as evaluate::SpecificIntrinsic:

  • move isIntrinsicModuleProcedure to detect them
  • in the helpers dealing with intrinsics, make evaluate::SpecificIntrinsic a pointer argument that can be null for intrinsic module procedures.
  • add getProcedureName() to call context to avoid relying on the evaluate::SpecificIntrinsic when it is not know to be null.

Diff Detail

Event Timeline

jeanPerier created this revision.Mar 6 2023, 12:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 12:28 AM
jeanPerier requested review of this revision.Mar 6 2023, 12:28 AM
This revision is now accepted and ready to land.Mar 6 2023, 12:54 AM
tblah added a subscriber: tblah.Mar 6 2023, 2:16 AM