]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Add OpenMP 'interop' directive parsing support
authorTobias Burnus <tburnus@baylibre.com>
Fri, 6 Sep 2024 09:45:46 +0000 (11:45 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Fri, 6 Sep 2024 09:45:46 +0000 (11:45 +0200)
commit4ce9e0a579fcd216c1a3439525201473402a895d
tree03fc6e67087b6d888e5c9c262b9e2aa471d0139d
parentd34cda720988674bcf8a24267c9e1ec61335d6de
Fortran: Add OpenMP 'interop' directive parsing support

Parse OpenMP's 'interop' directive but stop with a 'sorry, unimplemented'
after resolving.

Additionally, it moves some clause dumping away from the end directive as
that lead to 'nowait' not being printed when it should as some cases were
missed.

gcc/fortran/ChangeLog:

* dump-parse-tree.cc (show_omp_namelist): Handle OMP_LIST_INIT.
(show_omp_clauses): Handle OMP_LIST_{INIT,USE,DESTORY}; move 'nowait'
from end-directive to the directive dump.
(show_omp_node, show_code_node): Handle EXEC_OMP_INTEROP.
* gfortran.h (enum gfc_statement): Add ST_OMP_INTEROP.
(OMP_LIST_INIT, OMP_LIST_USE, OMP_LIST_DESTROY): Add.
(enum gfc_exec_op): Add EXEC_OMP_INTEROP.
(struct gfc_omp_namelist): Add interop items to union.
(gfc_free_omp_namelist): Add boolean arg.
* match.cc (gfc_free_omp_namelist): Update to free
interop union members.
* match.h (gfc_match_omp_interop): New.
* openmp.cc (gfc_omp_directives): Uncomment 'interop' entry.
(gfc_free_omp_clauses, gfc_match_omp_allocate,
gfc_match_omp_flush, gfc_match_omp_clause_reduction): Update
call.
(enum omp_mask2): Add OMP_CLAUSE_{INIT,USE,DESTROY}.
(OMP_INTEROP_CLAUSES): Use it.
(gfc_match_omp_clauses): Match those clauses.
(gfc_match_omp_prefer_type, gfc_match_omp_init,
gfc_match_omp_interop): New.
(resolve_omp_clauses): Handle interop clauses.
(omp_code_to_statement): Add ST_OMP_INTEROP.
(gfc_resolve_omp_directive): Add EXEC_OMP_INTEROP.
* parse.cc (decode_omp_directive): Parse 'interop' directive.
(next_statement, gfc_ascii_statement): Handle ST_OMP_INTEROP.
* st.cc (gfc_free_statement): Likewise
* resolve.cc (gfc_resolve_code): Handle EXEC_OMP_INTEROP.
* trans.cc (trans_code): Likewise.
* trans-openmp.cc (gfc_trans_omp_directive): Print 'sorry'
for EXEC_OMP_INTEROP.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/interop-1.f90: New test.
* gfortran.dg/gomp/interop-2.f90: New test.
* gfortran.dg/gomp/interop-3.f90: New test.
13 files changed:
gcc/fortran/dump-parse-tree.cc
gcc/fortran/gfortran.h
gcc/fortran/match.cc
gcc/fortran/match.h
gcc/fortran/openmp.cc
gcc/fortran/parse.cc
gcc/fortran/resolve.cc
gcc/fortran/st.cc
gcc/fortran/trans-openmp.cc
gcc/fortran/trans.cc
gcc/testsuite/gfortran.dg/gomp/interop-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/interop-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/interop-3.f90 [new file with mode: 0644]