I have committed the following patches onto the devel/omp/gcc-14 OpenMP
development branch to implement support for iterators in mapping clauses
and in to/from clauses in 'target update' constructs:
76e5b71adb8 openmp: Refactor handling of iterators
28f09913235 openmp: Add support for iterators in map clauses (C/C++)
3e3966d7846 openmp: Add support for iterators in 'target update' clauses
(C/C++)
These are revised versions of the patches previously posted at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/670333.html .
------
2afb6281a5a openmp, fortran: Move udm field of gfc_omp_namelist into a
new union
The namelist for mappers udm is stored in the union u2, but the
namespace ns is also stored in the same union, and the two need to be
used simultaneously if iterators are used together with custom mappers.
udm is therefore moved into a new union u3.
------
9e6586616e openmp, fortran: Revert to using tree expressions when
translating Fortran OpenMP array sections
A change made in the patch 'OpenACC 2.7: Implement reductions for arrays
and records' (a01aafa500) forced certain clause expressions to be in
temporaries rather than in tree expressions, which broke some
assumptions made by the patch series. As the patch was for OpenACC, I
reverted to the original behaviour for OpenMP.
------
8d601fddb3 openmp, fortran: Add support for map iterators in OpenMP
target construct (Fortran)
80861d9c3e63 openmp, fortran: Add support for iterators in OpenMP
'target update' constructs (Fortran)
These are revised versions of the Fortran portion of the patches
previously posted at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-November/670333.html .
------
21adb0ccac34 openmp: Disable strided target updates when iterators are used
New code was previously added to OG14 to implement strided target
updates (in the patches 'OpenMP: Support strided and shaped-array
updates for C++', 'OpenMP: Array shaping operator and strided "target
update" for C'). This code is also used to handle non-contiguous array
updates in general.
Unfortunately, this code has problems handling arrays of pointers to
arrays (e.g. int *x[N]), so we have opted not to implement it for now,
instead opting to always fall back to the original codepath for handling
target updates with iterators.
------
ab5fc0ca64e openmp: Add support for non-constant iterator parameters in
map, to and from clauses
This is a revised version of the patch posted at
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/671630.html .
------
e225950d8d8 openmp: Add macros for iterator element access
The number of elements in an iterator vector has risen all the way to
10, hence it has become tedious and error-prone to refer to the elements
by number. The patch introduces macros used to refer to the elements of
the iterator vector by name instead.
------
6c130074c9a openmp: Fix struct handling for OpenMP iterators
At several points during group handling, new clauses may be created
which also need to have iterators applied to them. However, at this
point, the iterator loop has already been built with the original set of
clauses.
This patch introduces a new mechanism by which new clauses can be
allocated a new elements array in the iterator loop after the loop was
initially built.
------
53b8a20948e openmp: Add support for using custom mappers with iterators
(C, C++)
8fab63e1ce2 openmp, Fortran: Add support using iterators with custom
mappers in Fortran
These patches implement support for using iterators together with custom
mappers. They work by taking any iterators applied to the original item
on which the mapper is applied, and applying them to all the expanded
items generated by applying the custom mapper. The resulting clauses are
then passed on for processing by the middle-end as usual.
------
ae60c1e09fe openmp, fortran: Add iterator support for Fortran
deep-mapping of allocatables
d28dcc50ceb openmp, fortran: Add support for non-constant iterator
bounds in Fortran deep-mapping iterator support
These patches implement support for using iterators together with
automatic deep-mapping of allocatables in Fortran.
At the point where maps are automatically generated for the allocatable
(in gfc_omp_deep_mapping_map), if an iterator is present, then the
assignments to the hostaddrs/size arrays are transformed into
assignments into an iterator element array made from within the iterator
loop instead. The hostaddr entry is then set to point to the element
array and the size entry is set to SIZE_MAX instead, so that libgomp
will treat the entry as an iterator entry. Any code generated due to
expression side effects also needs to go into the iterator loop as it
may reference the iterator variables.
Kwok Yeung