diff mbox

[gomp4] Replace enum omp_clause_map_kind with enum gomp_map_kind (was: Including a file from include/ in gcc/*.h)

Message ID 87ppak0xkh.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Jan. 12, 2015, 4:32 p.m. UTC
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(-)



Grüße,
 Thomas

Comments

Jakub Jelinek Jan. 12, 2015, 4:39 p.m. UTC | #1
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
diff mbox

Patch

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) \