This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower statement function references in HLFIR
ClosedPublic

Authored by jeanPerier on Dec 16 2022, 7:57 AM.

Details

Summary

Enable lowering of statement function references in HLFIR. This follows
the same principle as statement function lowering with the current
lowering:

  • Actual arguments are lowered and mapped to the statement function dummy symbols.
  • "HostAssociated" symbols are mapped to their host values (these are the symbols referred to inside the statement function expressions that are not statement function dummies. e.g: x in stmt_func(i) = x(i)).
  • The statement function expression is evaluated.

evaluate::SetLength has to be lowered to deal with statement functions
returning characters since the front-end is generating one to ensure the
statement function expression value is trimmed/padded to match the statement
function declared type.

Diff Detail

Event Timeline

jeanPerier created this revision.Dec 16 2022, 7:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2022, 7:57 AM
jeanPerier requested review of this revision.Dec 16 2022, 7:57 AM

Aside from a couple of nits, all builds and tests correctly and looks good. @vdonaldson should take a look, though.

flang/lib/Lower/Bridge.cpp
452

I don't think you need the curly braces here.

flang/lib/Lower/ConvertCall.cpp
419

Did you mean to say "There are no"

clementval accepted this revision.Dec 16 2022, 11:16 AM
clementval added a subscriber: clementval.

LGTM

This revision is now accepted and ready to land.Dec 16 2022, 11:16 AM
jeanPerier marked an inline comment as done.

Rebase, fix comment typo and remove braces where not needed.

jeanPerier marked an inline comment as done.Dec 19 2022, 12:57 AM
jeanPerier added inline comments.
flang/lib/Lower/ConvertCall.cpp
419

Yes, thanks

This revision was automatically updated to reflect the committed changes.