]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP/OpenACC: mapping group list-handling improvements
authorJulian Brown <julian@codesourcery.com>
Tue, 6 Sep 2022 22:34:38 +0000 (22:34 +0000)
committerJulian Brown <julian@codesourcery.com>
Wed, 14 Sep 2022 13:59:55 +0000 (13:59 +0000)
commitf469ce1d3ef94092647125662ddd93847712909f
treed4f00619fa555d863cf5ad7e25b480c3fab6b043
parent23baa717c991d77f206a9358ce2c04960ccf9eea
OpenMP/OpenACC: mapping group list-handling improvements

This patch adjusts OpenMP/OpenACC clause list handling in a couple of
places, in preparation for the following mapping-clause expansion rework
patch. Firstly mapping groups are removed as a whole in the C and C++
front-ends when an error is detected, which avoids leaving "badly-formed"
mapping clause groups in the list.

Secondly, reindexing of the omp_mapping_group hashmap (during
omp_build_struct_sibling_lists) has been reimplemented, fixing some
tricky corner-cases where mapping groups are removed from a list at the
same time as it is being reordered.

Thirdly, code to check if a different clause on the same directive maps
the whole of a struct that we have a component mapping for (for example)
has been outlined, removing a bit of code duplication.

2022-09-13  Julian Brown  <julian@codesourcery.com>

gcc/
* gimplify.cc (omp_group_last): Allow GOMP_MAP_ATTACH_DETACH after
GOMP_MAP_STRUCT (for reindexing).
(omp_gather_mapping_groups): Reimplement using...
(omp_gather_mapping_groups_1): This new function.  Stop processing at
GATHER_SENTINEL.
(omp_group_base): Allow GOMP_MAP_TO_PSET without any following node.
(omp_index_mapping_groups): Reimplement using...
(omp_index_mapping_groups_1): This new function.  Handle
REINDEX_SENTINEL.
(omp_reindex_mapping_groups, omp_mapped_by_containing_struct): New
functions.
(omp_tsort_mapping_groups_1): Adjust handling of base group being the
same as current group.  Use omp_mapped_by_containing_struct.
(omp_build_struct_sibling_lists): Use omp_mapped_by_containing_struct
and omp_reindex_mapping_groups.  Robustify group deletion for reordered
lists.
(gimplify_scan_omp_clauses): Update calls to
omp_build_struct_sibling_lists.

gcc/c/
* c-typeck.cc (c_finish_omp_clauses): Remove whole mapping node group
on error.

gcc/cp/
* semantics.cc (finish_omp_clauses): Likewise.
gcc/c/c-typeck.cc
gcc/cp/semantics.cc
gcc/gimplify.cc