[flang] Make builtin types more easily accessible; use them
authorpeter klausler <pklausler@nvidia.com>
Tue, 21 Sep 2021 23:06:30 +0000 (16:06 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 29 Sep 2021 20:06:01 +0000 (13:06 -0700)
commit52711fb8da1b0151f09c41bce1a3f0b5689ff87a
tree68290a049fdfacf9f9e9007841411bad86424291
parent969359e3b86b6cd238bcb48cdaeb9be5dbeddb4b
[flang] Make builtin types more easily accessible; use them

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.

Differential Revision: https://reviews.llvm.org/D110356
21 files changed:
flang/include/flang/Evaluate/intrinsics.h
flang/include/flang/Evaluate/tools.h
flang/include/flang/Evaluate/variable.h
flang/include/flang/Semantics/semantics.h
flang/include/flang/Semantics/tools.h
flang/lib/Evaluate/intrinsics.cpp
flang/lib/Evaluate/tools.cpp
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/expression.cpp
flang/lib/Semantics/mod-file.cpp
flang/lib/Semantics/mod-file.h
flang/lib/Semantics/resolve-names.cpp
flang/lib/Semantics/runtime-type-info.cpp
flang/lib/Semantics/semantics.cpp
flang/lib/Semantics/tools.cpp
flang/module/__fortran_builtins.f90
flang/module/__fortran_type_info.f90
flang/test/Semantics/misc-declarations.f90
flang/test/Semantics/resolve88.f90
flang/test/Semantics/this_image.f90
flang/tools/f18/CMakeLists.txt