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 45/89] Introduce gimple_omp_sections


gcc/
	* coretypes.h (gimple_omp_sections): New typedef.
	(const_gimple_omp_sections): New typedef.

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

	* gimple.c (gimple_build_omp_sections): Return a
	gimple_omp_sections rather than a plain gimple.

	* gimple.h (gimple_statement_base::as_a_gimple_omp_sections): New.
	(gimple_build_omp_sections): Return a gimple_omp_sections rather
	than a plain gimple.

	* omp-low.c (scan_omp_sections): Require a gimple_omp_sections
	rather than a plain gimple.
	(scan_omp_1_stmt): Add checked cast to gimple_omp_sections within
	GIMPLE_OMP_SECTIONS case of switch statement.
	(expand_omp_sections): Strengthen local "sections_stmt" from gimple
	to gimple_omp_sections.
	(lower_omp_sections): Likewise for "stmt".
---
 gcc/coretypes.h           |  4 ++++
 gcc/gimple-pretty-print.c |  7 ++++---
 gcc/gimple.c              |  5 +++--
 gcc/gimple.h              |  8 +++++++-
 gcc/omp-low.c             | 14 ++++++++------
 5 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 529dc96..bcea3c1 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_sections;
+typedef struct gimple_statement_omp_sections *gimple_omp_sections;
+typedef const struct gimple_statement_omp_sections *const_gimple_omp_sections;
+
 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;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 3787136..f375a61 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1362,8 +1362,8 @@ dump_gimple_omp_teams (pretty_printer *buffer, gimple_omp_teams gs, int spc,
 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc,
-			  int flags)
+dump_gimple_omp_sections (pretty_printer *buffer, gimple_omp_sections gs,
+			  int spc, int flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2194,7 +2194,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
       break;
 
     case GIMPLE_OMP_SECTIONS:
-      dump_gimple_omp_sections (buffer, gs, spc, flags);
+      dump_gimple_omp_sections (buffer, gs->as_a_gimple_omp_sections (),
+				spc, flags);
       break;
 
     case GIMPLE_OMP_SECTIONS_SWITCH:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 310839f..6de651d 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1006,10 +1006,11 @@ gimple_build_omp_return (bool wait_p)
    CLAUSES are any of the OMP sections contsruct's clauses: private,
    firstprivate, lastprivate, reduction, and nowait.  */
 
-gimple
+gimple_omp_sections
 gimple_build_omp_sections (gimple_seq body, tree clauses)
 {
-  gimple p = gimple_alloc (GIMPLE_OMP_SECTIONS, 0);
+  gimple_omp_sections p =
+    gimple_alloc (GIMPLE_OMP_SECTIONS, 0)->as_a_gimple_omp_sections ();
   if (body)
     gimple_omp_set_body (p, body);
   gimple_omp_sections_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 0a06620..155fca7 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_sections
+  as_a_gimple_omp_sections ()
+  {
+    return as_a <gimple_statement_omp_sections> (this);
+  }
+
   inline gimple_omp_single
   as_a_gimple_omp_single ()
   {
@@ -1652,7 +1658,7 @@ gimple gimple_build_omp_taskgroup (gimple_seq);
 gimple_omp_continue gimple_build_omp_continue (tree, tree);
 gimple gimple_build_omp_ordered (gimple_seq);
 gimple gimple_build_omp_return (bool);
-gimple gimple_build_omp_sections (gimple_seq, tree);
+gimple_omp_sections gimple_build_omp_sections (gimple_seq, tree);
 gimple gimple_build_omp_sections_switch (void);
 gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
 gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree);
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 680c21f..6d24927 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2143,7 +2143,7 @@ scan_omp_for (gimple_omp_for stmt, omp_context *outer_ctx)
 /* Scan an OpenMP sections directive.  */
 
 static void
-scan_omp_sections (gimple stmt, omp_context *outer_ctx)
+scan_omp_sections (gimple_omp_sections stmt, omp_context *outer_ctx)
 {
   omp_context *ctx;
 
@@ -2647,7 +2647,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_OMP_SECTIONS:
-      scan_omp_sections (stmt, ctx);
+      scan_omp_sections (stmt->as_a_gimple_omp_sections (), ctx);
       break;
 
     case GIMPLE_OMP_SINGLE:
@@ -6967,7 +6967,8 @@ expand_omp_sections (struct omp_region *region)
   unsigned len;
   basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
   gimple_stmt_iterator si, switch_si;
-  gimple sections_stmt, stmt;
+  gimple_omp_sections sections_stmt;
+  gimple stmt;
   gimple_omp_continue cont;
   edge_iterator ei;
   edge e;
@@ -7022,7 +7023,7 @@ expand_omp_sections (struct omp_region *region)
   /* The call to GOMP_sections_start goes in ENTRY_BB, replacing the
      GIMPLE_OMP_SECTIONS statement.  */
   si = gsi_last_bb (entry_bb);
-  sections_stmt = gsi_stmt (si);
+  sections_stmt = gsi_stmt (si)->as_a_gimple_omp_sections ();
   gcc_assert (gimple_code (sections_stmt) == GIMPLE_OMP_SECTIONS);
   vin = gimple_omp_sections_control (sections_stmt);
   if (!is_combined_parallel (region))
@@ -8424,11 +8425,12 @@ lower_omp_sections (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 {
   tree block, control;
   gimple_stmt_iterator tgsi;
-  gimple stmt, t;
+  gimple_omp_sections stmt;
+  gimple t;
   gimple_bind new_stmt, bind;
   gimple_seq ilist, dlist, olist, new_body;
 
-  stmt = gsi_stmt (*gsi_p);
+  stmt = gsi_stmt (*gsi_p)->as_a_gimple_omp_sections ();
 
   push_gimplify_context ();
 
-- 
1.8.5.3


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