This is an archive of the discontinued LLVM Phabricator instance.

[flang] Make builtin types more easily accessible; use them
ClosedPublic

Authored by klausler on Sep 23 2021, 11:10 AM.

Details

Summary

Rearrange the contents of builtin_* module files a little and
make sure that semantics implicitly USEs the module
Fortran_builtins
before processing each source file. This ensures that the special derived
types for TEAM_TYPE, EVENT_TYPE, LOCK_TYPE, &c. exist in the symbol table
where they will be available for use in coarray intrinsic function
processing.

Update IsTeamType() to exploit access to the __Fortran_builtins
module rather than applying ad hoc name tests. Move it and some
other utilities from Semantics/tools.* to Evaluate/tools.* to make
them available to intrinsics processing.

Add/correct the intrinsic table definitions for GET_TEAM, TEAM_NUMBER,
and THIS_IMAGE to exercise the built-in TEAM_TYPE as an argument and
as a result.

Add/correct/extend tests accordingly.

Diff Detail

Event Timeline

klausler created this revision.Sep 23 2021, 11:10 AM
klausler updated this revision to Diff 374653.Sep 23 2021, 12:59 PM

Fix usage of Arm driver in tools/f18/CMakeLists.txt.

awarzynski added inline comments.Sep 23 2021, 1:49 PM
flang/tools/f18/CMakeLists.txt
34

In LLVM Flang, -J is just an alias for -module-dir: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Options.td#L4589-L4592.

So, -J ${FLANG_INTRINSIC_MODULES_DIR} is identical to -module-dir ${FLANG_INTRINSIC_MODULES_DIR} and hence this change is not needed.

klausler marked an inline comment as done.Sep 23 2021, 1:52 PM
klausler added inline comments.
flang/tools/f18/CMakeLists.txt
34

Already removed in updated patch. But I'm not sure that equating -J with -module-dir is the right thing to do in the Arm driver. -J specifies a module search directory, while -module-dir specifies the single module output directory, yes?

Content of the patch LGTM, but beware that the -J/-module-dir error is still here (it looks like you may not have pushed the fix as intended, they are no changes between the two pahbricator patches).

awarzynski added inline comments.Sep 24 2021, 1:04 AM
flang/tools/f18/CMakeLists.txt
34

In LLVM Flang, -module-dir (as well as -J) specify module search directory _and_ module output directory. The semantics are consistent with gfortran. If you see different behavior then that's a bug.

New spelling (-module-dir) was suggested as a more accurate/descriptive alternative -J. See this e-mail and my reply that followed.

klausler updated this revision to Diff 374870.Sep 24 2021, 9:00 AM
klausler marked an inline comment as done.

Don't use both -module-dir and -J with flang-new (take 2)

klausler added inline comments.Sep 24 2021, 9:03 AM
flang/tools/f18/CMakeLists.txt
34

So how does one specify multiple module search directories, analogous to multiple -I header file search directories?

jeanPerier accepted this revision.Sep 24 2021, 9:52 AM
This revision is now accepted and ready to land.Sep 24 2021, 9:52 AM

Craig R.: any comments?

awarzynski added inline comments.Sep 27 2021, 3:28 AM
flang/tools/f18/CMakeLists.txt
34

Also with -I. From gfortran:

This path is also used to search for .mod files when previously compiled modules are required by a USE statement.

Craig R.: any comments?

Oh, you actually want me to comment on the change? I think you probably want me to use it. I need to take some time to digest the changes.

Craig R.: any comments?

Oh, you actually want me to comment on the change? I think you probably want me to use it. I need to take some time to digest the changes.

Would you like me to wait for your review comments before landing this patch?

Craig R.: any comments?

Oh, you actually want me to comment on the change? I think you probably want me to use it. I need to take some time to digest the changes.

Would you like me to wait for your review comments before landing this patch?

No please submit it. The changes look great.

This revision was landed with ongoing or failed builds.Sep 29 2021, 1:06 PM
This revision was automatically updated to reflect the committed changes.
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 29 2021, 1:06 PM