diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-09-05 18:05:24 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-09-05 18:06:06 +0200 |
commit | 938cda536019cd6a1bc0dd2346381185b420bbf8 (patch) | |
tree | 78f0c5604425d3e2db0576f1a35066187750ea2f /gcc/fortran/dump-parse-tree.cc | |
parent | b4d8a56a4c62ba8bca55469ae2b841fb4e1334a4 (diff) | |
download | gcc-938cda536019cd6a1bc0dd2346381185b420bbf8.zip gcc-938cda536019cd6a1bc0dd2346381185b420bbf8.tar.gz gcc-938cda536019cd6a1bc0dd2346381185b420bbf8.tar.bz2 |
Fortran/openmp: Partial OpenMP 5.2 doacross and omp_cur_iteration support
Add the Fortran support to the ME/C/C++ commit
r13-2388-ga651e6d59188da8992f8bfae2df1cb4e6316f9e6
gcc/fortran/ChangeLog:
* dump-parse-tree.cc (show_omp_namelist, show_omp_clauses): Handle
omp_cur_iteration and distinguish doacross/depend.
* gfortran.h (enum gfc_omp_depend_doacross_op): Renamed from
gfc_omp_depend_op.
(enum gfc_omp_depend_doacross_op): Add OMP_DOACROSS_SINK_FIRST,
Rename OMP_DEPEND_SINK to OMP_DOACROSS_SINK.
(gfc_omp_namelist) Handle renaming, rename depend_op to
depend_doacross_op.
(struct gfc_omp_clauses): Add doacross_source.
* openmp.cc (gfc_match_omp_depend_sink): Renamed to ...
(gfc_match_omp_doacross_sink): ... this; handle omp_all_memory.
(enum omp_mask2): Add OMP_CLAUSE_DOACROSS.
(gfc_match_omp_clauses): Handle 'doacross' and syntax changes to
depend.
(gfc_match_omp_depobj): Simplify as sink/source are now impossible.
(gfc_match_omp_ordered_depend): Request OMP_CLAUSE_DOACROSS.
(resolve_omp_clauses): Update sink/source checks.
(gfc_resolve_omp_directive): Resolve EXEC_OMP_ORDERED clauses.
* parse.cc (decode_omp_directive): Handle 'ordered doacross'.
* trans-openmp.cc (gfc_trans_omp_clauses): Handle doacross.
(gfc_trans_omp_do): Fix OMP_FOR_ORIG_DECLS handling if 'ordered'
clause is present.
(gfc_trans_omp_depobj): Update for member name change.
libgomp/ChangeLog:
* libgomp.texi (OpenMP 5.2): Update doacross/omp_cur_iteration status.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/all-memory-1.f90: Update dg-error.
* gfortran.dg/gomp/depend-iterator-2.f90: Likewise.
* gfortran.dg/gomp/depobj-2.f90: Likewise.
* gfortran.dg/gomp/doacross-5.f90: New test.
* gfortran.dg/gomp/doacross-6.f90: New test.
Diffstat (limited to 'gcc/fortran/dump-parse-tree.cc')
-rw-r--r-- | gcc/fortran/dump-parse-tree.cc | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc index 5352008..40c690c 100644 --- a/gcc/fortran/dump-parse-tree.cc +++ b/gcc/fortran/dump-parse-tree.cc @@ -1337,8 +1337,15 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n) if (n->u2.ns != ns_iter) { if (n != n2) - fputs (list_type == OMP_LIST_AFFINITY - ? ") AFFINITY(" : ") DEPEND(", dumpfile); + { + fputs (") ", dumpfile); + if (list_type == OMP_LIST_AFFINITY) + fputs ("AFFINITY (", dumpfile); + else if (n->u.depend_doacross_op == OMP_DOACROSS_SINK_FIRST) + fputs ("DOACROSS (", dumpfile); + else + fputs ("DEPEND (", dumpfile); + } if (n->u2.ns) { fputs ("ITERATOR(", dumpfile); @@ -1374,7 +1381,7 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n) default: break; } else if (list_type == OMP_LIST_DEPEND) - switch (n->u.depend_op) + switch (n->u.depend_doacross_op) { case OMP_DEPEND_IN: fputs ("in:", dumpfile); break; case OMP_DEPEND_OUT: fputs ("out:", dumpfile); break; @@ -1385,10 +1392,14 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n) fputs ("mutexinoutset:", dumpfile); break; case OMP_DEPEND_SINK_FIRST: + case OMP_DOACROSS_SINK_FIRST: fputs ("sink:", dumpfile); while (1) { - fprintf (dumpfile, "%s", n->sym->name); + if (!n->sym) + fputs ("omp_cur_iteration", dumpfile); + else + fprintf (dumpfile, "%s", n->sym->name); if (n->expr) { fputc ('+', dumpfile); @@ -1396,9 +1407,13 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n) } if (n->next == NULL) break; - else if (n->next->u.depend_op != OMP_DEPEND_SINK) + else if (n->next->u.depend_doacross_op != OMP_DOACROSS_SINK) { - fputs (") DEPEND(", dumpfile); + if (n->next->u.depend_doacross_op + == OMP_DOACROSS_SINK_FIRST) + fputs (") DOACROSS(", dumpfile); + else + fputs (") DEPEND(", dumpfile); break; } fputc (',', dumpfile); @@ -1674,7 +1689,14 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) case OMP_LIST_AFFINITY: type = "AFFINITY"; break; case OMP_LIST_ALIGNED: type = "ALIGNED"; break; case OMP_LIST_LINEAR: type = "LINEAR"; break; - case OMP_LIST_DEPEND: type = "DEPEND"; break; + case OMP_LIST_DEPEND: + if (omp_clauses->lists[list_type] + && (omp_clauses->lists[list_type]->u.depend_doacross_op + == OMP_DOACROSS_SINK_FIRST)) + type = "DOACROSS"; + else + type = "DEPEND"; + break; case OMP_LIST_MAP: type = "MAP"; break; case OMP_LIST_TO: type = "TO"; break; case OMP_LIST_FROM: type = "FROM"; break; @@ -1894,6 +1916,8 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) fputs (" DESTROY", dumpfile); if (omp_clauses->depend_source) fputs (" DEPEND(source)", dumpfile); + if (omp_clauses->doacross_source) + fputs (" DOACROSS(source:)", dumpfile); if (omp_clauses->capture) fputs (" CAPTURE", dumpfile); if (omp_clauses->depobj_update != OMP_DEPEND_UNSET) |