]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: C front-end support for dispatch + adjust_args
authorPaul-Antoine Arras <parras@baylibre.com>
Wed, 20 Nov 2024 14:28:57 +0000 (15:28 +0100)
committerPaul-Antoine Arras <parras@baylibre.com>
Wed, 20 Nov 2024 14:31:22 +0000 (15:31 +0100)
commitd7d8d9dae9f86df6ca5d03f0eb5d78898e6aa804
tree691b73f64f6ba1d1471ad61cad5bd30d560dfb1f
parent084ea8ad5845c9b69c1366fa6dfeaf1a6c5e423b
OpenMP: C front-end support for dispatch + adjust_args

This patch adds support to the C front-end to parse the `dispatch` construct and
the `adjust_args` clause. It also includes some common C/C++ bits for pragmas
and attributes.

Additional common C/C++ testcases are in a later patch in the series.

gcc/c-family/ChangeLog:

* c-attribs.cc (c_common_gnu_attributes): Add attribute for adjust_args
need_device_ptr.
* c-omp.cc (c_omp_directives): Uncomment dispatch.
* c-pragma.cc (omp_pragmas): Add dispatch.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_DISPATCH.
(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_NOCONTEXT and
PRAGMA_OMP_CLAUSE_NOVARIANTS.

gcc/c/ChangeLog:

* c-parser.cc (c_parser_omp_dispatch): New function.
(c_parser_omp_clause_name): Handle nocontext and novariants clauses.
(c_parser_omp_clause_novariants): New function.
(c_parser_omp_clause_nocontext): Likewise.
(c_parser_omp_all_clauses): Handle nocontext and novariants clauses.
(c_parser_omp_dispatch_body): New function adapted from
c_parser_expr_no_commas.
(OMP_DISPATCH_CLAUSE_MASK): Define.
(c_parser_omp_dispatch): New function.
(c_finish_omp_declare_variant): Parse adjust_args.
(c_parser_omp_construct): Handle PRAGMA_OMP_DISPATCH.
* c-typeck.cc (c_finish_omp_clauses): Handle OMP_CLAUSE_NOVARIANTS and
OMP_CLAUSE_NOCONTEXT.

gcc/testsuite/ChangeLog:

* gcc.dg/gomp/adjust-args-1.c: New test.
* gcc.dg/gomp/dispatch-1.c: New test.
* gcc.dg/gomp/dispatch-2.c: New test.
* gcc.dg/gomp/dispatch-3.c: New test.
* gcc.dg/gomp/dispatch-4.c: New test.
* gcc.dg/gomp/dispatch-5.c: New test.
12 files changed:
gcc/c-family/c-attribs.cc
gcc/c-family/c-omp.cc
gcc/c-family/c-pragma.cc
gcc/c-family/c-pragma.h
gcc/c/c-parser.cc
gcc/c/c-typeck.cc
gcc/testsuite/gcc.dg/gomp/adjust-args-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/dispatch-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/dispatch-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/dispatch-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/dispatch-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/dispatch-5.c [new file with mode: 0644]