Go to file
Paul-Antoine Arras 084ea8ad58 OpenMP: middle-end support for dispatch + adjust_args
This patch adds middle-end support for the `dispatch` construct and the
`adjust_args` clause. The heavy lifting is done in `gimplify_omp_dispatch` and
`gimplify_call_expr` respectively. For `adjust_args`, this mostly consists in
emitting a call to `omp_get_mapped_ptr` for the adequate device.

For dispatch, the following steps are performed:

* Handle the device clause, if any: set the default-device ICV at the top of the
dispatch region and restore its previous value at the end.

* Handle novariants and nocontext clauses, if any. Evaluate compile-time
constants and select a variant, if possible. Otherwise, emit code to handle all
possible cases at run time.

gcc/ChangeLog:

	* builtins.cc (builtin_fnspec): Handle BUILT_IN_OMP_GET_MAPPED_PTR.
	* gimple-low.cc (lower_stmt): Handle GIMPLE_OMP_DISPATCH.
	* gimple-pretty-print.cc (dump_gimple_omp_dispatch): New function.
	(pp_gimple_stmt_1): Handle GIMPLE_OMP_DISPATCH.
	* gimple-walk.cc (walk_gimple_stmt): Likewise.
	* gimple.cc (gimple_build_omp_dispatch): New function.
	(gimple_copy): Handle GIMPLE_OMP_DISPATCH.
	* gimple.def (GIMPLE_OMP_DISPATCH): Define.
	* gimple.h (gimple_build_omp_dispatch): Declare.
	(gimple_has_substatements): Handle GIMPLE_OMP_DISPATCH.
	(gimple_omp_dispatch_clauses): New function.
	(gimple_omp_dispatch_clauses_ptr): Likewise.
	(gimple_omp_dispatch_set_clauses): Likewise.
	(gimple_return_set_retval): Handle GIMPLE_OMP_DISPATCH.
	* gimplify.cc (enum omp_region_type): Add ORT_DISPATCH.
	(struct gimplify_omp_ctx): Add in_call_args.
	(gimplify_call_expr): Handle need_device_ptr arguments.
	(is_gimple_stmt): Handle OMP_DISPATCH.
	(gimplify_scan_omp_clauses): Handle OMP_CLAUSE_DEVICE in a dispatch
	construct. Handle OMP_CLAUSE_NOVARIANTS and OMP_CLAUSE_NOCONTEXT.
	(omp_has_novariants): New function.
	(omp_has_nocontext): Likewise.
	(omp_construct_selector_matches): Handle OMP_DISPATCH with nocontext
	clause.
	(find_ifn_gomp_dispatch): New function.
	(gimplify_omp_dispatch): Likewise.
	(gimplify_expr): Handle OMP_DISPATCH.
	* gimplify.h (omp_has_novariants): Declare.
	* internal-fn.cc (expand_GOMP_DISPATCH): New function.
	* internal-fn.def (GOMP_DISPATCH): Define.
	* omp-builtins.def (BUILT_IN_OMP_GET_MAPPED_PTR): Define.
	(BUILT_IN_OMP_GET_DEFAULT_DEVICE): Define.
	(BUILT_IN_OMP_SET_DEFAULT_DEVICE): Define.
	* omp-general.cc (omp_construct_traits_to_codes): Add OMP_DISPATCH.
	(struct omp_ts_info): Add dispatch.
	(omp_resolve_declare_variant): Handle novariants. Adjust
	DECL_ASSEMBLER_NAME.
	* omp-low.cc (scan_omp_1_stmt): Handle GIMPLE_OMP_DISPATCH.
	(lower_omp_dispatch): New function.
	(lower_omp_1): Call it.
	* tree-inline.cc (remap_gimple_stmt): Handle GIMPLE_OMP_DISPATCH.
	(estimate_num_insns): Handle GIMPLE_OMP_DISPATCH.
2024-11-20 15:31:22 +01:00
.forgejo
.github
c++tools
config
contrib Daily bump. 2024-11-19 00:19:52 +00:00
fixincludes
gcc OpenMP: middle-end support for dispatch + adjust_args 2024-11-20 15:31:22 +01:00
gnattools
gotools
include
INSTALL
libada
libatomic Daily bump. 2024-11-19 00:19:52 +00:00
libbacktrace
libcc1
libcody
libcpp Daily bump. 2024-11-19 00:19:52 +00:00
libdecnumber
libffi
libgcc Daily bump. 2024-11-20 00:19:59 +00:00
libgfortran
libgm2
libgo
libgomp Daily bump. 2024-11-19 00:19:52 +00:00
libgrust
libiberty Daily bump. 2024-11-20 00:19:59 +00:00
libitm Daily bump. 2024-11-19 00:19:52 +00:00
libobjc
libphobos Daily bump. 2024-11-19 00:19:52 +00:00
libquadmath
libsanitizer
libssp
libstdc++-v3 libstdc++: Use const_iterator in std::set::find<K> return type 2024-11-20 06:44:50 +00:00
libvtv Daily bump. 2024-11-19 00:19:52 +00:00
lto-plugin
maintainer-scripts
zlib
.b4-config
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2024-11-20 00:19:59 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
configure.ac Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt Remove Debian from SECURITY.txt 2024-11-19 12:27:33 +01:00
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.