This is an archive of the discontinued LLVM Phabricator instance.

[flang][NFC] addSymbol/lookupSymbol clean-up
ClosedPublic

Authored by jeanPerier on Feb 6 2023, 6:58 AM.

Details

Summary

HLFIR requires mapping symbol to a single mlir::Value (produced
by a fir::FortranVariableOpInterface), while the current lowering
maps the value to a fir::ExtdendedValue.

So far, the HLFIR symbol query was a special one. Hence, all the code
directly using symMap.lookupSymbol and symMap.addSymbol did not work
with the lowering to HLFIR.

Refactor the code so that symbol lookup and add symbol go through
the converter in a centralize place that handles the HLFIR case
(translate fir::FortranVariableOpInterface to fir::ExtdendedValue
in lookups, and generate hlfir.declare when adding symbols).

In the refactoring, fir::FortranVariableOpInterface is added as
a symbolBox variant to avoid special casing all lookups (shallowLookup...).

Remove some unused SymbolBox member function instead of updating
them.

Diff Detail

Event Timeline

jeanPerier created this revision.Feb 6 2023, 6:58 AM
jeanPerier requested review of this revision.Feb 6 2023, 6:58 AM
This revision is now accepted and ready to land.Feb 6 2023, 11:47 AM
This revision was automatically updated to reflect the committed changes.