diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-05-14 09:48:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-05-14 09:48:32 +0200 |
commit | 49ddde69fc8e1e4c48d4b0027ea37ac862da0f1f (patch) | |
tree | 5cb3ecbf1dbf9cc8e8e3b975b3f83a959e3353de /gcc/fortran/trans-openmp.c | |
parent | 42ef8a5e662a765dc794a7a5c0227bcd83556e44 (diff) | |
download | gcc-49ddde69fc8e1e4c48d4b0027ea37ac862da0f1f.zip gcc-49ddde69fc8e1e4c48d4b0027ea37ac862da0f1f.tar.gz gcc-49ddde69fc8e1e4c48d4b0027ea37ac862da0f1f.tar.bz2 |
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/fortran/trans-openmp.c')
-rw-r--r-- | gcc/fortran/trans-openmp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 8cf851e..e27ce41 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #undef GCC_DIAG_STYLE #define GCC_DIAG_STYLE __gcc_gfc__ #include "attribs.h" +#include "function.h" int ompws_flags; @@ -5392,6 +5393,7 @@ gfc_trans_omp_target (gfc_code *code) omp_clauses); if (code->op != EXEC_OMP_TARGET) OMP_TARGET_COMBINED (stmt) = 1; + cfun->has_omp_target = true; } gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); |