diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2020-10-28 11:43:49 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2020-11-13 22:58:57 +0100 |
commit | 703e4f86496214e4915db898397fcd0ae1d955e0 (patch) | |
tree | 58559da48f84a9a4328c83efd091b98c251c6da3 /gcc/omp-expand.c | |
parent | d1ba078d9bcc3457d36ba12695cfef29eb3ca942 (diff) | |
download | gcc-703e4f86496214e4915db898397fcd0ae1d955e0.zip gcc-703e4f86496214e4915db898397fcd0ae1d955e0.tar.gz gcc-703e4f86496214e4915db898397fcd0ae1d955e0.tar.bz2 |
Attach an attribute to all outlined OpenACC compute regions
This allows for making some things more explicit, later on.
gcc/
* omp-expand.c (expand_omp_target): Attach an attribute to all
outlined OpenACC compute regions.
* omp-offload.c (execute_oacc_device_lower): Adjust.
gcc/testsuite/
* c-c++-common/goacc/classify-parallel.c: Adjust.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* c-c++-common/goacc/classify-serial.c: New.
* gfortran.dg/goacc/classify-serial.f95: Likewise.
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r-- | gcc/omp-expand.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index ddca3d3..c6ee3eb 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -9284,27 +9284,33 @@ expand_omp_target (struct omp_region *region) entry_bb = region->entry; exit_bb = region->exit; + if (target_kind == GF_OMP_TARGET_KIND_OACC_KERNELS) + mark_loops_in_oacc_kernels_region (region->entry, region->exit); + + /* Going on, all OpenACC compute constructs are mapped to + 'BUILT_IN_GOACC_PARALLEL', and get their compute regions outlined. + To distinguish between them, we attach attributes. */ switch (target_kind) { + case GF_OMP_TARGET_KIND_OACC_PARALLEL: + DECL_ATTRIBUTES (child_fn) + = tree_cons (get_identifier ("oacc parallel"), + NULL_TREE, DECL_ATTRIBUTES (child_fn)); + break; case GF_OMP_TARGET_KIND_OACC_KERNELS: - mark_loops_in_oacc_kernels_region (region->entry, region->exit); - - /* Further down, all OpenACC compute constructs will be mapped to - BUILT_IN_GOACC_PARALLEL, and to distinguish between them, there - is an "oacc kernels" attribute set for OpenACC kernels. */ DECL_ATTRIBUTES (child_fn) = tree_cons (get_identifier ("oacc kernels"), NULL_TREE, DECL_ATTRIBUTES (child_fn)); break; case GF_OMP_TARGET_KIND_OACC_SERIAL: - /* Further down, all OpenACC compute constructs will be mapped to - BUILT_IN_GOACC_PARALLEL, and to distinguish between them, there - is an "oacc serial" attribute set for OpenACC serial. */ DECL_ATTRIBUTES (child_fn) = tree_cons (get_identifier ("oacc serial"), NULL_TREE, DECL_ATTRIBUTES (child_fn)); break; default: + /* Make sure we don't miss any. */ + gcc_checking_assert (!(is_gimple_omp_oacc (entry_stmt) + && is_gimple_omp_offloaded (entry_stmt))); break; } |