diff mbox

[gimple-classes,committed,03/10] Make remaining gimple_omp_teams_ accessors typesafe

Message ID 1414608480-32461-4-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Oct. 29, 2014, 6:47 p.m. UTC
gcc/ChangeLog.gimple-classes:
	* gimple.h (gimple_omp_teams_clauses): Strengthen param from
	const_gimple to const gomp_teams *.
	(gimple_omp_teams_clauses_ptr): Strengthen param from gimple to
	gomp_teams *.

	* gimple-walk.c (walk_gimple_op): Add checked cast.
	* tree-inline.c (remap_gimple_stmt): Within case GIMPLE_OMP_TEAMS,
	introduce local "omp_teams_stmt" via a checked cast, and use in
	place of "stmt".
	* tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
	(convert_local_reference_stmt): Likewise.
---
 gcc/ChangeLog.gimple-classes | 14 ++++++++++++++
 gcc/gimple-walk.c            |  5 +++--
 gcc/gimple.h                 | 13 +++++--------
 gcc/tree-inline.c            |  9 ++++++---
 gcc/tree-nested.c            | 31 +++++++++++++++++++++----------
 5 files changed, 49 insertions(+), 23 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 68add33..626ea2f 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,19 @@ 
 2014-10-29  David Malcolm  <dmalcolm@redhat.com>
 
+	* gimple.h (gimple_omp_teams_clauses): Strengthen param from
+	const_gimple to const gomp_teams *.
+	(gimple_omp_teams_clauses_ptr): Strengthen param from gimple to
+	gomp_teams *.
+
+	* gimple-walk.c (walk_gimple_op): Add checked cast.
+	* tree-inline.c (remap_gimple_stmt): Within case GIMPLE_OMP_TEAMS,
+	introduce local "omp_teams_stmt" via a checked cast, and use in
+	place of "stmt".
+	* tree-nested.c (convert_nonlocal_reference_stmt): Likewise.
+	(convert_local_reference_stmt): Likewise.
+
+2014-10-29  David Malcolm  <dmalcolm@redhat.com>
+
 	* gimple.h (gimple_omp_for_kind): Strengthen param from
 	const_gimple to const gomp_for *.
 	(gimple_omp_for_combined_p): Likewise.
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 28648c4..13c16bb 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -433,8 +433,9 @@  walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
       break;
 
     case GIMPLE_OMP_TEAMS:
-      ret = walk_tree (gimple_omp_teams_clauses_ptr (stmt), callback_op, wi,
-		       pset);
+      ret = walk_tree (gimple_omp_teams_clauses_ptr (
+			 as_a <gomp_teams *> (stmt)),
+		       callback_op, wi, pset);
       if (ret)
 	return ret;
       break;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6df9dbf..41f1691 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -5077,24 +5077,21 @@  gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
 }
 
 
-/* Return the clauses associated with OMP_TEAMS GS.  */
+/* Return the clauses associated with OMP_TEAMS OMP_TEAMS_STMT.  */
 
 static inline tree
-gimple_omp_teams_clauses (const_gimple gs)
+gimple_omp_teams_clauses (const gomp_teams *omp_teams_stmt)
 {
-  const gomp_teams *omp_teams_stmt =
-    as_a <const gomp_teams *> (gs);
   return omp_teams_stmt->clauses;
 }
 
 
-/* Return a pointer to the clauses associated with OMP_TEAMS GS.  */
+/* Return a pointer to the clauses associated with OMP_TEAMS
+   OMP_TEAMS_STMT.  */
 
 static inline tree *
-gimple_omp_teams_clauses_ptr (gimple gs)
+gimple_omp_teams_clauses_ptr (gomp_teams *omp_teams_stmt)
 {
-  gomp_teams *omp_teams_stmt =
-    as_a <gomp_teams *> (gs);
   return &omp_teams_stmt->clauses;
 }
 
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index fd20bcb..6498e23 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1474,9 +1474,12 @@  remap_gimple_stmt (gimple stmt, copy_body_data *id)
 	  break;
 
 	case GIMPLE_OMP_TEAMS:
-	  s1 = remap_gimple_seq (gimple_omp_body (stmt), id);
-	  copy = gimple_build_omp_teams
-		   (s1, gimple_omp_teams_clauses (stmt));
+	  {
+	    gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (stmt);
+	    s1 = remap_gimple_seq (gimple_omp_body (omp_teams_stmt), id);
+	    copy = gimple_build_omp_teams
+		     (s1, gimple_omp_teams_clauses (omp_teams_stmt));
+	  }
 	  break;
 
 	case GIMPLE_OMP_CRITICAL:
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 95ecbc0..3463151 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -1421,11 +1421,17 @@  convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_OMP_TEAMS:
-      save_suppress = info->suppress_expansion;
-      convert_nonlocal_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), wi);
-      walk_body (convert_nonlocal_reference_stmt, convert_nonlocal_reference_op,
-		 info, gimple_omp_body_ptr (stmt));
-      info->suppress_expansion = save_suppress;
+      {
+	gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (stmt);
+	save_suppress = info->suppress_expansion;
+	convert_nonlocal_omp_clauses (gimple_omp_teams_clauses_ptr (
+					omp_teams_stmt),
+				      wi);
+	walk_body (convert_nonlocal_reference_stmt,
+		   convert_nonlocal_reference_op,
+		   info, gimple_omp_body_ptr (omp_teams_stmt));
+	info->suppress_expansion = save_suppress;
+      }
       break;
 
     case GIMPLE_OMP_SECTION:
@@ -1990,11 +1996,16 @@  convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_OMP_TEAMS:
-      save_suppress = info->suppress_expansion;
-      convert_local_omp_clauses (gimple_omp_teams_clauses_ptr (stmt), wi);
-      walk_body (convert_local_reference_stmt, convert_local_reference_op,
-		 info, gimple_omp_body_ptr (stmt));
-      info->suppress_expansion = save_suppress;
+      {
+	gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (stmt);
+	save_suppress = info->suppress_expansion;
+	convert_local_omp_clauses (gimple_omp_teams_clauses_ptr (
+				     omp_teams_stmt),
+				   wi);
+	walk_body (convert_local_reference_stmt, convert_local_reference_op,
+		   info, gimple_omp_body_ptr (omp_teams_stmt));
+	info->suppress_expansion = save_suppress;
+      }
       break;
 
     case GIMPLE_OMP_SECTION: