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 36/89] Introduce gimple_omp_continue


gcc/
	* coretypes.h (gimple_omp_continue): New typedef.
	(const_gimple_omp_continue): New typedef.

	* gimple.h (gimple_statement_base::as_a_gimple_omp_continue): New.
	(gimple_build_omp_continue): Return a gimple_omp_continue rather
	than a plain gimple.
	(gimple_omp_continue_control_def): Require a
	const_gimple_omp_continue rather than a plain const_gimple.
	(gimple_omp_continue_control_use): Likewise.
	(gimple_omp_continue_control_def_ptr): Require a gimple_omp_continue
	rather than a plain gimple.
	(gimple_omp_continue_set_control_def): Likewise.
	(gimple_omp_continue_control_use_ptr): Likewise.
	(gimple_omp_continue_set_control_use): Likewise.

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

	* gimple-walk.c (walk_gimple_op): Likewise, adding a new local.

	* gimple.c (gimple_build_omp_continue): Return a
	gimple_omp_continue rather than a plain gimple.

	* omp-low.c (gimple_build_cond_empty): Return a gimple_cond
	rather than a plain gimple.
	(expand_omp_for_generic): Split local "stmt" into "assign_stmt",
	"cont_stmt", "cond_stmt", "call_stmt" of types gimple_assign,
	gimple_omp_continue, gimple_cond, gimple_call respectively.
	(expand_omp_for_static_nochunk): Likewise, splitting into two
	"cond_stmt" decls. "assign_stmt", "cont_stmt"
	(expand_omp_for_static_chunk): Likewise, splitting into
	"cond_stmt", "assign_stmt", "cont_stmt".
	(expand_omp_sections): Strengthen local "cont" from gimple to
	gimple_omp_continue.
---
 gcc/coretypes.h           |   4 ++
 gcc/gimple-pretty-print.c |   6 +-
 gcc/gimple-walk.c         |  19 +++---
 gcc/gimple.c              |   5 +-
 gcc/gimple.h              |  44 ++++++--------
 gcc/omp-low.c             | 144 ++++++++++++++++++++++++----------------------
 6 files changed, 115 insertions(+), 107 deletions(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 34c160e..e2ad76e 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -155,6 +155,10 @@ typedef struct gimple_statement_omp_atomic_store *gimple_omp_atomic_store;
 typedef const struct gimple_statement_omp_atomic_store *
   const_gimple_omp_atomic_store;
 
+struct gimple_statement_omp_continue;
+typedef struct gimple_statement_omp_continue *gimple_omp_continue;
+typedef const struct gimple_statement_omp_continue *const_gimple_omp_continue;
+
 union section;
 typedef union section section;
 struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 5cbda7d..3de01d0 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1227,7 +1227,8 @@ dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_continue (pretty_printer *buffer, gimple_omp_continue gs,
+			  int spc, int flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2165,7 +2166,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
       break;
 
     case GIMPLE_OMP_CONTINUE:
-      dump_gimple_omp_continue (buffer, gs, spc, flags);
+      dump_gimple_omp_continue (buffer, gs->as_a_gimple_omp_continue (), spc,
+				flags);
       break;
 
     case GIMPLE_OMP_SINGLE:
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index f15d1f3..f286748 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -298,15 +298,18 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
       break;
 
     case GIMPLE_OMP_CONTINUE:
-      ret = walk_tree (gimple_omp_continue_control_def_ptr (stmt),
-	  	       callback_op, wi, pset);
-      if (ret)
-	return ret;
+      {
+	gimple_omp_continue cont_stmt = stmt->as_a_gimple_omp_continue ();
+	ret = walk_tree (gimple_omp_continue_control_def_ptr (cont_stmt),
+			 callback_op, wi, pset);
+	if (ret)
+	  return ret;
 
-      ret = walk_tree (gimple_omp_continue_control_use_ptr (stmt),
-	  	       callback_op, wi, pset);
-      if (ret)
-	return ret;
+	ret = walk_tree (gimple_omp_continue_control_use_ptr (cont_stmt),
+			 callback_op, wi, pset);
+	if (ret)
+	  return ret;
+      }
       break;
 
     case GIMPLE_OMP_CRITICAL:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index c45cc48..a0fa31e 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -958,10 +958,11 @@ gimple_build_omp_taskgroup (gimple_seq body)
    CONTROL_DEF is the definition of the control variable.
    CONTROL_USE is the use of the control variable.  */
 
-gimple
+gimple_omp_continue
 gimple_build_omp_continue (tree control_def, tree control_use)
 {
-  gimple p = gimple_alloc (GIMPLE_OMP_CONTINUE, 0);
+  gimple_omp_continue p =
+    gimple_alloc (GIMPLE_OMP_CONTINUE, 0)->as_a_gimple_omp_continue ();
   gimple_omp_continue_set_control_def (p, control_def);
   gimple_omp_continue_set_control_use (p, control_use);
   return p;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index b74ff4b..5a3626e 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -348,6 +348,12 @@ public:
     return as_a <gimple_statement_omp_atomic_store> (this);
   }
 
+  inline gimple_omp_continue
+  as_a_gimple_omp_continue ()
+  {
+    return as_a <gimple_statement_omp_continue> (this);
+  }
+
   /* Dynamic casting methods, where the cast returns NULL if the
      stmt is not of the required kind.
 
@@ -1583,7 +1589,7 @@ gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
 gimple gimple_build_omp_section (gimple_seq);
 gimple gimple_build_omp_master (gimple_seq);
 gimple gimple_build_omp_taskgroup (gimple_seq);
-gimple gimple_build_omp_continue (tree, tree);
+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);
@@ -5649,64 +5655,52 @@ gimple_omp_atomic_load_rhs_ptr (gimple_omp_atomic_load load_stmt)
 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
 
 static inline tree
-gimple_omp_continue_control_def (const_gimple g)
+gimple_omp_continue_control_def (const_gimple_omp_continue cont_stmt)
 {
-  const gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <const gimple_statement_omp_continue> (g);
-  return omp_continue_stmt->control_def;
+  return cont_stmt->control_def;
 }
 
 /* The same as above, but return the address.  */
 
 static inline tree *
-gimple_omp_continue_control_def_ptr (gimple g)
+gimple_omp_continue_control_def_ptr (gimple_omp_continue cont_stmt)
 {
-  gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <gimple_statement_omp_continue> (g);
-  return &omp_continue_stmt->control_def;
+  return &cont_stmt->control_def;
 }
 
 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE.  */
 
 static inline void
-gimple_omp_continue_set_control_def (gimple g, tree def)
+gimple_omp_continue_set_control_def (gimple_omp_continue cont_stmt, tree def)
 {
-  gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <gimple_statement_omp_continue> (g);
-  omp_continue_stmt->control_def = def;
+  cont_stmt->control_def = def;
 }
 
 
 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
 
 static inline tree
-gimple_omp_continue_control_use (const_gimple g)
+gimple_omp_continue_control_use (const_gimple_omp_continue cont_stmt)
 {
-  const gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <const gimple_statement_omp_continue> (g);
-  return omp_continue_stmt->control_use;
+  return cont_stmt->control_use;
 }
 
 
 /* The same as above, but return the address.  */
 
 static inline tree *
-gimple_omp_continue_control_use_ptr (gimple g)
+gimple_omp_continue_control_use_ptr (gimple_omp_continue cont_stmt)
 {
-  gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <gimple_statement_omp_continue> (g);
-  return &omp_continue_stmt->control_use;
+  return &cont_stmt->control_use;
 }
 
 
 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE.  */
 
 static inline void
-gimple_omp_continue_set_control_use (gimple g, tree use)
+gimple_omp_continue_set_control_use (gimple_omp_continue cont_stmt, tree use)
 {
-  gimple_statement_omp_continue *omp_continue_stmt =
-    as_a <gimple_statement_omp_continue> (g);
-  omp_continue_stmt->control_use = use;
+  cont_stmt->control_use = use;
 }
 
 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 22ea34f..1cd4731 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -4132,7 +4132,7 @@ lower_send_shared_vars (gimple_seq *ilist, gimple_seq *olist, omp_context *ctx)
 /* A convenience function to build an empty GIMPLE_COND with just the
    condition.  */
 
-static gimple
+static gimple_cond
 gimple_build_cond_empty (tree cond)
 {
   enum tree_code pred_code;
@@ -5342,7 +5342,7 @@ expand_omp_for_generic (struct omp_region *region,
   basic_block entry_bb, cont_bb, exit_bb, l0_bb, l1_bb, collapse_bb;
   basic_block l2_bb = NULL, l3_bb = NULL;
   gimple_stmt_iterator gsi;
-  gimple stmt;
+  gimple_assign assign_stmt;
   bool in_combined_parallel = is_combined_parallel (region);
   bool broken_loop = region->cont == NULL;
   edge e, ne;
@@ -5557,8 +5557,8 @@ expand_omp_for_generic (struct omp_region *region,
 				DECL_P (startvar)
 				&& TREE_ADDRESSABLE (startvar),
 				NULL_TREE, false, GSI_CONTINUE_LINKING);
-  stmt = gimple_build_assign (startvar, t);
-  gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+  assign_stmt = gimple_build_assign (startvar, t);
+  gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
 
   t = iend0;
   if (bias)
@@ -5570,8 +5570,8 @@ expand_omp_for_generic (struct omp_region *region,
 				   false, GSI_CONTINUE_LINKING);
   if (endvar)
     {
-      stmt = gimple_build_assign (endvar, iend);
-      gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+      assign_stmt = gimple_build_assign (endvar, iend);
+      gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
     }
   if (fd->collapse > 1)
     expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar);
@@ -5581,10 +5581,11 @@ expand_omp_for_generic (struct omp_region *region,
       /* Code to control the increment and predicate for the sequential
 	 loop goes in the CONT_BB.  */
       gsi = gsi_last_bb (cont_bb);
-      stmt = gsi_stmt (gsi);
-      gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
-      vmain = gimple_omp_continue_control_use (stmt);
-      vback = gimple_omp_continue_control_def (stmt);
+      gimple_omp_continue cont_stmt =
+	gsi_stmt (gsi)->as_a_gimple_omp_continue ();
+      gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE);
+      vmain = gimple_omp_continue_control_use (cont_stmt);
+      vback = gimple_omp_continue_control_def (cont_stmt);
 
       if (!gimple_omp_for_combined_p (fd->for_stmt))
 	{
@@ -5596,14 +5597,14 @@ expand_omp_for_generic (struct omp_region *region,
 					DECL_P (vback)
 					&& TREE_ADDRESSABLE (vback),
 					NULL_TREE, true, GSI_SAME_STMT);
-	  stmt = gimple_build_assign (vback, t);
-	  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+	  assign_stmt = gimple_build_assign (vback, t);
+	  gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
 
 	  t = build2 (fd->loop.cond_code, boolean_type_node,
 		      DECL_P (vback) && TREE_ADDRESSABLE (vback) ? t : vback,
 		      iend);
-	  stmt = gimple_build_cond_empty (t);
-	  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+	  gimple_cond cond_stmt = gimple_build_cond_empty (t);
+	  gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
 	}
 
       /* Remove GIMPLE_OMP_CONTINUE.  */
@@ -5623,8 +5624,8 @@ expand_omp_for_generic (struct omp_region *region,
       if (TREE_TYPE (t) != boolean_type_node)
 	t = fold_build2 (NE_EXPR, boolean_type_node,
 			 t, build_int_cst (TREE_TYPE (t), 0));
-      stmt = gimple_build_cond_empty (t);
-      gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+      gimple_cond cond_stmt = gimple_build_cond_empty (t);
+      gsi_insert_after (&gsi, cond_stmt, GSI_CONTINUE_LINKING);
     }
 
   /* Add the loop cleanup function.  */
@@ -5635,10 +5636,10 @@ expand_omp_for_generic (struct omp_region *region,
     t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END_CANCEL);
   else
     t = builtin_decl_explicit (BUILT_IN_GOMP_LOOP_END);
-  stmt = gimple_build_call (t, 0);
+  gimple_call call_stmt = gimple_build_call (t, 0);
   if (gimple_omp_return_lhs (gsi_stmt (gsi)))
-    gimple_call_set_lhs (stmt, gimple_omp_return_lhs (gsi_stmt (gsi)));
-  gsi_insert_after (&gsi, stmt, GSI_SAME_STMT);
+    gimple_call_set_lhs (call_stmt, gimple_omp_return_lhs (gsi_stmt (gsi)));
+  gsi_insert_after (&gsi, call_stmt, GSI_SAME_STMT);
   gsi_remove (&gsi, true);
 
   /* Connect the new blocks.  */
@@ -5762,7 +5763,6 @@ expand_omp_for_static_nochunk (struct omp_region *region,
   basic_block body_bb, cont_bb, collapse_bb = NULL;
   basic_block fin_bb;
   gimple_stmt_iterator gsi;
-  gimple stmt;
   edge ep;
   enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS;
   enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM;
@@ -5826,18 +5826,18 @@ expand_omp_for_static_nochunk (struct omp_region *region,
       n2 = fold_convert (type, unshare_expr (fd->loop.n2));
       n2 = force_gimple_operand_gsi (&gsi, n2, true, NULL_TREE,
 				     true, GSI_SAME_STMT);
-      stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
-				NULL_TREE, NULL_TREE);
-      gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
-      if (walk_tree (gimple_cond_lhs_ptr (stmt),
+      gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
+						 NULL_TREE, NULL_TREE);
+      gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
+      if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
 		     expand_omp_regimplify_p, NULL, NULL)
-	  || walk_tree (gimple_cond_rhs_ptr (stmt),
+	  || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
 			expand_omp_regimplify_p, NULL, NULL))
 	{
-	  gsi = gsi_for_stmt (stmt);
-	  gimple_regimplify_operands (stmt, &gsi);
+	  gsi = gsi_for_stmt (cond_stmt);
+	  gimple_regimplify_operands (cond_stmt, &gsi);
 	}
-      ep = split_block (entry_bb, stmt);
+      ep = split_block (entry_bb, cond_stmt);
       ep->flags = EDGE_TRUE_VALUE;
       entry_bb = ep->dest;
       ep->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1);
@@ -5912,20 +5912,21 @@ expand_omp_for_static_nochunk (struct omp_region *region,
   gsi_insert_before (&gsi, gimple_build_assign (tt, t), GSI_SAME_STMT);
 
   t = build2 (LT_EXPR, boolean_type_node, threadid, tt);
-  stmt = gimple_build_cond_empty (t);
-  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+  gimple_cond cond_stmt = gimple_build_cond_empty (t);
+  gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT);
 
-  second_bb = split_block (entry_bb, stmt)->dest;
+  second_bb = split_block (entry_bb, cond_stmt)->dest;
   gsi = gsi_last_bb (second_bb);
   gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
 
   gsi_insert_before (&gsi, gimple_build_assign (tt, build_int_cst (itype, 0)),
 		     GSI_SAME_STMT);
-  stmt = gimple_build_assign_with_ops (PLUS_EXPR, q, q,
-				       build_int_cst (itype, 1));
-  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+  gimple_assign assign_stmt =
+    gimple_build_assign_with_ops (PLUS_EXPR, q, q,
+				  build_int_cst (itype, 1));
+  gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
 
-  third_bb = split_block (second_bb, stmt)->dest;
+  third_bb = split_block (second_bb, assign_stmt)->dest;
   gsi = gsi_last_bb (third_bb);
   gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_FOR);
 
@@ -5972,8 +5973,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
 				DECL_P (startvar)
 				&& TREE_ADDRESSABLE (startvar),
 				NULL_TREE, false, GSI_CONTINUE_LINKING);
-  stmt = gimple_build_assign (startvar, t);
-  gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+  assign_stmt = gimple_build_assign (startvar, t);
+  gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
 
   t = fold_convert (itype, e0);
   t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -5986,8 +5987,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
 				false, GSI_CONTINUE_LINKING);
   if (endvar)
     {
-      stmt = gimple_build_assign (endvar, e);
-      gsi_insert_after (&gsi, stmt, GSI_CONTINUE_LINKING);
+      assign_stmt = gimple_build_assign (endvar, e);
+      gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING);
     }
   if (fd->collapse > 1)
     expand_omp_for_init_vars (fd, &gsi, counts, inner_stmt, startvar);
@@ -5997,10 +5998,11 @@ expand_omp_for_static_nochunk (struct omp_region *region,
       /* The code controlling the sequential loop replaces the
 	 GIMPLE_OMP_CONTINUE.  */
       gsi = gsi_last_bb (cont_bb);
-      stmt = gsi_stmt (gsi);
-      gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
-      vmain = gimple_omp_continue_control_use (stmt);
-      vback = gimple_omp_continue_control_def (stmt);
+      gimple_omp_continue cont_stmt =
+	gsi_stmt (gsi)->as_a_gimple_omp_continue ();
+      gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE);
+      vmain = gimple_omp_continue_control_use (cont_stmt);
+      vback = gimple_omp_continue_control_def (cont_stmt);
 
       if (!gimple_omp_for_combined_p (fd->for_stmt))
 	{
@@ -6012,8 +6014,8 @@ expand_omp_for_static_nochunk (struct omp_region *region,
 					DECL_P (vback)
 					&& TREE_ADDRESSABLE (vback),
 					NULL_TREE, true, GSI_SAME_STMT);
-	  stmt = gimple_build_assign (vback, t);
-	  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
+	  assign_stmt = gimple_build_assign (vback, t);
+	  gsi_insert_before (&gsi, assign_stmt, GSI_SAME_STMT);
 
 	  t = build2 (fd->loop.cond_code, boolean_type_node,
 		      DECL_P (vback) && TREE_ADDRESSABLE (vback)
@@ -6133,7 +6135,6 @@ expand_omp_for_static_chunk (struct omp_region *region,
   basic_block entry_bb, exit_bb, body_bb, seq_start_bb, iter_part_bb;
   basic_block trip_update_bb = NULL, cont_bb, collapse_bb = NULL, fin_bb;
   gimple_stmt_iterator si;
-  gimple stmt;
   edge se;
   enum built_in_function get_num_threads = BUILT_IN_OMP_GET_NUM_THREADS;
   enum built_in_function get_thread_num = BUILT_IN_OMP_GET_THREAD_NUM;
@@ -6201,18 +6202,18 @@ expand_omp_for_static_chunk (struct omp_region *region,
       n2 = fold_convert (type, unshare_expr (fd->loop.n2));
       n2 = force_gimple_operand_gsi (&si, n2, true, NULL_TREE,
 				     true, GSI_SAME_STMT);
-      stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
-				NULL_TREE, NULL_TREE);
-      gsi_insert_before (&si, stmt, GSI_SAME_STMT);
-      if (walk_tree (gimple_cond_lhs_ptr (stmt),
+      gimple_cond cond_stmt = gimple_build_cond (fd->loop.cond_code, n1, n2,
+						 NULL_TREE, NULL_TREE);
+      gsi_insert_before (&si, cond_stmt, GSI_SAME_STMT);
+      if (walk_tree (gimple_cond_lhs_ptr (cond_stmt),
 		     expand_omp_regimplify_p, NULL, NULL)
-	  || walk_tree (gimple_cond_rhs_ptr (stmt),
+	  || walk_tree (gimple_cond_rhs_ptr (cond_stmt),
 			expand_omp_regimplify_p, NULL, NULL))
 	{
-	  si = gsi_for_stmt (stmt);
-	  gimple_regimplify_operands (stmt, &si);
+	  si = gsi_for_stmt (cond_stmt);
+	  gimple_regimplify_operands (cond_stmt, &si);
 	}
-      se = split_block (entry_bb, stmt);
+      se = split_block (entry_bb, cond_stmt);
       se->flags = EDGE_TRUE_VALUE;
       entry_bb = se->dest;
       se->probability = REG_BR_PROB_BASE - (REG_BR_PROB_BASE / 2000 - 1);
@@ -6294,8 +6295,9 @@ expand_omp_for_static_chunk (struct omp_region *region,
       trip_back = trip_var;
     }
 
-  stmt = gimple_build_assign (trip_init, build_int_cst (itype, 0));
-  gsi_insert_before (&si, stmt, GSI_SAME_STMT);
+  gimple_assign assign_stmt = gimple_build_assign (trip_init,
+						   build_int_cst (itype, 0));
+  gsi_insert_before (&si, assign_stmt, GSI_SAME_STMT);
 
   t = fold_build2 (MULT_EXPR, itype, threadid, fd->chunk_size);
   t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -6357,8 +6359,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
 				DECL_P (startvar)
 				&& TREE_ADDRESSABLE (startvar),
 				NULL_TREE, false, GSI_CONTINUE_LINKING);
-  stmt = gimple_build_assign (startvar, t);
-  gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
+  assign_stmt = gimple_build_assign (startvar, t);
+  gsi_insert_after (&si, assign_stmt, GSI_CONTINUE_LINKING);
 
   t = fold_convert (itype, e0);
   t = fold_build2 (MULT_EXPR, itype, t, step);
@@ -6371,8 +6373,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
 				false, GSI_CONTINUE_LINKING);
   if (endvar)
     {
-      stmt = gimple_build_assign (endvar, e);
-      gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
+      assign_stmt = gimple_build_assign (endvar, e);
+      gsi_insert_after (&si, assign_stmt, GSI_CONTINUE_LINKING);
     }
   if (fd->collapse > 1)
     expand_omp_for_init_vars (fd, &si, counts, inner_stmt, startvar);
@@ -6382,10 +6384,11 @@ expand_omp_for_static_chunk (struct omp_region *region,
       /* The code controlling the sequential loop goes in CONT_BB,
 	 replacing the GIMPLE_OMP_CONTINUE.  */
       si = gsi_last_bb (cont_bb);
-      stmt = gsi_stmt (si);
-      gcc_assert (gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
-      v_main = gimple_omp_continue_control_use (stmt);
-      v_back = gimple_omp_continue_control_def (stmt);
+      gimple_omp_continue cont_stmt =
+	gsi_stmt (si)->as_a_gimple_omp_continue ();
+      gcc_assert (gimple_code (cont_stmt) == GIMPLE_OMP_CONTINUE);
+      v_main = gimple_omp_continue_control_use (cont_stmt);
+      v_back = gimple_omp_continue_control_def (cont_stmt);
 
       if (!gimple_omp_for_combined_p (fd->for_stmt))
 	{
@@ -6396,8 +6399,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
 	  if (DECL_P (v_back) && TREE_ADDRESSABLE (v_back))
 	    t = force_gimple_operand_gsi (&si, t, true, NULL_TREE,
 					  true, GSI_SAME_STMT);
-	  stmt = gimple_build_assign (v_back, t);
-	  gsi_insert_before (&si, stmt, GSI_SAME_STMT);
+	  assign_stmt = gimple_build_assign (v_back, t);
+	  gsi_insert_before (&si, assign_stmt, GSI_SAME_STMT);
 
 	  t = build2 (fd->loop.cond_code, boolean_type_node,
 		      DECL_P (v_back) && TREE_ADDRESSABLE (v_back)
@@ -6416,8 +6419,8 @@ expand_omp_for_static_chunk (struct omp_region *region,
 
       t = build_int_cst (itype, 1);
       t = build2 (PLUS_EXPR, itype, trip_main, t);
-      stmt = gimple_build_assign (trip_back, t);
-      gsi_insert_after (&si, stmt, GSI_CONTINUE_LINKING);
+      assign_stmt = gimple_build_assign (trip_back, t);
+      gsi_insert_after (&si, assign_stmt, GSI_CONTINUE_LINKING);
     }
 
   /* Replace the GIMPLE_OMP_RETURN with a barrier, or nothing.  */
@@ -6957,7 +6960,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, cont;
+  gimple sections_stmt, stmt;
+  gimple_omp_continue cont;
   edge_iterator ei;
   edge e;
   struct omp_region *inner;
@@ -7038,7 +7042,7 @@ expand_omp_sections (struct omp_region *region)
   gcc_assert (gimple_code (gsi_stmt (switch_si)) == GIMPLE_OMP_SECTIONS_SWITCH);
   if (exit_reachable)
     {
-      cont = last_stmt (l1_bb);
+      cont = last_stmt (l1_bb)->as_a_gimple_omp_continue ();
       gcc_assert (gimple_code (cont) == GIMPLE_OMP_CONTINUE);
       vmain = gimple_omp_continue_control_use (cont);
       vnext = gimple_omp_continue_control_def (cont);
-- 
1.8.5.3


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