Skip to content
Snippets Groups Projects
Commit ed49709a authored by Paul-Antoine Arras's avatar Paul-Antoine Arras
Browse files

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.
parent d7d8d9da
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment