diff options
Diffstat (limited to 'gcc/tree-tailcall.c')
-rw-r--r-- | gcc/tree-tailcall.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 551ddcbc4a8..037dfbce207 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -280,7 +280,7 @@ independent_of_stmt_p (tree expr, gimple at, gimple_stmt_iterator gsi) additive factor for the real return value. */ static bool -process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, +process_assignment (gassign *stmt, gimple_stmt_iterator call, tree *m, tree *a, tree *ass_var) { tree op0, op1 = NULL_TREE, non_ass_var = NULL_TREE; @@ -401,11 +401,11 @@ static tree propagate_through_phis (tree var, edge e) { basic_block dest = e->dest; - gimple_stmt_iterator gsi; + gphi_iterator gsi; for (gsi = gsi_start_phis (dest); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); if (PHI_ARG_DEF_FROM_EDGE (phi, e) == var) return PHI_RESULT (phi); } @@ -419,7 +419,8 @@ static void find_tail_calls (basic_block bb, struct tailcall **ret) { tree ass_var = NULL_TREE, ret_var, func, param; - gimple stmt, call = NULL; + gimple stmt; + gcall *call = NULL; gimple_stmt_iterator gsi, agsi; bool tail_recursion; struct tailcall *nw; @@ -446,8 +447,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret) /* Check for a call. */ if (is_gimple_call (stmt)) { - call = stmt; - ass_var = gimple_call_lhs (stmt); + call = as_a <gcall *> (stmt); + ass_var = gimple_call_lhs (call); break; } @@ -572,7 +573,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret) return; /* This is a gimple assign. */ - if (! process_assignment (stmt, gsi, &tmp_m, &tmp_a, &ass_var)) + if (! process_assignment (as_a <gassign *> (stmt), gsi, &tmp_m, + &tmp_a, &ass_var)) return; if (tmp_a) @@ -597,7 +599,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret) } /* See if this is a tail call we can handle. */ - ret_var = gimple_return_retval (stmt); + ret_var = gimple_return_retval (as_a <greturn *> (stmt)); /* We may proceed if there either is no return value, or the return value is identical to the call's return. */ @@ -632,14 +634,14 @@ find_tail_calls (basic_block bb, struct tailcall **ret) static void add_successor_phi_arg (edge e, tree var, tree phi_arg) { - gimple_stmt_iterator gsi; + gphi_iterator gsi; for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) - if (PHI_RESULT (gsi_stmt (gsi)) == var) + if (PHI_RESULT (gsi.phi ()) == var) break; gcc_assert (!gsi_end_p (gsi)); - add_phi_arg (gsi_stmt (gsi), phi_arg, e, UNKNOWN_LOCATION); + add_phi_arg (gsi.phi (), phi_arg, e, UNKNOWN_LOCATION); } /* Creates a GIMPLE statement which computes the operation specified by @@ -654,7 +656,7 @@ adjust_return_value_with_ops (enum tree_code code, const char *label, tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl)); tree result = make_temp_ssa_name (ret_type, NULL, label); - gimple stmt; + gassign *stmt; if (POINTER_TYPE_P (ret_type)) { @@ -691,7 +693,7 @@ static tree update_accumulator_with_ops (enum tree_code code, tree acc, tree op1, gimple_stmt_iterator gsi) { - gimple stmt; + gassign *stmt; tree var = copy_ssa_name (acc, NULL); if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1))) stmt = gimple_build_assign_with_ops (code, var, acc, op1); @@ -758,7 +760,7 @@ static void adjust_return_value (basic_block bb, tree m, tree a) { tree retval; - gimple ret_stmt = gimple_seq_last_stmt (bb_seq (bb)); + greturn *ret_stmt = as_a <greturn *> (gimple_seq_last_stmt (bb_seq (bb))); gimple_stmt_iterator gsi = gsi_last_bb (bb); gcc_assert (gimple_code (ret_stmt) == GIMPLE_RETURN); @@ -831,7 +833,8 @@ eliminate_tail_call (struct tailcall *t) size_t idx; basic_block bb, first; edge e; - gimple phi; + gphi *phi; + gphi_iterator gpi; gimple_stmt_iterator gsi; gimple orig_stmt; @@ -884,7 +887,7 @@ eliminate_tail_call (struct tailcall *t) /* Add phi node entries for arguments. The ordering of the phi nodes should be the same as the ordering of the arguments. */ for (param = DECL_ARGUMENTS (current_function_decl), - idx = 0, gsi = gsi_start_phis (first); + idx = 0, gpi = gsi_start_phis (first); param; param = DECL_CHAIN (param), idx++) { @@ -892,11 +895,11 @@ eliminate_tail_call (struct tailcall *t) continue; arg = gimple_call_arg (stmt, idx); - phi = gsi_stmt (gsi); + phi = gpi.phi (); gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi))); add_phi_arg (phi, arg, e, gimple_location (stmt)); - gsi_next (&gsi); + gsi_next (&gpi); } /* Update the values of accumulators. */ @@ -929,7 +932,7 @@ optimize_tail_call (struct tailcall *t, bool opt_tailcalls) if (opt_tailcalls) { - gimple stmt = gsi_stmt (t->call_gsi); + gcall *stmt = as_a <gcall *> (gsi_stmt (t->call_gsi)); gimple_call_set_tail (stmt, true); cfun->tail_call_marked = true; @@ -958,7 +961,7 @@ create_tailcall_accumulator (const char *label, basic_block bb, tree init) ret_type = sizetype; tree tmp = make_temp_ssa_name (ret_type, NULL, label); - gimple phi; + gphi *phi; phi = create_phi_node (tmp, bb); /* RET_TYPE can be a float when -ffast-maths is enabled. */ @@ -1022,7 +1025,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) { tree name = ssa_default_def (cfun, param); tree new_name = make_ssa_name (param, SSA_NAME_DEF_STMT (name)); - gimple phi; + gphi *phi; set_ssa_default_def (cfun, param, new_name); phi = create_phi_node (name, first); |