diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-05-14 09:48:32 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:03:19 -0300 |
commit | 108613c42094df5bd590589733883e4305f8b8a5 (patch) | |
tree | b73991888bd6515d0b0688fbdc821a5ab48322df /gcc/c | |
parent | 6de85bc98a6070c58485db2ff2696cba72138730 (diff) | |
download | gcc-108613c42094df5bd590589733883e4305f8b8a5.tar.gz |
openmp: Also implicitly mark as declare target to functions mentioned in target regions
OpenMP 5.0 also specifies that functions referenced from target regions
(except for target regions with device(ancestor:)) are also implicitly declare target to.
This patch implements that.
2020-05-14 Jakub Jelinek <jakub@redhat.com>
* function.h (struct function): Add has_omp_target bit.
* omp-offload.c (omp_discover_declare_target_fn_r): New function,
old renamed to ...
(omp_discover_declare_target_tgt_fn_r): ... this.
(omp_discover_declare_target_var_r): Call
omp_discover_declare_target_tgt_fn_r instead of
omp_discover_declare_target_fn_r.
(omp_discover_implicit_declare_target): Also queue functions with
has_omp_target bit set, for those walk with
omp_discover_declare_target_fn_r, for declare target to functions
walk with omp_discover_declare_target_tgt_fn_r.
gcc/c/
* c-parser.c (c_parser_omp_target): Set cfun->has_omp_target.
gcc/cp/
* cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
gcc/fortran/
* trans-openmp.c: Include function.h.
(gfc_trans_omp_target): Set cfun->has_omp_target.
libgomp/
* testsuite/libgomp.c-c++-common/target-40.c: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7cf774ed171..9ae494a45e7 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2020-05-14 Jakub Jelinek <jakub@redhat.com> + + * c-parser.c (c_parser_omp_target): Set cfun->has_omp_target. + 2020-05-07 Richard Biener <rguenther@suse.de> PR middle-end/94703 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index ae354e6af66..5c8502bcceb 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -19866,6 +19866,7 @@ check_clauses: } pc = &OMP_CLAUSE_CHAIN (*pc); } + cfun->has_omp_target = true; return true; } |