mbox series

[0/7,og13] OpenMP: lvalue parsing and "declare mapper" support

Message ID cover.1688151381.git.julian@codesourcery.com
Headers show
Series OpenMP: lvalue parsing and "declare mapper" support | expand

Message

Julian Brown June 30, 2023, 7:23 p.m. UTC
This patch series provides generalised lvalue ("locator list item")
parsing for OpenMP "map", "to" and "from" clauses for C and C++, and
"declare mapper" support for C, C++ and Fortran.  It is based on the
latter part of the patch series sent upstream previously:

  https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609031.html

(parts 7, 8, 9, 10 and 11), with adjustments necessary due to other
patches already on og13 and also a few follow-up fixes.

Tested with offloading to AMD GCN.  I will apply (to og13) shortly.

Julian Brown (7):
  Fix up merge/formatting errors
  OpenMP: OpenMP 5.2 semantics for pointers with unmapped target
  OpenMP: lvalue parsing for map/to/from clauses (C++)
  OpenMP: C++ "declare mapper" support
  OpenMP: lvalue parsing for map clauses (C)
  OpenMP: Support OpenMP 5.0 "declare mapper" directives for C
  OpenMP: Fortran "!$omp declare mapper" support

 gcc/c-family/c-common.h                       |    7 +-
 gcc/c-family/c-omp.cc                         |  323 +-
 gcc/c-family/c-pretty-print.cc                |   12 +
 gcc/c/c-decl.cc                               |  169 +
 gcc/c/c-objc-common.h                         |   12 +
 gcc/c/c-parser.cc                             |  463 ++-
 gcc/c/c-tree.h                                |   10 +
 gcc/c/c-typeck.cc                             |  128 +-
 gcc/cp/constexpr.cc                           |   10 +
 gcc/cp/cp-gimplify.cc                         |    6 +
 gcc/cp/cp-objcp-common.h                      |    9 +
 gcc/cp/cp-tree.h                              |   19 +-
 gcc/cp/decl.cc                                |   27 +-
 gcc/cp/decl2.cc                               |   54 +-
 gcc/cp/error.cc                               |   34 +
 gcc/cp/parser.cc                              |  497 ++-
 gcc/cp/parser.h                               |    3 +
 gcc/cp/pt.cc                                  |   78 +-
 gcc/cp/semantics.cc                           |  261 +-
 gcc/cp/typeck.cc                              |   50 +
 gcc/fortran/dump-parse-tree.cc                |    4 +
 gcc/fortran/f95-lang.cc                       |    7 +
 gcc/fortran/gfortran.h                        |   56 +-
 gcc/fortran/match.cc                          |    9 +-
 gcc/fortran/match.h                           |    1 +
 gcc/fortran/module.cc                         |  251 +-
 gcc/fortran/openmp.cc                         |  299 +-
 gcc/fortran/parse.cc                          |   18 +-
 gcc/fortran/resolve.cc                        |    2 +
 gcc/fortran/st.cc                             |    2 +-
 gcc/fortran/symbol.cc                         |   16 +
 gcc/fortran/trans-decl.cc                     |   33 +-
 gcc/fortran/trans-openmp.cc                   |  785 +++-
 gcc/fortran/trans-stmt.h                      |    1 +
 gcc/fortran/trans.h                           |    3 +
 gcc/gimplify.cc                               |  583 ++-
 gcc/langhooks-def.h                           |   13 +
 gcc/langhooks.cc                              |   35 +
 gcc/langhooks.h                               |   16 +
 gcc/omp-general.h                             |   86 +
 .../c-c++-common/gomp/declare-mapper-12.c     |   22 +
 .../c-c++-common/gomp/declare-mapper-3.c      |   30 +
 .../c-c++-common/gomp/declare-mapper-4.c      |   78 +
 .../c-c++-common/gomp/declare-mapper-5.c      |   26 +
 .../c-c++-common/gomp/declare-mapper-6.c      |   23 +
 .../c-c++-common/gomp/declare-mapper-7.c      |   29 +
 .../c-c++-common/gomp/declare-mapper-8.c      |   43 +
 .../c-c++-common/gomp/declare-mapper-9.c      |   34 +
 gcc/testsuite/c-c++-common/gomp/map-6.c       |   14 +-
 gcc/testsuite/g++.dg/gomp/array-section-1.C   |   38 +
 gcc/testsuite/g++.dg/gomp/array-section-2.C   |   63 +
 .../g++.dg/gomp/bad-array-section-1.C         |   35 +
 .../g++.dg/gomp/bad-array-section-10.C        |   35 +
 .../g++.dg/gomp/bad-array-section-11.C        |   36 +
 .../g++.dg/gomp/bad-array-section-2.C         |   33 +
 .../g++.dg/gomp/bad-array-section-3.C         |   28 +
 .../g++.dg/gomp/bad-array-section-4.C         |   50 +
 .../g++.dg/gomp/bad-array-section-5.C         |   50 +
 .../g++.dg/gomp/bad-array-section-6.C         |   24 +
 .../g++.dg/gomp/bad-array-section-7.C         |   36 +
 .../g++.dg/gomp/bad-array-section-8.C         |   53 +
 .../g++.dg/gomp/bad-array-section-9.C         |   39 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-1.C  |   58 +
 gcc/testsuite/g++.dg/gomp/declare-mapper-2.C  |   30 +
 .../gomp/has_device_addr-non-lvalue-1.C       |   36 +
 gcc/testsuite/g++.dg/gomp/ind-base-3.C        |   37 +
 gcc/testsuite/g++.dg/gomp/map-assignment-1.C  |   12 +
 gcc/testsuite/g++.dg/gomp/map-inc-1.C         |   10 +
 gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C  |   19 +
 gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C      |   37 +
 gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C      |   40 +
 .../g++.dg/gomp/map-static-cast-lvalue-1.C    |   17 +
 gcc/testsuite/g++.dg/gomp/map-ternary-1.C     |   20 +
 gcc/testsuite/g++.dg/gomp/member-array-2.C    |   91 +
 gcc/testsuite/g++.dg/gomp/pr67522.C           |    2 +-
 .../gcc.dg/gomp/bad-array-section-c-1.c       |   16 +
 .../gcc.dg/gomp/bad-array-section-c-2.c       |   13 +
 .../gcc.dg/gomp/bad-array-section-c-3.c       |   24 +
 .../gcc.dg/gomp/bad-array-section-c-4.c       |   26 +
 .../gcc.dg/gomp/bad-array-section-c-5.c       |   15 +
 .../gcc.dg/gomp/bad-array-section-c-6.c       |   16 +
 .../gcc.dg/gomp/bad-array-section-c-7.c       |   26 +
 .../gcc.dg/gomp/bad-array-section-c-8.c       |   21 +
 gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c |   61 +
 gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c |   33 +
 .../gfortran.dg/gomp/declare-mapper-1.f90     |   71 +
 .../gfortran.dg/gomp/declare-mapper-14.f90    |   26 +
 .../gfortran.dg/gomp/declare-mapper-5.f90     |   45 +
 gcc/tree-core.h                               |    4 +
 gcc/tree-pretty-print.cc                      |   58 +
 gcc/tree.cc                                   |    2 +
 gcc/tree.def                                  |   10 +
 gcc/tree.h                                    |   19 +
 include/gomp-constants.h                      |   11 +-
 libgomp/target.c                              |    7 +-
 libgomp/testsuite/libgomp.c++/baseptrs-4.C    |   26 +-
 libgomp/testsuite/libgomp.c++/baseptrs-6.C    | 3199 +++++++++++++++++
 .../testsuite/libgomp.c++/declare-mapper-1.C  |   87 +
 .../testsuite/libgomp.c++/declare-mapper-2.C  |   55 +
 .../testsuite/libgomp.c++/declare-mapper-3.C  |   63 +
 .../testsuite/libgomp.c++/declare-mapper-4.C  |   63 +
 .../testsuite/libgomp.c++/declare-mapper-5.C  |   52 +
 .../testsuite/libgomp.c++/declare-mapper-6.C  |   37 +
 .../testsuite/libgomp.c++/declare-mapper-7.C  |   48 +
 .../testsuite/libgomp.c++/declare-mapper-8.C  |   61 +
 libgomp/testsuite/libgomp.c++/ind-base-1.C    |  162 +
 libgomp/testsuite/libgomp.c++/ind-base-2.C    |   93 +
 .../testsuite/libgomp.c++/lvalue-tofrom-1.C   |   75 +
 .../testsuite/libgomp.c++/lvalue-tofrom-2.C   |   71 +
 libgomp/testsuite/libgomp.c++/map-comma-1.C   |   15 +
 .../testsuite/libgomp.c++/map-rvalue-ref-1.C  |   22 +
 libgomp/testsuite/libgomp.c++/struct-ref-1.C  |   97 +
 .../testsuite/libgomp.c++/target-lambda-1.C   |    5 +-
 libgomp/testsuite/libgomp.c++/target-this-3.C |   11 +-
 libgomp/testsuite/libgomp.c++/target-this-4.C |   11 +-
 .../libgomp.c-c++-common/array-field-1.c      |   35 +
 .../libgomp.c-c++-common/array-of-struct-1.c  |   65 +
 .../libgomp.c-c++-common/array-of-struct-2.c  |   65 +
 .../libgomp.c-c++-common/declare-mapper-10.c  |   60 +
 .../libgomp.c-c++-common/declare-mapper-11.c  |   59 +
 .../libgomp.c-c++-common/declare-mapper-12.c  |   87 +
 .../libgomp.c-c++-common/declare-mapper-13.c  |   55 +
 .../libgomp.c-c++-common/declare-mapper-14.c  |   57 +
 .../libgomp.c-c++-common/declare-mapper-9.c   |   62 +
 .../libgomp.c-c++-common/ind-base-4.c         |   50 +
 .../libgomp.c-c++-common/unary-ptr-1.c        |   16 +
 .../libgomp.fortran/declare-mapper-10.f90     |   40 +
 .../libgomp.fortran/declare-mapper-11.f90     |   38 +
 .../libgomp.fortran/declare-mapper-12.f90     |   33 +
 .../libgomp.fortran/declare-mapper-13.f90     |   49 +
 .../libgomp.fortran/declare-mapper-15.f90     |   24 +
 .../libgomp.fortran/declare-mapper-17.f90     |   92 +
 .../libgomp.fortran/declare-mapper-18.f90     |   46 +
 .../libgomp.fortran/declare-mapper-19.f90     |   29 +
 .../libgomp.fortran/declare-mapper-2.f90      |   32 +
 .../libgomp.fortran/declare-mapper-20.f90     |   29 +
 .../libgomp.fortran/declare-mapper-21.f90     |   24 +
 .../libgomp.fortran/declare-mapper-3.f90      |   33 +
 .../libgomp.fortran/declare-mapper-4.f90      |   36 +
 .../libgomp.fortran/declare-mapper-6.f90      |   28 +
 .../libgomp.fortran/declare-mapper-7.f90      |   29 +
 .../libgomp.fortran/declare-mapper-8.f90      |  115 +
 .../libgomp.fortran/declare-mapper-9.f90      |   27 +
 143 files changed, 11422 insertions(+), 270 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-12.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-3.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-4.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-5.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-6.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-7.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-8.c
 create mode 100644 gcc/testsuite/c-c++-common/gomp/declare-mapper-9.c
 create mode 100644 gcc/testsuite/g++.dg/gomp/array-section-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/array-section-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-10.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-11.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-3.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-4.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-5.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-6.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-7.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-8.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/bad-array-section-9.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/has_device_addr-non-lvalue-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/ind-base-3.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-assignment-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-inc-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-static-cast-lvalue-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/map-ternary-1.C
 create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-2.C
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-1.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-2.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-3.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-4.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-5.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-6.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-7.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/bad-array-section-c-8.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/declare-mapper-10.c
 create mode 100644 gcc/testsuite/gcc.dg/gomp/declare-mapper-11.c
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/declare-mapper-1.f90
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/declare-mapper-14.f90
 create mode 100644 gcc/testsuite/gfortran.dg/gomp/declare-mapper-5.f90
 create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-6.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-2.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-3.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-4.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-5.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-6.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-7.C
 create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-8.C
 create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-2.C
 create mode 100644 libgomp/testsuite/libgomp.c++/lvalue-tofrom-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/lvalue-tofrom-2.C
 create mode 100644 libgomp/testsuite/libgomp.c++/map-comma-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/map-rvalue-ref-1.C
 create mode 100644 libgomp/testsuite/libgomp.c++/struct-ref-1.C
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-field-1.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-1.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-2.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-10.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-11.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-12.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-13.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-14.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/declare-mapper-9.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/ind-base-4.c
 create mode 100644 libgomp/testsuite/libgomp.c-c++-common/unary-ptr-1.c
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-10.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-11.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-12.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-13.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-15.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-17.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-18.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-19.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-2.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-20.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-21.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-3.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-4.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-6.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-7.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-8.f90
 create mode 100644 libgomp/testsuite/libgomp.fortran/declare-mapper-9.f90