aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/openmp.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2019-10-02 10:57:54 +0000
committerTobias Burnus <burnus@gcc.gnu.org>2019-10-02 12:57:54 +0200
commitef4add8e543091083b1a30350b653968e7c58ab2 (patch)
tree025615ae48c75d5713717f7c8b914b2c628cbc4b /gcc/fortran/openmp.c
parentfc1a202ca60def4894f2deeda8ae184527ee897e (diff)
downloadgcc-ef4add8e543091083b1a30350b653968e7c58ab2.zip
gcc-ef4add8e543091083b1a30350b653968e7c58ab2.tar.gz
gcc-ef4add8e543091083b1a30350b653968e7c58ab2.tar.bz2
Support OpenMP's use_device_addr in Fortran
gcc/fortran/ * dump-parse-tree.c (show_omp_clauses): Handle OMP_LIST_USE_DEVICE_ADDR. * gfortran.h (enum): Add OMP_LIST_USE_DEVICE_ADDR. * openmp.c (omp_mask1): Likewise. (gfc_match_omp_clauses): Match 'use_device_addr'. (OMP_TARGET_DATA_CLAUSES): Add OMP_LIST_USE_DEVICE_ADDR. (resolve_omp_clauses): Add it; add is_device_ptr checks. gcc/testsuite/ * gfortran.dg/gomp/is_device_ptr-1.f90: New. From-SVN: r276449
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r--gcc/fortran/openmp.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 2beac3d..7df7384 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -780,6 +780,7 @@ enum omp_mask1
OMP_CLAUSE_SIMD,
OMP_CLAUSE_THREADS,
OMP_CLAUSE_USE_DEVICE_PTR,
+ OMP_CLAUSE_USE_DEVICE_ADDR, /* Actually, OpenMP 5.0. */
OMP_CLAUSE_NOWAIT,
/* This must come last. */
OMP_MASK1_LAST
@@ -1849,6 +1850,11 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
("use_device_ptr (",
&c->lists[OMP_LIST_USE_DEVICE_PTR], false) == MATCH_YES)
continue;
+ if ((mask & OMP_CLAUSE_USE_DEVICE_ADDR)
+ && gfc_match_omp_variable_list
+ ("use_device_addr (",
+ &c->lists[OMP_LIST_USE_DEVICE_ADDR], false) == MATCH_YES)
+ continue;
break;
case 'v':
/* VECTOR_LENGTH must be matched before VECTOR, because the latter
@@ -2479,7 +2485,7 @@ cleanup:
| OMP_CLAUSE_IS_DEVICE_PTR)
#define OMP_TARGET_DATA_CLAUSES \
(omp_mask (OMP_CLAUSE_DEVICE) | OMP_CLAUSE_MAP | OMP_CLAUSE_IF \
- | OMP_CLAUSE_USE_DEVICE_PTR)
+ | OMP_CLAUSE_USE_DEVICE_PTR | OMP_CLAUSE_USE_DEVICE_ADDR)
#define OMP_TARGET_ENTER_DATA_CLAUSES \
(omp_mask (OMP_CLAUSE_DEVICE) | OMP_CLAUSE_MAP | OMP_CLAUSE_IF \
| OMP_CLAUSE_DEPEND | OMP_CLAUSE_NOWAIT)
@@ -4008,7 +4014,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
= { "PRIVATE", "FIRSTPRIVATE", "LASTPRIVATE", "COPYPRIVATE", "SHARED",
"COPYIN", "UNIFORM", "ALIGNED", "LINEAR", "DEPEND", "MAP",
"TO", "FROM", "REDUCTION", "DEVICE_RESIDENT", "LINK", "USE_DEVICE",
- "CACHE", "IS_DEVICE_PTR", "USE_DEVICE_PTR" };
+ "CACHE", "IS_DEVICE_PTR", "USE_DEVICE_PTR", "USE_DEVICE_ADDR" };
if (omp_clauses == NULL)
return;
@@ -4565,8 +4571,26 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
}
break;
case OMP_LIST_IS_DEVICE_PTR:
+ if (!n->sym->attr.dummy)
+ gfc_error ("Non-dummy object %qs in %s clause at %L",
+ n->sym->name, name, &n->where);
+ if (n->sym->attr.allocatable
+ || (n->sym->ts.type == BT_CLASS
+ && CLASS_DATA (n->sym)->attr.allocatable))
+ gfc_error ("ALLOCATABLE object %qs in %s clause at %L",
+ n->sym->name, name, &n->where);
+ if (n->sym->attr.pointer
+ || (n->sym->ts.type == BT_CLASS
+ && CLASS_DATA (n->sym)->attr.pointer))
+ gfc_error ("POINTER object %qs in %s clause at %L",
+ n->sym->name, name, &n->where);
+ if (n->sym->attr.value)
+ gfc_error ("VALUE object %qs in %s clause at %L",
+ n->sym->name, name, &n->where);
+ break;
case OMP_LIST_USE_DEVICE_PTR:
- /* FIXME: Handle these. */
+ case OMP_LIST_USE_DEVICE_ADDR:
+ /* FIXME: Handle OMP_LIST_USE_DEVICE_PTR. */
break;
default:
for (; n != NULL; n = n->next)