aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-07-01 17:52:03 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-07-01 17:52:03 +0200
commit9a668532fb19e7c57aa595a26ce3f0d95f9cbb1b (patch)
treeb127b7654ff9265f677a85bfc921e47aaf605c78 /gcc/cp
parentf843bea4ca5613cb713f8b9313daa3938f254a05 (diff)
downloadgcc-9a668532fb19e7c57aa595a26ce3f0d95f9cbb1b.zip
gcc-9a668532fb19e7c57aa595a26ce3f0d95f9cbb1b.tar.gz
gcc-9a668532fb19e7c57aa595a26ce3f0d95f9cbb1b.tar.bz2
OpenMP: Handle tofrom with target enter/exit data
In 5.2, a map clause can be map-entering or map-exiting, either containing 'tofrom'. The main reason for this is permit 'map(x)' with 'omp target enter/exit data', avoiding to specify 'to:/from:' explicitly. (OpenMP defaults to 'tofrom'.) gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Accept tofrom map-type modifier but use 'to' / 'from' internally. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): Accept tofrom map-type modifier but use 'to' / 'from' internally. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_namelist): For the map-type, also handle the always modifer and release/delete. * openmp.cc (resolve_omp_clauses): Accept tofrom map-type modifier for target enter/exit data, but use 'to' / 'from' internally. libgomp/ChangeLog: * libgomp.texi (OpenMP 5.2): Mark target enter/exit data with fromto as implemented. gcc/testsuite/ChangeLog: * c-c++-common/gomp/target-data-2.c: New test. * c-c++-common/gomp/target-data-3.c: New test. * gfortran.dg/gomp/target-data-1.f90: New test. * gfortran.dg/gomp/target-data-2.f90: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/parser.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index c5d1f9d..212ed14 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -44445,6 +44445,14 @@ cp_parser_omp_target_enter_data (cp_parser *parser, cp_token *pragma_tok,
case GOMP_MAP_ALLOC:
map_seen = 3;
break;
+ case GOMP_MAP_TOFROM:
+ OMP_CLAUSE_SET_MAP_KIND (*pc, GOMP_MAP_TO);
+ map_seen = 3;
+ break;
+ case GOMP_MAP_ALWAYS_TOFROM:
+ OMP_CLAUSE_SET_MAP_KIND (*pc, GOMP_MAP_ALWAYS_TO);
+ map_seen = 3;
+ break;
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
@@ -44454,7 +44462,7 @@ cp_parser_omp_target_enter_data (cp_parser *parser, cp_token *pragma_tok,
map_seen |= 1;
error_at (OMP_CLAUSE_LOCATION (*pc),
"%<#pragma omp target enter data%> with map-type other "
- "than %<to%> or %<alloc%> on %<map%> clause");
+ "than %<to%>, %<tofrom%> or %<alloc%> on %<map%> clause");
*pc = OMP_CLAUSE_CHAIN (*pc);
continue;
}
@@ -44537,6 +44545,14 @@ cp_parser_omp_target_exit_data (cp_parser *parser, cp_token *pragma_tok,
case GOMP_MAP_DELETE:
map_seen = 3;
break;
+ case GOMP_MAP_TOFROM:
+ OMP_CLAUSE_SET_MAP_KIND (*pc, GOMP_MAP_FROM);
+ map_seen = 3;
+ break;
+ case GOMP_MAP_ALWAYS_TOFROM:
+ OMP_CLAUSE_SET_MAP_KIND (*pc, GOMP_MAP_ALWAYS_FROM);
+ map_seen = 3;
+ break;
case GOMP_MAP_FIRSTPRIVATE_POINTER:
case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
case GOMP_MAP_ALWAYS_POINTER:
@@ -44546,8 +44562,8 @@ cp_parser_omp_target_exit_data (cp_parser *parser, cp_token *pragma_tok,
map_seen |= 1;
error_at (OMP_CLAUSE_LOCATION (*pc),
"%<#pragma omp target exit data%> with map-type other "
- "than %<from%>, %<release%> or %<delete%> on %<map%>"
- " clause");
+ "than %<from%>, %<tofrom%>, %<release%> or %<delete%> "
+ "on %<map%> clause");
*pc = OMP_CLAUSE_CHAIN (*pc);
continue;
}