aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-low.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2015-10-21 16:14:01 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2015-10-21 16:14:01 +0000
commit68d58afb65a42cb7886552a1532fc11dc06eaed4 (patch)
tree22ecc181739aaf3a10d2ee54152d87daabb76014 /gcc/omp-low.c
parent9f47c7e5cf3f69d34ad09c97a729649d18dfb3a6 (diff)
downloadgcc-68d58afb65a42cb7886552a1532fc11dc06eaed4.zip
gcc-68d58afb65a42cb7886552a1532fc11dc06eaed4.tar.gz
gcc-68d58afb65a42cb7886552a1532fc11dc06eaed4.tar.bz2
omp-low.c (check_omp_nesting_restrictions): Check OpenACC loop nesting.
gcc/ * omp-low.c (check_omp_nesting_restrictions): Check OpenACC loop nesting. testsuite/ * c-c++-common/goacc/clauses-fail.c: Adjust errors. * c-c++-common/goacc/sb-1.c: Adjust errors. * c-c++-common/goacc/sb-3.c: Adjust errors. * c-c++-common/goacc/loop-1.c: Adjust errors. * c-c++-common/goacc/nesting-1.c: Adjust errors. * c-c++-common/goacc-gomp/nesting-fail-1.c: Adjust errors. * c-c++-common/goacc-gomp/nesting-1.c: Adjust errors. From-SVN: r229129
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r--gcc/omp-low.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index b71609b7..ad7c017 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -3178,6 +3178,43 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx)
/* We split taskloop into task and nested taskloop in it. */
if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_TASKLOOP)
return true;
+ if (gimple_omp_for_kind (stmt) == GF_OMP_FOR_KIND_OACC_LOOP)
+ {
+ bool ok = false;
+
+ if (ctx)
+ switch (gimple_code (ctx->stmt))
+ {
+ case GIMPLE_OMP_FOR:
+ ok = (gimple_omp_for_kind (ctx->stmt)
+ == GF_OMP_FOR_KIND_OACC_LOOP);
+ break;
+
+ case GIMPLE_OMP_TARGET:
+ switch (gimple_omp_target_kind (ctx->stmt))
+ {
+ case GF_OMP_TARGET_KIND_OACC_PARALLEL:
+ case GF_OMP_TARGET_KIND_OACC_KERNELS:
+ ok = true;
+ break;
+
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+ else if (get_oacc_fn_attrib (current_function_decl))
+ ok = true;
+ if (!ok)
+ {
+ error_at (gimple_location (stmt),
+ "OpenACC loop directive must be associated with"
+ " an OpenACC compute region");
+ return false;
+ }
+ }
/* FALLTHRU */
case GIMPLE_CALL:
if (is_gimple_call (stmt)