Hi, This patch series contains a reimplementation of the clause-ordering code in gimplify.c (omp_target_reorder_clauses), in anticipation of extending support for lvalues in mapping clauses for OpenMP 5.0. This builds (or will build) on a series of patches by Chung-Lin and myself that haven't completed review for mainline yet: I've included these for context, but I'm not proposing "taking ownership" of Chung-Lin's patches -- my assumption is that those patches will make it upstream without fundamental changes, so the work built on top of them will still be largely valid.
(The merges of Chung-Lin's patches on top of current mainline aren't entirely trivial because of a clash with https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573600.html. Hopefully my merge attempt helps, though I've probably made mistakes in parts of the code I don't fully understand!). Further commentary on individual patches -- particularly the 8th, which is intended as an RFC, and is the main reason for posting this series. Tested with offloading to NVPTX, and bootstrapped. Thanks, Julian Chung-Lin Tang (3): Improve OpenMP target support for C++ [PR92120 v4b] OpenMP 5.0: Implement relaxation of implicit map vs. existing device mappings Remove array section base-pointer mapping semantics, and other front-end adjustments (mainline trunk) Julian Brown (5): Rewrite GOMP_MAP_ATTACH_DETACH mappings unconditionally OpenMP/OpenACC: Move array_ref/indirect_ref handling code out of extract_base_bit_offset OpenACC/OpenMP: Refactor struct lowering in gimplify.c OpenACC: Rework indirect struct handling in gimplify.c OpenMP 5.0: [WIP, RFC] Clause ordering for OpenMP 5.0 (topological sorting by base pointer) gcc/c/c-parser.c | 57 +- gcc/c/c-typeck.c | 103 +- gcc/cp/cp-tree.h | 2 + gcc/cp/parser.c | 126 +- gcc/cp/pt.c | 5 + gcc/cp/semantics.c | 677 ++++++- gcc/fortran/trans-openmp.c | 23 +- gcc/gimplify.c | 1665 +++++++++++++---- gcc/omp-low.c | 31 +- .../c-c++-common/goacc/combined-reduction.c | 4 +- .../goacc/deep-copy-arrayofstruct.c | 5 +- .../goacc/firstprivate-mappings-1.c | 6 +- gcc/testsuite/c-c++-common/goacc/mdc-1.c | 2 +- .../c-c++-common/goacc/reduction-1.c | 4 +- .../c-c++-common/goacc/reduction-2.c | 4 +- .../c-c++-common/goacc/reduction-3.c | 4 +- .../c-c++-common/goacc/reduction-4.c | 4 +- .../c-c++-common/gomp/target-enter-data-1.c | 24 + .../c-c++-common/gomp/target-implicit-map-1.c | 39 + .../c-c++-common/gomp/target-implicit-map-2.c | 52 + .../g++.dg/goacc/firstprivate-mappings-1.C | 2 +- gcc/testsuite/g++.dg/goacc/member-array-acc.C | 13 + gcc/testsuite/g++.dg/gomp/member-array-omp.C | 13 + gcc/testsuite/g++.dg/gomp/target-3.C | 36 + gcc/testsuite/g++.dg/gomp/target-lambda-1.C | 94 + gcc/testsuite/g++.dg/gomp/target-lambda-2.C | 35 + gcc/testsuite/g++.dg/gomp/target-this-1.C | 33 + gcc/testsuite/g++.dg/gomp/target-this-2.C | 49 + gcc/testsuite/g++.dg/gomp/target-this-3.C | 105 ++ gcc/testsuite/g++.dg/gomp/target-this-4.C | 107 ++ gcc/testsuite/g++.dg/gomp/target-this-5.C | 34 + gcc/testsuite/g++.dg/gomp/this-2.C | 24 +- gcc/testsuite/gcc.dg/gomp/target-3.c | 16 + .../gfortran.dg/goacc/common-block-3.f90 | 8 +- .../gfortran.dg/goacc/loop-tree-1.f90 | 2 +- .../goacc/private-explicit-kernels-1.f95 | 4 +- .../goacc/private-predetermined-kernels-1.f95 | 4 +- gcc/tree-pretty-print.c | 11 + gcc/tree.h | 5 + include/gomp-constants.h | 27 +- libgomp/libgomp.h | 2 +- libgomp/oacc-mem.c | 7 +- libgomp/target.c | 246 ++- libgomp/testsuite/libgomp.c++/target-11.C | 14 +- libgomp/testsuite/libgomp.c++/target-12.C | 2 +- libgomp/testsuite/libgomp.c++/target-15.C | 20 +- libgomp/testsuite/libgomp.c++/target-16.C | 20 +- libgomp/testsuite/libgomp.c++/target-17.C | 20 +- libgomp/testsuite/libgomp.c++/target-21.C | 8 +- libgomp/testsuite/libgomp.c++/target-23.C | 34 + .../testsuite/libgomp.c++/target-lambda-1.C | 86 + .../testsuite/libgomp.c++/target-lambda-2.C | 30 + libgomp/testsuite/libgomp.c++/target-this-1.C | 29 + libgomp/testsuite/libgomp.c++/target-this-2.C | 47 + libgomp/testsuite/libgomp.c++/target-this-3.C | 99 + libgomp/testsuite/libgomp.c++/target-this-4.C | 104 + libgomp/testsuite/libgomp.c++/target-this-5.C | 30 + .../target-implicit-map-1.c | 31 + .../target-implicit-map-2.c | 46 + libgomp/testsuite/libgomp.c/target-23.c | 2 +- libgomp/testsuite/libgomp.c/target-29.c | 20 +- .../testsuite/libgomp.oacc-c++/deep-copy-17.C | 101 + .../libgomp.oacc-c-c++-common/deep-copy-15.c | 68 + .../libgomp.oacc-c-c++-common/deep-copy-16.c | 231 +++ 64 files changed, 4066 insertions(+), 690 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/target-implicit-map-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/target-implicit-map-2.c create mode 100644 gcc/testsuite/g++.dg/goacc/member-array-acc.C create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-omp.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-3.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-lambda-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-lambda-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-this-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-this-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-this-3.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-this-4.C create mode 100644 gcc/testsuite/g++.dg/gomp/target-this-5.C create mode 100644 gcc/testsuite/gcc.dg/gomp/target-3.c create mode 100644 libgomp/testsuite/libgomp.c++/target-23.C create mode 100644 libgomp/testsuite/libgomp.c++/target-lambda-1.C create mode 100644 libgomp/testsuite/libgomp.c++/target-lambda-2.C create mode 100644 libgomp/testsuite/libgomp.c++/target-this-1.C create mode 100644 libgomp/testsuite/libgomp.c++/target-this-2.C create mode 100644 libgomp/testsuite/libgomp.c++/target-this-3.C create mode 100644 libgomp/testsuite/libgomp.c++/target-this-4.C create mode 100644 libgomp/testsuite/libgomp.c++/target-this-5.C create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/target-implicit-map-2.c create mode 100644 libgomp/testsuite/libgomp.oacc-c++/deep-copy-17.C create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-15.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c -- 2.29.2