[PATCH 1/5] openmp: Add GOMP_MAP_SHAPE_DIM and grid-dim pointer marker prerequisites
Paul-Antoine Arras <[email protected]> Wed, 5 Aug 2026 22:23:39 +0200
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
Introduce the new GOMP_MAP_SHAPE_DIM map kind, the
OMP_CLAUSE_MAP_GRID_DIM_POINTER accessor, and their tree-pretty-print
support ahead of the front-end and lowering changes that use them.
gcc/ChangeLog:
* tree-pretty-print.cc (dump_omp_clause): Handle GOMP_MAP_SHAPE_DIM and
print [pointer]/[pointer set] annotations.
* tree.h (OMP_CLAUSE_MAP_GRID_DIM_POINTER): New.
include/ChangeLog:
* gomp-constants.h (enum gomp_map_kind): Add GOMP_MAP_SHAPE_DIM.
---
gcc/tree-pretty-print.cc | 9 +++++++++
gcc/tree.h | 7 +++++++
include/gomp-constants.h | 3 ++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index 0959397a149..71d430d7330 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -1167,6 +1167,9 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
case GOMP_MAP_GRID_STRIDE:
pp_string (pp, "grid_stride");
break;
+ case GOMP_MAP_SHAPE_DIM:
+ pp_string (pp, "shape_dim");
+ break;
case GOMP_MAP_UNSET:
pp_string (pp, "unset");
break;
@@ -1273,6 +1276,12 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
pp_string (pp, " [runtime_implicit]");
if (OMP_CLAUSE_MAP_GIMPLE_ONLY (clause))
pp_string (pp, " [gimple only]");
+ if (OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_TO_PSET
+ && !OMP_CLAUSE_SIZE (clause))
+ pp_string (pp, " [pointer set]");
+ if (OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_GRID_DIM
+ && OMP_CLAUSE_MAP_GRID_DIM_POINTER (clause))
+ pp_string (pp, " [pointer]");
}
pp_right_paren (pp);
break;
diff --git a/gcc/tree.h b/gcc/tree.h
index 6aa263aaada..72306428920 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1971,6 +1971,13 @@ class auto_suppress_location_wrappers
#define OMP_CLAUSE_MAP_POINTS_TO_READONLY(NODE) \
TREE_CONSTANT (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
+/* Nonzero on a GOMP_MAP_GRID_DIM clause if the dimension it describes
+ selects into a pointer (requiring a dereference to reach the next
+ dimension) rather than a regular array dimension. */
+#define OMP_CLAUSE_MAP_GRID_DIM_POINTER(NODE) \
+ TREE_THIS_VOLATILE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
+
+
/* Same as above, for use in OpenACC cache directives. */
#define OMP_CLAUSE__CACHE__READONLY(NODE) \
TREE_READONLY (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__CACHE_))
diff --git a/include/gomp-constants.h b/include/gomp-constants.h
index 96ff5ee4b44..7bf71f9d55d 100644
--- a/include/gomp-constants.h
+++ b/include/gomp-constants.h
@@ -252,7 +252,8 @@ enum gomp_map_kind
definition (only for Fortran at present). */
GOMP_MAP_MAPPING_GROUP = (GOMP_MAP_LAST | 11),
GOMP_MAP_GRID_DIM = (GOMP_MAP_LAST | 12),
- GOMP_MAP_GRID_STRIDE = (GOMP_MAP_LAST | 13)
+ GOMP_MAP_GRID_STRIDE = (GOMP_MAP_LAST | 13),
+ GOMP_MAP_SHAPE_DIM = (GOMP_MAP_LAST | 14)
};
#define GOMP_MAP_COPY_TO_P(X) \
--
2.53.0