aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-general.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
commite252b51ccde010cbd2a146485d8045103cd99533 (patch)
treee060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/omp-general.c
parentf10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff)
parent104c05c5284b7822d770ee51a7d91946c7e56d50 (diff)
downloadgcc-e252b51ccde010cbd2a146485d8045103cd99533.zip
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/omp-general.c')
-rw-r--r--gcc/omp-general.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index fa6de01..cc6aecb 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -79,10 +79,11 @@ omp_check_optional_argument (tree decl, bool for_present_check)
return lang_hooks.decls.omp_check_optional_argument (decl, for_present_check);
}
-/* Return true if DECL is a reference type. */
+/* True if OpenMP should privatize what this DECL points to rather
+ than the DECL itself. */
bool
-omp_is_reference (tree decl)
+omp_privatize_by_reference (tree decl)
{
return lang_hooks.decls.omp_privatize_by_reference (decl);
}
@@ -968,7 +969,7 @@ omp_max_simt_vf (void)
if (ENABLE_OFFLOADING)
for (const char *c = getenv ("OFFLOAD_TARGET_NAMES"); c;)
{
- if (!strncmp (c, "nvptx", strlen ("nvptx")))
+ if (startswith (c, "nvptx"))
return 32;
else if ((c = strchr (c, ':')))
c++;
@@ -2576,6 +2577,7 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
const char *routine_str)
{
tree c_level = NULL_TREE;
+ tree c_nohost = NULL_TREE;
tree c_p = NULL_TREE;
for (tree c = *clauses; c; c_p = c, c = OMP_CLAUSE_CHAIN (c))
switch (OMP_CLAUSE_CODE (c))
@@ -2608,6 +2610,10 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
c = c_p;
}
break;
+ case OMP_CLAUSE_NOHOST:
+ /* Don't worry about duplicate clauses here. */
+ c_nohost = c;
+ break;
default:
gcc_unreachable ();
}
@@ -2642,6 +2648,7 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
this one for compatibility. */
/* Collect previous directive's clauses. */
tree c_level_p = NULL_TREE;
+ tree c_nohost_p = NULL_TREE;
for (tree c = TREE_VALUE (attr); c; c = OMP_CLAUSE_CHAIN (c))
switch (OMP_CLAUSE_CODE (c))
{
@@ -2652,6 +2659,10 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
gcc_checking_assert (c_level_p == NULL_TREE);
c_level_p = c;
break;
+ case OMP_CLAUSE_NOHOST:
+ gcc_checking_assert (c_nohost_p == NULL_TREE);
+ c_nohost_p = c;
+ break;
default:
gcc_unreachable ();
}
@@ -2667,6 +2678,13 @@ oacc_verify_routine_clauses (tree fndecl, tree *clauses, location_t loc,
c_diag_p = c_level_p;
goto incompatible;
}
+ /* Matching 'nohost' clauses? */
+ if ((c_nohost == NULL_TREE) != (c_nohost_p == NULL_TREE))
+ {
+ c_diag = c_nohost;
+ c_diag_p = c_nohost_p;
+ goto incompatible;
+ }
/* Compatible. */
return 1;