summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-uninit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
-rw-r--r--gcc/tree-ssa-uninit.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 0d87558f5a9..9fa3acf2ea3 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -301,7 +301,7 @@ can_skip_redundant_opnd (tree opnd, gimple phi)
that have empty (or possibly empty) definitions. */
static unsigned
-compute_uninit_opnds_pos (gimple phi)
+compute_uninit_opnds_pos (gphi *phi)
{
size_t i, n;
unsigned uninit_opnds = 0;
@@ -653,7 +653,7 @@ find_predicates (pred_chain_union *preds,
VISITED_PHIS is a pointer set for detecting cycles. */
static void
-collect_phi_def_edges (gimple phi, basic_block cd_root,
+collect_phi_def_edges (gphi *phi, basic_block cd_root,
vec<edge> *edges,
hash_set<gimple> *visited_phis)
{
@@ -686,7 +686,7 @@ collect_phi_def_edges (gimple phi, basic_block cd_root,
if (gimple_code (def) == GIMPLE_PHI
&& dominated_by_p (CDI_DOMINATORS,
gimple_bb (def), cd_root))
- collect_phi_def_edges (def, cd_root, edges,
+ collect_phi_def_edges (as_a <gphi *> (def), cd_root, edges,
visited_phis);
else if (!uninit_undefined_value_p (opnd))
{
@@ -706,7 +706,7 @@ collect_phi_def_edges (gimple phi, basic_block cd_root,
composite predicates pointed to by PREDS. */
static bool
-find_def_preds (pred_chain_union *preds, gimple phi)
+find_def_preds (pred_chain_union *preds, gphi *phi)
{
size_t num_chains = 0, i, n;
vec<edge> dep_chains[MAX_NUM_CHAINS];
@@ -944,9 +944,9 @@ find_matching_predicate_in_rest_chains (pred_info pred,
static bool
is_use_properly_guarded (gimple use_stmt,
basic_block use_bb,
- gimple phi,
+ gphi *phi,
unsigned uninit_opnds,
- hash_set<gimple> *visited_phis);
+ hash_set<gphi *> *visited_phis);
/* Returns true if all uninitialized opnds are pruned. Returns false
otherwise. PHI is the phi node with uninitialized operands,
@@ -983,12 +983,12 @@ is_use_properly_guarded (gimple use_stmt,
*/
static bool
-prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
+prune_uninit_phi_opnds_in_unrealizable_paths (gphi *phi,
unsigned uninit_opnds,
- gimple flag_def,
+ gphi *flag_def,
tree boundary_cst,
enum tree_code cmp_code,
- hash_set<gimple> *visited_phis,
+ hash_set<gphi *> *visited_phis,
bitmap *visited_flag_phis)
{
unsigned i;
@@ -1003,22 +1003,22 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
flag_arg = gimple_phi_arg_def (flag_def, i);
if (!is_gimple_constant (flag_arg))
{
- gimple flag_arg_def, phi_arg_def;
+ gphi *flag_arg_def, *phi_arg_def;
tree phi_arg;
unsigned uninit_opnds_arg_phi;
if (TREE_CODE (flag_arg) != SSA_NAME)
return false;
- flag_arg_def = SSA_NAME_DEF_STMT (flag_arg);
- if (gimple_code (flag_arg_def) != GIMPLE_PHI)
+ flag_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (flag_arg));
+ if (!flag_arg_def)
return false;
phi_arg = gimple_phi_arg_def (phi, i);
if (TREE_CODE (phi_arg) != SSA_NAME)
return false;
- phi_arg_def = SSA_NAME_DEF_STMT (phi_arg);
- if (gimple_code (phi_arg_def) != GIMPLE_PHI)
+ phi_arg_def = dyn_cast <gphi *> (SSA_NAME_DEF_STMT (phi_arg));
+ if (!phi_arg_def)
return false;
if (gimple_bb (phi_arg_def) != gimple_bb (flag_arg_def))
@@ -1059,16 +1059,16 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
opnd = gimple_phi_arg_def (phi, i);
opnd_def = SSA_NAME_DEF_STMT (opnd);
- if (gimple_code (opnd_def) == GIMPLE_PHI)
+ if (gphi *opnd_def_phi = dyn_cast <gphi *> (opnd_def))
{
edge opnd_edge;
unsigned uninit_opnds2
- = compute_uninit_opnds_pos (opnd_def);
+ = compute_uninit_opnds_pos (opnd_def_phi);
gcc_assert (!MASK_EMPTY (uninit_opnds2));
opnd_edge = gimple_phi_arg_edge (phi, i);
if (!is_use_properly_guarded (phi,
opnd_edge->src,
- opnd_def,
+ opnd_def_phi,
uninit_opnds2,
visited_phis))
return false;
@@ -1157,8 +1157,8 @@ prune_uninit_phi_opnds_in_unrealizable_paths (gimple phi,
static bool
use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
- gimple phi, unsigned uninit_opnds,
- hash_set<gimple> *visited_phis)
+ gphi *phi, unsigned uninit_opnds,
+ hash_set<gphi *> *visited_phis)
{
unsigned int i, n;
gimple flag_def = 0;
@@ -1231,7 +1231,7 @@ use_pred_not_overlap_with_undef_path_pred (pred_chain_union preds,
all_pruned = prune_uninit_phi_opnds_in_unrealizable_paths (phi,
uninit_opnds,
- flag_def,
+ as_a <gphi *> (flag_def),
boundary_cst,
cmp_code,
visited_phis,
@@ -2112,9 +2112,9 @@ normalize_preds (pred_chain_union preds, gimple use_or_def, bool is_use)
static bool
is_use_properly_guarded (gimple use_stmt,
basic_block use_bb,
- gimple phi,
+ gphi *phi,
unsigned uninit_opnds,
- hash_set<gimple> *visited_phis)
+ hash_set<gphi *> *visited_phis)
{
basic_block phi_bb;
pred_chain_union preds = vNULL;
@@ -2181,9 +2181,9 @@ is_use_properly_guarded (gimple use_stmt,
if the new phi is already in the worklist. */
static gimple
-find_uninit_use (gimple phi, unsigned uninit_opnds,
- vec<gimple> *worklist,
- hash_set<gimple> *added_to_worklist)
+find_uninit_use (gphi *phi, unsigned uninit_opnds,
+ vec<gphi *> *worklist,
+ hash_set<gphi *> *added_to_worklist)
{
tree phi_result;
use_operand_p use_p;
@@ -2200,13 +2200,13 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
if (is_gimple_debug (use_stmt))
continue;
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- use_bb = gimple_phi_arg_edge (use_stmt,
+ if (gphi *use_phi = dyn_cast <gphi *> (use_stmt))
+ use_bb = gimple_phi_arg_edge (use_phi,
PHI_ARG_INDEX_FROM_USE (use_p))->src;
else
use_bb = gimple_bb (use_stmt);
- hash_set<gimple> visited_phis;
+ hash_set<gphi *> visited_phis;
if (is_use_properly_guarded (use_stmt, use_bb, phi, uninit_opnds,
&visited_phis))
continue;
@@ -2222,7 +2222,7 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
/* Found a phi use that is not guarded,
add the phi to the worklist. */
- if (!added_to_worklist->add (use_stmt))
+ if (!added_to_worklist->add (as_a <gphi *> (use_stmt)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -2230,7 +2230,7 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
print_gimple_stmt (dump_file, use_stmt, 0, 0);
}
- worklist->safe_push (use_stmt);
+ worklist->safe_push (as_a <gphi *> (use_stmt));
possibly_undefined_names->add (phi_result);
}
}
@@ -2247,8 +2247,8 @@ find_uninit_use (gimple phi, unsigned uninit_opnds,
a pointer set tracking if the new phi is added to the worklist or not. */
static void
-warn_uninitialized_phi (gimple phi, vec<gimple> *worklist,
- hash_set<gimple> *added_to_worklist)
+warn_uninitialized_phi (gphi *phi, vec<gphi *> *worklist,
+ hash_set<gphi *> *added_to_worklist)
{
unsigned uninit_opnds;
gimple uninit_use_stmt = 0;
@@ -2333,8 +2333,8 @@ unsigned int
pass_late_warn_uninitialized::execute (function *fun)
{
basic_block bb;
- gimple_stmt_iterator gsi;
- vec<gimple> worklist = vNULL;
+ gphi_iterator gsi;
+ vec<gphi *> worklist = vNULL;
calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS);
@@ -2346,13 +2346,13 @@ pass_late_warn_uninitialized::execute (function *fun)
timevar_push (TV_TREE_UNINIT);
possibly_undefined_names = new hash_set<tree>;
- hash_set<gimple> added_to_worklist;
+ hash_set<gphi *> added_to_worklist;
/* Initialize worklist */
FOR_EACH_BB_FN (bb, fun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple phi = gsi_stmt (gsi);
+ gphi *phi = gsi.phi ();
size_t n, i;
n = gimple_phi_num_args (phi);
@@ -2381,7 +2381,7 @@ pass_late_warn_uninitialized::execute (function *fun)
while (worklist.length () != 0)
{
- gimple cur_phi = 0;
+ gphi *cur_phi = 0;
cur_phi = worklist.pop ();
warn_uninitialized_phi (cur_phi, &worklist, &added_to_worklist);
}