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 53/89] More gimple_phi


gcc/
	* gimple.h (gimple_phi_set_result): Require a gimple_phi rather
	than a plain gimple.
	(gimple_phi_set_arg): Likewise.

	* tree-outof-ssa.c (remove_gimple_phi_args): Likewise; add a checked
	cast to gimple_phi.

	* tree-sra.c (replace_removed_params_ssa_names): Add a checked
	cast to gimple_phi.
---
 gcc/gimple.h         | 18 ++++++++----------
 gcc/tree-outof-ssa.c |  4 ++--
 gcc/tree-sra.c       |  2 +-
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index 72f67ce..c48b3d5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -4181,15 +4181,14 @@ gimple_phi_result_ptr (gimple gs)
   return &phi_stmt->result;
 }
 
-/* Set RESULT to be the SSA name created by GIMPLE_PHI GS.  */
+/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI.  */
 
 static inline void
-gimple_phi_set_result (gimple gs, tree result)
+gimple_phi_set_result (gimple_phi phi, tree result)
 {
-  gimple_phi phi_stmt = as_a <gimple_statement_phi> (gs);
-  phi_stmt->result = result;
+  phi->result = result;
   if (result && TREE_CODE (result) == SSA_NAME)
-    SSA_NAME_DEF_STMT (result) = gs;
+    SSA_NAME_DEF_STMT (result) = phi;
 }
 
 
@@ -4205,14 +4204,13 @@ gimple_phi_arg (gimple gs, unsigned index)
 }
 
 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
-   for GIMPLE_PHI GS.  */
+   for GIMPLE_PHI PHI.  */
 
 static inline void
-gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
+gimple_phi_set_arg (gimple_phi phi, unsigned index, struct phi_arg_d * phiarg)
 {
-  gimple_phi phi_stmt = as_a <gimple_statement_phi> (gs);
-  gcc_gimple_checking_assert (index <= phi_stmt->nargs);
-  phi_stmt->args[index] = *phiarg;
+  gcc_gimple_checking_assert (index <= phi->nargs);
+  phi->args[index] = *phiarg;
 }
 
 /* Return the PHI nodes for basic block BB, or NULL if there are no
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 026b048..d1f91dd 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -788,7 +788,7 @@ eliminate_phi (edge e, elim_graph g)
    check to see if this allows another PHI node to be removed.  */
 
 static void
-remove_gimple_phi_args (gimple phi)
+remove_gimple_phi_args (gimple_phi phi)
 {
   use_operand_p arg_p;
   ssa_op_iter iter;
@@ -816,7 +816,7 @@ remove_gimple_phi_args (gimple phi)
 	      /* Also remove the def if it is a PHI node.  */
 	      if (gimple_code (stmt) == GIMPLE_PHI)
 		{
-		  remove_gimple_phi_args (stmt);
+		  remove_gimple_phi_args (stmt->as_a_gimple_phi ());
 		  gsi = gsi_for_stmt (stmt);
 		  remove_phi_node (&gsi, true);
 		}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 52198a8..e6e0629 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -4517,7 +4517,7 @@ replace_removed_params_ssa_names (gimple stmt,
   else if (is_gimple_call (stmt))
     gimple_call_set_lhs (stmt, name);
   else
-    gimple_phi_set_result (stmt, name);
+    gimple_phi_set_result (stmt->as_a_gimple_phi (), name);
 
   replace_uses_by (lhs, name);
   release_ssa_name (lhs);
-- 
1.8.5.3


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