Fortran: Add 'device_type' clause to OpenMP's declare target
authorTobias Burnus <tobias@codesourcery.com>
Wed, 26 Aug 2020 07:32:40 +0000 (09:32 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 26 Aug 2020 07:32:40 +0000 (09:32 +0200)
commitd58e7173ef964ddac3ab3ad8cc97de8f9f3b32ee
tree4554d34bd8b9a0bfc30b1db3dd075f9c09dda41e
parent4797a61cc5024fc9adf5918e9bb2b78988f9e4d4
Fortran: Add 'device_type' clause to OpenMP's declare target

gcc/fortran/ChangeLog:

* gfortran.h (enum gfc_omp_device_type): New.
(symbol_attribute, gfc_omp_clauses, gfc_common_head): Use it.
* module.c (enum ab_attribute): Add AB_OMP_DEVICE_TYPE_HOST,
AB_OMP_DEVICE_TYPE_NOHOST and AB_OMP_DEVICE_TYPE_ANY.
(attr_bits, mio_symbol_attribute): Handle it.
(load_commons, write_common_0): Handle omp_device_type flag.
* openmp.c (enum omp_mask1): Add OMP_CLAUSE_DEVICE_TYPE
(OMP_DECLARE_TARGET_CLAUSES): Likewise.
(gfc_match_omp_clauses): Match 'device_type'.
(gfc_match_omp_declare_target): Handle it.
* trans-common.c (build_common_decl): Write device-type clause.
* trans-decl.c (add_attributes_to_decl): Likewise.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/declare-target-4.f90: New test.
* gfortran.dg/gomp/declare-target-5.f90: New test.
gcc/fortran/gfortran.h
gcc/fortran/module.c
gcc/fortran/openmp.c
gcc/fortran/trans-common.c
gcc/fortran/trans-decl.c
gcc/testsuite/gfortran.dg/gomp/declare-target-4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/declare-target-5.f90 [new file with mode: 0644]