diff mbox

[gomp4] Gimplification: Merge gimplify_oacc_parallel into gimplify_omp_workshare. (was: [gomp4 9/9] OpenACC: Basic support for #pragma acc parallel.)

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

Commit Message

Thomas Schwinge Feb. 27, 2014, 7:58 p.m. UTC
Hi!

On Wed, 6 Nov 2013 20:53:00 +0100, I wrote:
> 	gcc/
> 	* gimplify.c [...]
> 	(gimplify_oacc_parallel): New function.

To get rid of code duplication, I have applied the following in r208206:

commit 9ffb216dd43bda84f56ce7fe68ae15cc08110924
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Feb 27 19:56:28 2014 +0000

    Gimplification: Merge gimplify_oacc_parallel into gimplify_omp_workshare.
    
    	gcc/
    	* gimplify.c (gimplify_oacc_parallel): Merge into
    	gimplify_omp_workshare.  Update all callers.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@208206 138bc75d-0d04-0410-961f-82ee72b054a4



Grüße,
 Thomas
diff mbox

Patch

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 9f5941f..3d9b06d 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,8 @@ 
+2014-02-27  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gimplify.c (gimplify_oacc_parallel): Merge into
+	gimplify_omp_workshare.  Update all callers.
+
 2014-02-27  Ilmir Usmanov  <i.usmanov@samsung.com>
 
 	Fix OpenACC ASYNC clause: it cannot contain integer-expression-list.
diff --git gcc/gimplify.c gcc/gimplify.c
index d0a4779..6dbabfa 100644
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -6572,38 +6572,6 @@  gimplify_adjust_omp_clauses (tree *list_p)
   delete_omp_context (ctx);
 }
 
-/* Gimplify the contents of an OACC_PARALLEL statement.  This involves
-   gimplification of the body, as well as scanning the body for used
-   variables.  We need to do this scan now, because variable-sized
-   decls will be decomposed during gimplification.  */
-
-static void
-gimplify_oacc_parallel (tree *expr_p, gimple_seq *pre_p)
-{
-  tree expr = *expr_p;
-  gimple g;
-  gimple_seq body = NULL;
-  enum omp_region_type ort = (enum omp_region_type) (ORT_TARGET
-						     | ORT_TARGET_OFFLOAD
-						     | ORT_TARGET_MAP_FORCE);
-
-  gimplify_scan_omp_clauses (&OACC_PARALLEL_CLAUSES (expr), pre_p, ort);
-
-  push_gimplify_context ();
-
-  g = gimplify_and_return_first (OACC_PARALLEL_BODY (expr), &body);
-  if (gimple_code (g) == GIMPLE_BIND)
-    pop_gimplify_context (g);
-  else
-    pop_gimplify_context (NULL);
-
-  gimplify_adjust_omp_clauses (&OACC_PARALLEL_CLAUSES (expr));
-
-  g = gimple_build_oacc_parallel (body, OACC_PARALLEL_CLAUSES (expr));
-  gimplify_seq_add_stmt (pre_p, g);
-  *expr_p = NULL_TREE;
-}
-
 /* Gimplify the contents of an OMP_PARALLEL statement.  This involves
    gimplification of the body, as well as scanning the body for used
    variables.  We need to do this scan now, because variable-sized
@@ -7039,6 +7007,11 @@  gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
       ort = (enum omp_region_type) (ORT_TARGET
 				    | ORT_TARGET_MAP_FORCE);
       break;
+    case OACC_PARALLEL:
+      ort = (enum omp_region_type) (ORT_TARGET
+				    | ORT_TARGET_OFFLOAD
+				    | ORT_TARGET_MAP_FORCE);
+      break;
     case OMP_SECTIONS:
     case OMP_SINGLE:
       ort = ORT_WORKSHARE;
@@ -7097,6 +7070,9 @@  gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
       stmt = gimple_build_omp_target (body, GF_OMP_TARGET_KIND_OACC_DATA,
 				      OACC_DATA_CLAUSES (expr));
       break;
+    case OACC_PARALLEL:
+      stmt = gimple_build_oacc_parallel (body, OACC_PARALLEL_CLAUSES (expr));
+      break;
     case OMP_SECTIONS:
       stmt = gimple_build_omp_sections (body, OMP_CLAUSES (expr));
       break;
@@ -8060,11 +8036,6 @@  gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 	  ret = GS_ALL_DONE;
 	  break;
 
-	case OACC_PARALLEL:
-	  gimplify_oacc_parallel (expr_p, pre_p);
-	  ret = GS_ALL_DONE;
-	  break;
-
 	case OACC_KERNELS:
 	case OACC_HOST_DATA:
 	case OACC_DECLARE:
@@ -8095,6 +8066,7 @@  gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
 	  break;
 
 	case OACC_DATA:
+	case OACC_PARALLEL:
 	case OMP_SECTIONS:
 	case OMP_SINGLE:
 	case OMP_TARGET: