gcc/include
Chung-Lin Tang 0ab29cf0bb openmp: Improve OpenMP target support for C++ (PR92120)
This patch implements several C++ specific mapping capabilities introduced for
OpenMP 5.0, including implicit mapping of this[:1] for non-static member
functions, zero-length array section mapping of pointer-typed members,
lambda captured variable access in target regions, and use of lambda objects
inside target regions.

Several adjustments to the C/C++ front-ends to allow more member-access syntax
as valid is also included.

	PR middle-end/92120

gcc/cp/ChangeLog:

	* cp-tree.h (finish_omp_target): New declaration.
	(finish_omp_target_clauses): Likewise.
	* parser.c (cp_parser_omp_clause_map): Adjust call to
	cp_parser_omp_var_list_no_open to set 'allow_deref' argument to true.
	(cp_parser_omp_target): Factor out code, adjust into calls to new
	function finish_omp_target.
	* pt.c (tsubst_expr): Add call to finish_omp_target_clauses for
	OMP_TARGET case.
	* semantics.c (handle_omp_array_sections_1): Add handling to create
	'this->member' from 'member' FIELD_DECL. Remove case of rejecting
	'this' when not in declare simd.
	(handle_omp_array_sections): Likewise.
	(finish_omp_clauses): Likewise. Adjust to allow 'this[]' in OpenMP
	map clauses. Handle 'A->member' case in map clauses. Remove case of
	rejecting 'this' when not in declare simd.
	(struct omp_target_walk_data): New struct for walking over
	target-directive tree body.
	(finish_omp_target_clauses_r): New function for tree walk.
	(finish_omp_target_clauses): New function.
	(finish_omp_target): New function.

gcc/c/ChangeLog:

	* c-parser.c (c_parser_omp_clause_map): Set 'allow_deref' argument in
	call to c_parser_omp_variable_list to 'true'.
	* c-typeck.c (handle_omp_array_sections_1): Add strip of MEM_REF in
	array base handling.
	(c_finish_omp_clauses): Handle 'A->member' case in map clauses.

gcc/ChangeLog:

	* gimplify.c ("tree-hash-traits.h"): Add include.
	(gimplify_scan_omp_clauses): Change struct_map_to_clause to type
	hash_map<tree_operand, tree> *. Adjust struct map handling to handle
	cases of *A and A->B expressions. Under !DECL_P case of
	GOMP_CLAUSE_MAP handling, add STRIP_NOPS for indir_p case, add to
	struct_deref_set for map(*ptr_to_struct) cases. Add MEM_REF case when
	handling component_ref_p case. Add unshare_expr and gimplification
	when created GOMP_MAP_STRUCT is not a DECL. Add code to add
	firstprivate pointer for *pointer-to-struct case.
	(gimplify_adjust_omp_clauses): Move GOMP_MAP_STRUCT removal code for
	exit data directives code to earlier position.
	* omp-low.c (lower_omp_target):
	Handle GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION map kinds.
	* tree-pretty-print.c (dump_omp_clause): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/gomp/target-3.c: New testcase.
	* g++.dg/gomp/target-3.C: New testcase.
	* g++.dg/gomp/target-lambda-1.C: New testcase.
	* g++.dg/gomp/target-lambda-2.C: New testcase.
	* g++.dg/gomp/target-this-1.C: New testcase.
	* g++.dg/gomp/target-this-2.C: New testcase.
	* g++.dg/gomp/target-this-3.C: New testcase.
	* g++.dg/gomp/target-this-4.C: New testcase.
	* g++.dg/gomp/target-this-5.C: New testcase.
	* g++.dg/gomp/this-2.C: Adjust testcase.

include/ChangeLog:

	* gomp-constants.h (enum gomp_map_kind):
	Add GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION map kinds.
	(GOMP_MAP_POINTER_P):
	Include GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION.

libgomp/ChangeLog:

	* libgomp.h (gomp_attach_pointer): Add bool parameter.
	* oacc-mem.c (acc_attach_async): Update call to gomp_attach_pointer.
	(goacc_enter_data_internal): Likewise.
	* target.c (gomp_map_vars_existing): Update assert condition to
	include GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION.
	(gomp_map_pointer): Add 'bool allow_zero_length_array_sections'
	parameter, add support for mapping a pointer with NULL target.
	(gomp_attach_pointer): Add 'bool allow_zero_length_array_sections'
	parameter, add support for attaching a pointer with NULL target.
	(gomp_map_vars_internal): Update calls to gomp_map_pointer and
	gomp_attach_pointer, add handling for
	GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION cases.
	* testsuite/libgomp.c++/target-23.C: New testcase.
	* testsuite/libgomp.c++/target-lambda-1.C: New testcase.
	* testsuite/libgomp.c++/target-lambda-2.C: New testcase.
	* testsuite/libgomp.c++/target-this-1.C: New testcase.
	* testsuite/libgomp.c++/target-this-2.C: New testcase.
	* testsuite/libgomp.c++/target-this-3.C: New testcase.
	* testsuite/libgomp.c++/target-this-4.C: New testcase.
	* testsuite/libgomp.c++/target-this-5.C: New testcase.
2021-12-08 22:29:06 +08:00
..
gdb Update copyright years. 2021-01-04 10:26:59 +01:00
ansidecl.h include: Fix -Wundef warnings in ansidecl.h 2021-07-24 12:51:00 -04:00
btf.h BTF: Support for BTF_KIND_FLOAT 2021-07-02 08:32:44 -07:00
ChangeLog Daily bump. 2021-11-13 00:16:39 +00:00
ChangeLog-9103
ChangeLog.jit
COPYING
COPYING3
ctf.h CTF/BTF debug formats 2021-06-28 18:47:20 +02:00
demangle.h c++: Adjust mangling of __alignof__ [PR88115] 2021-03-30 22:57:11 -04:00
dwarf2.def Update copyright years. 2021-01-04 10:26:59 +01:00
dwarf2.h Update copyright years. 2021-01-04 10:26:59 +01:00
dyn-string.h Update copyright years. 2021-01-04 10:26:59 +01:00
environ.h Update copyright years. 2021-01-04 10:26:59 +01:00
fibheap.h Update copyright years. 2021-01-04 10:26:59 +01:00
filenames.h Update copyright years. 2021-01-04 10:26:59 +01:00
floatformat.h Update pathname for IBM long double description. 2021-09-27 10:56:14 -04:00
fnmatch.h Update copyright years. 2021-01-04 10:26:59 +01:00
gcc-c-fe.def Update copyright years. 2021-01-04 10:26:59 +01:00
gcc-c-interface.h Update copyright years. 2021-01-04 10:26:59 +01:00
gcc-cp-fe.def Update copyright years. 2021-01-04 10:26:59 +01:00
gcc-cp-interface.h Update copyright years. 2021-01-04 10:26:59 +01:00
gcc-interface.h Update copyright years. 2021-01-04 10:26:59 +01:00
getopt.h Update copyright years. 2021-01-04 10:26:59 +01:00
gomp-constants.h openmp: Improve OpenMP target support for C++ (PR92120) 2021-12-08 22:29:06 +08:00
hashtab.h libiberty: add htab_eq_string 2021-05-06 08:51:28 -06:00
hsa_ext_amd.h Import HSA header files from AMD 2020-12-09 11:10:40 +00:00
hsa_ext_image.h Import HSA header files from AMD 2020-12-09 11:10:40 +00:00
hsa.h Import HSA header files from AMD 2020-12-09 11:10:40 +00:00
leb128.h Update copyright years. 2021-01-04 10:26:59 +01:00
libiberty.h Update copyright years. 2021-01-04 10:26:59 +01:00
longlong.h Update copyright years. 2021-01-04 10:26:59 +01:00
lto-symtab.h Update copyright years. 2021-01-04 10:26:59 +01:00
md5.h include: Allow for our md5.h to defer to the system header 2021-11-05 13:06:34 +01:00
objalloc.h Update copyright years. 2021-01-04 10:26:59 +01:00
obstack.h obstack.h __PTR_ALIGN vs. ubsan 2021-09-22 17:14:17 +09:30
partition.h Update copyright years. 2021-01-04 10:26:59 +01:00
plugin-api.h Update copyright years. 2021-01-04 10:26:59 +01:00
safe-ctype.h Update copyright years. 2021-01-04 10:26:59 +01:00
sha1.h Update copyright years. 2021-01-04 10:26:59 +01:00
simple-object.h Update copyright years. 2021-01-04 10:26:59 +01:00
sort.h Update copyright years. 2021-01-04 10:26:59 +01:00
splay-tree.h Update copyright years. 2021-01-04 10:26:59 +01:00
symcat.h Update copyright years. 2021-01-04 10:26:59 +01:00
timeval-utils.h Update copyright years. 2021-01-04 10:26:59 +01:00
unique-ptr.h Update copyright years. 2021-01-04 10:26:59 +01:00
vtv-change-permission.h Update copyright years. 2021-01-04 10:26:59 +01:00
xregex2.h Update copyright years. 2021-01-04 10:26:59 +01:00
xregex.h
xtensa-config.h Update copyright years. 2021-01-04 10:26:59 +01:00