This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add kernel to lower expressions to HLFIR
ClosedPublic

Authored by jeanPerier on Oct 21 2022, 7:03 AM.

Details

Summary

This patch adds the kernel to lower evaluate::Expr to HLFIR to a
hlfir::FortranEntity (a single mlir::Value that can be interpreted as
a Fortran variable or the value of a Fortram expression).

It implements lowering of simple name designators ("x") and starts
adding a translation layer in AbstractConverter::genExprBox and
AbstractConverter::genExprAddr so that the new expression lowering
can be used without any changes for now in the current statement and
construct lowering.

Diff Detail

Event Timeline

jeanPerier created this revision.Oct 21 2022, 7:03 AM
jeanPerier requested review of this revision.Oct 21 2022, 7:03 AM
PeteSteinfeld accepted this revision.Oct 21 2022, 10:59 AM

Aside from my comment about creating a utility function for the code in Bridge.cpp, all builds and tests correctly and looks good.

flang/lib/Lower/Bridge.cpp
441–444

This patch includes this set of calls a couple of times where you conditionally attach a cleanup function. Should you have a separate function to handle such combinations of calls?

470–473

Here it is again ...

This revision is now accepted and ready to land.Oct 21 2022, 10:59 AM
clementval accepted this revision.Oct 21 2022, 11:11 AM

Move the conditional cleanup attach pattern in a helper.

This revision was automatically updated to reflect the committed changes.