diff mbox series

[3/5] OpenMP: Introduce C_ORT_{, OMP_}DECLARE_MAPPER c_omp_region_type types

Message ID 7f150aec826622376459cdecd2c870bc2e80d07b.1691672603.git.julian@codesourcery.com
State New
Headers show
Series OpenMP: Implement 'declare mapper' for 'target update' directives | expand

Commit Message

Julian Brown Aug. 10, 2023, 1:33 p.m. UTC
This patch adds C_ORT_DECLARE_MAPPER and C_ORT_OMP_DECLARE_MAPPER
region types to the c_omp_region_type enum, and uses them in cp/pt.cc.
Previously the C_ORT_DECLARE_SIMD code was being abused to inhibit calling
finish_omp_clauses within mapper definitions, but this patch uses one
of the new enumeration values for that purpose instead.  This shouldn't
result in any behaviour change, but improves self-documentation.

2023-08-10  Julian Brown  <julian@codesourcery.com>

gcc/c-family/
	* c-common.h (c_omp_region_type): Add C_ORT_DECLARE_MAPPER and
	C_ORT_OMP_DECLARE_MAPPER codes.

gcc/cp/
	* pt.cc (tsubst_omp_clauses): Use C_ORT_OMP_DECLARE_MAPPER.
	(tsubst_expr): Likewise.
---
 gcc/c-family/c-common.h | 2 ++
 gcc/cp/pt.cc            | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index c805c8b2f7e..079d1eaafaa 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1271,9 +1271,11 @@  enum c_omp_region_type
   C_ORT_DECLARE_SIMD		= 1 << 2,
   C_ORT_TARGET			= 1 << 3,
   C_ORT_EXIT_DATA		= 1 << 4,
+  C_ORT_DECLARE_MAPPER		= 1 << 6,
   C_ORT_OMP_DECLARE_SIMD	= C_ORT_OMP | C_ORT_DECLARE_SIMD,
   C_ORT_OMP_TARGET		= C_ORT_OMP | C_ORT_TARGET,
   C_ORT_OMP_EXIT_DATA		= C_ORT_OMP | C_ORT_EXIT_DATA,
+  C_ORT_OMP_DECLARE_MAPPER	= C_ORT_OMP | C_ORT_DECLARE_MAPPER,
   C_ORT_ACC_TARGET		= C_ORT_ACC | C_ORT_TARGET
 };
 
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index fb50c5ac48d..2794c0ebecb 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -18328,7 +18328,7 @@  tsubst_omp_clauses (tree clauses, enum c_omp_region_type ort,
     }
 
   new_clauses = nreverse (new_clauses);
-  if (ort != C_ORT_OMP_DECLARE_SIMD)
+  if (ort != C_ORT_OMP_DECLARE_SIMD && ort != C_ORT_OMP_DECLARE_MAPPER)
     {
       if (ort & C_ORT_OMP)
 	new_clauses = c_omp_instantiate_mappers (new_clauses, ort);
@@ -19905,7 +19905,7 @@  tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
 	decl = tsubst (decl, args, complain, in_decl);
 	tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
 	tree clauses = OMP_DECLARE_MAPPER_CLAUSES (t);
-	clauses = tsubst_omp_clauses (clauses, C_ORT_OMP_DECLARE_SIMD, args,
+	clauses = tsubst_omp_clauses (clauses, C_ORT_OMP_DECLARE_MAPPER, args,
 				      complain, in_decl);
 	TREE_TYPE (t) = type;
 	OMP_DECLARE_MAPPER_DECL (t) = decl;