]> 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:58 +0000 (15:28 +0100)
committerPaul-Antoine Arras <parras@baylibre.com>
Wed, 20 Nov 2024 14:31:22 +0000 (15:31 +0100)
commited49709acda4938f71ef2dfac68450be5429db3d
tree7abb2fae1a1cf7f5a6c0ba94cbfd4c5369fd5824
parentd7d8d9dae9f86df6ca5d03f0eb5d78898e6aa804
OpenMP: C++ front-end support for dispatch + adjust_args

This patch adds C++ support for the `dispatch` construct and the `adjust_args`
clause. It relies on the c-family bits comprised in the corresponding C front
end patch for pragmas and attributes.

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

gcc/cp/ChangeLog:

* decl.cc (omp_declare_variant_finalize_one): Set adjust_args
need_device_ptr attribute.
* parser.cc (cp_parser_direct_declarator): Update call to
cp_parser_late_return_type_opt.
(cp_parser_late_return_type_opt): Add 'tree parms' parameter. Update
call to cp_parser_late_parsing_omp_declare_simd.
(cp_parser_omp_clause_name): Handle nocontext and novariants clauses.
(cp_parser_omp_clause_novariants): New function.
(cp_parser_omp_clause_nocontext): Likewise.
(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_NOVARIANTS and
PRAGMA_OMP_CLAUSE_NOCONTEXT.
(cp_parser_omp_dispatch_body): New function, inspired from
cp_parser_assignment_expression and cp_parser_postfix_expression.
(OMP_DISPATCH_CLAUSE_MASK): Define.
(cp_parser_omp_dispatch): New function.
(cp_finish_omp_declare_variant): Add parameter. Handle adjust_args
clause.
(cp_parser_late_parsing_omp_declare_simd): Add parameter. Update calls
to cp_finish_omp_declare_variant and cp_finish_omp_declare_variant.
(cp_parser_omp_construct): Handle PRAGMA_OMP_DISPATCH.
(cp_parser_pragma): Likewise.
* semantics.cc (finish_omp_clauses): Handle OMP_CLAUSE_NOCONTEXT and
OMP_CLAUSE_NOVARIANTS.
* pt.cc (tsubst_omp_clauses): Handle OMP_CLAUSE_NOCONTEXT and
OMP_CLAUSE_NOVARIANTS.
(tsubst_stmt): Handle OMP_DISPATCH.
(tsubst_expr): Handle IFN_GOMP_DISPATCH.

gcc/testsuite/ChangeLog:

* g++.dg/gomp/adjust-args-1.C: New test.
* g++.dg/gomp/adjust-args-2.C: New test.
* g++.dg/gomp/adjust-args-3.C: New test.
* g++.dg/gomp/dispatch-1.C: New test.
* g++.dg/gomp/dispatch-2.C: New test.
* g++.dg/gomp/dispatch-3.C: New test.
* g++.dg/gomp/dispatch-4.C: New test.
* g++.dg/gomp/dispatch-5.C: New test.
* g++.dg/gomp/dispatch-6.C: New test.
* g++.dg/gomp/dispatch-7.C: New test.
14 files changed:
gcc/cp/decl.cc
gcc/cp/parser.cc
gcc/cp/pt.cc
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/gomp/adjust-args-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/adjust-args-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/adjust-args-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/dispatch-7.C [new file with mode: 0644]