public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] Use include/gomp-constants.h more actively
@ 2014-12-17 22:32 Thomas Schwinge
  2014-12-18 18:33 ` Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively) Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2014-12-17 22:32 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 36390 bytes --]

Hi!

Committed to gomp-4_0-branch in r218840:

commit febcd8dfdb10fa80edff0880973d1915ca2fef74
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Dec 17 22:26:24 2014 +0000

    Use include/gomp-constants.h more actively.
    
    	include/
    	* gomp-constants.h: Update.  Change all users.
    
    	gcc/
    	* builtins.c (expand_builtin_acc_on_device): Use
    	include/gomp-constants.h.
    	* omp-low.c (expand_omp_target, oacc_process_reduction_data)
    	(lower_omp_target): Likewise.
    	* tree-core.h (enum omp_clause_map_kind): Likewise.
    	gcc/c-family/
    	* c-omp.c (c_finish_oacc_wait): Use include/gomp-constants.h.
    	gcc/c/
    	* c-parser.c (c_parser_oacc_clause_async): Use
    	include/gomp-constants.h.
    	gcc/cp/
    	* parser.c (cp_parser_oacc_clause_async): Use
    	include/gomp-constants.h.
    	gcc/fortran/
    	* openmp.c (gfc_match_omp_clauses): Use include/gomp-constants.h.
    
    	libgomp/
    	* Makefile.am: Don't add ../include/gomp-constants.h to
    	nodist_libsubinclude_HEADERS.
    
    	libgomp/
    	* openacc.h: Don't include "gomp-constants.h".
    
    	libgomp/
    	* oacc-parallel.c (dump_var): Remove.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@218840 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp                |  6 +++
 gcc/builtins.c                    |  7 +--
 gcc/c-family/ChangeLog.gomp       |  4 ++
 gcc/c-family/c-omp.c              |  3 +-
 gcc/c/ChangeLog.gomp              |  5 +++
 gcc/c/c-parser.c                  |  4 +-
 gcc/cp/ChangeLog.gomp             |  5 +++
 gcc/cp/parser.c                   |  4 +-
 gcc/fortran/ChangeLog.gomp        |  4 ++
 gcc/fortran/openmp.c              |  4 +-
 gcc/omp-low.c                     | 32 +++++++-------
 gcc/tree-core.h                   | 35 +++++++--------
 include/ChangeLog.gomp            |  2 +
 include/gomp-constants.h          | 89 ++++++++++++++++++++++++---------------
 libgomp/ChangeLog.gomp            |  9 ++++
 libgomp/Makefile.am               |  2 +-
 libgomp/Makefile.in               |  2 +-
 libgomp/libgomp_target.h          | 10 ++---
 libgomp/oacc-mem.c                |  2 +-
 libgomp/oacc-parallel.c           | 56 ++++++------------------
 libgomp/openacc.f90               |  2 +
 libgomp/openacc.h                 | 15 +++----
 libgomp/openacc_lib.h             |  2 +
 libgomp/target.c                  | 23 +++++-----
 libgomp/testsuite/lib/libgomp.exp |  2 +-
 25 files changed, 180 insertions(+), 149 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index f925902..1a2ccdd 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,5 +1,11 @@
 2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* builtins.c (expand_builtin_acc_on_device): Use
+	include/gomp-constants.h.
+	* omp-low.c (expand_omp_target, oacc_process_reduction_data)
+	(lower_omp_target): Likewise.
+	* tree-core.h (enum omp_clause_map_kind): Likewise.
+
 	* omp-low.c (build_omp_regions_1, make_gimple_omp_edges): Simplify
 	multi-line if conditions.
 
diff --git gcc/builtins.c gcc/builtins.c
index 9a9d935..fcf3f53 100644
--- gcc/builtins.c
+++ gcc/builtins.c
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "tree-chkp.h"
 #include "rtl-chkp.h"
+#include "gomp-constants.h"
 
 
 static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
@@ -5903,11 +5904,11 @@ expand_builtin_acc_on_device (tree exp, rtx target ATTRIBUTE_UNUSED)
   /* Build: (arg == v1 || arg == v2) ? 1 : 0.  */
 
 #ifdef ACCEL_COMPILER
-  v1 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_not_host */ 3);
+  v1 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_NOT_HOST);
   v2 = build_int_cst (TREE_TYPE (arg), ACCEL_COMPILER_acc_device);
 #else
-  v1 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_none */ 0);
-  v2 = build_int_cst (TREE_TYPE (arg), /* TODO: acc_device_host */ 2);
+  v1 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_NONE);
+  v2 = build_int_cst (TREE_TYPE (arg), GOMP_DEVICE_HOST);
 #endif
 
   v1 = fold_build2_loc (loc, EQ_EXPR, integer_type_node, arg, v1);
diff --git gcc/c-family/ChangeLog.gomp gcc/c-family/ChangeLog.gomp
index 5f3b641..2b6cb57 100644
--- gcc/c-family/ChangeLog.gomp
+++ gcc/c-family/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-omp.c (c_finish_oacc_wait): Use include/gomp-constants.h.
+
 2014-11-05  James Norris  <jnorris@codesourcery.com>
 
 	* c-pragma.c (oacc_pragmas): Add "cache".
diff --git gcc/c-family/c-omp.c gcc/c-family/c-omp.c
index 9bbfe0e..5a42042 100644
--- gcc/c-family/c-omp.c
+++ gcc/c-family/c-omp.c
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-expr.h"
 #include "langhooks.h"
 #include "omp-low.h"
+#include "gomp-constants.h"
 
 
 /* Complete a #pragma oacc wait construct.  LOC is the location of
@@ -48,7 +49,7 @@ c_finish_oacc_wait (location_t loc, tree parms, tree clauses)
   if (find_omp_clause (clauses, OMP_CLAUSE_ASYNC))
     t = OMP_CLAUSE_ASYNC_EXPR (clauses);
   else
-    t = build_int_cst (integer_type_node, -2);  /* TODO: XXX FIX -2.  */
+    t = build_int_cst (integer_type_node, GOMP_ASYNC_SYNC);
 
   args->quick_push (t);
   args->quick_push (build_int_cst (integer_type_node, nparms));
diff --git gcc/c/ChangeLog.gomp gcc/c/ChangeLog.gomp
index a223a17..b710f47 100644
--- gcc/c/ChangeLog.gomp
+++ gcc/c/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-parser.c (c_parser_oacc_clause_async): Use
+	include/gomp-constants.h.
+
 2014-11-05  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* c-parser.c (c_parser_omp_clause_name) <"host">: Return
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 7703096..741f21a 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -71,6 +71,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "plugin.h"
 #include "omp-low.h"
 #include "builtins.h"
+#include "gomp-constants.h"
 
 \f
 /* Initialization routine for this file.  */
@@ -10682,8 +10683,7 @@ c_parser_oacc_clause_async (c_parser *parser, tree list)
   tree c, t;
   location_t loc = c_parser_peek_token (parser)->location;
 
-  /* TODO XXX: FIX -1  (acc_async_noval).  */
-  t = build_int_cst (integer_type_node, -1);
+  t = build_int_cst (integer_type_node, GOMP_ASYNC_NOVAL);
 
   if (c_parser_peek_token (parser)->type == CPP_OPEN_PAREN)
     {
diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp
index f5d400f..4490186 100644
--- gcc/cp/ChangeLog.gomp
+++ gcc/cp/ChangeLog.gomp
@@ -1,3 +1,8 @@
+2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* parser.c (cp_parser_oacc_clause_async): Use
+	include/gomp-constants.h.
+
 2014-11-05  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* parser.c (cp_parser_oacc_data_clause): Group
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 176eec7..99fd5b2 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "parser.h"
 #include "type-utils.h"
 #include "omp-low.h"
+#include "gomp-constants.h"
 
 \f
 /* The lexer.  */
@@ -29035,8 +29036,7 @@ cp_parser_oacc_clause_async (cp_parser *parser, tree list)
   tree c, t;
   location_t loc = cp_lexer_peek_token (parser->lexer)->location;
 
-  /* TODO XXX: FIX -1  (acc_async_noval).  */
-  t = build_int_cst (integer_type_node, -1);
+  t = build_int_cst (integer_type_node, GOMP_ASYNC_NOVAL);
 
   if (cp_lexer_peek_token (parser->lexer)->type == CPP_OPEN_PAREN)
     {
diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp
index 2bc5820..385e348 100644
--- gcc/fortran/ChangeLog.gomp
+++ gcc/fortran/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* openmp.c (gfc_match_omp_clauses): Use include/gomp-constants.h.
+
 2014-11-20  Cesar Philippidis  <cesar@codesourcery.com>
 
 	* openmp.c (resolve_oacc_cache): Mark the code parameter as
diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c
index c847003..46aeb60 100644
--- gcc/fortran/openmp.c
+++ gcc/fortran/openmp.c
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "parse.h"
 #include "hash-set.h"
 #include "diagnostic.h"
+#include "gomp-constants.h"
 
 /* Match an end of OpenMP directive.  End of OpenMP directive is optional
    whitespace, followed by '\n' or comment '!'.  */
@@ -502,8 +503,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, uint64_t mask,
 		c->async_expr = gfc_get_constant_expr (BT_INTEGER,
 						       gfc_default_integer_kind,
 						      &gfc_current_locus);
-		/* TODO XXX: FIX -1 (acc_async_noval).  */
-		mpz_set_si (c->async_expr->value.integer, -1);
+		mpz_set_si (c->async_expr->value.integer, GOMP_ASYNC_NOVAL);
 	      }
 	    continue;
 	  }
diff --git gcc/omp-low.c gcc/omp-low.c
index fd117dc..e5c6802 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -89,6 +89,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cilk.h"
 #include "context.h"
 #include "lto-section-names.h"
+#include "gomp-constants.h"
 
 
 /* Lowering of OpenMP parallel and workshare constructs proceeds in two
@@ -9032,10 +9033,10 @@ expand_omp_target (struct omp_region *region)
 
   clauses = gimple_omp_target_clauses (entry_stmt);
 
-  /* By default, the value of DEVICE is -1 (let runtime library choose)
-     and there is no conditional.  */
+  /* By default, the value of DEVICE is GOMP_DEVICE_ICV (let runtime
+     library choose) and there is no conditional.  */
   cond = NULL_TREE;
-  device = build_int_cst (integer_type_node, -1);
+  device = build_int_cst (integer_type_node, GOMP_DEVICE_ICV);
 
   c = find_omp_clause (clauses, OMP_CLAUSE_IF);
   if (c)
@@ -9060,7 +9061,7 @@ expand_omp_target (struct omp_region *region)
   device = fold_convert_loc (clause_loc, integer_type_node, device);
 
   /* If we found the clause 'if (cond)', build
-     (cond ? device : -2).  */
+     (cond ? device : GOMP_DEVICE_HOST_FALLBACK).  */
   if (cond)
     {
       cond = gimple_boolify (cond);
@@ -9097,7 +9098,8 @@ expand_omp_target (struct omp_region *region)
 
       gsi = gsi_start_bb (else_bb);
       stmt = gimple_build_assign (tmp_var,
-				  build_int_cst (integer_type_node, -2));
+				  build_int_cst (integer_type_node,
+						 GOMP_DEVICE_HOST_FALLBACK));
       gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
 
       make_edge (cond_bb, then_bb, EDGE_TRUE_VALUE);
@@ -9188,10 +9190,10 @@ expand_omp_target (struct omp_region *region)
 	int t_wait_idx;
 
 	/* Default values for t_async.  */
-	/* TODO: XXX FIX -2.  */
 	t_async = fold_convert_loc (gimple_location (entry_stmt),
 				    integer_type_node,
-				    build_int_cst (integer_type_node, -2));
+				    build_int_cst (integer_type_node,
+						   GOMP_ASYNC_SYNC));
 	/* ..., but if present, use the value specified by the respective
 	   clause, making sure that is of the correct type.  */
 	c = find_omp_clause (clauses, OMP_CLAUSE_ASYNC);
@@ -9937,8 +9939,9 @@ oacc_process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
 	  /* Set nthreads = 1 for ACC_DEVICE_TYPE=host.  */
 	  acc_device_host = create_tmp_var (integer_type_node,
 					    ".acc_device_host");
-	  gimplify_assign (acc_device_host, build_int_cst (integer_type_node,
-							   2),
+	  gimplify_assign (acc_device_host,
+			   build_int_cst (integer_type_node,
+					  GOMP_DEVICE_HOST),
 			   in_stmt_seqp);
 
 	  enter = create_artificial_label (UNKNOWN_LOCATION);
@@ -9954,8 +9957,9 @@ oacc_process_reduction_data (gimple_seq *body, gimple_seq *in_stmt_seqp,
 	  gimple_seq_add_stmt (in_stmt_seqp, gimple_build_label (exit));
 
 	  /* Also, set nthreads = 1 for ACC_DEVICE_TYPE=host_nonshm.  */
-	  gimplify_assign (acc_device_host, build_int_cst (integer_type_node,
-							   3),
+	  gimplify_assign (acc_device_host,
+			   build_int_cst (integer_type_node,
+					  GOMP_DEVICE_HOST_NONSHM),
 			   in_stmt_seqp);
 
 	  enter = create_artificial_label (UNKNOWN_LOCATION);
@@ -11476,16 +11480,14 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		    mark_addressable (avar);
 		    enum omp_clause_map_kind map_kind
 		      = OMP_CLAUSE_MAP_KIND (c);
-		    if ((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
-			 && (map_kind & OMP_CLAUSE_MAP_TO))
+		    if (GOMP_MAP_COPY_TO_P (map_kind)
 			|| map_kind == OMP_CLAUSE_MAP_POINTER
 			|| map_kind == OMP_CLAUSE_MAP_TO_PSET
 			|| map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
 		      gimplify_assign (avar, var, &ilist);
 		    avar = build_fold_addr_expr (avar);
 		    gimplify_assign (x, avar, &ilist);
-		    if (((!(map_kind & OMP_CLAUSE_MAP_SPECIAL)
-			  && (map_kind & OMP_CLAUSE_MAP_FROM))
+		    if ((GOMP_MAP_COPY_FROM_P (map_kind)
 			 || map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
 			&& !TYPE_READONLY (TREE_TYPE (var)))
 		      {
diff --git gcc/tree-core.h gcc/tree-core.h
index 743bc0d..fc61b88 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "alias.h"
 #include "flags.h"
 #include "symtab.h"
+#include "gomp-constants.h"
 
 /* This file contains all the data structures that define the 'tree' type.
    There are no accessor macros nor functions in this file. Only the
@@ -1236,45 +1237,41 @@ enum omp_clause_depend_kind
 enum omp_clause_map_kind
 {
   /* If not already present, allocate.  */
-  OMP_CLAUSE_MAP_ALLOC = 0,
+  OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
   /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_TO = 1 << 0,
+  OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
   /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FROM = 1 << 1,
+  OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
   /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_TOFROM = OMP_CLAUSE_MAP_TO | OMP_CLAUSE_MAP_FROM,
-  /* Special map kinds.  */
-  OMP_CLAUSE_MAP_SPECIAL = 1 << 2,
+  OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
   /* The following kind is an internal only map kind, used for pointer based
      array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
      which is implicitly POINTER_SIZE_UNITS, but the bias.  */
-  OMP_CLAUSE_MAP_POINTER = OMP_CLAUSE_MAP_SPECIAL,
+  OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
   /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
      OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
      falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
      wasn't mapped already.  */
-  OMP_CLAUSE_MAP_TO_PSET,
+  OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
   /* The following are only valid for OpenACC.  */
-  /* Flag to force a specific behavior (or else, a run-time error).  */
-  OMP_CLAUSE_MAP_FORCE = 1 << 3,
   /* Allocate.  */
-  OMP_CLAUSE_MAP_FORCE_ALLOC = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_ALLOC,
+  OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
   /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_FORCE_TO = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_TO,
+  OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
   /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FORCE_FROM = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_FROM,
+  OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
   /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_FORCE_TOFROM = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_TOFROM,
+  OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
   /* Must already be present.  */
-  OMP_CLAUSE_MAP_FORCE_PRESENT = OMP_CLAUSE_MAP_FORCE | OMP_CLAUSE_MAP_SPECIAL,
+  OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
   /* Deallocate a mapping, without copying from device.  */
-  OMP_CLAUSE_MAP_FORCE_DEALLOC,
+  OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
   /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
-     POINTER_SIZE / BITS_PER_UNIT.  */
-  OMP_CLAUSE_MAP_FORCE_DEVICEPTR,
+     POINTER_SIZE_UNITS.  */
+  OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
 
   /* End marker.  */
-  OMP_CLAUSE_MAP_LAST
+  OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
 };
 
 enum omp_clause_proc_bind_kind
diff --git include/ChangeLog.gomp include/ChangeLog.gomp
index 6baa7a8..c65a210 100644
--- include/ChangeLog.gomp
+++ include/ChangeLog.gomp
@@ -1,5 +1,7 @@
 2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* gomp-constants.h: Update.  Change all users.
+
 	* gomp-constants.h: Don't define GOMP_MAP_FORCE_PRIVATE and
 	GOMP_MAP_FORCE_FIRSTPRIVATE.  Change all users.
 
diff --git include/gomp-constants.h include/gomp-constants.h
index e042f9e..b5f8d88 100644
--- include/gomp-constants.h
+++ include/gomp-constants.h
@@ -1,4 +1,7 @@
-/* Copyright (C) 2014 Free Software Foundation, Inc.
+/* Communication between GCC and libgomp.
+
+   Copyright (C) 2014 Free Software Foundation, Inc.
+
    Contributed by Mentor Embedded.
 
    This file is part of the GNU Offloading and Multi Processing Library
@@ -26,46 +29,66 @@
 #ifndef GOMP_CONSTANTS_H
 #define GOMP_CONSTANTS_H 1
 
-/* Enumerated variable mapping types used to communicate between GCC and
-   libgomp.  These values are used for both OpenMP and OpenACC.  */
+/* Memory mapping types.  */
 
-#define _GOMP_MAP_FLAG_SPECIAL		(1 << 2)
-#define _GOMP_MAP_FLAG_FORCE		(1 << 3)
+/* One byte.  */
+#define GOMP_MAP_VALUE_LIMIT		(1 << 8)
 
-#define GOMP_MAP_ALLOC			0x00
-#define GOMP_MAP_ALLOC_TO		0x01
-#define GOMP_MAP_ALLOC_FROM		0x02
-#define GOMP_MAP_ALLOC_TOFROM		0x03
-#define GOMP_MAP_POINTER		0x04
-#define GOMP_MAP_TO_PSET		0x05
-#define GOMP_MAP_FORCE_ALLOC		0x08
-#define GOMP_MAP_FORCE_TO		0x09
-#define GOMP_MAP_FORCE_FROM		0x0a
-#define GOMP_MAP_FORCE_TOFROM		0x0b
-#define GOMP_MAP_FORCE_PRESENT		0x0c
-#define GOMP_MAP_FORCE_DEALLOC		0x0d
-#define GOMP_MAP_FORCE_DEVICEPTR	0x0e
+#define GOMP_MAP_FLAG_TO		(1 << 0)
+#define GOMP_MAP_FLAG_FROM		(1 << 1)
+/* Special map kinds, enumerated starting here.  */
+#define GOMP_MAP_FLAG_SPECIAL_0		(1 << 2)
+#define GOMP_MAP_FLAG_SPECIAL_1		(1 << 3)
+#define GOMP_MAP_FLAG_SPECIAL		(GOMP_MAP_FLAG_SPECIAL_1 \
+					 | GOMP_MAP_FLAG_SPECIAL_0)
+/* Flag to force a specific behavior (or else, trigger a run-time error).  */
+#define GOMP_MAP_FLAG_FORCE		(1 << 7)
 
-#define GOMP_MAP_COPYTO_P(X) \
-  ((X) == GOMP_MAP_ALLOC_TO || (X) == GOMP_MAP_FORCE_TO)
+#define GOMP_MAP_ALLOC			0
+#define GOMP_MAP_TO			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
+#define GOMP_MAP_FROM			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
+#define GOMP_MAP_TOFROM			(GOMP_MAP_TO | GOMP_MAP_FROM)
+#define GOMP_MAP_POINTER		(GOMP_MAP_FLAG_SPECIAL_0 | 0)
+#define GOMP_MAP_TO_PSET		(GOMP_MAP_FLAG_SPECIAL_0 | 1)
+#define GOMP_MAP_FORCE_PRESENT		(GOMP_MAP_FLAG_SPECIAL_0 | 2)
+#define GOMP_MAP_FORCE_DEALLOC		(GOMP_MAP_FLAG_SPECIAL_0 | 3)
+#define GOMP_MAP_FORCE_DEVICEPTR	(GOMP_MAP_FLAG_SPECIAL_1 | 0)
+#define GOMP_MAP_FORCE_ALLOC		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
+#define GOMP_MAP_FORCE_TO		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
+#define GOMP_MAP_FORCE_FROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
+#define GOMP_MAP_FORCE_TOFROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
 
-#define GOMP_MAP_COPYFROM_P(X) \
-  ((X) == GOMP_MAP_ALLOC_FROM || (X) == GOMP_MAP_FORCE_FROM)
+#define GOMP_MAP_COPY_TO_P(X) \
+  (!((X) & GOMP_MAP_FLAG_SPECIAL) \
+   && ((X) & GOMP_MAP_FLAG_TO))
 
-#define GOMP_MAP_TOFROM_P(X) \
-  ((X) == GOMP_MAP_ALLOC_TOFROM || (X) == GOMP_MAP_FORCE_TOFROM)
+#define GOMP_MAP_COPY_FROM_P(X) \
+  (!((X) & GOMP_MAP_FLAG_SPECIAL) \
+   && ((X) & GOMP_MAP_FLAG_FROM))
 
 #define GOMP_MAP_POINTER_P(X) \
   ((X) == GOMP_MAP_POINTER)
 
-#define GOMP_IF_CLAUSE_FALSE		-2
-
-/* Canonical list of target type codes for OpenMP/OpenACC.  */
-#define GOMP_TARGET_NONE		0
-#define GOMP_TARGET_HOST		2
-#define GOMP_TARGET_HOST_NONSHM		3
-#define GOMP_TARGET_NOT_HOST		4
-#define GOMP_TARGET_NVIDIA_PTX		5
-#define GOMP_TARGET_INTEL_MIC		6
+
+/* Asynchronous behavior.  Keep in sync with
+   libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_async_t.  */
+
+#define GOMP_ASYNC_NOVAL		-1
+#define GOMP_ASYNC_SYNC			-2
+
+
+/* Device codes.  Keep in sync with
+   libgomp/{openacc.h,openacc.f90,openacc_lib.h}:acc_device_t as well as
+   libgomp/libgomp_target.h.  */
+#define GOMP_DEVICE_NONE		0
+#define GOMP_DEVICE_DEFAULT		1
+#define GOMP_DEVICE_HOST		2
+#define GOMP_DEVICE_HOST_NONSHM		3
+#define GOMP_DEVICE_NOT_HOST		4
+#define GOMP_DEVICE_NVIDIA_PTX		5
+#define GOMP_DEVICE_INTEL_MIC		6
+
+#define GOMP_DEVICE_ICV			-1
+#define GOMP_DEVICE_HOST_FALLBACK	-2
 
 #endif
diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index ab668a5..dd37326 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,4 +1,13 @@
 2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* Makefile.am: Don't add ../include/gomp-constants.h to
+	nodist_libsubinclude_HEADERS.
+
+	* openacc.h: Don't include "gomp-constants.h".
+
+	* oacc-parallel.c (dump_var): Remove.
+
+2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
 	    Julian Brown  <julian@codesourcery.com>
 	    David Malcolm  <dmalcolm@redhat.com>
 
diff --git libgomp/Makefile.am libgomp/Makefile.am
index 01bb1ec..4471fab 100644
--- libgomp/Makefile.am
+++ libgomp/Makefile.am
@@ -72,7 +72,7 @@ libgomp_la_SOURCES += openacc.f90
 endif
 
 nodist_noinst_HEADERS = libgomp_f.h
-nodist_libsubinclude_HEADERS = omp.h openacc.h ../include/gomp-constants.h
+nodist_libsubinclude_HEADERS = omp.h openacc.h
 if USE_FORTRAN
 nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
 	openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod
diff --git libgomp/Makefile.in libgomp/Makefile.in
index 2447498..1457aeb 100644
--- libgomp/Makefile.in
+++ libgomp/Makefile.in
@@ -417,7 +417,7 @@ libgomp_plugin_host_nonshm_la_LDFLAGS = \
 
 libgomp_plugin_host_nonshm_la_LIBTOOLFLAGS = --tag=disable-static
 nodist_noinst_HEADERS = libgomp_f.h
-nodist_libsubinclude_HEADERS = omp.h openacc.h ../include/gomp-constants.h
+nodist_libsubinclude_HEADERS = omp.h openacc.h
 @USE_FORTRAN_TRUE@nodist_finclude_HEADERS = omp_lib.h omp_lib.f90 omp_lib.mod omp_lib_kinds.mod \
 @USE_FORTRAN_TRUE@	openacc_lib.h openacc.f90 openacc.mod openacc_kinds.mod
 
diff --git libgomp/libgomp_target.h libgomp/libgomp_target.h
index 6da9be8..4d658cc 100644
--- libgomp/libgomp_target.h
+++ libgomp/libgomp_target.h
@@ -27,13 +27,13 @@
 
 #include "gomp-constants.h"
 
-/* Type of offload target device.  Keep in sync with openacc.h:acc_device_t.  */
+/* Type of offload target device.  Keep in sync with include/gomp-constants.h.  */
 enum offload_target_type
 {
-  OFFLOAD_TARGET_TYPE_HOST = GOMP_TARGET_HOST,
-  OFFLOAD_TARGET_TYPE_HOST_NONSHM = GOMP_TARGET_HOST_NONSHM,
-  OFFLOAD_TARGET_TYPE_NVIDIA_PTX = GOMP_TARGET_NVIDIA_PTX,
-  OFFLOAD_TARGET_TYPE_INTEL_MIC = GOMP_TARGET_INTEL_MIC
+  OFFLOAD_TARGET_TYPE_HOST = 2,
+  OFFLOAD_TARGET_TYPE_HOST_NONSHM = 3,
+  OFFLOAD_TARGET_TYPE_NVIDIA_PTX = 5,
+  OFFLOAD_TARGET_TYPE_INTEL_MIC = 6
 };
 
 /* Auxiliary struct, used for transferring a host-target address range mapping
diff --git libgomp/oacc-mem.c libgomp/oacc-mem.c
index cfb63f5..7453020 100644
--- libgomp/oacc-mem.c
+++ libgomp/oacc-mem.c
@@ -385,7 +385,7 @@ present_create_copy (unsigned f, void *h, size_t s)
       void *hostaddrs = h;
 
       if (f & PCC_Copy)
-	kinds = GOMP_MAP_ALLOC_TO;
+	kinds = GOMP_MAP_TO;
       else
 	kinds = GOMP_MAP_ALLOC;
 
diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c
index 3726794..abe6aa9 100644
--- libgomp/oacc-parallel.c
+++ libgomp/oacc-parallel.c
@@ -38,36 +38,6 @@
 #include <assert.h>
 #include <alloca.h>
 
-static void
-dump_var (char *s, size_t idx, void *hostaddr, size_t size, unsigned char kind)
-{
-  gomp_debug (0, " %2zi: %3s 0x%.2x -", idx, s, kind & 0xff);
-
-  switch (kind & 0xff)
-    {
-      case 0x00: gomp_debug (0, " ALLOC              "); break;
-      case 0x01: gomp_debug (0, " ALLOC TO           "); break;
-      case 0x02: gomp_debug (0, " ALLOC FROM         "); break;
-      case 0x03: gomp_debug (0, " ALLOC TOFROM       "); break;
-      case 0x04: gomp_debug (0, " POINTER            "); break;
-      case 0x05: gomp_debug (0, " TO_PSET            "); break;
-
-      case 0x08: gomp_debug (0, " FORCE_ALLOC        "); break;
-      case 0x09: gomp_debug (0, " FORCE_TO           "); break;
-      case 0x0a: gomp_debug (0, " FORCE_FROM         "); break;
-      case 0x0b: gomp_debug (0, " FORCE_TOFROM       "); break;
-      case 0x0c: gomp_debug (0, " FORCE_PRESENT      "); break;
-      case 0x0d: gomp_debug (0, " FORCE_DEALLOC      "); break;
-      case 0x0e: gomp_debug (0, " FORCE_DEVICEPTR    "); break;
-
-      case (unsigned char) -1: gomp_debug (0, " DUMMY              "); break;
-      default: gomp_debug (0, "UGH! 0x%x\n", kind);
-    }
-    
-  gomp_debug (0, "- %d - %4d/0x%04x ", 1 << (kind >> 8), (int) size, (int) size);
-  gomp_debug (0, "- %p\n", hostaddr);
-}
-
 static int
 find_pset (int pos, size_t mapnum, unsigned short *kinds)
 {
@@ -90,7 +60,7 @@ select_acc_device (int device_type)
 {
   goacc_lazy_initialize ();
 
-  if (device_type == GOMP_IF_CLAUSE_FALSE)
+  if (device_type == GOMP_DEVICE_HOST_FALLBACK)
     return;
 
   if (device_type == acc_device_none)
@@ -114,7 +84,7 @@ GOACC_parallel (int device, void (*fn) (void *), const void *offload_table,
 		int num_gangs, int num_workers, int vector_length,
 		int async, int num_waits, ...)
 {
-  bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+  bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   va_list ap;
   struct goacc_thread *thr;
   struct gomp_device_descr *acc_dev;
@@ -139,7 +109,7 @@ GOACC_parallel (int device, void (*fn) (void *), const void *offload_table,
 
   /* Host fallback if "if" clause is false or if the current device is set to
      the host.  */
-  if (!if_clause_condition_value)
+  if (host_fallback)
     {
       goacc_save_and_set_bind (acc_device_host);
       fn (hostaddrs);
@@ -206,7 +176,7 @@ void
 GOACC_data_start (int device, const void *offload_table, size_t mapnum,
 		  void **hostaddrs, size_t *sizes, unsigned short *kinds)
 {
-  bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+  bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   struct target_mem_desc *tgt;
 
   gomp_debug (0, "%s: mapnum=%zd, hostaddrs=%p, sizes=%p, kinds=%p\n",
@@ -219,7 +189,7 @@ GOACC_data_start (int device, const void *offload_table, size_t mapnum,
 
   /* Host fallback or 'do nothing'.  */
   if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
-      || !if_clause_condition_value)
+      || host_fallback)
     {
       tgt = gomp_map_vars (NULL, 0, NULL, NULL, NULL, NULL, true, false);
       tgt->prev = thr->mapped_data;
@@ -255,7 +225,7 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
 {
   struct goacc_thread *thr;
   struct gomp_device_descr *acc_dev;
-  bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+  bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   bool data_enter = false;
   size_t i;
 
@@ -265,7 +235,7 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
   acc_dev = thr->dev;
 
   if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
-      || !if_clause_condition_value)
+      || host_fallback)
     return;
 
   if (num_waits > 0)
@@ -289,14 +259,16 @@ GOACC_enter_exit_data (int device, const void *offload_table, size_t mapnum,
       if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET)
 	continue;
 
-      if (kind == GOMP_MAP_FORCE_ALLOC || kind == GOMP_MAP_FORCE_PRESENT
+      if (kind == GOMP_MAP_FORCE_ALLOC
+	  || kind == GOMP_MAP_FORCE_PRESENT
 	  || kind == GOMP_MAP_FORCE_TO)
 	{
 	  data_enter = true;
 	  break;
 	}
 
-      if (kind == GOMP_MAP_FORCE_DEALLOC || kind == GOMP_MAP_FORCE_FROM)
+      if (kind == GOMP_MAP_FORCE_DEALLOC
+	  || kind == GOMP_MAP_FORCE_FROM)
 	break;
 
       gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
@@ -466,7 +438,7 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
 	      void **hostaddrs, size_t *sizes, unsigned short *kinds,
 	      int async, int num_waits, ...)
 {
-  bool if_clause_condition_value = device != GOMP_IF_CLAUSE_FALSE;
+  bool host_fallback = device == GOMP_DEVICE_HOST_FALLBACK;
   size_t i;
 
   select_acc_device (device);
@@ -475,7 +447,7 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
   struct gomp_device_descr *acc_dev = thr->dev;
 
   if ((acc_dev->capabilities & TARGET_CAP_SHARED_MEM)
-      || !if_clause_condition_value)
+      || host_fallback)
     return;
 
   if (num_waits > 0)
@@ -495,8 +467,6 @@ GOACC_update (int device, const void *offload_table, size_t mapnum,
     {
       unsigned char kind = kinds[i] & 0xff;
 
-      dump_var ("UPD", i, hostaddrs[i], sizes[i], kinds[i]);
-
       switch (kind)
 	{
 	case GOMP_MAP_POINTER:
diff --git libgomp/openacc.f90 libgomp/openacc.f90
index c2952e7..7d4710f 100644
--- libgomp/openacc.f90
+++ libgomp/openacc.f90
@@ -39,6 +39,7 @@ module openacc_kinds
   public :: acc_device_none, acc_device_default, acc_device_host
   public :: acc_device_not_host, acc_device_nvidia
 
+  ! Keep in sync with include/gomp-constants.h.
   integer (acc_device_kind), parameter :: acc_device_none = 0
   integer (acc_device_kind), parameter :: acc_device_default = 1
   integer (acc_device_kind), parameter :: acc_device_host = 2
@@ -52,6 +53,7 @@ module openacc_kinds
 
   public :: acc_async_noval, acc_async_sync
 
+  ! Keep in sync with include/gomp-constants.h.
   integer (acc_handle_kind), parameter :: acc_async_noval = -1
   integer (acc_handle_kind), parameter :: acc_async_sync = -2
 
diff --git libgomp/openacc.h libgomp/openacc.h
index 4ac1365..dd8c2b8 100644
--- libgomp/openacc.h
+++ libgomp/openacc.h
@@ -29,8 +29,6 @@
 #ifndef _OPENACC_H
 #define _OPENACC_H 1
 
-#include "gomp-constants.h"
-
 /* The OpenACC std is silent on whether or not including openacc.h
    might or must not include other header files.  We chose to include
    some.  */
@@ -51,18 +49,19 @@ extern "C" {
   /* Types */
   typedef enum acc_device_t
     {
+      /* Keep in sync with include/gomp-constants.h.  */
       acc_device_none = 0,
-      acc_device_default, /* This has to be a distinct value, as no
-			     return value can match it.  */
-      acc_device_host = GOMP_TARGET_HOST,
-      acc_device_host_nonshm = GOMP_TARGET_HOST_NONSHM,
-      acc_device_not_host,
-      acc_device_nvidia = GOMP_TARGET_NVIDIA_PTX,
+      acc_device_default = 1,
+      acc_device_host = 2,
+      acc_device_host_nonshm = 3,
+      acc_device_not_host = 4,
+      acc_device_nvidia = 5,
       _ACC_device_hwm
     } acc_device_t;
 
   typedef enum acc_async_t
     {
+      /* Keep in sync with include/gomp-constants.h.  */
       acc_async_noval = -1,
       acc_async_sync  = -2
     } acc_async_t;
diff --git libgomp/openacc_lib.h libgomp/openacc_lib.h
index 1f630c9..4924e24 100644
--- libgomp/openacc_lib.h
+++ libgomp/openacc_lib.h
@@ -34,6 +34,7 @@
 
       integer, parameter :: acc_device_kind = 4
 
+!     Keep in sync with include/gomp-constants.h.
       integer (acc_device_kind), parameter :: acc_device_none = 0
       integer (acc_device_kind), parameter :: acc_device_default = 1
       integer (acc_device_kind), parameter :: acc_device_host = 2
@@ -43,6 +44,7 @@
 
       integer, parameter :: acc_handle_kind = 4
 
+!     Keep in sync with include/gomp-constants.h.
       integer (acc_handle_kind), parameter :: acc_async_noval = -1
       integer (acc_handle_kind), parameter :: acc_async_sync = -2
 
diff --git libgomp/target.c libgomp/target.c
index c92b43a..fc94e8f 100644
--- libgomp/target.c
+++ libgomp/target.c
@@ -100,7 +100,7 @@ gomp_get_num_devices (void)
 static struct gomp_device_descr *
 resolve_device (int device_id)
 {
-  if (device_id == -1)
+  if (device_id == GOMP_DEVICE_ICV)
     {
       struct gomp_task_icv *icv = gomp_icv (false);
       device_id = icv->default_device_var;
@@ -120,8 +120,7 @@ static inline void
 gomp_map_vars_existing (splay_tree_key oldn, splay_tree_key newn,
 			unsigned char kind)
 {
-  if ((!(kind & _GOMP_MAP_FLAG_SPECIAL)
-       && (kind & _GOMP_MAP_FLAG_FORCE))
+  if ((kind & GOMP_MAP_FLAG_FORCE)
       || oldn->host_start > newn->host_start
       || oldn->host_end < newn->host_end)
     gomp_fatal ("Trying to map into device [%p..%p) object when "
@@ -339,8 +338,7 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 		k->tgt = tgt;
 		k->tgt_offset = tgt_size;
 		tgt_size += k->host_end - k->host_start;
-		k->copy_from = GOMP_MAP_COPYFROM_P (kind & typemask)
-			       || GOMP_MAP_TOFROM_P (kind & typemask);
+		k->copy_from = GOMP_MAP_COPY_FROM_P (kind & typemask);
 		k->refcount = 1;
 		k->async_refcount = 0;
 		tgt->refcount++;
@@ -352,12 +350,12 @@ gomp_map_vars (struct gomp_device_descr *devicep, size_t mapnum,
 		switch (kind & typemask)
 		  {
 		  case GOMP_MAP_ALLOC:
-		  case GOMP_MAP_ALLOC_FROM:
+		  case GOMP_MAP_FROM:
 		  case GOMP_MAP_FORCE_ALLOC:
 		  case GOMP_MAP_FORCE_FROM:
 		    break;
-		  case GOMP_MAP_ALLOC_TO:
-		  case GOMP_MAP_ALLOC_TOFROM:
+		  case GOMP_MAP_TO:
+		  case GOMP_MAP_TOFROM:
 		  case GOMP_MAP_FORCE_TO:
 		  case GOMP_MAP_FORCE_TOFROM:
 		    /* Copy from host to device memory.  */
@@ -692,7 +690,7 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm,
 			  (void *) cur_node.host_end,
 			  (void *) n->host_start,
 			  (void *) n->host_end);
-	    if (GOMP_MAP_COPYTO_P (kind & typemask))
+	    if (GOMP_MAP_COPY_TO_P (kind & typemask))
 	      /* Copy from host to device memory.  */
 	      devicep->host2dev_func (devicep->target_id,
 				      (void *) (n->tgt->tgt_start
@@ -701,7 +699,7 @@ gomp_update (struct gomp_device_descr *devicep, struct gomp_memory_mapping *mm,
 						- n->host_start),
 				      (void *) cur_node.host_start,
 				      cur_node.host_end - cur_node.host_start);
-	    else if (GOMP_MAP_COPYFROM_P (kind & typemask))
+	    if (GOMP_MAP_COPY_FROM_P (kind & typemask))
 	      /* Copy from device to host memory.  */
 	      devicep->dev2host_func (devicep->target_id,
 				      (void *) cur_node.host_start,
@@ -826,8 +824,9 @@ gomp_fini_device (struct gomp_device_descr *devicep)
 }
 
 /* Called when encountering a target directive.  If DEVICE
-   is -1, it means use device-var ICV.  If it is -2 (or any other value
-   larger than last available hw device, use host fallback.
+   is GOMP_DEVICE_ICV, it means use device-var ICV.  If it is
+   GOMP_DEVICE_HOST_FALLBACK (or any value
+   larger than last available hw device), use host fallback.
    FN is address of host code, OFFLOAD_TABLE contains value of the
    __OFFLOAD_TABLE__ symbol in the shared library or binary that invokes
    GOMP_target.  HOSTADDRS, SIZES and KINDS are arrays
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 9ee71c4..81545db 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -162,7 +162,7 @@ proc libgomp_init { args } {
         lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs"
         lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
         lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
-	# The top-level include directory, for libgomp-constants.h.
+	# The top-level include directory, for gomp-constants.h.
 	lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/../../include"
     }
     lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)
  2014-12-17 22:32 [gomp4] Use include/gomp-constants.h more actively Thomas Schwinge
@ 2014-12-18 18:33 ` Thomas Schwinge
  2014-12-18 18:37   ` Jakub Jelinek
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2014-12-18 18:33 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

Hi!

On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> Committed to gomp-4_0-branch in r218840:
> 
> commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Wed Dec 17 22:26:24 2014 +0000
> 
>     Use include/gomp-constants.h more actively.

> diff --git gcc/tree-core.h gcc/tree-core.h
> index 743bc0d..fc61b88 100644
> --- gcc/tree-core.h
> +++ gcc/tree-core.h
> @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "alias.h"
>  #include "flags.h"
>  #include "symtab.h"
> +#include "gomp-constants.h"
>  
>  /* This file contains all the data structures that define the 'tree' type.
>     There are no accessor macros nor functions in this file. Only the

Is it actually "OK" to #include "gomp-constants.h" (living in
[GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
installed, for later use by plugins -- which then need to be able to find
gomp-constants, too, but that is not being installed?

> --- include/gomp-constants.h
> +++ include/gomp-constants.h


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)
  2014-12-18 18:33 ` Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively) Thomas Schwinge
@ 2014-12-18 18:37   ` Jakub Jelinek
  2014-12-19 18:04     ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2014-12-18 18:37 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Thu, Dec 18, 2014 at 07:25:03PM +0100, Thomas Schwinge wrote:
> Hi!
> 
> On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> > Committed to gomp-4_0-branch in r218840:
> > 
> > commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> > Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> > Date:   Wed Dec 17 22:26:24 2014 +0000
> > 
> >     Use include/gomp-constants.h more actively.
> 
> > diff --git gcc/tree-core.h gcc/tree-core.h
> > index 743bc0d..fc61b88 100644
> > --- gcc/tree-core.h
> > +++ gcc/tree-core.h
> > @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
> >  #include "alias.h"
> >  #include "flags.h"
> >  #include "symtab.h"
> > +#include "gomp-constants.h"
> >  
> >  /* This file contains all the data structures that define the 'tree' type.
> >     There are no accessor macros nor functions in this file. Only the
> 
> Is it actually "OK" to #include "gomp-constants.h" (living in
> [GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
> installed, for later use by plugins -- which then need to be able to find
> gomp-constants, too, but that is not being installed?

Generally, it must be possible to include include/ headers from gcc/
headers, even when they are used by plugins.  Otherwise system.h including
libiberty.h and safe-ctype.h etc. wouldn't work.  Perhaps you need to add
gomp-constants.h to some Makefile variable or something, look at how is
safe-ctype.h etc. handled.

That said, including gomp-constants.h from tree-core.h is I think very much
against all the Andrew's efforts to flatten headers (which is something I'm
not very happy with generally, but in this case, I think only the very few
files that really need the constants should include it).

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)
  2014-12-18 18:37   ` Jakub Jelinek
@ 2014-12-19 18:04     ` Thomas Schwinge
  2014-12-19 19:48       ` Jakub Jelinek
  2014-12-22 15:17       ` Thomas Schwinge
  0 siblings, 2 replies; 9+ messages in thread
From: Thomas Schwinge @ 2014-12-19 18:04 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 42330 bytes --]

Hi Jakub!

On Thu, 18 Dec 2014 19:33:07 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Dec 18, 2014 at 07:25:03PM +0100, Thomas Schwinge wrote:
> > On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> > > Committed to gomp-4_0-branch in r218840:
> > > 
> > > commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> > > Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> > > Date:   Wed Dec 17 22:26:24 2014 +0000
> > > 
> > >     Use include/gomp-constants.h more actively.
> > 
> > > diff --git gcc/tree-core.h gcc/tree-core.h
> > > index 743bc0d..fc61b88 100644
> > > --- gcc/tree-core.h
> > > +++ gcc/tree-core.h
> > > @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
> > >  #include "alias.h"
> > >  #include "flags.h"
> > >  #include "symtab.h"
> > > +#include "gomp-constants.h"
> > >  
> > >  /* This file contains all the data structures that define the 'tree' type.
> > >     There are no accessor macros nor functions in this file. Only the
> > 
> > Is it actually "OK" to #include "gomp-constants.h" (living in
> > [GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
> > installed, for later use by plugins -- which then need to be able to find
> > gomp-constants, too, but that is not being installed?
> 
> Generally, it must be possible to include include/ headers from gcc/
> headers, even when they are used by plugins.  Otherwise system.h including
> libiberty.h and safe-ctype.h etc. wouldn't work.  Perhaps you need to add
> gomp-constants.h to some Makefile variable or something, look at how is
> safe-ctype.h etc. handled.

Aha, that's how it is done, I guess, in gcc/Makefile.in:

    [...]
    SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
            $(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
    [...]
    PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h [...]
    [...]
    # Install the headers needed to build a plugin.
    install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
    # We keep the directory structure for files in config or c-family and .def
    # files. All other files are flattened to a single directory.
            $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
            headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
            [...]
    [...]

> That said, including gomp-constants.h from tree-core.h is I think very much
> against all the Andrew's efforts to flatten headers (which is something I'm
> not very happy with generally, but in this case, I think only the very few
> files that really need the constants should include it).

Like this (not yet applied)?

Talking about external code (GCC plugins), do we have to take any
measures about the removed enum omp_clause_map_kind?  (Would a mere
»#define omp_clause_map_kind gomp_map_kind« work?  That'd also mean that
we do have to add include/gomp-constants.h to PLUGIN_HEADERS, and get it
included automatically, I think?)

commit b1255597c6b069719960e53e385399c479c4be8b
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Dec 19 18:32:25 2014 +0100

    Replace enum omp_clause_map_kind with enum gomp_map_kind.
    
    	gcc/
    	* tree-core.h: Instead of defining enum omp_clause_map_kind, use
    	include/gomp-constants.h's enum gomp_map_kind.  Update all users.
    	include/
    	* gomp-constants.h: Populate enum gomp_map_kind.
---
 gcc/c/c-parser.c           | 38 ++++++++++++++---------------
 gcc/c/c-typeck.c           |  9 +++----
 gcc/cp/parser.c            | 38 ++++++++++++++---------------
 gcc/cp/semantics.c         |  9 +++----
 gcc/fortran/trans-openmp.c | 47 ++++++++++++++++++------------------
 gcc/gimplify.c             | 18 +++++++-------
 gcc/omp-low.c              | 60 ++++++++++++++++++++++------------------------
 gcc/tree-core.h            | 43 +++------------------------------
 gcc/tree-nested.c          |  8 +++----
 gcc/tree-pretty-print.c    | 31 ++++++++++++------------
 gcc/tree-streamer-in.c     |  2 +-
 gcc/tree-streamer-out.c    |  2 +-
 gcc/tree.h                 |  4 ++--
 include/gomp-constants.h   | 50 +++++++++++++++++++++++++++-----------
 14 files changed, 173 insertions(+), 186 deletions(-)

diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 3ad1e6b..3385a28 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -10248,45 +10248,45 @@ static tree
 c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
 			   tree list)
 {
-  enum omp_clause_map_kind kind;
+  enum gomp_map_kind kind;
   switch (c_kind)
     {
     case PRAGMA_OACC_CLAUSE_COPY:
-      kind = OMP_CLAUSE_MAP_FORCE_TOFROM;
+      kind = GOMP_MAP_FORCE_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_COPYIN:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_CREATE:
-      kind = OMP_CLAUSE_MAP_FORCE_ALLOC;
+      kind = GOMP_MAP_FORCE_ALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DELETE:
-      kind = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+      kind = GOMP_MAP_FORCE_DEALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DEVICE:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_HOST:
     case PRAGMA_OACC_CLAUSE_SELF:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT:
-      kind = OMP_CLAUSE_MAP_FORCE_PRESENT;
+      kind = GOMP_MAP_FORCE_PRESENT;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY:
-      kind = OMP_CLAUSE_MAP_TOFROM;
+      kind = GOMP_MAP_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN:
-      kind = OMP_CLAUSE_MAP_TO;
+      kind = GOMP_MAP_TO;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FROM;
+      kind = GOMP_MAP_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE:
-      kind = OMP_CLAUSE_MAP_ALLOC;
+      kind = GOMP_MAP_ALLOC;
       break;
     default:
       gcc_unreachable ();
@@ -10331,7 +10331,7 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -11372,7 +11372,7 @@ static tree
 c_parser_omp_clause_map (c_parser *parser, tree list)
 {
   location_t clause_loc = c_parser_peek_token (parser)->location;
-  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
+  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
   tree nl, c;
 
   if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
@@ -11383,13 +11383,13 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
     {
       const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
       if (strcmp ("alloc", p) == 0)
-	kind = OMP_CLAUSE_MAP_ALLOC;
+	kind = GOMP_MAP_ALLOC;
       else if (strcmp ("to", p) == 0)
-	kind = OMP_CLAUSE_MAP_TO;
+	kind = GOMP_MAP_TO;
       else if (strcmp ("from", p) == 0)
-	kind = OMP_CLAUSE_MAP_FROM;
+	kind = GOMP_MAP_FROM;
       else if (strcmp ("tofrom", p) == 0)
-	kind = OMP_CLAUSE_MAP_TOFROM;
+	kind = GOMP_MAP_TOFROM;
       else
 	{
 	  c_parser_error (parser, "invalid map kind");
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index bf436f5..9ed887f 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-family/c-ubsan.h"
 #include "cilk.h"
 #include "wide-int.h"
+#include "gomp-constants.h"
 
 /* Possible cases of implicit bad conversions.  Used to select
    diagnostic messages in convert_for_assignment.  */
@@ -11812,9 +11813,9 @@ handle_omp_array_sections (tree c)
       OMP_CLAUSE_SIZE (c) = size;
       if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
 	return false;
-      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_FORCE_DEVICEPTR);
+      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
       tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
       if (!c_mark_addressable (t))
 	return false;
       OMP_CLAUSE_DECL (c2) = t;
@@ -12237,9 +12238,9 @@ c_finish_omp_clauses (tree clauses)
 	  else if (!c_mark_addressable (t))
 	    remove = true;
 	  else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		     && (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+		     && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 			 || (OMP_CLAUSE_MAP_KIND (c)
-			     == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)))
+			     == GOMP_MAP_FORCE_DEVICEPTR)))
 		   && !lang_hooks.types.omp_mappable_type (TREE_TYPE (t)))
 	    {
 	      error_at (OMP_CLAUSE_LOCATION (c),
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 3145574..a677499 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -27829,45 +27829,45 @@ static tree
 cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
 			    tree list)
 {
-  enum omp_clause_map_kind kind;
+  enum gomp_map_kind kind;
   switch (c_kind)
     {
     case PRAGMA_OACC_CLAUSE_COPY:
-      kind = OMP_CLAUSE_MAP_FORCE_TOFROM;
+      kind = GOMP_MAP_FORCE_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_COPYIN:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_CREATE:
-      kind = OMP_CLAUSE_MAP_FORCE_ALLOC;
+      kind = GOMP_MAP_FORCE_ALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DELETE:
-      kind = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+      kind = GOMP_MAP_FORCE_DEALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DEVICE:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_HOST:
     case PRAGMA_OACC_CLAUSE_SELF:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT:
-      kind = OMP_CLAUSE_MAP_FORCE_PRESENT;
+      kind = GOMP_MAP_FORCE_PRESENT;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY:
-      kind = OMP_CLAUSE_MAP_TOFROM;
+      kind = GOMP_MAP_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN:
-      kind = OMP_CLAUSE_MAP_TO;
+      kind = GOMP_MAP_TO;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FROM;
+      kind = GOMP_MAP_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE:
-      kind = OMP_CLAUSE_MAP_ALLOC;
+      kind = GOMP_MAP_ALLOC;
       break;
     default:
       gcc_unreachable ();
@@ -27912,7 +27912,7 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -28838,7 +28838,7 @@ static tree
 cp_parser_omp_clause_map (cp_parser *parser, tree list)
 {
   tree nlist, c;
-  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
+  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
 
   if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
     return list;
@@ -28850,13 +28850,13 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list)
       const char *p = IDENTIFIER_POINTER (id);
 
       if (strcmp ("alloc", p) == 0)
-	kind = OMP_CLAUSE_MAP_ALLOC;
+	kind = GOMP_MAP_ALLOC;
       else if (strcmp ("to", p) == 0)
-	kind = OMP_CLAUSE_MAP_TO;
+	kind = GOMP_MAP_TO;
       else if (strcmp ("from", p) == 0)
-	kind = OMP_CLAUSE_MAP_FROM;
+	kind = GOMP_MAP_FROM;
       else if (strcmp ("tofrom", p) == 0)
-	kind = OMP_CLAUSE_MAP_TOFROM;
+	kind = GOMP_MAP_TOFROM;
       else
 	{
 	  cp_parser_error (parser, "invalid map kind");
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index 28d3ae8..9691ed6 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-low.h"
 #include "builtins.h"
 #include "convert.h"
+#include "gomp-constants.h"
 
 /* There routines provide a modular interface to perform many parsing
    operations.  They may therefore be used during actual parsing, or
@@ -4637,7 +4638,7 @@ handle_omp_array_sections (tree c)
 	    return false;
 	  tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 				      OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
 	  if (!cxx_mark_addressable (t))
 	    return false;
 	  OMP_CLAUSE_DECL (c2) = t;
@@ -4661,7 +4662,7 @@ handle_omp_array_sections (tree c)
 	    {
 	      tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 					  OMP_CLAUSE_MAP);
-	      OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+	      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
 	      OMP_CLAUSE_DECL (c3) = ptr;
 	      OMP_CLAUSE_DECL (c2) = convert_from_reference (ptr);
 	      OMP_CLAUSE_SIZE (c3) = size_zero_node;
@@ -5753,7 +5754,7 @@ finish_omp_clauses (tree clauses)
 	      if (processing_template_decl)
 		break;
 	      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		  && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+		  && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 		break;
 	      if (DECL_P (t))
 		error ("%qD is not a variable in %qs clause", t,
@@ -5774,7 +5775,7 @@ finish_omp_clauses (tree clauses)
 		   && !cxx_mark_addressable (t))
 	    remove = true;
 	  else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		     && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+		     && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 		   && !type_dependent_expression_p (t)
 		   && !cp_omp_mappable_type ((TREE_CODE (TREE_TYPE (t))
 					      == REFERENCE_TYPE)
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index bdc00c8..3f77bc2 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "trans-const.h"
 #include "arith.h"
 #include "omp-low.h"
+#include "gomp-constants.h"
 
 int ompws_flags;
 
@@ -1034,7 +1035,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	return;
       tree orig_decl = decl;
       c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c4) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c4) = GOMP_MAP_POINTER;
       OMP_CLAUSE_DECL (c4) = decl;
       OMP_CLAUSE_SIZE (c4) = size_int (0);
       decl = build_fold_indirect_ref (decl);
@@ -1045,7 +1046,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	      || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
 	{
 	  c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
 	  OMP_CLAUSE_DECL (c3) = unshare_expr (decl);
 	  OMP_CLAUSE_SIZE (c3) = size_int (0);
 	  decl = build_fold_indirect_ref (decl);
@@ -1062,11 +1063,11 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
       ptr = build_fold_indirect_ref (ptr);
       OMP_CLAUSE_DECL (c) = ptr;
       c2 = build_omp_clause (input_location, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_TO_PSET;
+      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_TO_PSET;
       OMP_CLAUSE_DECL (c2) = decl;
       OMP_CLAUSE_SIZE (c2) = TYPE_SIZE_UNIT (type);
       c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
       OMP_CLAUSE_DECL (c3) = gfc_conv_descriptor_data_get (decl);
       OMP_CLAUSE_SIZE (c3) = size_int (0);
       tree size = create_tmp_var (gfc_array_index_type);
@@ -1942,7 +1943,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      tree orig_decl = decl;
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -1952,7 +1953,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			{
 			  node3 = build_omp_clause (input_location,
 						    OMP_CLAUSE_MAP);
-			  OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+			  OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 			  OMP_CLAUSE_DECL (node3) = decl;
 			  OMP_CLAUSE_SIZE (node3) = size_int (0);
 			  decl = build_fold_indirect_ref (decl);
@@ -1968,12 +1969,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      OMP_CLAUSE_DECL (node) = ptr;
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = OMP_CLAUSE_MAP_TO_PSET;
+		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		      OMP_CLAUSE_SIZE (node3) = size_int (0);
@@ -2059,7 +2060,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		    {
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -2071,12 +2072,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      ptr2 = gfc_conv_descriptor_data_get (decl);
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = OMP_CLAUSE_MAP_TO_PSET;
+		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		    }
@@ -2091,7 +2092,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			}
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3) = decl;
 		    }
 		  ptr2 = fold_convert (sizetype, ptr2);
@@ -2101,37 +2102,37 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 	      switch (n->u.map_op)
 		{
 		case OMP_MAP_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_ALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_ALLOC;
 		  break;
 		case OMP_MAP_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_TO;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TO;
 		  break;
 		case OMP_MAP_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FROM;
 		  break;
 		case OMP_MAP_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_TOFROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TOFROM;
 		  break;
 		case OMP_MAP_FORCE_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_ALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_ALLOC;
 		  break;
 		case OMP_MAP_FORCE_DEALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEALLOC;
 		  break;
 		case OMP_MAP_FORCE_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_TO;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TO;
 		  break;
 		case OMP_MAP_FORCE_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_FROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_FROM;
 		  break;
 		case OMP_MAP_FORCE_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_TOFROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TOFROM;
 		  break;
 		case OMP_MAP_FORCE_PRESENT:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_PRESENT;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_PRESENT;
 		  break;
 		case OMP_MAP_FORCE_DEVICEPTR:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEVICEPTR;
 		  break;
 		default:
 		  gcc_unreachable ();
diff --git gcc/gimplify.c gcc/gimplify.c
index 6972def..4b574da 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-low.h"
 #include "gimple-low.h"
 #include "cilk.h"
+#include "gomp-constants.h"
 
 #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
 #include "tree-pass.h"		/* FIXME: only for PROP_gimple_any */
@@ -6436,8 +6437,8 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
   else if (code == OMP_CLAUSE_MAP)
     {
       OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
-				     ? OMP_CLAUSE_MAP_TO
-				     : OMP_CLAUSE_MAP_TOFROM;
+				     ? GOMP_MAP_TO
+				     : GOMP_MAP_TOFROM;
       if (DECL_SIZE (decl)
 	  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 	{
@@ -6458,7 +6459,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 				      OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (nc) = decl;
 	  OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	  OMP_CLAUSE_MAP_KIND (nc) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
 	  OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause);
 	  OMP_CLAUSE_CHAIN (clause) = nc;
 	}
@@ -6608,13 +6609,12 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 	    remove = true;
 	  else if (DECL_SIZE (decl)
 		   && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
-		   && OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_POINTER)
+		   && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_POINTER)
 	    {
-	      /* For OMP_CLAUSE_MAP_FORCE_DEVICEPTR, we'll never enter here,
-		 because for these, TREE_CODE (DECL_SIZE (decl)) will always be
+	      /* For GOMP_MAP_FORCE_DEVICEPTR, we'll never enter here, because
+		 for these, TREE_CODE (DECL_SIZE (decl)) will always be
 		 INTEGER_CST.  */
-	      gcc_assert (OMP_CLAUSE_MAP_KIND (c)
-			  != OMP_CLAUSE_MAP_FORCE_DEVICEPTR);
+	      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
 
 	      tree decl2 = DECL_VALUE_EXPR (decl);
 	      gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
@@ -6633,7 +6633,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 					  OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (nc) = decl;
 	      OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	      OMP_CLAUSE_MAP_KIND (nc) = OMP_CLAUSE_MAP_POINTER;
+	      OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
 	      OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (c);
 	      OMP_CLAUSE_CHAIN (c) = nc;
 	      c = nc;
diff --git gcc/omp-low.c gcc/omp-low.c
index 1395f24..5dd540b 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -1836,11 +1836,10 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      && varpool_node::get_create (decl)->offloadable)
 	    break;
 	  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-	      && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+	      && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 	    {
-	      /* Ignore OMP_CLAUSE_MAP_POINTER kind for arrays in
-		 regions that are not offloaded; there is nothing to map for
-		 those.  */
+	      /* Ignore GOMP_MAP_POINTER kind for arrays in regions that are
+		 not offloaded; there is nothing to map for those.  */
 	      if (!is_gimple_omp_offloaded (ctx->stmt)
 		  && !POINTER_TYPE_P (TREE_TYPE (decl)))
 		break;
@@ -1861,7 +1860,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      else
 		{
 		  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		      && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+		      && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		      && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 		      && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
 		    install_var_field (decl, true, 7, ctx);
@@ -1879,7 +1878,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		  && nc != NULL_TREE
 		  && OMP_CLAUSE_CODE (nc) == OMP_CLAUSE_MAP
 		  && OMP_CLAUSE_DECL (nc) == base
-		  && OMP_CLAUSE_MAP_KIND (nc) == OMP_CLAUSE_MAP_POINTER
+		  && OMP_CLAUSE_MAP_KIND (nc) == GOMP_MAP_POINTER
 		  && integer_zerop (OMP_CLAUSE_SIZE (nc)))
 		{
 		  OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c) = 1;
@@ -1996,7 +1995,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	    break;
 	  if (DECL_P (decl))
 	    {
-	      if (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+	      if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		  && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
 		  && !COMPLETE_TYPE_P (TREE_TYPE (decl)))
 		{
@@ -9707,7 +9706,7 @@ oacc_initialize_reduction_data (tree clauses, tree nthreads,
       /* Add the reduction array to the list of clauses.  */
       tree x = array;
       t = build_omp_clause (gimple_location (ctx->stmt), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (t) = OMP_CLAUSE_MAP_FORCE_FROM;
+      OMP_CLAUSE_MAP_KIND (t) = GOMP_MAP_FORCE_FROM;
       OMP_CLAUSE_DECL (t) = x;
       OMP_CLAUSE_CHAIN (t) = NULL;
       if (oc)
@@ -11229,20 +11228,20 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	/* First check what we're prepared to handle in the following.  */
 	switch (OMP_CLAUSE_MAP_KIND (c))
 	  {
-	  case OMP_CLAUSE_MAP_ALLOC:
-	  case OMP_CLAUSE_MAP_TO:
-	  case OMP_CLAUSE_MAP_FROM:
-	  case OMP_CLAUSE_MAP_TOFROM:
-	  case OMP_CLAUSE_MAP_POINTER:
-	  case OMP_CLAUSE_MAP_TO_PSET:
+	  case GOMP_MAP_ALLOC:
+	  case GOMP_MAP_TO:
+	  case GOMP_MAP_FROM:
+	  case GOMP_MAP_TOFROM:
+	  case GOMP_MAP_POINTER:
+	  case GOMP_MAP_TO_PSET:
 	    break;
-	  case OMP_CLAUSE_MAP_FORCE_ALLOC:
-	  case OMP_CLAUSE_MAP_FORCE_TO:
-	  case OMP_CLAUSE_MAP_FORCE_FROM:
-	  case OMP_CLAUSE_MAP_FORCE_TOFROM:
-	  case OMP_CLAUSE_MAP_FORCE_PRESENT:
-	  case OMP_CLAUSE_MAP_FORCE_DEALLOC:
-	  case OMP_CLAUSE_MAP_FORCE_DEVICEPTR:
+	  case GOMP_MAP_FORCE_ALLOC:
+	  case GOMP_MAP_FORCE_TO:
+	  case GOMP_MAP_FORCE_FROM:
+	  case GOMP_MAP_FORCE_TOFROM:
+	  case GOMP_MAP_FORCE_PRESENT:
+	  case GOMP_MAP_FORCE_DEALLOC:
+	  case GOMP_MAP_FORCE_DEVICEPTR:
 	    gcc_assert (is_gimple_omp_oacc (stmt));
 	    break;
 	  default:
@@ -11278,7 +11277,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	  {
 	    x = build_receiver_ref (var, true, ctx);
 	    tree new_var = lookup_decl (var, ctx);
-	    if (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+	    if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		&& !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 		&& TREE_CODE (TREE_TYPE (var)) == ARRAY_TYPE)
 	      x = build_simple_mem_ref (x);
@@ -11407,7 +11406,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		    gimplify_assign (x, var, &ilist);
 		  }
 		else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-			 && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+			 && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 			 && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 			 && TREE_CODE (TREE_TYPE (ovar)) == ARRAY_TYPE)
 		  {
@@ -11425,17 +11424,16 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		    gcc_assert (offloaded);
 		    tree avar = create_tmp_var (TREE_TYPE (var));
 		    mark_addressable (avar);
-		    enum omp_clause_map_kind map_kind
-		      = OMP_CLAUSE_MAP_KIND (c);
+		    enum gomp_map_kind map_kind = OMP_CLAUSE_MAP_KIND (c);
 		    if (GOMP_MAP_COPY_TO_P (map_kind)
-			|| map_kind == OMP_CLAUSE_MAP_POINTER
-			|| map_kind == OMP_CLAUSE_MAP_TO_PSET
-			|| map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
+			|| map_kind == GOMP_MAP_POINTER
+			|| map_kind == GOMP_MAP_TO_PSET
+			|| map_kind == GOMP_MAP_FORCE_DEVICEPTR)
 		      gimplify_assign (avar, var, &ilist);
 		    avar = build_fold_addr_expr (avar);
 		    gimplify_assign (x, avar, &ilist);
 		    if ((GOMP_MAP_COPY_FROM_P (map_kind)
-			 || map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
+			 || map_kind == GOMP_MAP_FORCE_DEVICEPTR)
 			&& !TYPE_READONLY (TREE_TYPE (var)))
 		      {
 			x = build_sender_ref (ovar, ctx);
@@ -11465,10 +11463,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		tkind = OMP_CLAUSE_MAP_KIND (c);
 		break;
 	      case OMP_CLAUSE_TO:
-		tkind = OMP_CLAUSE_MAP_TO;
+		tkind = GOMP_MAP_TO;
 		break;
 	      case OMP_CLAUSE_FROM:
-		tkind = OMP_CLAUSE_MAP_FROM;
+		tkind = GOMP_MAP_FROM;
 		break;
 	      default:
 		gcc_unreachable ();
diff --git gcc/tree-core.h gcc/tree-core.h
index 66e6b5a..f22d4f9 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -1239,45 +1239,8 @@ enum omp_clause_depend_kind
   OMP_CLAUSE_DEPEND_LAST
 };
 
-enum omp_clause_map_kind
-{
-  /* If not already present, allocate.  */
-  OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
-  /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
-  /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
-  /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
-  /* The following kind is an internal only map kind, used for pointer based
-     array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
-     which is implicitly POINTER_SIZE_UNITS, but the bias.  */
-  OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
-  /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
-     OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
-     falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
-     wasn't mapped already.  */
-  OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
-  /* The following are only valid for OpenACC.  */
-  /* Allocate.  */
-  OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
-  /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
-  /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
-  /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
-  /* Must already be present.  */
-  OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
-  /* Deallocate a mapping, without copying from device.  */
-  OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
-  /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
-     POINTER_SIZE_UNITS.  */
-  OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
-
-  /* End marker.  */
-  OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
-};
+/* See include/gomp-constants.h.  */
+enum gomp_map_kind;
 
 enum omp_clause_proc_bind_kind
 {
@@ -1350,7 +1313,7 @@ struct GTY(()) tree_omp_clause {
     enum omp_clause_default_kind   default_kind;
     enum omp_clause_schedule_kind  schedule_kind;
     enum omp_clause_depend_kind    depend_kind;
-    enum omp_clause_map_kind       map_kind;
+    enum gomp_map_kind		   map_kind;
     enum omp_clause_proc_bind_kind proc_bind_kind;
     enum tree_code                 reduction_code;
   } GTY ((skip)) subcode;
diff --git gcc/tree-nested.c gcc/tree-nested.c
index 6a3e587..714375d 100644
--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -54,6 +54,7 @@
 #include "expr.h"	/* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL.  */
 #include "langhooks.h"
 #include "gimple-low.h"
+#include "gomp-constants.h"
 
 
 /* The object of this pass is to lower the representation of a set of nested
@@ -1399,7 +1400,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  decl = get_chain_decl (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = decl;
-	  OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TO;
+	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TO;
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -1965,7 +1966,7 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  (void) get_frame_type (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = info->frame_decl;
-	  OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TOFROM;
+	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TOFROM;
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (info->frame_decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -2406,8 +2407,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	    {
 	      c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (c) = decl;
-	      OMP_CLAUSE_MAP_KIND (c)
-		= i ? OMP_CLAUSE_MAP_TO : OMP_CLAUSE_MAP_TOFROM;
+	      OMP_CLAUSE_MAP_KIND (c) = i ? GOMP_MAP_TO : GOMP_MAP_TOFROM;
 	      OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	      OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	      gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt),
diff --git gcc/tree-pretty-print.c gcc/tree-pretty-print.c
index 80ab17a..52588ac 100644
--- gcc/tree-pretty-print.c
+++ gcc/tree-pretty-print.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "value-prof.h"
 #include "wide-int-print.h"
 #include "internal-fn.h"
+#include "gomp-constants.h"
 
 /* Local functions, macros and variables.  */
 static const char *op_symbol (const_tree);
@@ -516,39 +517,39 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
       pp_string (pp, "map(");
       switch (OMP_CLAUSE_MAP_KIND (clause))
 	{
-	case OMP_CLAUSE_MAP_ALLOC:
-	case OMP_CLAUSE_MAP_POINTER:
+	case GOMP_MAP_ALLOC:
+	case GOMP_MAP_POINTER:
 	  pp_string (pp, "alloc");
 	  break;
-	case OMP_CLAUSE_MAP_TO:
-	case OMP_CLAUSE_MAP_TO_PSET:
+	case GOMP_MAP_TO:
+	case GOMP_MAP_TO_PSET:
 	  pp_string (pp, "to");
 	  break;
-	case OMP_CLAUSE_MAP_FROM:
+	case GOMP_MAP_FROM:
 	  pp_string (pp, "from");
 	  break;
-	case OMP_CLAUSE_MAP_TOFROM:
+	case GOMP_MAP_TOFROM:
 	  pp_string (pp, "tofrom");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_ALLOC:
+	case GOMP_MAP_FORCE_ALLOC:
 	  pp_string (pp, "force_alloc");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_TO:
+	case GOMP_MAP_FORCE_TO:
 	  pp_string (pp, "force_to");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_FROM:
+	case GOMP_MAP_FORCE_FROM:
 	  pp_string (pp, "force_from");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_TOFROM:
+	case GOMP_MAP_FORCE_TOFROM:
 	  pp_string (pp, "force_tofrom");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_PRESENT:
+	case GOMP_MAP_FORCE_PRESENT:
 	  pp_string (pp, "force_present");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_DEALLOC:
+	case GOMP_MAP_FORCE_DEALLOC:
 	  pp_string (pp, "force_dealloc");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_DEVICEPTR:
+	case GOMP_MAP_FORCE_DEVICEPTR:
 	  pp_string (pp, "force_deviceptr");
 	  break;
 	default:
@@ -561,10 +562,10 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
       if (OMP_CLAUSE_SIZE (clause))
 	{
 	  if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
-	      && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_POINTER)
+	      && OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_POINTER)
 	    pp_string (pp, " [pointer assign, bias: ");
 	  else if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
-		   && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_TO_PSET)
+		   && OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_TO_PSET)
 	    pp_string (pp, " [pointer set, len: ");
 	  else
 	    pp_string (pp, " [len: ");
diff --git gcc/tree-streamer-in.c gcc/tree-streamer-in.c
index eb205ed..cf05ed4 100644
--- gcc/tree-streamer-in.c
+++ gcc/tree-streamer-in.c
@@ -427,7 +427,7 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
       break;
     case OMP_CLAUSE_MAP:
       OMP_CLAUSE_MAP_KIND (expr)
-	= bp_unpack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST);
+	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
       break;
     case OMP_CLAUSE_PROC_BIND:
       OMP_CLAUSE_PROC_BIND_KIND (expr)
diff --git gcc/tree-streamer-out.c gcc/tree-streamer-out.c
index 0d87cff..80cf9bb 100644
--- gcc/tree-streamer-out.c
+++ gcc/tree-streamer-out.c
@@ -387,7 +387,7 @@ pack_ts_omp_clause_value_fields (struct output_block *ob,
 		    OMP_CLAUSE_DEPEND_KIND (expr));
       break;
     case OMP_CLAUSE_MAP:
-      bp_pack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST,
+      bp_pack_enum (bp, gomp_map_kind, GOMP_MAP_LAST,
 		    OMP_CLAUSE_MAP_KIND (expr));
       break;
     case OMP_CLAUSE_PROC_BIND:
diff --git gcc/tree.h gcc/tree.h
index 41be2c8..70a4169 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -1402,8 +1402,8 @@ extern void protected_set_expr_location (tree, location_t);
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
 
 /* Nonzero if this map clause is for array (rather than pointer) based array
-   section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and
-   correspoidng OMP_CLAUSE_MAP_POINTER clause are marked with this flag.  */
+   section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding
+   OMP_CLAUSE_MAP with GOMP_MAP_POINTER are marked with this flag.  */
 #define OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION(NODE) \
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.public_flag)
 
diff --git include/gomp-constants.h include/gomp-constants.h
index b5f8d88..ff0dd14 100644
--- include/gomp-constants.h
+++ include/gomp-constants.h
@@ -32,7 +32,7 @@
 /* Memory mapping types.  */
 
 /* One byte.  */
-#define GOMP_MAP_VALUE_LIMIT		(1 << 8)
+#define GOMP_MAP_LAST			(1 << 8)
 
 #define GOMP_MAP_FLAG_TO		(1 << 0)
 #define GOMP_MAP_FLAG_FROM		(1 << 1)
@@ -44,19 +44,41 @@
 /* Flag to force a specific behavior (or else, trigger a run-time error).  */
 #define GOMP_MAP_FLAG_FORCE		(1 << 7)
 
-#define GOMP_MAP_ALLOC			0
-#define GOMP_MAP_TO			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
-#define GOMP_MAP_FROM			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
-#define GOMP_MAP_TOFROM			(GOMP_MAP_TO | GOMP_MAP_FROM)
-#define GOMP_MAP_POINTER		(GOMP_MAP_FLAG_SPECIAL_0 | 0)
-#define GOMP_MAP_TO_PSET		(GOMP_MAP_FLAG_SPECIAL_0 | 1)
-#define GOMP_MAP_FORCE_PRESENT		(GOMP_MAP_FLAG_SPECIAL_0 | 2)
-#define GOMP_MAP_FORCE_DEALLOC		(GOMP_MAP_FLAG_SPECIAL_0 | 3)
-#define GOMP_MAP_FORCE_DEVICEPTR	(GOMP_MAP_FLAG_SPECIAL_1 | 0)
-#define GOMP_MAP_FORCE_ALLOC		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
-#define GOMP_MAP_FORCE_TO		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
-#define GOMP_MAP_FORCE_FROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
-#define GOMP_MAP_FORCE_TOFROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
+enum gomp_map_kind
+  {
+    /* If not already present, allocate.  */
+    GOMP_MAP_ALLOC =			0,
+    /* ..., and copy to device.  */
+    GOMP_MAP_TO =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
+    /* ..., and copy from device.  */
+    GOMP_MAP_FROM =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
+    /* ..., and copy to and from device.  */
+    GOMP_MAP_TOFROM =			(GOMP_MAP_TO | GOMP_MAP_FROM),
+    /* The following kind is an internal only map kind, used for pointer based
+       array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
+       which is implicitly POINTER_SIZE_UNITS, but the bias.  */
+    GOMP_MAP_POINTER =			(GOMP_MAP_FLAG_SPECIAL_0 | 0),
+    /* Also internal, behaves like GOMP_MAP_TO, but additionally any
+       GOMP_MAP_POINTER records consecutive after it which have addresses
+       falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
+       mapped already.  */
+    GOMP_MAP_TO_PSET =			(GOMP_MAP_FLAG_SPECIAL_0 | 1),
+    /* Must already be present.  */
+    GOMP_MAP_FORCE_PRESENT =		(GOMP_MAP_FLAG_SPECIAL_0 | 2),
+    /* Deallocate a mapping, without copying from device.  */
+    GOMP_MAP_FORCE_DEALLOC =		(GOMP_MAP_FLAG_SPECIAL_0 | 3),
+    /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
+       POINTER_SIZE_UNITS.  */
+    GOMP_MAP_FORCE_DEVICEPTR =		(GOMP_MAP_FLAG_SPECIAL_1 | 0),
+    /* Allocate.  */
+    GOMP_MAP_FORCE_ALLOC =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
+    /* ..., and copy to device.  */
+    GOMP_MAP_FORCE_TO =			(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
+    /* ..., and copy from device.  */
+    GOMP_MAP_FORCE_FROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
+    /* ..., and copy to and from device.  */
+    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
+  };
 
 #define GOMP_MAP_COPY_TO_P(X) \
   (!((X) & GOMP_MAP_FLAG_SPECIAL) \


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)
  2014-12-19 18:04     ` Thomas Schwinge
@ 2014-12-19 19:48       ` Jakub Jelinek
  2014-12-22 15:17       ` Thomas Schwinge
  1 sibling, 0 replies; 9+ messages in thread
From: Jakub Jelinek @ 2014-12-19 19:48 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches

On Fri, Dec 19, 2014 at 06:54:04PM +0100, Thomas Schwinge wrote:
> Like this (not yet applied)?

I think it is fine, though the ChangeLog entry is not.  Though in the late
of hopefully soonish merge and creation of full ChangeLog entry it is not a
big deal.

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively)
  2014-12-19 18:04     ` Thomas Schwinge
  2014-12-19 19:48       ` Jakub Jelinek
@ 2014-12-22 15:17       ` Thomas Schwinge
  2015-01-12 17:01         ` [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h) Thomas Schwinge
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2014-12-22 15:17 UTC (permalink / raw)
  To: michael.collison, Andrew MacLeod, David Malcolm
  Cc: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 13390 bytes --]

Hi!

I'm sending this again with some more people copied -- because I see
you're working on tree.h/tree-core.h flattening, or know you're familiar
with GCC plugins.  ;-) Here is a question concerning both of that, where
I'd appreciate your input.

(That said, I don't find a "GCC plugins" person listed in the MAINTAINERS
file, would that be worth adding?)

Full quote follows:

On Fri, 19 Dec 2014 18:54:04 +0100, I wrote:
> On Thu, 18 Dec 2014 19:33:07 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Dec 18, 2014 at 07:25:03PM +0100, Thomas Schwinge wrote:
> > > On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> > > > Committed to gomp-4_0-branch in r218840:
> > > > 
> > > > commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> > > > Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> > > > Date:   Wed Dec 17 22:26:24 2014 +0000
> > > > 
> > > >     Use include/gomp-constants.h more actively.
> > > 
> > > > diff --git gcc/tree-core.h gcc/tree-core.h
> > > > index 743bc0d..fc61b88 100644
> > > > --- gcc/tree-core.h
> > > > +++ gcc/tree-core.h
> > > > @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
> > > >  #include "alias.h"
> > > >  #include "flags.h"
> > > >  #include "symtab.h"
> > > > +#include "gomp-constants.h"
> > > >  
> > > >  /* This file contains all the data structures that define the 'tree' type.
> > > >     There are no accessor macros nor functions in this file. Only the
> > > 
> > > Is it actually "OK" to #include "gomp-constants.h" (living in
> > > [GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
> > > installed, for later use by plugins -- which then need to be able to find
> > > gomp-constants, too, but that is not being installed?
> > 
> > Generally, it must be possible to include include/ headers from gcc/
> > headers, even when they are used by plugins.  Otherwise system.h including
> > libiberty.h and safe-ctype.h etc. wouldn't work.  Perhaps you need to add
> > gomp-constants.h to some Makefile variable or something, look at how is
> > safe-ctype.h etc. handled.
> 
> Aha, that's how it is done, I guess, in gcc/Makefile.in:
> 
>     [...]
>     SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
>             $(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
>     [...]
>     PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h [...]
>     [...]
>     # Install the headers needed to build a plugin.
>     install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
>     # We keep the directory structure for files in config or c-family and .def
>     # files. All other files are flattened to a single directory.
>             $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
>             headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
>             [...]
>     [...]
> 
> > That said, including gomp-constants.h from tree-core.h is I think very much
> > against all the Andrew's efforts to flatten headers (which is something I'm
> > not very happy with generally, but in this case, I think only the very few
> > files that really need the constants should include it).
> 
> Like this (not yet applied)?

[Jakub: »I think it is fine.«]

> Talking about external code (GCC plugins), do we have to take any
> measures about the removed enum omp_clause_map_kind?  (Would a mere
> »#define omp_clause_map_kind gomp_map_kind« work?  That'd also mean that
> we do have to add include/gomp-constants.h to PLUGIN_HEADERS, and get it
> included automatically, I think?)
> 
> commit b1255597c6b069719960e53e385399c479c4be8b
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Fri Dec 19 18:32:25 2014 +0100
> 
>     Replace enum omp_clause_map_kind with enum gomp_map_kind.
>     
>     	gcc/
>     	* tree-core.h: Instead of defining enum omp_clause_map_kind, use
>     	include/gomp-constants.h's enum gomp_map_kind.  Update all users.
>     	include/
>     	* gomp-constants.h: Populate enum gomp_map_kind.
> ---
>  gcc/c/c-parser.c           | 38 ++++++++++++++---------------
>  gcc/c/c-typeck.c           |  9 +++----
>  gcc/cp/parser.c            | 38 ++++++++++++++---------------
>  gcc/cp/semantics.c         |  9 +++----
>  gcc/fortran/trans-openmp.c | 47 ++++++++++++++++++------------------
>  gcc/gimplify.c             | 18 +++++++-------
>  gcc/omp-low.c              | 60 ++++++++++++++++++++++------------------------
>  gcc/tree-core.h            | 43 +++------------------------------
>  gcc/tree-nested.c          |  8 +++----
>  gcc/tree-pretty-print.c    | 31 ++++++++++++------------
>  gcc/tree-streamer-in.c     |  2 +-
>  gcc/tree-streamer-out.c    |  2 +-
>  gcc/tree.h                 |  4 ++--
>  include/gomp-constants.h   | 50 +++++++++++++++++++++++++++-----------
>  14 files changed, 173 insertions(+), 186 deletions(-)

Here is (this is on top of gomp-4_0-branch, by the way) the patch:
reordererd, and snipped to relevant parts.

The new "provider":

> --- include/gomp-constants.h
> +++ include/gomp-constants.h
> @@ -32,7 +32,7 @@
>  /* Memory mapping types.  */
>  
>  /* One byte.  */
> -#define GOMP_MAP_VALUE_LIMIT		(1 << 8)
> +#define GOMP_MAP_LAST			(1 << 8)
>  
>  #define GOMP_MAP_FLAG_TO		(1 << 0)
>  #define GOMP_MAP_FLAG_FROM		(1 << 1)
> @@ -44,19 +44,41 @@
>  /* Flag to force a specific behavior (or else, trigger a run-time error).  */
>  #define GOMP_MAP_FLAG_FORCE		(1 << 7)
>  
> -#define GOMP_MAP_ALLOC			0
> -#define GOMP_MAP_TO			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
> -#define GOMP_MAP_FROM			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
> -#define GOMP_MAP_TOFROM			(GOMP_MAP_TO | GOMP_MAP_FROM)
> -#define GOMP_MAP_POINTER		(GOMP_MAP_FLAG_SPECIAL_0 | 0)
> -#define GOMP_MAP_TO_PSET		(GOMP_MAP_FLAG_SPECIAL_0 | 1)
> -#define GOMP_MAP_FORCE_PRESENT		(GOMP_MAP_FLAG_SPECIAL_0 | 2)
> -#define GOMP_MAP_FORCE_DEALLOC		(GOMP_MAP_FLAG_SPECIAL_0 | 3)
> -#define GOMP_MAP_FORCE_DEVICEPTR	(GOMP_MAP_FLAG_SPECIAL_1 | 0)
> -#define GOMP_MAP_FORCE_ALLOC		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
> -#define GOMP_MAP_FORCE_TO		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
> -#define GOMP_MAP_FORCE_FROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
> -#define GOMP_MAP_FORCE_TOFROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
> +enum gomp_map_kind
> +  {
> +    /* If not already present, allocate.  */
> +    GOMP_MAP_ALLOC =			0,
> +    /* ..., and copy to device.  */
> +    GOMP_MAP_TO =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
> +    /* ..., and copy from device.  */
> +    GOMP_MAP_FROM =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
> +    /* ..., and copy to and from device.  */
> +    GOMP_MAP_TOFROM =			(GOMP_MAP_TO | GOMP_MAP_FROM),
> +    /* The following kind is an internal only map kind, used for pointer based
> +       array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
> +       which is implicitly POINTER_SIZE_UNITS, but the bias.  */
> +    GOMP_MAP_POINTER =			(GOMP_MAP_FLAG_SPECIAL_0 | 0),
> +    /* Also internal, behaves like GOMP_MAP_TO, but additionally any
> +       GOMP_MAP_POINTER records consecutive after it which have addresses
> +       falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
> +       mapped already.  */
> +    GOMP_MAP_TO_PSET =			(GOMP_MAP_FLAG_SPECIAL_0 | 1),
> +    /* Must already be present.  */
> +    GOMP_MAP_FORCE_PRESENT =		(GOMP_MAP_FLAG_SPECIAL_0 | 2),
> +    /* Deallocate a mapping, without copying from device.  */
> +    GOMP_MAP_FORCE_DEALLOC =		(GOMP_MAP_FLAG_SPECIAL_0 | 3),
> +    /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
> +       POINTER_SIZE_UNITS.  */
> +    GOMP_MAP_FORCE_DEVICEPTR =		(GOMP_MAP_FLAG_SPECIAL_1 | 0),
> +    /* Allocate.  */
> +    GOMP_MAP_FORCE_ALLOC =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
> +    /* ..., and copy to device.  */
> +    GOMP_MAP_FORCE_TO =			(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
> +    /* ..., and copy from device.  */
> +    GOMP_MAP_FORCE_FROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
> +    /* ..., and copy to and from device.  */
> +    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
> +  };
>  
>  #define GOMP_MAP_COPY_TO_P(X) \
>    (!((X) & GOMP_MAP_FLAG_SPECIAL) \

The former "provider":

> --- gcc/tree-core.h
> +++ gcc/tree-core.h
> @@ -1239,45 +1239,8 @@ enum omp_clause_depend_kind
>    OMP_CLAUSE_DEPEND_LAST
>  };
>  
> -enum omp_clause_map_kind
> -{
> -  /* If not already present, allocate.  */
> -  OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
> -  /* ..., and copy to device.  */
> -  OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
> -  /* ..., and copy from device.  */
> -  OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
> -  /* ..., and copy to and from device.  */
> -  OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
> -  /* The following kind is an internal only map kind, used for pointer based
> -     array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
> -     which is implicitly POINTER_SIZE_UNITS, but the bias.  */
> -  OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
> -  /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
> -     OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
> -     falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
> -     wasn't mapped already.  */
> -  OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
> -  /* The following are only valid for OpenACC.  */
> -  /* Allocate.  */
> -  OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
> -  /* ..., and copy to device.  */
> -  OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
> -  /* ..., and copy from device.  */
> -  OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
> -  /* ..., and copy to and from device.  */
> -  OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
> -  /* Must already be present.  */
> -  OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
> -  /* Deallocate a mapping, without copying from device.  */
> -  OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
> -  /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
> -     POINTER_SIZE_UNITS.  */
> -  OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
> -
> -  /* End marker.  */
> -  OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
> -};
> +/* See include/gomp-constants.h.  */
> +enum gomp_map_kind;
>  
>  enum omp_clause_proc_bind_kind
>  {
> @@ -1350,7 +1313,7 @@ struct GTY(()) tree_omp_clause {
>      enum omp_clause_default_kind   default_kind;
>      enum omp_clause_schedule_kind  schedule_kind;
>      enum omp_clause_depend_kind    depend_kind;
> -    enum omp_clause_map_kind       map_kind;
> +    enum gomp_map_kind		   map_kind;
>      enum omp_clause_proc_bind_kind proc_bind_kind;
>      enum tree_code                 reduction_code;
>    } GTY ((skip)) subcode;

A sample of the "consumers":

> --- gcc/c/c-parser.c
> +++ gcc/c/c-parser.c
> [...]
> @@ -11372,7 +11372,7 @@ static tree
>  c_parser_omp_clause_map (c_parser *parser, tree list)
>  {
>    location_t clause_loc = c_parser_peek_token (parser)->location;
> -  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
> +  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
>    tree nl, c;
>  
>    if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
> @@ -11383,13 +11383,13 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
>      {
>        const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
>        if (strcmp ("alloc", p) == 0)
> -	kind = OMP_CLAUSE_MAP_ALLOC;
> +	kind = GOMP_MAP_ALLOC;
> [...]
> --- gcc/gimplify.c
> +++ gcc/gimplify.c
> @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "omp-low.h"
>  #include "gimple-low.h"
>  #include "cilk.h"
> +#include "gomp-constants.h"
>  
>  #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
>  #include "tree-pass.h"		/* FIXME: only for PROP_gimple_any */
> @@ -6436,8 +6437,8 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
>    else if (code == OMP_CLAUSE_MAP)
>      {
>        OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
> -				     ? OMP_CLAUSE_MAP_TO
> -				     : OMP_CLAUSE_MAP_TOFROM;
> +				     ? GOMP_MAP_TO
> +				     : GOMP_MAP_TOFROM;
> [...]
> --- gcc/tree-streamer-in.c
> +++ gcc/tree-streamer-in.c
> @@ -427,7 +427,7 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
>        break;
>      case OMP_CLAUSE_MAP:
>        OMP_CLAUSE_MAP_KIND (expr)
> -	= bp_unpack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST);
> +	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
>        break;
>      case OMP_CLAUSE_PROC_BIND:
>        OMP_CLAUSE_PROC_BIND_KIND (expr)
> --- gcc/tree-streamer-out.c
> +++ gcc/tree-streamer-out.c
> @@ -387,7 +387,7 @@ pack_ts_omp_clause_value_fields (struct output_block *ob,
>  		    OMP_CLAUSE_DEPEND_KIND (expr));
>        break;
>      case OMP_CLAUSE_MAP:
> -      bp_pack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST,
> +      bp_pack_enum (bp, gomp_map_kind, GOMP_MAP_LAST,
>  		    OMP_CLAUSE_MAP_KIND (expr));
>        break;
>      case OMP_CLAUSE_PROC_BIND:


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h)
  2014-12-22 15:17       ` Thomas Schwinge
@ 2015-01-12 17:01         ` Thomas Schwinge
  2015-01-12 18:00           ` Jakub Jelinek
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Schwinge @ 2015-01-12 17:01 UTC (permalink / raw)
  To: michael.collison, Andrew MacLeod, David Malcolm
  Cc: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 57132 bytes --]

Hi!

On Mon, 22 Dec 2014 16:13:01 +0100, I wrote:
> I'm sending this again with some more people copied -- because I see
> you're working on tree.h/tree-core.h flattening, or know you're familiar
> with GCC plugins.  ;-) Here is a question concerning both of that, where
> I'd appreciate your input.
> 
> (That said, I don't find a "GCC plugins" person listed in the MAINTAINERS
> file, would that be worth adding?)
> 
> Full quote follows:
> 
> On Fri, 19 Dec 2014 18:54:04 +0100, I wrote:
> > On Thu, 18 Dec 2014 19:33:07 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> > > On Thu, Dec 18, 2014 at 07:25:03PM +0100, Thomas Schwinge wrote:
> > > > On Wed, 17 Dec 2014 23:26:53 +0100, I wrote:
> > > > > Committed to gomp-4_0-branch in r218840:
> > > > > 
> > > > > commit febcd8dfdb10fa80edff0880973d1915ca2fef74
> > > > > Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
> > > > > Date:   Wed Dec 17 22:26:24 2014 +0000
> > > > > 
> > > > >     Use include/gomp-constants.h more actively.
> > > > 
> > > > > diff --git gcc/tree-core.h gcc/tree-core.h
> > > > > index 743bc0d..fc61b88 100644
> > > > > --- gcc/tree-core.h
> > > > > +++ gcc/tree-core.h
> > > > > @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
> > > > >  #include "alias.h"
> > > > >  #include "flags.h"
> > > > >  #include "symtab.h"
> > > > > +#include "gomp-constants.h"
> > > > >  
> > > > >  /* This file contains all the data structures that define the 'tree' type.
> > > > >     There are no accessor macros nor functions in this file. Only the
> > > > 
> > > > Is it actually "OK" to #include "gomp-constants.h" (living in
> > > > [GCC]/include/) from gcc/tree-core.h?  Isn't the tree-core.h file getting
> > > > installed, for later use by plugins -- which then need to be able to find
> > > > gomp-constants, too, but that is not being installed?
> > > 
> > > Generally, it must be possible to include include/ headers from gcc/
> > > headers, even when they are used by plugins.  Otherwise system.h including
> > > libiberty.h and safe-ctype.h etc. wouldn't work.  Perhaps you need to add
> > > gomp-constants.h to some Makefile variable or something, look at how is
> > > safe-ctype.h etc. handled.
> > 
> > Aha, that's how it is done, I guess, in gcc/Makefile.in:
> > 
> >     [...]
> >     SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
> >             $(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
> >     [...]
> >     PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h [...]
> >     [...]
> >     # Install the headers needed to build a plugin.
> >     install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
> >     # We keep the directory structure for files in config or c-family and .def
> >     # files. All other files are flattened to a single directory.
> >             $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
> >             headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\012' | sort -u`; \
> >             [...]
> >     [...]
> > 
> > > That said, including gomp-constants.h from tree-core.h is I think very much
> > > against all the Andrew's efforts to flatten headers (which is something I'm
> > > not very happy with generally, but in this case, I think only the very few
> > > files that really need the constants should include it).
> > 
> > Like this (not yet applied)?
> 
> [Jakub: »I think it is fine.«]
> 
> > Talking about external code (GCC plugins), do we have to take any
> > measures about the removed enum omp_clause_map_kind?  (Would a mere
> > »#define omp_clause_map_kind gomp_map_kind« work?  That'd also mean that
> > we do have to add include/gomp-constants.h to PLUGIN_HEADERS, and get it
> > included automatically, I think?)
> > 
> > commit b1255597c6b069719960e53e385399c479c4be8b
> > Author: Thomas Schwinge <thomas@codesourcery.com>
> > Date:   Fri Dec 19 18:32:25 2014 +0100
> > 
> >     Replace enum omp_clause_map_kind with enum gomp_map_kind.
> >     
> >     	gcc/
> >     	* tree-core.h: Instead of defining enum omp_clause_map_kind, use
> >     	include/gomp-constants.h's enum gomp_map_kind.  Update all users.
> >     	include/
> >     	* gomp-constants.h: Populate enum gomp_map_kind.
> > ---
> >  gcc/c/c-parser.c           | 38 ++++++++++++++---------------
> >  gcc/c/c-typeck.c           |  9 +++----
> >  gcc/cp/parser.c            | 38 ++++++++++++++---------------
> >  gcc/cp/semantics.c         |  9 +++----
> >  gcc/fortran/trans-openmp.c | 47 ++++++++++++++++++------------------
> >  gcc/gimplify.c             | 18 +++++++-------
> >  gcc/omp-low.c              | 60 ++++++++++++++++++++++------------------------
> >  gcc/tree-core.h            | 43 +++------------------------------
> >  gcc/tree-nested.c          |  8 +++----
> >  gcc/tree-pretty-print.c    | 31 ++++++++++++------------
> >  gcc/tree-streamer-in.c     |  2 +-
> >  gcc/tree-streamer-out.c    |  2 +-
> >  gcc/tree.h                 |  4 ++--
> >  include/gomp-constants.h   | 50 +++++++++++++++++++++++++++-----------
> >  14 files changed, 173 insertions(+), 186 deletions(-)
> 
> Here is (this is on top of gomp-4_0-branch, by the way) the patch:
> reordererd, and snipped to relevant parts.
> 
> The new "provider":
> 
> > --- include/gomp-constants.h
> > +++ include/gomp-constants.h
> > @@ -32,7 +32,7 @@
> >  /* Memory mapping types.  */
> >  
> >  /* One byte.  */
> > -#define GOMP_MAP_VALUE_LIMIT		(1 << 8)
> > +#define GOMP_MAP_LAST			(1 << 8)
> >  
> >  #define GOMP_MAP_FLAG_TO		(1 << 0)
> >  #define GOMP_MAP_FLAG_FROM		(1 << 1)
> > @@ -44,19 +44,41 @@
> >  /* Flag to force a specific behavior (or else, trigger a run-time error).  */
> >  #define GOMP_MAP_FLAG_FORCE		(1 << 7)
> >  
> > -#define GOMP_MAP_ALLOC			0
> > -#define GOMP_MAP_TO			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
> > -#define GOMP_MAP_FROM			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
> > -#define GOMP_MAP_TOFROM			(GOMP_MAP_TO | GOMP_MAP_FROM)
> > -#define GOMP_MAP_POINTER		(GOMP_MAP_FLAG_SPECIAL_0 | 0)
> > -#define GOMP_MAP_TO_PSET		(GOMP_MAP_FLAG_SPECIAL_0 | 1)
> > -#define GOMP_MAP_FORCE_PRESENT		(GOMP_MAP_FLAG_SPECIAL_0 | 2)
> > -#define GOMP_MAP_FORCE_DEALLOC		(GOMP_MAP_FLAG_SPECIAL_0 | 3)
> > -#define GOMP_MAP_FORCE_DEVICEPTR	(GOMP_MAP_FLAG_SPECIAL_1 | 0)
> > -#define GOMP_MAP_FORCE_ALLOC		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
> > -#define GOMP_MAP_FORCE_TO		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
> > -#define GOMP_MAP_FORCE_FROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
> > -#define GOMP_MAP_FORCE_TOFROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
> > +enum gomp_map_kind
> > +  {
> > +    /* If not already present, allocate.  */
> > +    GOMP_MAP_ALLOC =			0,
> > +    /* ..., and copy to device.  */
> > +    GOMP_MAP_TO =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
> > +    /* ..., and copy from device.  */
> > +    GOMP_MAP_FROM =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
> > +    /* ..., and copy to and from device.  */
> > +    GOMP_MAP_TOFROM =			(GOMP_MAP_TO | GOMP_MAP_FROM),
> > +    /* The following kind is an internal only map kind, used for pointer based
> > +       array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
> > +       which is implicitly POINTER_SIZE_UNITS, but the bias.  */
> > +    GOMP_MAP_POINTER =			(GOMP_MAP_FLAG_SPECIAL_0 | 0),
> > +    /* Also internal, behaves like GOMP_MAP_TO, but additionally any
> > +       GOMP_MAP_POINTER records consecutive after it which have addresses
> > +       falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
> > +       mapped already.  */
> > +    GOMP_MAP_TO_PSET =			(GOMP_MAP_FLAG_SPECIAL_0 | 1),
> > +    /* Must already be present.  */
> > +    GOMP_MAP_FORCE_PRESENT =		(GOMP_MAP_FLAG_SPECIAL_0 | 2),
> > +    /* Deallocate a mapping, without copying from device.  */
> > +    GOMP_MAP_FORCE_DEALLOC =		(GOMP_MAP_FLAG_SPECIAL_0 | 3),
> > +    /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
> > +       POINTER_SIZE_UNITS.  */
> > +    GOMP_MAP_FORCE_DEVICEPTR =		(GOMP_MAP_FLAG_SPECIAL_1 | 0),
> > +    /* Allocate.  */
> > +    GOMP_MAP_FORCE_ALLOC =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
> > +    /* ..., and copy to device.  */
> > +    GOMP_MAP_FORCE_TO =			(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
> > +    /* ..., and copy from device.  */
> > +    GOMP_MAP_FORCE_FROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
> > +    /* ..., and copy to and from device.  */
> > +    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
> > +  };
> >  
> >  #define GOMP_MAP_COPY_TO_P(X) \
> >    (!((X) & GOMP_MAP_FLAG_SPECIAL) \
> 
> The former "provider":
> 
> > --- gcc/tree-core.h
> > +++ gcc/tree-core.h
> > @@ -1239,45 +1239,8 @@ enum omp_clause_depend_kind
> >    OMP_CLAUSE_DEPEND_LAST
> >  };
> >  
> > -enum omp_clause_map_kind
> > -{
> > -  /* If not already present, allocate.  */
> > -  OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
> > -  /* ..., and copy to device.  */
> > -  OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
> > -  /* ..., and copy from device.  */
> > -  OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
> > -  /* ..., and copy to and from device.  */
> > -  OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
> > -  /* The following kind is an internal only map kind, used for pointer based
> > -     array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
> > -     which is implicitly POINTER_SIZE_UNITS, but the bias.  */
> > -  OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
> > -  /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
> > -     OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
> > -     falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
> > -     wasn't mapped already.  */
> > -  OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
> > -  /* The following are only valid for OpenACC.  */
> > -  /* Allocate.  */
> > -  OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
> > -  /* ..., and copy to device.  */
> > -  OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
> > -  /* ..., and copy from device.  */
> > -  OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
> > -  /* ..., and copy to and from device.  */
> > -  OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
> > -  /* Must already be present.  */
> > -  OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
> > -  /* Deallocate a mapping, without copying from device.  */
> > -  OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
> > -  /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
> > -     POINTER_SIZE_UNITS.  */
> > -  OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
> > -
> > -  /* End marker.  */
> > -  OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
> > -};
> > +/* See include/gomp-constants.h.  */
> > +enum gomp_map_kind;
> >  
> >  enum omp_clause_proc_bind_kind
> >  {
> > @@ -1350,7 +1313,7 @@ struct GTY(()) tree_omp_clause {
> >      enum omp_clause_default_kind   default_kind;
> >      enum omp_clause_schedule_kind  schedule_kind;
> >      enum omp_clause_depend_kind    depend_kind;
> > -    enum omp_clause_map_kind       map_kind;
> > +    enum gomp_map_kind		   map_kind;
> >      enum omp_clause_proc_bind_kind proc_bind_kind;
> >      enum tree_code                 reduction_code;
> >    } GTY ((skip)) subcode;
> 
> A sample of the "consumers":
> 
> > --- gcc/c/c-parser.c
> > +++ gcc/c/c-parser.c
> > [...]
> > @@ -11372,7 +11372,7 @@ static tree
> >  c_parser_omp_clause_map (c_parser *parser, tree list)
> >  {
> >    location_t clause_loc = c_parser_peek_token (parser)->location;
> > -  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
> > +  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
> >    tree nl, c;
> >  
> >    if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
> > @@ -11383,13 +11383,13 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
> >      {
> >        const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
> >        if (strcmp ("alloc", p) == 0)
> > -	kind = OMP_CLAUSE_MAP_ALLOC;
> > +	kind = GOMP_MAP_ALLOC;
> > [...]
> > --- gcc/gimplify.c
> > +++ gcc/gimplify.c
> > @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
> >  #include "omp-low.h"
> >  #include "gimple-low.h"
> >  #include "cilk.h"
> > +#include "gomp-constants.h"
> >  
> >  #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
> >  #include "tree-pass.h"		/* FIXME: only for PROP_gimple_any */
> > @@ -6436,8 +6437,8 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
> >    else if (code == OMP_CLAUSE_MAP)
> >      {
> >        OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
> > -				     ? OMP_CLAUSE_MAP_TO
> > -				     : OMP_CLAUSE_MAP_TOFROM;
> > +				     ? GOMP_MAP_TO
> > +				     : GOMP_MAP_TOFROM;
> > [...]
> > --- gcc/tree-streamer-in.c
> > +++ gcc/tree-streamer-in.c
> > @@ -427,7 +427,7 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
> >        break;
> >      case OMP_CLAUSE_MAP:
> >        OMP_CLAUSE_MAP_KIND (expr)
> > -	= bp_unpack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST);
> > +	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
> >        break;
> >      case OMP_CLAUSE_PROC_BIND:
> >        OMP_CLAUSE_PROC_BIND_KIND (expr)
> > --- gcc/tree-streamer-out.c
> > +++ gcc/tree-streamer-out.c
> > @@ -387,7 +387,7 @@ pack_ts_omp_clause_value_fields (struct output_block *ob,
> >  		    OMP_CLAUSE_DEPEND_KIND (expr));
> >        break;
> >      case OMP_CLAUSE_MAP:
> > -      bp_pack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST,
> > +      bp_pack_enum (bp, gomp_map_kind, GOMP_MAP_LAST,
> >  		    OMP_CLAUSE_MAP_KIND (expr));
> >        break;
> >      case OMP_CLAUSE_PROC_BIND:

I have now committed the patch to gomp-4_0-branch in the following form.
The issues raised above remain to be resolved.

In spirit against the tree.h header flattening, I had to keep the
#include "include/gomp-constants.h" in gcc/tree-core.h, because otherwise
I'd have to add it to a ton of *.c files, just for the enum gomp_map_kind
definition.

I found that in the C++ dialect used by GCC, it is not possible to
declare an enum without giving the list of enumerators.  N2764 (from
2008) resolved this by adding appropriate syntax for declaring enums,
however: "warning: scoped enums only available with -std=c++11 or
-std=gnu++11".  If it were possible to use this, we could add to
gcc/tree-core.h:

    enum gomp_map_kind : char;

... (or similar), and this way decouple the declaration (gcc/tree-core.h)
From the actual "population of it" (include/gomp-constants.h).
Alternatively, in gcc/tree-core.h:struct tree_omp_clause, we could switch
the map_kind member from enum gomp_map_kind to a char -- but that would
defeat the usage of an enum (easy pretty-printing of its enumerators in
GDB, and so on.).

Committed to gomp-4_0-branch in r219476:

commit 3421740e4c0b9262810d1c0b98f2b6c58623f868
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Jan 12 16:17:35 2015 +0000

    Replace enum omp_clause_map_kind with enum gomp_map_kind.
    
    	include/
    	* gomp-constants.h (GOMP_MAP_LAST): Rename from
    	GOMP_MAP_VALUE_LIMIT.  Change all users.
    	(GOMP_MAP_ALLOC, GOMP_MAP_TO, GOMP_MAP_FROM, GOMP_MAP_TOFROM)
    	(GOMP_MAP_POINTER, GOMP_MAP_TO_PSET, GOMP_MAP_FORCE_PRESENT)
    	(GOMP_MAP_FORCE_DEALLOC, GOMP_MAP_FORCE_DEVICEPTR)
    	(GOMP_MAP_FORCE_ALLOC, GOMP_MAP_FORCE_TO, GOMP_MAP_FORCE_FROM)
    	(GOMP_MAP_FORCE_TOFROM): Move into a new enum gomp_map_kind.
    	gcc/
    	* tree-core.h (OMP_CLAUSE_MAP_ALLOC, OMP_CLAUSE_MAP_TO)
    	(OMP_CLAUSE_MAP_FROM, OMP_CLAUSE_MAP_TOFROM)
    	(OMP_CLAUSE_MAP_POINTER, OMP_CLAUSE_MAP_TO_PSET)
    	(OMP_CLAUSE_MAP_FORCE_ALLOC, OMP_CLAUSE_MAP_FORCE_TO)
    	(OMP_CLAUSE_MAP_FORCE_FROM, OMP_CLAUSE_MAP_FORCE_TOFROM)
    	(OMP_CLAUSE_MAP_FORCE_PRESENT, OMP_CLAUSE_MAP_FORCE_DEALLOC)
    	(OMP_CLAUSE_MAP_FORCE_DEVICEPTR, OMP_CLAUSE_MAP_LAST): Remove from
    	enum omp_clause_map_kind.  Change all users to
    	include/gomp-constants.h's enum gomp_map_kind.
    	(enum omp_clause_map_kind): Remove.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219476 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp         | 13 ++++++++++
 gcc/c/c-parser.c           | 38 ++++++++++++++---------------
 gcc/c/c-typeck.c           |  9 +++----
 gcc/cp/parser.c            | 38 ++++++++++++++---------------
 gcc/cp/semantics.c         |  9 +++----
 gcc/fortran/trans-openmp.c | 47 ++++++++++++++++++------------------
 gcc/gimplify.c             | 18 +++++++-------
 gcc/omp-low.c              | 60 ++++++++++++++++++++++------------------------
 gcc/tree-core.h            | 42 +-------------------------------
 gcc/tree-nested.c          |  8 +++----
 gcc/tree-pretty-print.c    | 31 ++++++++++++------------
 gcc/tree-streamer-in.c     |  2 +-
 gcc/tree-streamer-out.c    |  2 +-
 gcc/tree.h                 |  4 ++--
 include/ChangeLog.gomp     | 10 ++++++++
 include/gomp-constants.h   | 50 +++++++++++++++++++++++++++-----------
 16 files changed, 194 insertions(+), 187 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 64877db..c627871 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,16 @@
+2015-01-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* tree-core.h (OMP_CLAUSE_MAP_ALLOC, OMP_CLAUSE_MAP_TO)
+	(OMP_CLAUSE_MAP_FROM, OMP_CLAUSE_MAP_TOFROM)
+	(OMP_CLAUSE_MAP_POINTER, OMP_CLAUSE_MAP_TO_PSET)
+	(OMP_CLAUSE_MAP_FORCE_ALLOC, OMP_CLAUSE_MAP_FORCE_TO)
+	(OMP_CLAUSE_MAP_FORCE_FROM, OMP_CLAUSE_MAP_FORCE_TOFROM)
+	(OMP_CLAUSE_MAP_FORCE_PRESENT, OMP_CLAUSE_MAP_FORCE_DEALLOC)
+	(OMP_CLAUSE_MAP_FORCE_DEVICEPTR, OMP_CLAUSE_MAP_LAST): Remove from
+	enum omp_clause_map_kind.  Change all users to
+	include/gomp-constants.h's enum gomp_map_kind.
+	(enum omp_clause_map_kind): Remove.
+
 2014-12-18  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* builtins.c (expand_builtin_acc_on_device): Fix logic error.
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index 7fb3912..b0c0280 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -10258,45 +10258,45 @@ static tree
 c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
 			   tree list)
 {
-  enum omp_clause_map_kind kind;
+  enum gomp_map_kind kind;
   switch (c_kind)
     {
     case PRAGMA_OACC_CLAUSE_COPY:
-      kind = OMP_CLAUSE_MAP_FORCE_TOFROM;
+      kind = GOMP_MAP_FORCE_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_COPYIN:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_CREATE:
-      kind = OMP_CLAUSE_MAP_FORCE_ALLOC;
+      kind = GOMP_MAP_FORCE_ALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DELETE:
-      kind = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+      kind = GOMP_MAP_FORCE_DEALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DEVICE:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_HOST:
     case PRAGMA_OACC_CLAUSE_SELF:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT:
-      kind = OMP_CLAUSE_MAP_FORCE_PRESENT;
+      kind = GOMP_MAP_FORCE_PRESENT;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY:
-      kind = OMP_CLAUSE_MAP_TOFROM;
+      kind = GOMP_MAP_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN:
-      kind = OMP_CLAUSE_MAP_TO;
+      kind = GOMP_MAP_TO;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FROM;
+      kind = GOMP_MAP_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE:
-      kind = OMP_CLAUSE_MAP_ALLOC;
+      kind = GOMP_MAP_ALLOC;
       break;
     default:
       gcc_unreachable ();
@@ -10341,7 +10341,7 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -11382,7 +11382,7 @@ static tree
 c_parser_omp_clause_map (c_parser *parser, tree list)
 {
   location_t clause_loc = c_parser_peek_token (parser)->location;
-  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
+  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
   tree nl, c;
 
   if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
@@ -11393,13 +11393,13 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
     {
       const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
       if (strcmp ("alloc", p) == 0)
-	kind = OMP_CLAUSE_MAP_ALLOC;
+	kind = GOMP_MAP_ALLOC;
       else if (strcmp ("to", p) == 0)
-	kind = OMP_CLAUSE_MAP_TO;
+	kind = GOMP_MAP_TO;
       else if (strcmp ("from", p) == 0)
-	kind = OMP_CLAUSE_MAP_FROM;
+	kind = GOMP_MAP_FROM;
       else if (strcmp ("tofrom", p) == 0)
-	kind = OMP_CLAUSE_MAP_TOFROM;
+	kind = GOMP_MAP_TOFROM;
       else
 	{
 	  c_parser_error (parser, "invalid map kind");
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index cdfa230..747e322 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -68,6 +68,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "c-family/c-ubsan.h"
 #include "cilk.h"
 #include "wide-int.h"
+#include "gomp-constants.h"
 
 /* Possible cases of implicit bad conversions.  Used to select
    diagnostic messages in convert_for_assignment.  */
@@ -11940,9 +11941,9 @@ handle_omp_array_sections (tree c)
       OMP_CLAUSE_SIZE (c) = size;
       if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_MAP)
 	return false;
-      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_FORCE_DEVICEPTR);
+      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
       tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
       if (!c_mark_addressable (t))
 	return false;
       OMP_CLAUSE_DECL (c2) = t;
@@ -12365,9 +12366,9 @@ c_finish_omp_clauses (tree clauses)
 	  else if (!c_mark_addressable (t))
 	    remove = true;
 	  else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		     && (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+		     && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 			 || (OMP_CLAUSE_MAP_KIND (c)
-			     == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)))
+			     == GOMP_MAP_FORCE_DEVICEPTR)))
 		   && !lang_hooks.types.omp_mappable_type (TREE_TYPE (t)))
 	    {
 	      error_at (OMP_CLAUSE_LOCATION (c),
diff --git gcc/cp/parser.c gcc/cp/parser.c
index bd1e956..eaa6eee 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -27915,45 +27915,45 @@ static tree
 cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
 			    tree list)
 {
-  enum omp_clause_map_kind kind;
+  enum gomp_map_kind kind;
   switch (c_kind)
     {
     case PRAGMA_OACC_CLAUSE_COPY:
-      kind = OMP_CLAUSE_MAP_FORCE_TOFROM;
+      kind = GOMP_MAP_FORCE_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_COPYIN:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_CREATE:
-      kind = OMP_CLAUSE_MAP_FORCE_ALLOC;
+      kind = GOMP_MAP_FORCE_ALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DELETE:
-      kind = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+      kind = GOMP_MAP_FORCE_DEALLOC;
       break;
     case PRAGMA_OACC_CLAUSE_DEVICE:
-      kind = OMP_CLAUSE_MAP_FORCE_TO;
+      kind = GOMP_MAP_FORCE_TO;
       break;
     case PRAGMA_OACC_CLAUSE_HOST:
     case PRAGMA_OACC_CLAUSE_SELF:
-      kind = OMP_CLAUSE_MAP_FORCE_FROM;
+      kind = GOMP_MAP_FORCE_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT:
-      kind = OMP_CLAUSE_MAP_FORCE_PRESENT;
+      kind = GOMP_MAP_FORCE_PRESENT;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY:
-      kind = OMP_CLAUSE_MAP_TOFROM;
+      kind = GOMP_MAP_TOFROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN:
-      kind = OMP_CLAUSE_MAP_TO;
+      kind = GOMP_MAP_TO;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT:
-      kind = OMP_CLAUSE_MAP_FROM;
+      kind = GOMP_MAP_FROM;
       break;
     case PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE:
-      kind = OMP_CLAUSE_MAP_ALLOC;
+      kind = GOMP_MAP_ALLOC;
       break;
     default:
       gcc_unreachable ();
@@ -27998,7 +27998,7 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -28924,7 +28924,7 @@ static tree
 cp_parser_omp_clause_map (cp_parser *parser, tree list)
 {
   tree nlist, c;
-  enum omp_clause_map_kind kind = OMP_CLAUSE_MAP_TOFROM;
+  enum gomp_map_kind kind = GOMP_MAP_TOFROM;
 
   if (!cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN))
     return list;
@@ -28936,13 +28936,13 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list)
       const char *p = IDENTIFIER_POINTER (id);
 
       if (strcmp ("alloc", p) == 0)
-	kind = OMP_CLAUSE_MAP_ALLOC;
+	kind = GOMP_MAP_ALLOC;
       else if (strcmp ("to", p) == 0)
-	kind = OMP_CLAUSE_MAP_TO;
+	kind = GOMP_MAP_TO;
       else if (strcmp ("from", p) == 0)
-	kind = OMP_CLAUSE_MAP_FROM;
+	kind = GOMP_MAP_FROM;
       else if (strcmp ("tofrom", p) == 0)
-	kind = OMP_CLAUSE_MAP_TOFROM;
+	kind = GOMP_MAP_TOFROM;
       else
 	{
 	  cp_parser_error (parser, "invalid map kind");
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index 4794f44..fd37954 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -66,6 +66,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-low.h"
 #include "builtins.h"
 #include "convert.h"
+#include "gomp-constants.h"
 
 /* There routines provide a modular interface to perform many parsing
    operations.  They may therefore be used during actual parsing, or
@@ -4670,7 +4671,7 @@ handle_omp_array_sections (tree c)
 	    return false;
 	  tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 				      OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
 	  if (!cxx_mark_addressable (t))
 	    return false;
 	  OMP_CLAUSE_DECL (c2) = t;
@@ -4694,7 +4695,7 @@ handle_omp_array_sections (tree c)
 	    {
 	      tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 					  OMP_CLAUSE_MAP);
-	      OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+	      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
 	      OMP_CLAUSE_DECL (c3) = ptr;
 	      OMP_CLAUSE_DECL (c2) = convert_from_reference (ptr);
 	      OMP_CLAUSE_SIZE (c3) = size_zero_node;
@@ -5788,7 +5789,7 @@ finish_omp_clauses (tree clauses)
 	      if (processing_template_decl)
 		break;
 	      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		  && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+		  && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 		break;
 	      if (DECL_P (t))
 		error ("%qD is not a variable in %qs clause", t,
@@ -5809,7 +5810,7 @@ finish_omp_clauses (tree clauses)
 		   && !cxx_mark_addressable (t))
 	    remove = true;
 	  else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		     && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+		     && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 		   && !type_dependent_expression_p (t)
 		   && !cp_omp_mappable_type ((TREE_CODE (TREE_TYPE (t))
 					      == REFERENCE_TYPE)
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index 80fdb2c..c230f73 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "trans-const.h"
 #include "arith.h"
 #include "omp-low.h"
+#include "gomp-constants.h"
 
 int ompws_flags;
 
@@ -1045,7 +1046,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	return;
       tree orig_decl = decl;
       c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c4) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c4) = GOMP_MAP_POINTER;
       OMP_CLAUSE_DECL (c4) = decl;
       OMP_CLAUSE_SIZE (c4) = size_int (0);
       decl = build_fold_indirect_ref (decl);
@@ -1056,7 +1057,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	      || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
 	{
 	  c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
 	  OMP_CLAUSE_DECL (c3) = unshare_expr (decl);
 	  OMP_CLAUSE_SIZE (c3) = size_int (0);
 	  decl = build_fold_indirect_ref (decl);
@@ -1073,11 +1074,11 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
       ptr = build_fold_indirect_ref (ptr);
       OMP_CLAUSE_DECL (c) = ptr;
       c2 = build_omp_clause (input_location, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = OMP_CLAUSE_MAP_TO_PSET;
+      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_TO_PSET;
       OMP_CLAUSE_DECL (c2) = decl;
       OMP_CLAUSE_SIZE (c2) = TYPE_SIZE_UNIT (type);
       c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c3) = OMP_CLAUSE_MAP_POINTER;
+      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
       OMP_CLAUSE_DECL (c3) = gfc_conv_descriptor_data_get (decl);
       OMP_CLAUSE_SIZE (c3) = size_int (0);
       tree size = create_tmp_var (gfc_array_index_type);
@@ -1953,7 +1954,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      tree orig_decl = decl;
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -1963,7 +1964,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			{
 			  node3 = build_omp_clause (input_location,
 						    OMP_CLAUSE_MAP);
-			  OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+			  OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 			  OMP_CLAUSE_DECL (node3) = decl;
 			  OMP_CLAUSE_SIZE (node3) = size_int (0);
 			  decl = build_fold_indirect_ref (decl);
@@ -1979,12 +1980,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      OMP_CLAUSE_DECL (node) = ptr;
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = OMP_CLAUSE_MAP_TO_PSET;
+		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		      OMP_CLAUSE_SIZE (node3) = size_int (0);
@@ -2070,7 +2071,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		    {
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -2082,12 +2083,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      ptr2 = gfc_conv_descriptor_data_get (decl);
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = OMP_CLAUSE_MAP_TO_PSET;
+		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		    }
@@ -2102,7 +2103,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			}
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = OMP_CLAUSE_MAP_POINTER;
+		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
 		      OMP_CLAUSE_DECL (node3) = decl;
 		    }
 		  ptr2 = fold_convert (sizetype, ptr2);
@@ -2112,37 +2113,37 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 	      switch (n->u.map_op)
 		{
 		case OMP_MAP_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_ALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_ALLOC;
 		  break;
 		case OMP_MAP_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_TO;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TO;
 		  break;
 		case OMP_MAP_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FROM;
 		  break;
 		case OMP_MAP_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_TOFROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TOFROM;
 		  break;
 		case OMP_MAP_FORCE_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_ALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_ALLOC;
 		  break;
 		case OMP_MAP_FORCE_DEALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEALLOC;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEALLOC;
 		  break;
 		case OMP_MAP_FORCE_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_TO;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TO;
 		  break;
 		case OMP_MAP_FORCE_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_FROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_FROM;
 		  break;
 		case OMP_MAP_FORCE_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_TOFROM;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TOFROM;
 		  break;
 		case OMP_MAP_FORCE_PRESENT:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_PRESENT;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_PRESENT;
 		  break;
 		case OMP_MAP_FORCE_DEVICEPTR:
-		  OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEVICEPTR;
 		  break;
 		default:
 		  gcc_unreachable ();
diff --git gcc/gimplify.c gcc/gimplify.c
index 45bd556..cbbb9a7 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -76,6 +76,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "omp-low.h"
 #include "gimple-low.h"
 #include "cilk.h"
+#include "gomp-constants.h"
 
 #include "langhooks-def.h"	/* FIXME: for lhd_set_decl_assembler_name */
 #include "tree-pass.h"		/* FIXME: only for PROP_gimple_any */
@@ -6442,8 +6443,8 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
   else if (code == OMP_CLAUSE_MAP)
     {
       OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
-				     ? OMP_CLAUSE_MAP_TO
-				     : OMP_CLAUSE_MAP_TOFROM;
+				     ? GOMP_MAP_TO
+				     : GOMP_MAP_TOFROM;
       if (DECL_SIZE (decl)
 	  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 	{
@@ -6464,7 +6465,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 				      OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (nc) = decl;
 	  OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	  OMP_CLAUSE_MAP_KIND (nc) = OMP_CLAUSE_MAP_POINTER;
+	  OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
 	  OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause);
 	  OMP_CLAUSE_CHAIN (clause) = nc;
 	}
@@ -6614,13 +6615,12 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 	    remove = true;
 	  else if (DECL_SIZE (decl)
 		   && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
-		   && OMP_CLAUSE_MAP_KIND (c) != OMP_CLAUSE_MAP_POINTER)
+		   && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_POINTER)
 	    {
-	      /* For OMP_CLAUSE_MAP_FORCE_DEVICEPTR, we'll never enter here,
-		 because for these, TREE_CODE (DECL_SIZE (decl)) will always be
+	      /* For GOMP_MAP_FORCE_DEVICEPTR, we'll never enter here, because
+		 for these, TREE_CODE (DECL_SIZE (decl)) will always be
 		 INTEGER_CST.  */
-	      gcc_assert (OMP_CLAUSE_MAP_KIND (c)
-			  != OMP_CLAUSE_MAP_FORCE_DEVICEPTR);
+	      gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
 
 	      tree decl2 = DECL_VALUE_EXPR (decl);
 	      gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
@@ -6639,7 +6639,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 					  OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (nc) = decl;
 	      OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	      OMP_CLAUSE_MAP_KIND (nc) = OMP_CLAUSE_MAP_POINTER;
+	      OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
 	      OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (c);
 	      OMP_CLAUSE_CHAIN (c) = nc;
 	      c = nc;
diff --git gcc/omp-low.c gcc/omp-low.c
index f4c7720..703816a 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -1843,11 +1843,10 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      && varpool_node::get_create (decl)->offloadable)
 	    break;
 	  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-	      && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
+	      && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)
 	    {
-	      /* Ignore OMP_CLAUSE_MAP_POINTER kind for arrays in
-		 regions that are not offloaded; there is nothing to map for
-		 those.  */
+	      /* Ignore GOMP_MAP_POINTER kind for arrays in regions that are
+		 not offloaded; there is nothing to map for those.  */
 	      if (!is_gimple_omp_offloaded (ctx->stmt)
 		  && !POINTER_TYPE_P (TREE_TYPE (decl)))
 		break;
@@ -1868,7 +1867,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      else
 		{
 		  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-		      && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+		      && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		      && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 		      && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE)
 		    install_var_field (decl, true, 7, ctx);
@@ -1886,7 +1885,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		  && nc != NULL_TREE
 		  && OMP_CLAUSE_CODE (nc) == OMP_CLAUSE_MAP
 		  && OMP_CLAUSE_DECL (nc) == base
-		  && OMP_CLAUSE_MAP_KIND (nc) == OMP_CLAUSE_MAP_POINTER
+		  && OMP_CLAUSE_MAP_KIND (nc) == GOMP_MAP_POINTER
 		  && integer_zerop (OMP_CLAUSE_SIZE (nc)))
 		{
 		  OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c) = 1;
@@ -2003,7 +2002,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	    break;
 	  if (DECL_P (decl))
 	    {
-	      if (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+	      if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		  && TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
 		  && !COMPLETE_TYPE_P (TREE_TYPE (decl)))
 		{
@@ -9714,7 +9713,7 @@ oacc_initialize_reduction_data (tree clauses, tree nthreads,
       /* Add the reduction array to the list of clauses.  */
       tree x = array;
       t = build_omp_clause (gimple_location (ctx->stmt), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (t) = OMP_CLAUSE_MAP_FORCE_FROM;
+      OMP_CLAUSE_MAP_KIND (t) = GOMP_MAP_FORCE_FROM;
       OMP_CLAUSE_DECL (t) = x;
       OMP_CLAUSE_CHAIN (t) = NULL;
       if (oc)
@@ -11236,20 +11235,20 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	/* First check what we're prepared to handle in the following.  */
 	switch (OMP_CLAUSE_MAP_KIND (c))
 	  {
-	  case OMP_CLAUSE_MAP_ALLOC:
-	  case OMP_CLAUSE_MAP_TO:
-	  case OMP_CLAUSE_MAP_FROM:
-	  case OMP_CLAUSE_MAP_TOFROM:
-	  case OMP_CLAUSE_MAP_POINTER:
-	  case OMP_CLAUSE_MAP_TO_PSET:
+	  case GOMP_MAP_ALLOC:
+	  case GOMP_MAP_TO:
+	  case GOMP_MAP_FROM:
+	  case GOMP_MAP_TOFROM:
+	  case GOMP_MAP_POINTER:
+	  case GOMP_MAP_TO_PSET:
 	    break;
-	  case OMP_CLAUSE_MAP_FORCE_ALLOC:
-	  case OMP_CLAUSE_MAP_FORCE_TO:
-	  case OMP_CLAUSE_MAP_FORCE_FROM:
-	  case OMP_CLAUSE_MAP_FORCE_TOFROM:
-	  case OMP_CLAUSE_MAP_FORCE_PRESENT:
-	  case OMP_CLAUSE_MAP_FORCE_DEALLOC:
-	  case OMP_CLAUSE_MAP_FORCE_DEVICEPTR:
+	  case GOMP_MAP_FORCE_ALLOC:
+	  case GOMP_MAP_FORCE_TO:
+	  case GOMP_MAP_FORCE_FROM:
+	  case GOMP_MAP_FORCE_TOFROM:
+	  case GOMP_MAP_FORCE_PRESENT:
+	  case GOMP_MAP_FORCE_DEALLOC:
+	  case GOMP_MAP_FORCE_DEVICEPTR:
 	    gcc_assert (is_gimple_omp_oacc (stmt));
 	    break;
 	  default:
@@ -11285,7 +11284,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	  {
 	    x = build_receiver_ref (var, true, ctx);
 	    tree new_var = lookup_decl (var, ctx);
-	    if (OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+	    if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 		&& !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 		&& TREE_CODE (TREE_TYPE (var)) == ARRAY_TYPE)
 	      x = build_simple_mem_ref (x);
@@ -11414,7 +11413,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		    gimplify_assign (x, var, &ilist);
 		  }
 		else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
-			 && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER
+			 && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
 			 && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
 			 && TREE_CODE (TREE_TYPE (ovar)) == ARRAY_TYPE)
 		  {
@@ -11432,17 +11431,16 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		    gcc_assert (offloaded);
 		    tree avar = create_tmp_var (TREE_TYPE (var));
 		    mark_addressable (avar);
-		    enum omp_clause_map_kind map_kind
-		      = OMP_CLAUSE_MAP_KIND (c);
+		    enum gomp_map_kind map_kind = OMP_CLAUSE_MAP_KIND (c);
 		    if (GOMP_MAP_COPY_TO_P (map_kind)
-			|| map_kind == OMP_CLAUSE_MAP_POINTER
-			|| map_kind == OMP_CLAUSE_MAP_TO_PSET
-			|| map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
+			|| map_kind == GOMP_MAP_POINTER
+			|| map_kind == GOMP_MAP_TO_PSET
+			|| map_kind == GOMP_MAP_FORCE_DEVICEPTR)
 		      gimplify_assign (avar, var, &ilist);
 		    avar = build_fold_addr_expr (avar);
 		    gimplify_assign (x, avar, &ilist);
 		    if ((GOMP_MAP_COPY_FROM_P (map_kind)
-			 || map_kind == OMP_CLAUSE_MAP_FORCE_DEVICEPTR)
+			 || map_kind == GOMP_MAP_FORCE_DEVICEPTR)
 			&& !TYPE_READONLY (TREE_TYPE (var)))
 		      {
 			x = build_sender_ref (ovar, ctx);
@@ -11472,10 +11470,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 		tkind = OMP_CLAUSE_MAP_KIND (c);
 		break;
 	      case OMP_CLAUSE_TO:
-		tkind = OMP_CLAUSE_MAP_TO;
+		tkind = GOMP_MAP_TO;
 		break;
 	      case OMP_CLAUSE_FROM:
-		tkind = OMP_CLAUSE_MAP_FROM;
+		tkind = GOMP_MAP_FROM;
 		break;
 	      default:
 		gcc_unreachable ();
diff --git gcc/tree-core.h gcc/tree-core.h
index fa8071b..9d3c386 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -1227,46 +1227,6 @@ enum omp_clause_depend_kind
   OMP_CLAUSE_DEPEND_LAST
 };
 
-enum omp_clause_map_kind
-{
-  /* If not already present, allocate.  */
-  OMP_CLAUSE_MAP_ALLOC = GOMP_MAP_ALLOC,
-  /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_TO = GOMP_MAP_TO,
-  /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FROM = GOMP_MAP_FROM,
-  /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_TOFROM = GOMP_MAP_TOFROM,
-  /* The following kind is an internal only map kind, used for pointer based
-     array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
-     which is implicitly POINTER_SIZE_UNITS, but the bias.  */
-  OMP_CLAUSE_MAP_POINTER = GOMP_MAP_POINTER,
-  /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any
-     OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses
-     falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET
-     wasn't mapped already.  */
-  OMP_CLAUSE_MAP_TO_PSET = GOMP_MAP_TO_PSET,
-  /* The following are only valid for OpenACC.  */
-  /* Allocate.  */
-  OMP_CLAUSE_MAP_FORCE_ALLOC = GOMP_MAP_FORCE_ALLOC,
-  /* ..., and copy to device.  */
-  OMP_CLAUSE_MAP_FORCE_TO = GOMP_MAP_FORCE_TO,
-  /* ..., and copy from device.  */
-  OMP_CLAUSE_MAP_FORCE_FROM = GOMP_MAP_FORCE_FROM,
-  /* ..., and copy to and from device.  */
-  OMP_CLAUSE_MAP_FORCE_TOFROM = GOMP_MAP_FORCE_TOFROM,
-  /* Must already be present.  */
-  OMP_CLAUSE_MAP_FORCE_PRESENT = GOMP_MAP_FORCE_PRESENT,
-  /* Deallocate a mapping, without copying from device.  */
-  OMP_CLAUSE_MAP_FORCE_DEALLOC = GOMP_MAP_FORCE_DEALLOC,
-  /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
-     POINTER_SIZE_UNITS.  */
-  OMP_CLAUSE_MAP_FORCE_DEVICEPTR = GOMP_MAP_FORCE_DEVICEPTR,
-
-  /* End marker.  */
-  OMP_CLAUSE_MAP_LAST = GOMP_MAP_VALUE_LIMIT
-};
-
 enum omp_clause_proc_bind_kind
 {
   /* Numbers should match omp_proc_bind_t enum in omp.h.  */
@@ -1338,7 +1298,7 @@ struct GTY(()) tree_omp_clause {
     enum omp_clause_default_kind   default_kind;
     enum omp_clause_schedule_kind  schedule_kind;
     enum omp_clause_depend_kind    depend_kind;
-    enum omp_clause_map_kind       map_kind;
+    enum gomp_map_kind		   map_kind;
     enum omp_clause_proc_bind_kind proc_bind_kind;
     enum tree_code                 reduction_code;
   } GTY ((skip)) subcode;
diff --git gcc/tree-nested.c gcc/tree-nested.c
index 60066fc..29326ed 100644
--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -60,6 +60,7 @@
 #include "expr.h"	/* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL.  */
 #include "langhooks.h"
 #include "gimple-low.h"
+#include "gomp-constants.h"
 
 
 /* The object of this pass is to lower the representation of a set of nested
@@ -1405,7 +1406,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  decl = get_chain_decl (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = decl;
-	  OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TO;
+	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TO;
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -1971,7 +1972,7 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  (void) get_frame_type (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = info->frame_decl;
-	  OMP_CLAUSE_MAP_KIND (c) = OMP_CLAUSE_MAP_TOFROM;
+	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TOFROM;
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (info->frame_decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -2412,8 +2413,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	    {
 	      c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (c) = decl;
-	      OMP_CLAUSE_MAP_KIND (c)
-		= i ? OMP_CLAUSE_MAP_TO : OMP_CLAUSE_MAP_TOFROM;
+	      OMP_CLAUSE_MAP_KIND (c) = i ? GOMP_MAP_TO : GOMP_MAP_TOFROM;
 	      OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	      OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	      gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt),
diff --git gcc/tree-pretty-print.c gcc/tree-pretty-print.c
index fe4b127..1e44fc7 100644
--- gcc/tree-pretty-print.c
+++ gcc/tree-pretty-print.c
@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "value-prof.h"
 #include "wide-int-print.h"
 #include "internal-fn.h"
+#include "gomp-constants.h"
 
 /* Local functions, macros and variables.  */
 static const char *op_symbol (const_tree);
@@ -521,39 +522,39 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
       pp_string (pp, "map(");
       switch (OMP_CLAUSE_MAP_KIND (clause))
 	{
-	case OMP_CLAUSE_MAP_ALLOC:
-	case OMP_CLAUSE_MAP_POINTER:
+	case GOMP_MAP_ALLOC:
+	case GOMP_MAP_POINTER:
 	  pp_string (pp, "alloc");
 	  break;
-	case OMP_CLAUSE_MAP_TO:
-	case OMP_CLAUSE_MAP_TO_PSET:
+	case GOMP_MAP_TO:
+	case GOMP_MAP_TO_PSET:
 	  pp_string (pp, "to");
 	  break;
-	case OMP_CLAUSE_MAP_FROM:
+	case GOMP_MAP_FROM:
 	  pp_string (pp, "from");
 	  break;
-	case OMP_CLAUSE_MAP_TOFROM:
+	case GOMP_MAP_TOFROM:
 	  pp_string (pp, "tofrom");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_ALLOC:
+	case GOMP_MAP_FORCE_ALLOC:
 	  pp_string (pp, "force_alloc");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_TO:
+	case GOMP_MAP_FORCE_TO:
 	  pp_string (pp, "force_to");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_FROM:
+	case GOMP_MAP_FORCE_FROM:
 	  pp_string (pp, "force_from");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_TOFROM:
+	case GOMP_MAP_FORCE_TOFROM:
 	  pp_string (pp, "force_tofrom");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_PRESENT:
+	case GOMP_MAP_FORCE_PRESENT:
 	  pp_string (pp, "force_present");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_DEALLOC:
+	case GOMP_MAP_FORCE_DEALLOC:
 	  pp_string (pp, "force_dealloc");
 	  break;
-	case OMP_CLAUSE_MAP_FORCE_DEVICEPTR:
+	case GOMP_MAP_FORCE_DEVICEPTR:
 	  pp_string (pp, "force_deviceptr");
 	  break;
 	default:
@@ -566,10 +567,10 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
       if (OMP_CLAUSE_SIZE (clause))
 	{
 	  if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
-	      && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_POINTER)
+	      && OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_POINTER)
 	    pp_string (pp, " [pointer assign, bias: ");
 	  else if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
-		   && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_TO_PSET)
+		   && OMP_CLAUSE_MAP_KIND (clause) == GOMP_MAP_TO_PSET)
 	    pp_string (pp, " [pointer set, len: ");
 	  else
 	    pp_string (pp, " [len: ");
diff --git gcc/tree-streamer-in.c gcc/tree-streamer-in.c
index c436852..c3090fb 100644
--- gcc/tree-streamer-in.c
+++ gcc/tree-streamer-in.c
@@ -436,7 +436,7 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
       break;
     case OMP_CLAUSE_MAP:
       OMP_CLAUSE_MAP_KIND (expr)
-	= bp_unpack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST);
+	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
       break;
     case OMP_CLAUSE_PROC_BIND:
       OMP_CLAUSE_PROC_BIND_KIND (expr)
diff --git gcc/tree-streamer-out.c gcc/tree-streamer-out.c
index 480fb1e..de59d92 100644
--- gcc/tree-streamer-out.c
+++ gcc/tree-streamer-out.c
@@ -395,7 +395,7 @@ pack_ts_omp_clause_value_fields (struct output_block *ob,
 		    OMP_CLAUSE_DEPEND_KIND (expr));
       break;
     case OMP_CLAUSE_MAP:
-      bp_pack_enum (bp, omp_clause_map_kind, OMP_CLAUSE_MAP_LAST,
+      bp_pack_enum (bp, gomp_map_kind, GOMP_MAP_LAST,
 		    OMP_CLAUSE_MAP_KIND (expr));
       break;
     case OMP_CLAUSE_PROC_BIND:
diff --git gcc/tree.h gcc/tree.h
index 1615086..fd731e8 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -1393,8 +1393,8 @@ extern void protected_set_expr_location (tree, location_t);
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
 
 /* Nonzero if this map clause is for array (rather than pointer) based array
-   section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and
-   correspoidng OMP_CLAUSE_MAP_POINTER clause are marked with this flag.  */
+   section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding
+   OMP_CLAUSE_MAP with GOMP_MAP_POINTER are marked with this flag.  */
 #define OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION(NODE) \
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.public_flag)
 
diff --git include/ChangeLog.gomp include/ChangeLog.gomp
index 80c8251..e9ae362 100644
--- include/ChangeLog.gomp
+++ include/ChangeLog.gomp
@@ -1,3 +1,13 @@
+2015-01-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gomp-constants.h (GOMP_MAP_LAST): Rename from
+	GOMP_MAP_VALUE_LIMIT.  Change all users.
+	(GOMP_MAP_ALLOC, GOMP_MAP_TO, GOMP_MAP_FROM, GOMP_MAP_TOFROM)
+	(GOMP_MAP_POINTER, GOMP_MAP_TO_PSET, GOMP_MAP_FORCE_PRESENT)
+	(GOMP_MAP_FORCE_DEALLOC, GOMP_MAP_FORCE_DEVICEPTR)
+	(GOMP_MAP_FORCE_ALLOC, GOMP_MAP_FORCE_TO, GOMP_MAP_FORCE_FROM)
+	(GOMP_MAP_FORCE_TOFROM): Move into a new enum gomp_map_kind.
+
 2014-12-17  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* gomp-constants.h: Update.  Change all users.
diff --git include/gomp-constants.h include/gomp-constants.h
index bb68160..e3d2820 100644
--- include/gomp-constants.h
+++ include/gomp-constants.h
@@ -32,7 +32,7 @@
 /* Memory mapping types.  */
 
 /* One byte.  */
-#define GOMP_MAP_VALUE_LIMIT		(1 << 8)
+#define GOMP_MAP_LAST			(1 << 8)
 
 #define GOMP_MAP_FLAG_TO		(1 << 0)
 #define GOMP_MAP_FLAG_FROM		(1 << 1)
@@ -44,19 +44,41 @@
 /* Flag to force a specific behavior (or else, trigger a run-time error).  */
 #define GOMP_MAP_FLAG_FORCE		(1 << 7)
 
-#define GOMP_MAP_ALLOC			0
-#define GOMP_MAP_TO			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO)
-#define GOMP_MAP_FROM			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM)
-#define GOMP_MAP_TOFROM			(GOMP_MAP_TO | GOMP_MAP_FROM)
-#define GOMP_MAP_POINTER		(GOMP_MAP_FLAG_SPECIAL_0 | 0)
-#define GOMP_MAP_TO_PSET		(GOMP_MAP_FLAG_SPECIAL_0 | 1)
-#define GOMP_MAP_FORCE_PRESENT		(GOMP_MAP_FLAG_SPECIAL_0 | 2)
-#define GOMP_MAP_FORCE_DEALLOC		(GOMP_MAP_FLAG_SPECIAL_0 | 3)
-#define GOMP_MAP_FORCE_DEVICEPTR	(GOMP_MAP_FLAG_SPECIAL_1 | 0)
-#define GOMP_MAP_FORCE_ALLOC		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC)
-#define GOMP_MAP_FORCE_TO		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO)
-#define GOMP_MAP_FORCE_FROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM)
-#define GOMP_MAP_FORCE_TOFROM		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
+enum gomp_map_kind
+  {
+    /* If not already present, allocate.  */
+    GOMP_MAP_ALLOC =			0,
+    /* ..., and copy to device.  */
+    GOMP_MAP_TO =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_TO),
+    /* ..., and copy from device.  */
+    GOMP_MAP_FROM =			(GOMP_MAP_ALLOC | GOMP_MAP_FLAG_FROM),
+    /* ..., and copy to and from device.  */
+    GOMP_MAP_TOFROM =			(GOMP_MAP_TO | GOMP_MAP_FROM),
+    /* The following kind is an internal only map kind, used for pointer based
+       array sections.  OMP_CLAUSE_SIZE for these is not the pointer size,
+       which is implicitly POINTER_SIZE_UNITS, but the bias.  */
+    GOMP_MAP_POINTER =			(GOMP_MAP_FLAG_SPECIAL_0 | 0),
+    /* Also internal, behaves like GOMP_MAP_TO, but additionally any
+       GOMP_MAP_POINTER records consecutive after it which have addresses
+       falling into that range will not be ignored if GOMP_MAP_TO_PSET wasn't
+       mapped already.  */
+    GOMP_MAP_TO_PSET =			(GOMP_MAP_FLAG_SPECIAL_0 | 1),
+    /* Must already be present.  */
+    GOMP_MAP_FORCE_PRESENT =		(GOMP_MAP_FLAG_SPECIAL_0 | 2),
+    /* Deallocate a mapping, without copying from device.  */
+    GOMP_MAP_FORCE_DEALLOC =		(GOMP_MAP_FLAG_SPECIAL_0 | 3),
+    /* Is a device pointer.  OMP_CLAUSE_SIZE for these is unused; is implicitly
+       POINTER_SIZE_UNITS.  */
+    GOMP_MAP_FORCE_DEVICEPTR =		(GOMP_MAP_FLAG_SPECIAL_1 | 0),
+    /* Allocate.  */
+    GOMP_MAP_FORCE_ALLOC =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_ALLOC),
+    /* ..., and copy to device.  */
+    GOMP_MAP_FORCE_TO =			(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TO),
+    /* ..., and copy from device.  */
+    GOMP_MAP_FORCE_FROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_FROM),
+    /* ..., and copy to and from device.  */
+    GOMP_MAP_FORCE_TOFROM =		(GOMP_MAP_FLAG_FORCE | GOMP_MAP_TOFROM)
+  };
 
 #define GOMP_MAP_COPY_TO_P(X) \
   (!((X) & GOMP_MAP_FLAG_SPECIAL) \


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h)
  2015-01-12 17:01         ` [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h) Thomas Schwinge
@ 2015-01-12 18:00           ` Jakub Jelinek
  2015-01-13 11:15             ` Thomas Schwinge
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Jelinek @ 2015-01-12 18:00 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: michael.collison, Andrew MacLeod, David Malcolm, gcc-patches

On Mon, Jan 12, 2015 at 05:32:14PM +0100, Thomas Schwinge wrote:
> I have now committed the patch to gomp-4_0-branch in the following form.
> The issues raised above remain to be resolved.
> 
> In spirit against the tree.h header flattening, I had to keep the
> #include "include/gomp-constants.h" in gcc/tree-core.h, because otherwise
> I'd have to add it to a ton of *.c files, just for the enum gomp_map_kind
> definition.
> 
> I found that in the C++ dialect used by GCC, it is not possible to
> declare an enum without giving the list of enumerators.  N2764 (from
> 2008) resolved this by adding appropriate syntax for declaring enums,
> however: "warning: scoped enums only available with -std=c++11 or
> -std=gnu++11".  If it were possible to use this, we could add to
> gcc/tree-core.h:
> 
>     enum gomp_map_kind : char;
> 
> ... (or similar), and this way decouple the declaration (gcc/tree-core.h)
> From the actual "population of it" (include/gomp-constants.h).
> Alternatively, in gcc/tree-core.h:struct tree_omp_clause, we could switch
> the map_kind member from enum gomp_map_kind to a char -- but that would
> defeat the usage of an enum (easy pretty-printing of its enumerators in
> GDB, and so on.).

Or just don't do this and duplicate the constants and just assert somewhere
(in omp-low.c) at compile time that all the values match.
Either using char and casting the value only in the OMP_* macros
or duplicating the values sound preferrable over including
include/gomp-constants.h from tree-core.h.

	Jakub

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h)
  2015-01-12 18:00           ` Jakub Jelinek
@ 2015-01-13 11:15             ` Thomas Schwinge
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Schwinge @ 2015-01-13 11:15 UTC (permalink / raw)
  To: gcc-patches
  Cc: michael.collison, Andrew MacLeod, David Malcolm, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 26132 bytes --]

Hi!

On Mon, 12 Jan 2015 17:39:16 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Jan 12, 2015 at 05:32:14PM +0100, Thomas Schwinge wrote:
> > I have now committed the patch to gomp-4_0-branch in the following form.
> > The issues raised above remain to be resolved.

(I'll try to address those later on.)


> > In spirit against the tree.h header flattening, I had to keep the
> > #include "include/gomp-constants.h" in gcc/tree-core.h, because otherwise
> > I'd have to add it to a ton of *.c files, just for the enum gomp_map_kind
> > definition.
> > 
> > I found that in the C++ dialect used by GCC, it is not possible to
> > declare an enum without giving the list of enumerators.  N2764 (from
> > 2008) resolved this by adding appropriate syntax for declaring enums,
> > however: "warning: scoped enums only available with -std=c++11 or
> > -std=gnu++11".  If it were possible to use this, we could add to
> > gcc/tree-core.h:
> > 
> >     enum gomp_map_kind : char;
> > 
> > ... (or similar), and this way decouple the declaration (gcc/tree-core.h)
> > From the actual "population of it" (include/gomp-constants.h).
> > Alternatively, in gcc/tree-core.h:struct tree_omp_clause, we could switch
> > the map_kind member from enum gomp_map_kind to a char -- but that would
> > defeat the usage of an enum (easy pretty-printing of its enumerators in
> > GDB, and so on.).
> 
> Or just don't do this and duplicate the constants and just assert somewhere
> (in omp-low.c) at compile time that all the values match.
> Either using char and casting the value only in the OMP_* macros
> or duplicating the values sound preferrable over including
> include/gomp-constants.h from tree-core.h.

Indeed I've found precedent in gcc/tree.h: there already are a few
*_SET_* functions, also used for casting to/from enum types.  Committed
to gomp-4_0-branch in r219524:

commit 7dbb7ec6c08d604926fca30e105d2b6411cf73cb
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Jan 13 10:50:01 2015 +0000

    Avoid inclusion of "gomp-constants.h" in gcc/tree-core.h.
    
    N2764 (from 2008) added syntax for declaring enums, however: "warning: scoped
    enums only available with -std=c++11 or -std=gnu++11": in the C++ dialect
    currently used by GCC, it is not possible to declare an enum without giving the
    full list of enumerators.  If it were possible to use this, we could add to
    gcc/tree-core.h:
    
        enum gomp_map_kind : unsigned char;
    
    ..., and keep using enum gomp_map_kind for gcc/tree-core.h's struct
    tree_omp_clause's map_kind member, and this way decouple the declaration
    (gcc/tree-core.h) from the actual "population of it"
    (include/gomp-constants.h).  Until switching GCC to C++11, we'll have to do as
    follows:
    
    	gcc/
    	* tree-core.h: Don't include "gomp-constants.h".
    	(struct tree_omp_clause): Change type of map_kind member from enum
    	gomp_map_kind to unsigned char.
    	* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
    	(OMP_CLAUSE_SET_MAP_KIND): New macro.
    	* gimplify.c (gimplify_adjust_omp_clauses_1)
    	(gimplify_adjust_omp_clauses): Use OMP_CLAUSE_SET_MAP_KIND.
    	* omp-low.c (oacc_initialize_reduction_data): Likewise.
    	* tree-nested.c (convert_nonlocal_reference_stmt)
    	(convert_local_reference_stmt, convert_gimple_call): Likewise.
    	* tree-streamer-in.c (unpack_ts_omp_clause_value_fields):
    	Likewise.
    	gcc/c/
    	* c-parser.c (c_parser_oacc_data_clause)
    	(c_parser_oacc_data_clause_deviceptr, c_parser_omp_clause_map):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    	* c-typeck.c (handle_omp_array_sections): Likewise.
    	gcc/cp/
    	* parser.c (cp_parser_oacc_data_clause)
    	(cp_parser_oacc_data_clause_deviceptr, cp_parser_omp_clause_map):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    	* semantics.c (handle_omp_array_sections): Likewise.
    	gcc/fortran/
    	* trans-openmp.c (gfc_omp_finish_clause, gfc_trans_omp_clauses):
    	Use OMP_CLAUSE_SET_MAP_KIND.
    
    	gcc/
    	* lto-streamer-out.c: Include "gomp-constants.h".
    	* tree-streamer-in.c: Likewise.
    	* tree-streamer-out.c: Likewise.
    	gcc/lto/
    	* lto.c: Include "gomp-constants.h".
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@219524 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp         | 19 +++++++++++++++++++
 gcc/c/ChangeLog.gomp       |  7 +++++++
 gcc/c/c-parser.c           |  6 +++---
 gcc/c/c-typeck.c           |  2 +-
 gcc/cp/ChangeLog.gomp      |  7 +++++++
 gcc/cp/parser.c            |  6 +++---
 gcc/cp/semantics.c         |  4 ++--
 gcc/fortran/trans-openmp.c | 46 +++++++++++++++++++++++-----------------------
 gcc/gimplify.c             | 11 ++++++-----
 gcc/lto-streamer-out.c     |  1 +
 gcc/lto/ChangeLog.gomp     |  4 ++++
 gcc/lto/lto.c              |  1 +
 gcc/omp-low.c              |  2 +-
 gcc/tree-core.h            |  5 ++---
 gcc/tree-nested.c          |  6 +++---
 gcc/tree-streamer-in.c     |  6 ++++--
 gcc/tree-streamer-out.c    |  2 ++
 gcc/tree.h                 |  5 ++++-
 18 files changed, 93 insertions(+), 47 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index c627871..6ed6962 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,22 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* tree-core.h: Don't include "gomp-constants.h".
+	(struct tree_omp_clause): Change type of map_kind member from enum
+	gomp_map_kind to unsigned char.
+	* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
+	(OMP_CLAUSE_SET_MAP_KIND): New macro.
+	* gimplify.c (gimplify_adjust_omp_clauses_1)
+	(gimplify_adjust_omp_clauses): Use OMP_CLAUSE_SET_MAP_KIND.
+	* omp-low.c (oacc_initialize_reduction_data): Likewise.
+	* tree-nested.c (convert_nonlocal_reference_stmt)
+	(convert_local_reference_stmt, convert_gimple_call): Likewise.
+	* tree-streamer-in.c (unpack_ts_omp_clause_value_fields):
+	Likewise.
+
+	* lto-streamer-out.c: Include "gomp-constants.h".
+	* tree-streamer-in.c: Likewise.
+	* tree-streamer-out.c: Likewise.
+
 2015-01-12  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* tree-core.h (OMP_CLAUSE_MAP_ALLOC, OMP_CLAUSE_MAP_TO)
diff --git gcc/c/ChangeLog.gomp gcc/c/ChangeLog.gomp
index 84fd4ff..5a261a9 100644
--- gcc/c/ChangeLog.gomp
+++ gcc/c/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c-parser.c (c_parser_oacc_data_clause)
+	(c_parser_oacc_data_clause_deviceptr, c_parser_omp_clause_map):
+	Use OMP_CLAUSE_SET_MAP_KIND.
+	* c-typeck.c (handle_omp_array_sections): Likewise.
+
 2014-12-19  Jakub Jelinek  <jakub@redhat.com>
 
 	* c-parser.c (c_parser_omp_clause_name): Use PRAGMA_OACC_CLAUSE_*
diff --git gcc/c/c-parser.c gcc/c/c-parser.c
index b0c0280..fc6661b 100644
--- gcc/c/c-parser.c
+++ gcc/c/c-parser.c
@@ -10305,7 +10305,7 @@ c_parser_oacc_data_clause (c_parser *parser, pragma_omp_clause c_kind,
   nl = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nl;
 }
@@ -10341,7 +10341,7 @@ c_parser_oacc_data_clause_deviceptr (c_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR);
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -11414,7 +11414,7 @@ c_parser_omp_clause_map (c_parser *parser, tree list)
   nl = c_parser_omp_variable_list (parser, clause_loc, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
   return nl;
diff --git gcc/c/c-typeck.c gcc/c/c-typeck.c
index 747e322..f39dfdd 100644
--- gcc/c/c-typeck.c
+++ gcc/c/c-typeck.c
@@ -11943,7 +11943,7 @@ handle_omp_array_sections (tree c)
 	return false;
       gcc_assert (OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FORCE_DEVICEPTR);
       tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
       if (!c_mark_addressable (t))
 	return false;
       OMP_CLAUSE_DECL (c2) = t;
diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp
index dc7f30a..d4cd7a9 100644
--- gcc/cp/ChangeLog.gomp
+++ gcc/cp/ChangeLog.gomp
@@ -1,3 +1,10 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* parser.c (cp_parser_oacc_data_clause)
+	(cp_parser_oacc_data_clause_deviceptr, cp_parser_omp_clause_map):
+	Use OMP_CLAUSE_SET_MAP_KIND.
+	* semantics.c (handle_omp_array_sections): Likewise.
+
 2014-12-19  Jakub Jelinek  <jakub@redhat.com>
 
 	* parser.c (cp_parser_omp_clause_name): Use PRAGMA_OACC_CLAUSE_*
diff --git gcc/cp/parser.c gcc/cp/parser.c
index eaa6eee..1ce7de7 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -27962,7 +27962,7 @@ cp_parser_oacc_data_clause (cp_parser *parser, pragma_omp_clause c_kind,
   nl = cp_parser_omp_var_list (parser, OMP_CLAUSE_MAP, list);
 
   for (c = nl; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nl;
 }
@@ -27998,7 +27998,7 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list)
 	error_at (loc, "%qD is not a pointer variable", v);
 
       tree u = build_omp_clause (loc, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (u) = GOMP_MAP_FORCE_DEVICEPTR;
+      OMP_CLAUSE_SET_MAP_KIND (u, GOMP_MAP_FORCE_DEVICEPTR);
       OMP_CLAUSE_DECL (u) = v;
       OMP_CLAUSE_CHAIN (u) = list;
       list = u;
@@ -28959,7 +28959,7 @@ cp_parser_omp_clause_map (cp_parser *parser, tree list)
 					  NULL);
 
   for (c = nlist; c != list; c = OMP_CLAUSE_CHAIN (c))
-    OMP_CLAUSE_MAP_KIND (c) = kind;
+    OMP_CLAUSE_SET_MAP_KIND (c, kind);
 
   return nlist;
 }
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index fd37954..915048d 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -4671,7 +4671,7 @@ handle_omp_array_sections (tree c)
 	    return false;
 	  tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 				      OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_POINTER);
 	  if (!cxx_mark_addressable (t))
 	    return false;
 	  OMP_CLAUSE_DECL (c2) = t;
@@ -4695,7 +4695,7 @@ handle_omp_array_sections (tree c)
 	    {
 	      tree c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c),
 					  OMP_CLAUSE_MAP);
-	      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+	      OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
 	      OMP_CLAUSE_DECL (c3) = ptr;
 	      OMP_CLAUSE_DECL (c2) = convert_from_reference (ptr);
 	      OMP_CLAUSE_SIZE (c3) = size_zero_node;
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index c230f73..fe47a96 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -1046,7 +1046,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	return;
       tree orig_decl = decl;
       c4 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c4) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c4, GOMP_MAP_POINTER);
       OMP_CLAUSE_DECL (c4) = decl;
       OMP_CLAUSE_SIZE (c4) = size_int (0);
       decl = build_fold_indirect_ref (decl);
@@ -1057,7 +1057,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
 	      || GFC_DECL_GET_SCALAR_ALLOCATABLE (orig_decl)))
 	{
 	  c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-	  OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
 	  OMP_CLAUSE_DECL (c3) = unshare_expr (decl);
 	  OMP_CLAUSE_SIZE (c3) = size_int (0);
 	  decl = build_fold_indirect_ref (decl);
@@ -1074,11 +1074,11 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p)
       ptr = build_fold_indirect_ref (ptr);
       OMP_CLAUSE_DECL (c) = ptr;
       c2 = build_omp_clause (input_location, OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c2) = GOMP_MAP_TO_PSET;
+      OMP_CLAUSE_SET_MAP_KIND (c2, GOMP_MAP_TO_PSET);
       OMP_CLAUSE_DECL (c2) = decl;
       OMP_CLAUSE_SIZE (c2) = TYPE_SIZE_UNIT (type);
       c3 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (c3) = GOMP_MAP_POINTER;
+      OMP_CLAUSE_SET_MAP_KIND (c3, GOMP_MAP_POINTER);
       OMP_CLAUSE_DECL (c3) = gfc_conv_descriptor_data_get (decl);
       OMP_CLAUSE_SIZE (c3) = size_int (0);
       tree size = create_tmp_var (gfc_array_index_type);
@@ -1954,7 +1954,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      tree orig_decl = decl;
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -1964,7 +1964,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			{
 			  node3 = build_omp_clause (input_location,
 						    OMP_CLAUSE_MAP);
-			  OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+			  OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 			  OMP_CLAUSE_DECL (node3) = decl;
 			  OMP_CLAUSE_SIZE (node3) = size_int (0);
 			  decl = build_fold_indirect_ref (decl);
@@ -1980,12 +1980,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      OMP_CLAUSE_DECL (node) = ptr;
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
+		      OMP_CLAUSE_SET_MAP_KIND (node2, GOMP_MAP_TO_PSET);
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		      OMP_CLAUSE_SIZE (node3) = size_int (0);
@@ -2071,7 +2071,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		    {
 		      node4 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node4) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node4, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node4) = decl;
 		      OMP_CLAUSE_SIZE (node4) = size_int (0);
 		      decl = build_fold_indirect_ref (decl);
@@ -2083,12 +2083,12 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 		      ptr2 = gfc_conv_descriptor_data_get (decl);
 		      node2 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node2) = GOMP_MAP_TO_PSET;
+		      OMP_CLAUSE_SET_MAP_KIND (node2, GOMP_MAP_TO_PSET);
 		      OMP_CLAUSE_DECL (node2) = decl;
 		      OMP_CLAUSE_SIZE (node2) = TYPE_SIZE_UNIT (type);
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3)
 			= gfc_conv_descriptor_data_get (decl);
 		    }
@@ -2103,7 +2103,7 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 			}
 		      node3 = build_omp_clause (input_location,
 						OMP_CLAUSE_MAP);
-		      OMP_CLAUSE_MAP_KIND (node3) = GOMP_MAP_POINTER;
+		      OMP_CLAUSE_SET_MAP_KIND (node3, GOMP_MAP_POINTER);
 		      OMP_CLAUSE_DECL (node3) = decl;
 		    }
 		  ptr2 = fold_convert (sizetype, ptr2);
@@ -2113,37 +2113,37 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 	      switch (n->u.map_op)
 		{
 		case OMP_MAP_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_ALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_ALLOC);
 		  break;
 		case OMP_MAP_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TO;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_TO);
 		  break;
 		case OMP_MAP_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FROM);
 		  break;
 		case OMP_MAP_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_TOFROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_TOFROM);
 		  break;
 		case OMP_MAP_FORCE_ALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_ALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_ALLOC);
 		  break;
 		case OMP_MAP_FORCE_DEALLOC:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEALLOC;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_DEALLOC);
 		  break;
 		case OMP_MAP_FORCE_TO:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TO;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_TO);
 		  break;
 		case OMP_MAP_FORCE_FROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_FROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_FROM);
 		  break;
 		case OMP_MAP_FORCE_TOFROM:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_TOFROM;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_TOFROM);
 		  break;
 		case OMP_MAP_FORCE_PRESENT:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_PRESENT;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_PRESENT);
 		  break;
 		case OMP_MAP_FORCE_DEVICEPTR:
-		  OMP_CLAUSE_MAP_KIND (node) = GOMP_MAP_FORCE_DEVICEPTR;
+		  OMP_CLAUSE_SET_MAP_KIND (node, GOMP_MAP_FORCE_DEVICEPTR);
 		  break;
 		default:
 		  gcc_unreachable ();
diff --git gcc/gimplify.c gcc/gimplify.c
index cbbb9a7..da5f4da 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -6442,9 +6442,10 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
     OMP_CLAUSE_PRIVATE_OUTER_REF (clause) = 1;
   else if (code == OMP_CLAUSE_MAP)
     {
-      OMP_CLAUSE_MAP_KIND (clause) = flags & GOVD_MAP_TO_ONLY
-				     ? GOMP_MAP_TO
-				     : GOMP_MAP_TOFROM;
+      OMP_CLAUSE_SET_MAP_KIND (clause,
+			       flags & GOVD_MAP_TO_ONLY
+			       ? GOMP_MAP_TO
+			       : GOMP_MAP_TOFROM);
       if (DECL_SIZE (decl)
 	  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 	{
@@ -6465,7 +6466,7 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data)
 				      OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (nc) = decl;
 	  OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	  OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
+	  OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
 	  OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause);
 	  OMP_CLAUSE_CHAIN (clause) = nc;
 	}
@@ -6639,7 +6640,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, tree *list_p)
 					  OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (nc) = decl;
 	      OMP_CLAUSE_SIZE (nc) = size_zero_node;
-	      OMP_CLAUSE_MAP_KIND (nc) = GOMP_MAP_POINTER;
+	      OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER);
 	      OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (c);
 	      OMP_CLAUSE_CHAIN (c) = nc;
 	      c = nc;
diff --git gcc/lto-streamer-out.c gcc/lto-streamer-out.c
index 21a78bb..f06bd26 100644
--- gcc/lto-streamer-out.c
+++ gcc/lto-streamer-out.c
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "streamer-hooks.h"
 #include "cfgloop.h"
 #include "builtins.h"
+#include "gomp-constants.h"
 
 
 static void lto_write_tree (struct output_block*, tree, bool);
diff --git gcc/lto/ChangeLog.gomp gcc/lto/ChangeLog.gomp
index a738a26..758419d 100644
--- gcc/lto/ChangeLog.gomp
+++ gcc/lto/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-01-13  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* lto.c: Include "gomp-constants.h".
+
 2014-03-20  Bernd Schmidt  <bernds@codesourcery.com>
 
 	From Michael Zolotukhin.
diff --git gcc/lto/lto.c gcc/lto/lto.c
index 96e5fd1..15d3f10 100644
--- gcc/lto/lto.c
+++ gcc/lto/lto.c
@@ -77,6 +77,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-inline.h"
 #include "params.h"
 #include "ipa-utils.h"
+#include "gomp-constants.h"
 
 
 /* Number of parallel tasks to run, -1 if we want to use GNU Make jobserver.  */
diff --git gcc/omp-low.c gcc/omp-low.c
index 703816a..063bd52 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -9713,7 +9713,7 @@ oacc_initialize_reduction_data (tree clauses, tree nthreads,
       /* Add the reduction array to the list of clauses.  */
       tree x = array;
       t = build_omp_clause (gimple_location (ctx->stmt), OMP_CLAUSE_MAP);
-      OMP_CLAUSE_MAP_KIND (t) = GOMP_MAP_FORCE_FROM;
+      OMP_CLAUSE_SET_MAP_KIND (t, GOMP_MAP_FORCE_FROM);
       OMP_CLAUSE_DECL (t) = x;
       OMP_CLAUSE_CHAIN (t) = NULL;
       if (oc)
diff --git gcc/tree-core.h gcc/tree-core.h
index 9d3c386..735ce5c 100644
--- gcc/tree-core.h
+++ gcc/tree-core.h
@@ -20,8 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TREE_CORE_H
 #define GCC_TREE_CORE_H
 
-#include "gomp-constants.h"
-
 /* This file contains all the data structures that define the 'tree' type.
    There are no accessor macros nor functions in this file. Only the
    basic data structures, extern declarations and type definitions.  */
@@ -1298,7 +1296,8 @@ struct GTY(()) tree_omp_clause {
     enum omp_clause_default_kind   default_kind;
     enum omp_clause_schedule_kind  schedule_kind;
     enum omp_clause_depend_kind    depend_kind;
-    enum gomp_map_kind		   map_kind;
+    /* See include/gomp-constants.h for enum gomp_map_kind's values.  */
+    unsigned char		   map_kind;
     enum omp_clause_proc_bind_kind proc_bind_kind;
     enum tree_code                 reduction_code;
   } GTY ((skip)) subcode;
diff --git gcc/tree-nested.c gcc/tree-nested.c
index 29326ed..6509af8 100644
--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -1406,7 +1406,7 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  decl = get_chain_decl (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = decl;
-	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TO;
+	  OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TO);
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -1972,7 +1972,7 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	  (void) get_frame_type (info);
 	  c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	  OMP_CLAUSE_DECL (c) = info->frame_decl;
-	  OMP_CLAUSE_MAP_KIND (c) = GOMP_MAP_TOFROM;
+	  OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TOFROM);
 	  OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (info->frame_decl);
 	  OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	  gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt), c);
@@ -2413,7 +2413,7 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	    {
 	      c = build_omp_clause (gimple_location (stmt), OMP_CLAUSE_MAP);
 	      OMP_CLAUSE_DECL (c) = decl;
-	      OMP_CLAUSE_MAP_KIND (c) = i ? GOMP_MAP_TO : GOMP_MAP_TOFROM;
+	      OMP_CLAUSE_SET_MAP_KIND (c, i ? GOMP_MAP_TO : GOMP_MAP_TOFROM);
 	      OMP_CLAUSE_SIZE (c) = DECL_SIZE_UNIT (decl);
 	      OMP_CLAUSE_CHAIN (c) = gimple_omp_target_clauses (stmt);
 	      gimple_omp_target_set_clauses (as_a <gomp_target *> (stmt),
diff --git gcc/tree-streamer-in.c gcc/tree-streamer-in.c
index c3090fb..67d33ed 100644
--- gcc/tree-streamer-in.c
+++ gcc/tree-streamer-in.c
@@ -59,6 +59,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "lto-streamer.h"
 #include "builtins.h"
 #include "ipa-chkp.h"
+#include "gomp-constants.h"
+
 
 /* Read a STRING_CST from the string table in DATA_IN using input
    block IB.  */
@@ -435,8 +437,8 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in,
 	= bp_unpack_enum (bp, omp_clause_depend_kind, OMP_CLAUSE_DEPEND_LAST);
       break;
     case OMP_CLAUSE_MAP:
-      OMP_CLAUSE_MAP_KIND (expr)
-	= bp_unpack_enum (bp, gomp_map_kind, GOMP_MAP_LAST);
+      OMP_CLAUSE_SET_MAP_KIND (expr, bp_unpack_enum (bp, gomp_map_kind,
+						     GOMP_MAP_LAST));
       break;
     case OMP_CLAUSE_PROC_BIND:
       OMP_CLAUSE_PROC_BIND_KIND (expr)
diff --git gcc/tree-streamer-out.c gcc/tree-streamer-out.c
index de59d92..3669680 100644
--- gcc/tree-streamer-out.c
+++ gcc/tree-streamer-out.c
@@ -55,6 +55,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-streamer.h"
 #include "data-streamer.h"
 #include "streamer-hooks.h"
+#include "gomp-constants.h"
+
 
 /* Output the STRING constant to the string
    table in OB.  Then put the index onto the INDEX_STREAM.  */
diff --git gcc/tree.h gcc/tree.h
index fd731e8..51c9429 100644
--- gcc/tree.h
+++ gcc/tree.h
@@ -1390,7 +1390,10 @@ extern void protected_set_expr_location (tree, location_t);
   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEPEND)->omp_clause.subcode.depend_kind)
 
 #define OMP_CLAUSE_MAP_KIND(NODE) \
-  (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
+  ((enum gomp_map_kind) OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
+#define OMP_CLAUSE_SET_MAP_KIND(NODE, MAP_KIND) \
+  (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind \
+   = (unsigned char) (MAP_KIND))
 
 /* Nonzero if this map clause is for array (rather than pointer) based array
    section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-01-13 10:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-17 22:32 [gomp4] Use include/gomp-constants.h more actively Thomas Schwinge
2014-12-18 18:33 ` Including a file from include/ in gcc/*.h (was: [gomp4] Use include/gomp-constants.h more actively) Thomas Schwinge
2014-12-18 18:37   ` Jakub Jelinek
2014-12-19 18:04     ` Thomas Schwinge
2014-12-19 19:48       ` Jakub Jelinek
2014-12-22 15:17       ` Thomas Schwinge
2015-01-12 17:01         ` [gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h) Thomas Schwinge
2015-01-12 18:00           ` Jakub Jelinek
2015-01-13 11:15             ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).