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 56/89] Various gimple to gimple_call conversions in IPA


gcc/
	* ipa-prop.c (detect_type_change): Require a gimple_call rather
	than a plain gimple.
	(detect_type_change_ssa): Likewise.
	(compute_complex_assign_jump_func): Likewise.
	(compute_complex_ancestor_jump_func): Likewise.
	(compute_known_type_jump_func): Likewise.
	(determine_known_aggregate_parts): Likewise.
	(ipa_compute_jump_functions_for_edge): Strengthen local "call" to
	a gimple_call; add checked cast to gimple_phi.
	(ipa_note_param_call): Require a gimple_call rather than a plain
	gimple.
	(ipa_analyze_indirect_call_uses): Likewise.
	(ipa_analyze_virtual_call_uses): Likewise.
	(ipa_analyze_call_uses): Likewise.
	(ipa_analyze_stmt_uses):Add checked cast to gimple_call.
	(ipa_intraprocedural_devirtualization): Require a gimple_call
	rather than a plain gimple.

	* ipa-prop.h (ipa_intraprocedural_devirtualization): Require a
	gimple_call rather than a plain gimple.

	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Replace use of is_gimple_call with dyn_cast_gimple_call and a
	new local "call_stmt".
---
 gcc/ipa-prop.c     | 33 +++++++++++++++++++--------------
 gcc/ipa-prop.h     |  2 +-
 gcc/tree-ssa-pre.c | 10 +++++-----
 3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 45d540e..5f2f02f 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -679,7 +679,7 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data)
    returned by get_ref_base_and_extent, as is the offset.  */
 
 static bool
-detect_type_change (tree arg, tree base, tree comp_type, gimple call,
+detect_type_change (tree arg, tree base, tree comp_type, gimple_call call,
 		    struct ipa_jump_func *jfunc, HOST_WIDE_INT offset)
 {
   struct type_change_info tci;
@@ -744,7 +744,7 @@ detect_type_change (tree arg, tree base, tree comp_type, gimple call,
 
 static bool
 detect_type_change_ssa (tree arg, tree comp_type,
-			gimple call, struct ipa_jump_func *jfunc)
+			gimple_call call, struct ipa_jump_func *jfunc)
 {
   gcc_checking_assert (TREE_CODE (arg) == SSA_NAME);
   if (!flag_devirtualize
@@ -1034,7 +1034,7 @@ static void
 compute_complex_assign_jump_func (struct ipa_node_params *info,
 				  struct param_analysis_info *parms_ainfo,
 				  struct ipa_jump_func *jfunc,
-				  gimple call, gimple stmt, tree name,
+				  gimple_call call, gimple stmt, tree name,
 				  tree param_type)
 {
   HOST_WIDE_INT offset, size, max_size;
@@ -1190,7 +1190,8 @@ static void
 compute_complex_ancestor_jump_func (struct ipa_node_params *info,
 				    struct param_analysis_info *parms_ainfo,
 				    struct ipa_jump_func *jfunc,
-				    gimple call, gimple phi, tree param_type)
+				    gimple_call call, gimple_phi phi,
+				    tree param_type)
 {
   HOST_WIDE_INT offset;
   gimple assign, cond;
@@ -1259,7 +1260,7 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info,
 
 static void
 compute_known_type_jump_func (tree op, struct ipa_jump_func *jfunc,
-			      gimple call, tree expected_type)
+			      gimple_call call, tree expected_type)
 {
   HOST_WIDE_INT offset, size, max_size;
   tree base;
@@ -1363,7 +1364,7 @@ struct ipa_known_agg_contents_list
    JFUNC is the jump function into which the constants are subsequently stored.  */
 
 static void
-determine_known_aggregate_parts (gimple call, tree arg, tree arg_type,
+determine_known_aggregate_parts (gimple_call call, tree arg, tree arg_type,
 				 struct ipa_jump_func *jfunc)
 {
   struct ipa_known_agg_contents_list *list = NULL;
@@ -1599,7 +1600,7 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo,
 {
   struct ipa_node_params *info = IPA_NODE_REF (cs->caller);
   struct ipa_edge_args *args = IPA_EDGE_REF (cs);
-  gimple call = cs->call_stmt;
+  gimple_call call = cs->call_stmt;
   int n, arg_num = gimple_call_num_args (call);
 
   if (arg_num == 0 || args->jump_functions)
@@ -1662,7 +1663,9 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo,
 						  call, stmt, arg, param_type);
 	      else if (gimple_code (stmt) == GIMPLE_PHI)
 		compute_complex_ancestor_jump_func (info, parms_ainfo, jfunc,
-						    call, stmt, param_type);
+						    call,
+						    stmt->as_a_gimple_phi (),
+						    param_type);
 	    }
 	}
       else
@@ -1784,7 +1787,8 @@ ipa_is_ssa_with_stmt_def (tree t)
    indirect call graph edge.  */
 
 static struct cgraph_edge *
-ipa_note_param_call (struct cgraph_node *node, int param_index, gimple stmt)
+ipa_note_param_call (struct cgraph_node *node, int param_index,
+		     gimple_call stmt)
 {
   struct cgraph_edge *cs;
 
@@ -1858,7 +1862,7 @@ static void
 ipa_analyze_indirect_call_uses (struct cgraph_node *node,
 				struct ipa_node_params *info,
 				struct param_analysis_info *parms_ainfo,
-				gimple call, tree target)
+				gimple_call call, tree target)
 {
   gimple def;
   tree n1, n2;
@@ -2001,7 +2005,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
 
 static void
 ipa_analyze_virtual_call_uses (struct cgraph_node *node,
-			       struct ipa_node_params *info, gimple call,
+			       struct ipa_node_params *info, gimple_call call,
 			       tree target)
 {
   struct cgraph_edge *cs;
@@ -2060,7 +2064,8 @@ ipa_analyze_virtual_call_uses (struct cgraph_node *node,
 static void
 ipa_analyze_call_uses (struct cgraph_node *node,
 		       struct ipa_node_params *info,
-		       struct param_analysis_info *parms_ainfo, gimple call)
+		       struct param_analysis_info *parms_ainfo,
+		       gimple_call call)
 {
   tree target = gimple_call_fn (call);
   struct cgraph_edge *cs;
@@ -2092,7 +2097,7 @@ ipa_analyze_stmt_uses (struct cgraph_node *node, struct ipa_node_params *info,
 		       struct param_analysis_info *parms_ainfo, gimple stmt)
 {
   if (is_gimple_call (stmt))
-    ipa_analyze_call_uses (node, info, parms_ainfo, stmt);
+    ipa_analyze_call_uses (node, info, parms_ainfo, stmt->as_a_gimple_call ());
 }
 
 /* Callback of walk_stmt_load_store_addr_ops for the visit_load.
@@ -2256,7 +2261,7 @@ ipa_analyze_node (struct cgraph_node *node)
    target function declaration, otherwise return NULL.  */
 
 tree
-ipa_intraprocedural_devirtualization (gimple call)
+ipa_intraprocedural_devirtualization (gimple_call call)
 {
   tree binfo, token, fndecl;
   struct ipa_jump_func jfunc;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 8fdd92c..bf3602c 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -584,7 +584,7 @@ tree ipa_get_indirect_edge_target (struct cgraph_edge *ie,
 				   vec<ipa_agg_jump_function_p> );
 struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree);
 tree ipa_binfo_from_known_type_jfunc (struct ipa_jump_func *);
-tree ipa_intraprocedural_devirtualization (gimple);
+tree ipa_intraprocedural_devirtualization (gimple_call);
 
 /* Functions related to both.  */
 void ipa_analyze_node (struct cgraph_node *);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 41fe055..f081349 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4339,9 +4339,9 @@ eliminate_dom_walker::before_dom_children (basic_block b)
 	}
       /* Visit indirect calls and turn them into direct calls if
 	 possible.  */
-      if (is_gimple_call (stmt))
+      if (gimple_call call_stmt = stmt->dyn_cast_gimple_call ())
 	{
-	  tree orig_fn = gimple_call_fn (stmt);
+	  tree orig_fn = gimple_call_fn (call_stmt);
 	  tree fn;
 	  if (!orig_fn)
 	    continue;
@@ -4353,7 +4353,7 @@ eliminate_dom_walker::before_dom_children (basic_block b)
 	      fn = VN_INFO (OBJ_TYPE_REF_EXPR (orig_fn))->valnum;
 	      if (!gimple_call_addr_fndecl (fn))
 		{
-		  fn = ipa_intraprocedural_devirtualization (stmt);
+		  fn = ipa_intraprocedural_devirtualization (call_stmt);
 		  if (fn)
 		    fn = build_fold_addr_expr (fn);
 		}
@@ -4376,12 +4376,12 @@ eliminate_dom_walker::before_dom_children (basic_block b)
 		  print_gimple_stmt (dump_file, stmt, 0, 0);
 		}
 
-	      gimple_call_set_fn (stmt, fn);
+	      gimple_call_set_fn (call_stmt, fn);
 	      el_to_update.safe_push (stmt);
 
 	      /* When changing a call into a noreturn call, cfg cleanup
 		 is needed to fix up the noreturn call.  */
-	      if (!was_noreturn && gimple_call_noreturn_p (stmt))
+	      if (!was_noreturn && gimple_call_noreturn_p (call_stmt))
 		el_todo |= TODO_cleanup_cfg;
 
 	      /* If we removed EH side-effects from the statement, clean
-- 
1.8.5.3


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