diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2020-01-10 23:23:44 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2020-01-10 23:23:44 +0100 |
commit | b3b75e664a619dae98571a0b3ac8034f5fa7c2be (patch) | |
tree | c557ed2e8d6ac3cf602df662f0fb8d72c3b56888 /gcc/gimplify.c | |
parent | 68be73fc42b969d8d595aeda98e3ea962a7a9ed5 (diff) | |
download | gcc-b3b75e664a619dae98571a0b3ac8034f5fa7c2be.zip gcc-b3b75e664a619dae98571a0b3ac8034f5fa7c2be.tar.gz gcc-b3b75e664a619dae98571a0b3ac8034f5fa7c2be.tar.bz2 |
Further changes for the OpenACC 'if_present' clause on the 'host_data' construct
gcc/
* tree.h (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT): New definition.
* tree-core.h: Document it.
* gimplify.c (gimplify_omp_workshare): Set it.
* omp-low.c (lower_omp_target): Use it.
* tree-pretty-print.c (dump_omp_clause): Print it.
gcc/testsuite/
* c-c++-common/goacc/host_data-1.c: Extend.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
gcc/
* omp-low.c (lower_omp_target) <OMP_CLAUSE_USE_DEVICE_PTR etc.>:
Assert that for OpenACC we always have 'GOMP_MAP_USE_DEVICE_PTR'.
libgomp/
* target.c (gomp_map_vars_internal)
<GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT>: Clean up/elaborate code
paths.
From-SVN: r280149
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 00d264f..fe7236d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -12802,14 +12802,21 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p) stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_DATA, OMP_CLAUSES (expr)); break; - case OACC_KERNELS: - stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_KERNELS, - OMP_CLAUSES (expr)); - break; case OACC_HOST_DATA: + if (omp_find_clause (OMP_CLAUSES (expr), OMP_CLAUSE_IF_PRESENT)) + { + for (tree c = OMP_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_USE_DEVICE_PTR) + OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (c) = 1; + } + stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_HOST_DATA, OMP_CLAUSES (expr)); break; + case OACC_KERNELS: + stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_KERNELS, + OMP_CLAUSES (expr)); + break; case OACC_PARALLEL: stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_PARALLEL, OMP_CLAUSES (expr)); |