[gomp4] Re: FWD: Re: OpenACC subarray specifications in the GCC Fortran front end

Thomas Schwinge thomas@codesourcery.com
Tue Nov 11 15:02:00 GMT 2014


Hi!

On Mon, 28 Jul 2014 10:00:46 -0700, Cesar Philippidis <cesar@codesourcery.com> wrote:
> On 07/25/2014 09:01 AM, Thomas Schwinge wrote:
> > [...] you may directly fold in the following patch to nuke the
> > unused OMP_LIST_COPY (or do that later).

> > --- gcc/fortran/dump-parse-tree.c
> > +++ gcc/fortran/dump-parse-tree.c
> > @@ -1257,7 +1257,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
> >  	const char *type = NULL;
> >  	switch (list_type)
> >  	  {
> > -	  case OMP_LIST_COPY: type = "COPY"; break;
> >  	  case OMP_LIST_DEVICEPTR: type = "DEVICEPTR"; break;
> >  	  case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break;
> >  	  case OMP_LIST_DEVICE_RESIDENT: type = "USE_DEVICE"; break;
> > --- gcc/fortran/gfortran.h
> > +++ gcc/fortran/gfortran.h
> > @@ -1157,9 +1157,8 @@ enum
> >    OMP_LIST_TO,
> >    OMP_LIST_FROM,
> >    OMP_LIST_REDUCTION,
> > -  OMP_LIST_COPY,
> > -  OMP_LIST_DATA_CLAUSE_FIRST = OMP_LIST_COPY,
> >    OMP_LIST_DEVICEPTR,
> > +  OMP_LIST_DATA_CLAUSE_FIRST = OMP_LIST_DEVICEPTR,
> >    OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DEVICEPTR,
> >    OMP_LIST_DEVICE_RESIDENT,
> >    OMP_LIST_USE_DEVICE,
> 
> I'll take care of this separately.

I have now committed the following to gomp-4_0-branch in r217353:

commit 782a3dab5694d561f80bda7a29000250a681781a
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue Nov 11 14:52:16 2014 +0000

    Fortran OMP_LIST_* maintenance.
    
    	gcc/fortran/
    	* gfortran.h (OMP_LIST_COPY, OMP_LIST_DATA_CLAUSE_FIRST)
    	(OMP_LIST_DATA_CLAUSE_LAST, OMP_LIST_LAST): Remove.
    	* dump-parse-tree.c (show_omp_clauses): Update.
    	* openmp.c (resolve_omp_clauses, gfc_resolve_oacc_declare):
    	Likewise.
    	* trans-openmp.c (gfc_trans_omp_clauses): Likewise.
    	(gfc_trans_omp_map_clause_list): Remove.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@217353 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/fortran/ChangeLog.gomp    |  8 ++++++++
 gcc/fortran/dump-parse-tree.c |  1 -
 gcc/fortran/gfortran.h        |  6 +-----
 gcc/fortran/openmp.c          | 42 ++++++++++--------------------------------
 gcc/fortran/trans-openmp.c    | 31 -------------------------------
 5 files changed, 19 insertions(+), 69 deletions(-)

diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp
index 1ae1d31..f846890 100644
--- gcc/fortran/ChangeLog.gomp
+++ gcc/fortran/ChangeLog.gomp
@@ -1,5 +1,13 @@
 2014-11-11  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* gfortran.h (OMP_LIST_COPY, OMP_LIST_DATA_CLAUSE_FIRST)
+	(OMP_LIST_DATA_CLAUSE_LAST, OMP_LIST_LAST): Remove.
+	* dump-parse-tree.c (show_omp_clauses): Update.
+	* openmp.c (resolve_omp_clauses, gfc_resolve_oacc_declare):
+	Likewise.
+	* trans-openmp.c (gfc_trans_omp_clauses): Likewise.
+	(gfc_trans_omp_map_clause_list): Remove.
+
 	* gfortran.h (OMP_LIST_DEVICEPTR): Remove, and instead...
 	(enum gfc_omp_map_op): ... add OMP_MAP_FORCE_DEVICEPTR here.
 	* dump-parse-tree.c (show_omp_clauses): Update.
diff --git gcc/fortran/dump-parse-tree.c gcc/fortran/dump-parse-tree.c
index e7aff22..e9d04e7 100644
--- gcc/fortran/dump-parse-tree.c
+++ gcc/fortran/dump-parse-tree.c
@@ -1251,7 +1251,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
 	const char *type = NULL;
 	switch (list_type)
 	  {
-	  case OMP_LIST_COPY: type = "COPY"; break;
 	  case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break;
 	  case OMP_LIST_DEVICE_RESIDENT: type = "USE_DEVICE"; break;
 	  case OMP_LIST_CACHE: type = ""; break;
diff --git gcc/fortran/gfortran.h gcc/fortran/gfortran.h
index 18adbee..aed37d3 100644
--- gcc/fortran/gfortran.h
+++ gcc/fortran/gfortran.h
@@ -1183,14 +1183,10 @@ enum
   OMP_LIST_TO,
   OMP_LIST_FROM,
   OMP_LIST_REDUCTION,
-  OMP_LIST_COPY,
-  OMP_LIST_DATA_CLAUSE_FIRST = OMP_LIST_COPY,
-  OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DATA_CLAUSE_FIRST,
   OMP_LIST_DEVICE_RESIDENT,
   OMP_LIST_USE_DEVICE,
   OMP_LIST_CACHE,
-  OMP_LIST_NUM,
-  OMP_LIST_LAST = OMP_LIST_NUM
+  OMP_LIST_NUM
 };
 
 /* Because a symbol can belong to multiple namelists, they must be
diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c
index 82726b8..47c146e 100644
--- gcc/fortran/openmp.c
+++ gcc/fortran/openmp.c
@@ -2870,11 +2870,8 @@ resolve_omp_clauses (gfc_code *code, locus *where,
   static const char *clause_names[]
     = { "PRIVATE", "FIRSTPRIVATE", "LASTPRIVATE", "COPYPRIVATE", "SHARED",
 	"COPYIN", "UNIFORM", "ALIGNED", "LINEAR", "DEPEND", "MAP",
-	"TO", "FROM", "REDUCTION",
-	"COPY", "COPYIN", "COPYOUT", "CREATE", "DELETE", "PRESENT",
-	"PRESENT_OR_COPY", "PRESENT_OR_COPYIN", "PRESENT_OR_COPYOUT",
-	"PRESENT_OR_CREATE", "DEVICE_RESIDENT", "USE_DEVICE",
-	"HOST", "DEVICE", "CACHE" };
+	"TO", "FROM", "REDUCTION", "DEVICE_RESIDENT", "USE_DEVICE",
+	"CACHE" };
 
   if (omp_clauses == NULL)
     return;
@@ -3231,15 +3228,6 @@ resolve_omp_clauses (gfc_code *code, locus *where,
 		      break;
 		    }
 
-		if (list >= OMP_LIST_DATA_CLAUSE_FIRST
-		    && list < OMP_LIST_DATA_CLAUSE_LAST)
-		  resolve_oacc_data_clauses (n->sym, *where, name);
-
-		if (list > OMP_LIST_DATA_CLAUSE_LAST)
-		  {
-		    check_symbol_not_pointer (n->sym, *where, name);
-		    check_array_not_assumed (n->sym, *where, name);
-		  }
 		switch (list)
 		  {
 		  case OMP_LIST_REDUCTION:
@@ -3391,6 +3379,11 @@ resolve_omp_clauses (gfc_code *code, locus *where,
 		      if (n->sym->attr.cray_pointee)
 			gfc_error ("Cray pointee object '%s' in %s clause at %L",
 				   n->sym->name, name, where);
+		      /* FALLTHRU */
+		  case OMP_LIST_DEVICE_RESIDENT:
+		  case OMP_LIST_CACHE:
+		    check_symbol_not_pointer (n->sym, *where, name);
+		    check_array_not_assumed (n->sym, *where, name);
 		    break;
 		  default:
 		    break;
@@ -4618,10 +4611,6 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
   int list;
   gfc_omp_namelist *n;
   locus loc;
-  static const char *clause_names[] = {"COPY", "COPYIN", "COPYOUT", "CREATE",
-	"DELETE", "PRESENT", "PRESENT_OR_COPY", "PRESENT_OR_COPYIN",
-	"PRESENT_OR_COPYOUT", "PRESENT_OR_CREATE",
-	"DEVICE_RESIDENT"};
 
   if (ns->oacc_declare_clauses == NULL)
     return;
@@ -4629,7 +4618,7 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
   loc = ns->oacc_declare_clauses->ext.loc;
 
   /* FIXME: handle omp_list_map.  */
-  for (list = OMP_LIST_DATA_CLAUSE_FIRST;
+  for (/* TODO */ list = OMP_LIST_DEVICE_RESIDENT;
        list <= OMP_LIST_DEVICE_RESIDENT; list++)
     for (n = ns->oacc_declare_clauses->lists[list]; n; n = n->next)
       {
@@ -4638,7 +4627,7 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
 	  gfc_error ("PARAMETER object '%s' is not allowed at %L", n->sym->name, &loc);
       }
 
-  for (list = OMP_LIST_DATA_CLAUSE_FIRST;
+  for (/* TODO */ list = OMP_LIST_DEVICE_RESIDENT;
        list <= OMP_LIST_DEVICE_RESIDENT; list++)
     for (n = ns->oacc_declare_clauses->lists[list]; n; n = n->next)
       {
@@ -4649,20 +4638,9 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
 	  n->sym->mark = 1;
       }
 
-  for (list = OMP_LIST_DATA_CLAUSE_FIRST;
-       list < OMP_LIST_DATA_CLAUSE_LAST; /* Skip deviceptr clause.  */
-       list++)
-    {
-      const char *name = clause_names[list - OMP_LIST_DATA_CLAUSE_FIRST];
-      for (n = ns->oacc_declare_clauses->lists[list]; n; n = n->next)
-	resolve_oacc_data_clauses (n->sym, loc, name);
-    }
-
   for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICE_RESIDENT]; n;
        n = n->next)
-    check_array_not_assumed (n->sym, loc,
-			     clause_names[OMP_LIST_DEVICE_RESIDENT -
-					  OMP_LIST_DATA_CLAUSE_FIRST]);
+    check_array_not_assumed (n->sym, loc, "DEVICE_RESIDENT");
 }
 
 
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index c1cf5a9..6967c4f 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -1707,25 +1707,6 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list,
   return list;
 }
 
-static tree
-gfc_trans_omp_map_clause_list (enum omp_clause_map_kind kind, 
-			       gfc_omp_namelist *namelist, tree list)
-{
-  for (; namelist != NULL; namelist = namelist->next)
-    if (namelist->sym->attr.referenced)
-      {
-	tree t = gfc_trans_omp_variable (namelist->sym, false);
-	if (t != error_mark_node)
-	  {
-	    tree node = build_omp_clause (input_location, OMP_CLAUSE_MAP);
-	    OMP_CLAUSE_DECL (node) = t;
-	    OMP_CLAUSE_MAP_KIND (node) = kind;
-	    list = gfc_trans_add_clause (node, list);
-	  }
-      }
-  return list;
-}
-
 static inline tree
 gfc_convert_expr_to_tree (stmtblock_t *block, gfc_expr *expr)
 {
@@ -1759,18 +1740,6 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
 
       if (n == NULL)
 	continue;
-      if (list >= OMP_LIST_DATA_CLAUSE_FIRST
-	  && list <= OMP_LIST_DATA_CLAUSE_LAST)
-	{
-	  enum omp_clause_map_kind kind;
-	  switch (list) 
-	    {
-	    default:
-	      gcc_unreachable ();
-	    }
-	  omp_clauses = gfc_trans_omp_map_clause_list (kind, n, omp_clauses);
-	  continue;
-	}
       switch (list)
 	{
 	case OMP_LIST_REDUCTION:


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141111/520e1cc9/attachment.sig>


More information about the Gcc-patches mailing list