This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 42/89] Introduce gimple_omp_single


gcc/
	* coretypes.h (gimple_omp_single): New typedef.
	(const_gimple_omp_single): New typedef.

	* gimple.h (gimple_statement_base::as_a_gimple_omp_single): New.
	(gimple_build_omp_single): Return a gimple_omp_single rather than
	a plain gimple.
	(gimple_omp_single_set_clauses): Require a gimple_omp_single
	rather than a plain gimple.

	* gimple-pretty-print.c (dump_gimple_omp_single): Require a
	gimple_omp_single rather than a plain gimple.
	(pp_gimple_stmt_1): Add checked cast to gimple_omp_single within
	GIMPLE_OMP_SINGLE case of switch statement.

	* gimple.c (gimple_build_omp_single): Return a gimple_omp_single
	rather than a plain gimple.

	* omp-low.c (scan_omp_single): Require a gimple_omp_single rather
	than a plain gimple.
	(scan_omp_1_stmt): Add checked cast to gimple_omp_single within
	GIMPLE_OMP_SINGLE case of switch statement.
	(lower_omp_single_simple): Require a gimple_omp_single rather
	than a plain gimple.
	(lower_omp_single_copy): Likewise.
	(lower_omp_single): Strengthen local "single_stmt" from gimple to
	gimple_omp_single.
---
 gcc/coretypes.h           |  4 ++++
 gcc/gimple-pretty-print.c |  6 ++++--
 gcc/gimple.c              |  5 +++--
 gcc/gimple.h              | 14 +++++++++-----
 gcc/omp-low.c             | 12 +++++++-----
 5 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 9564ab7..6d7bb0f 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -175,6 +175,10 @@ struct gimple_statement_omp_task;
 typedef struct gimple_statement_omp_task *gimple_omp_task;
 typedef const struct gimple_statement_omp_task *const_gimple_omp_task;
 
+struct gimple_statement_omp_single;
+typedef struct gimple_statement_omp_single *gimple_omp_single;
+typedef const struct gimple_statement_omp_single *const_gimple_omp_single;
+
 union section;
 typedef union section section;
 struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index d249373..d024730 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1252,7 +1252,8 @@ dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs,
 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_single (pretty_printer *buffer, gimple_omp_single gs,
+			int spc, int flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2172,7 +2173,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
       break;
 
     case GIMPLE_OMP_SINGLE:
-      dump_gimple_omp_single (buffer, gs, spc, flags);
+      dump_gimple_omp_single (buffer, gs->as_a_gimple_omp_single (), spc,
+			      flags);
       break;
 
     case GIMPLE_OMP_TARGET:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 1f58a03..ba9adb8 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1033,10 +1033,11 @@ gimple_build_omp_sections_switch (void)
    CLAUSES are any of the OMP single construct's clauses: private, firstprivate,
    copyprivate, nowait.  */
 
-gimple
+gimple_omp_single
 gimple_build_omp_single (gimple_seq body, tree clauses)
 {
-  gimple p = gimple_alloc (GIMPLE_OMP_SINGLE, 0);
+  gimple_omp_single p =
+    gimple_alloc (GIMPLE_OMP_SINGLE, 0)->as_a_gimple_omp_single ();
   if (body)
     gimple_omp_set_body (p, body);
   gimple_omp_single_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6675d9b..485cec4 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -378,6 +378,12 @@ public:
     return as_a <gimple_statement_omp_task> (this);
   }
 
+  inline gimple_omp_single
+  as_a_gimple_omp_single ()
+  {
+    return as_a <gimple_statement_omp_single> (this);
+  }
+
   /* Dynamic casting methods, where the cast returns NULL if the
      stmt is not of the required kind.
 
@@ -1636,7 +1642,7 @@ gimple gimple_build_omp_ordered (gimple_seq);
 gimple gimple_build_omp_return (bool);
 gimple gimple_build_omp_sections (gimple_seq, tree);
 gimple gimple_build_omp_sections_switch (void);
-gimple gimple_build_omp_single (gimple_seq, tree);
+gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
 gimple gimple_build_omp_target (gimple_seq, int, tree);
 gimple gimple_build_omp_teams (gimple_seq, tree);
 gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
@@ -5330,13 +5336,11 @@ gimple_omp_single_clauses_ptr (gimple gs)
 }
 
 
-/* Set CLAUSES to be the clauses associated with OMP_SINGLE GS.  */
+/* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT.  */
 
 static inline void
-gimple_omp_single_set_clauses (gimple gs, tree clauses)
+gimple_omp_single_set_clauses (gimple_omp_single omp_single_stmt, tree clauses)
 {
-  gimple_statement_omp_single *omp_single_stmt =
-    as_a <gimple_statement_omp_single> (gs);
   omp_single_stmt->clauses = clauses;
 }
 
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 990b985..f17226b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2155,7 +2155,7 @@ scan_omp_sections (gimple stmt, omp_context *outer_ctx)
 /* Scan an OpenMP single directive.  */
 
 static void
-scan_omp_single (gimple stmt, omp_context *outer_ctx)
+scan_omp_single (gimple_omp_single stmt, omp_context *outer_ctx)
 {
   omp_context *ctx;
   tree name;
@@ -2651,7 +2651,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_OMP_SINGLE:
-      scan_omp_single (stmt, ctx);
+      scan_omp_single (stmt->as_a_gimple_omp_single (), ctx);
       break;
 
     case GIMPLE_OMP_SECTION:
@@ -8522,7 +8522,7 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
   to a synchronization analysis pass.  */
 
 static void
-lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
+lower_omp_single_simple (gimple_omp_single single_stmt, gimple_seq *pre_p)
 {
   location_t loc = gimple_location (single_stmt);
   tree tlabel = create_artificial_label (loc);
@@ -8577,7 +8577,8 @@ lower_omp_single_simple (gimple single_stmt, gimple_seq *pre_p)
   to a synchronization analysis pass.  */
 
 static void
-lower_omp_single_copy (gimple single_stmt, gimple_seq *pre_p, omp_context *ctx)
+lower_omp_single_copy (gimple_omp_single single_stmt, gimple_seq *pre_p,
+		       omp_context *ctx)
 {
   tree ptr_type, t, l0, l1, l2, bfn_decl;
   gimple_seq copyin_seq;
@@ -8633,7 +8634,8 @@ static void
 lower_omp_single (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 {
   tree block;
-  gimple t, single_stmt = gsi_stmt (*gsi_p);
+  gimple t;
+  gimple_omp_single single_stmt = gsi_stmt (*gsi_p)->as_a_gimple_omp_single ();
   gimple_bind bind;
   gimple_seq bind_body, bind_body_tail = NULL, dlist;
 
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]