+2018-08-27 Martin Liska <mliska@suse.cz>
+
+ * cfgexpand.c (expand_asm_stmt): Use label_to_block and pass
+ cfun argument explicitly.
+ * gimple-pretty-print.c (dump_gimple_switch): Likewise.
+ * hsa-gen.c (gen_hsa_insns_for_switch_stmt): Use new
+ function gimple_switch_default_bb.
+ (convert_switch_statements):
+ (expand_builtins):
+ * ipa-fnsummary.c (set_switch_stmt_execution_predicate):
+ * stmt.c (label_to_block_fn): Use label_to_block and pass
+ cfun argument explicitly and use gimple_switch_label_bb.
+ (expand_case): Likewise.
+ * tree-cfg.c (lower_phi_internal_fn): Use label_to_block and pass
+ cfun argument explicitly. Likewise.
+ (make_edges_bb): Likewise.
+ (make_cond_expr_edges): Likewise.
+ (get_cases_for_edge): Likewise.
+ (make_gimple_switch_edges): Likewise.
+ (label_to_block_fn): Likewise.
+ (label_to_block): Likewise.
+ (make_goto_expr_edges): Likewise.
+ (make_gimple_asm_edges): Likewise.
+ (main_block_label): Likewise.
+ (group_case_labels_stmt): Likewise.
+ (find_taken_edge_computed_goto): Likewise.
+ (find_taken_edge_switch_expr): Likewise.
+ (gimple_verify_flow_info): Likewise.
+ (gimple_redirect_edge_and_branch): Likewise.
+ (gimple_switch_label_bb): New function.
+ (gimple_switch_default_bb): Likewise.
+ (gimple_switch_edge): Likewise.
+ (gimple_switch_default_edge): Likewise.
+ * tree-cfg.h (label_to_block_fn): Remove and replace ...
+ (label_to_block): ... with this.
+ (gimple_switch_label_bb): New.
+ (gimple_switch_default_bb): Likewise.
+ (gimple_switch_edge): Likewise.
+ (gimple_switch_default_edge): Likewise.
+ * tree-cfgcleanup.c (convert_single_case_switch): Use
+ new gimple functions and pass new argument to label_to_block.
+ (cleanup_control_flow_bb):
+ * tree-eh.c (make_eh_dispatch_edges): Use label_to_block and pass
+ cfun argument explicitly.
+ (make_eh_edges): Likewise.
+ (redirect_eh_dispatch_edge): Likewise.
+ (lower_resx): Likewise.
+ (lower_eh_dispatch): Likewise.
+ (maybe_remove_unreachable_handlers): Likewise.
+ (unsplit_eh): Likewise.
+ (cleanup_empty_eh): Likewise.
+ (verify_eh_edges): Likewise.
+ (verify_eh_dispatch_edge): Likewise.
+ * tree-ssa-dom.c (record_edge_info): Likewise.
+ * tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
+ * tree-ssa-threadedge.c (thread_around_empty_blocks): Likewise.
+ (thread_through_normal_block): Likewise.
+ * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
+ * tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
+ * tree-switch-conversion.c (switch_conversion::collect): Use new
+ gimple functions.
+ (switch_conversion::check_final_bb): Likewise.
+ (switch_conversion::gather_default_values): Pass new argument
+ to label_to_block.
+ (switch_conversion::build_constructors): Likewise.
+ (switch_decision_tree::compute_cases_per_edge): Use new
+ gimple_switch_edge function.
+ (switch_decision_tree::analyze_switch_statement): Pass new argument
+ to label_to_block.
+ (switch_decision_tree::try_switch_expansion): Use
+ gimple_switch_default_edge.
+ * tree-vrp.c (find_switch_asserts): Pass new argument
+ to label_to_block.
+ * vr-values.c (vr_values::vrp_visit_switch_stmt): Likewise.
+ (vr_values::simplify_switch_using_ranges): Likewise.
+
2018-08-27 Richard Biener <rguenther@suse.de>
* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Declare.
may insert further instructions into the same basic block after
asm goto and if we don't do this, insertion of instructions on
the fallthru edge might misbehave. See PR58670. */
- if (fallthru_bb && label_to_block_fn (cfun, label) == fallthru_bb)
+ if (fallthru_bb && label_to_block (cfun, label) == fallthru_bb)
{
if (fallthru_label == NULL_RTX)
fallthru_label = gen_label_rtx ();
if (cfun && cfun->cfg)
{
- basic_block dest = label_to_block (label);
+ basic_block dest = label_to_block (cfun, label);
if (dest)
{
edge label_edge = find_edge (gimple_bb (gs), dest);
e->flags &= ~EDGE_FALLTHRU;
e->flags |= EDGE_TRUE_VALUE;
- function *func = DECL_STRUCT_FUNCTION (current_function_decl);
tree index_tree = gimple_switch_index (s);
tree lowest = get_switch_low (s);
tree highest = get_switch_high (s);
hbb->append_insn (new hsa_insn_cbr (cmp_reg));
- tree default_label = gimple_switch_default_label (s);
- basic_block default_label_bb = label_to_block_fn (func,
- CASE_LABEL (default_label));
+ basic_block default_label_bb = gimple_switch_default_bb (cfun, s);
if (!gimple_seq_empty_p (phi_nodes (default_label_bb)))
{
for (unsigned i = 1; i < labels; i++)
{
tree label = gimple_switch_label (s, i);
- basic_block bb = label_to_block_fn (func, CASE_LABEL (label));
+ basic_block bb = label_to_block (cfun, CASE_LABEL (label));
unsigned HOST_WIDE_INT sub_low
= tree_to_uhwi (int_const_binop (MINUS_EXPR, CASE_LOW (label), lowest));
static bool
convert_switch_statements (void)
{
- function *func = DECL_STRUCT_FUNCTION (current_function_decl);
basic_block bb;
bool modified_cfg = false;
- FOR_EACH_BB_FN (bb, func)
+ FOR_EACH_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi = gsi_last_bb (bb);
if (gsi_end_p (gsi))
tree index_type = TREE_TYPE (index);
tree default_label = gimple_switch_default_label (s);
basic_block default_label_bb
- = label_to_block_fn (func, CASE_LABEL (default_label));
+ = label_to_block (cfun, CASE_LABEL (default_label));
basic_block cur_bb = bb;
auto_vec <edge> new_edges;
should be fixed after we add new collection of edges. */
for (unsigned i = 0; i < labels; i++)
{
- tree label = gimple_switch_label (s, i);
- basic_block label_bb = label_to_block_fn (func, CASE_LABEL (label));
+ basic_block label_bb = gimple_switch_label_bb (cfun, s, i);
edge e = find_edge (bb, label_bb);
edge_counts.safe_push (e->count ());
edge_probabilities.safe_push (e->probability);
gsi_insert_before (&cond_gsi, c, GSI_SAME_STMT);
- basic_block label_bb
- = label_to_block_fn (func, CASE_LABEL (label));
+ basic_block label_bb = label_to_block (cfun, CASE_LABEL (label));
edge new_edge = make_edge (cur_bb, label_bb, EDGE_TRUE_VALUE);
profile_probability prob_sum = sum_slice <profile_probability>
(edge_probabilities, i, labels, profile_probability::never ())
static void
expand_builtins ()
{
- function *func = DECL_STRUCT_FUNCTION (current_function_decl);
basic_block bb;
- FOR_EACH_BB_FN (bb, func)
+ FOR_EACH_BB_FN (bb, cfun)
{
for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
gsi_next (&gsi))
tree min, max;
predicate p;
- e = find_edge (bb, label_to_block (CASE_LABEL (cl)));
+ e = gimple_switch_edge (cfun, last, case_idx);
min = CASE_LOW (cl);
max = CASE_HIGH (cl);
/* Label to jump to when node matches. */
tree m_code_label;
};
-
-extern basic_block label_to_block_fn (struct function *, tree);
\f
static bool check_unique_operand_names (tree, tree, tree);
static char *resolve_operand_name_1 (char *, tree, tree, tree);
/* Find the default case target label. */
tree default_lab = CASE_LABEL (gimple_switch_default_label (stmt));
default_label = jump_target_rtx (default_lab);
- basic_block default_bb = label_to_block_fn (cfun, default_lab);
+ basic_block default_bb = label_to_block (cfun, default_lab);
edge default_edge = find_edge (bb, default_bb);
/* Get upper and lower bounds of case values. */
{
tree arg = gimple_call_arg (stmt, i);
if (TREE_CODE (arg) == LABEL_DECL)
- pred = label_to_block (arg);
+ pred = label_to_block (cfun, arg);
else
{
edge e = find_edge (pred, bb);
tree label2 = gimple_transaction_label_uninst (txn);
if (label1)
- make_edge (bb, label_to_block (label1), EDGE_FALLTHRU);
+ make_edge (bb, label_to_block (cfun, label1), EDGE_FALLTHRU);
if (label2)
- make_edge (bb, label_to_block (label2),
+ make_edge (bb, label_to_block (cfun, label2),
EDGE_TM_UNINSTRUMENTED | (label1 ? 0 : EDGE_FALLTHRU));
tree label3 = gimple_transaction_label_over (txn);
if (gimple_transaction_subcode (txn)
& (GTMA_HAVE_ABORT | GTMA_IS_OUTER))
- make_edge (bb, label_to_block (label3), EDGE_TM_ABORT);
+ make_edge (bb, label_to_block (cfun, label3), EDGE_TM_ABORT);
fallthru = false;
}
/* Entry basic blocks for each component. */
then_label = gimple_cond_true_label (entry);
else_label = gimple_cond_false_label (entry);
- then_bb = label_to_block (then_label);
- else_bb = label_to_block (else_label);
+ then_bb = label_to_block (cfun, then_label);
+ else_bb = label_to_block (cfun, else_label);
then_stmt = first_stmt (then_bb);
else_stmt = first_stmt (else_bb);
{
tree elt = gimple_switch_label (t, i);
tree lab = CASE_LABEL (elt);
- basic_block label_bb = label_to_block (lab);
+ basic_block label_bb = label_to_block (cfun, lab);
edge this_edge = find_edge (e->src, label_bb);
/* Add it to the chain of CASE_LABEL_EXPRs referencing E, or create
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (entry, i));
- basic_block label_bb = label_to_block (lab);
+ basic_block label_bb = gimple_switch_label_bb (cfun, entry, i);
make_edge (bb, label_bb, 0);
}
}
/* Return the basic block holding label DEST. */
basic_block
-label_to_block_fn (struct function *ifun, tree dest)
+label_to_block (struct function *ifun, tree dest)
{
int uid = LABEL_DECL_UID (dest);
if (simple_goto_p (goto_t))
{
tree dest = gimple_goto_dest (goto_t);
- basic_block label_bb = label_to_block (dest);
+ basic_block label_bb = label_to_block (cfun, dest);
edge e = make_edge (bb, label_bb, EDGE_FALLTHRU);
e->goto_locus = gimple_location (goto_t);
gsi_remove (&last, true);
for (i = 0; i < n; ++i)
{
tree label = TREE_VALUE (gimple_asm_label_op (stmt, i));
- basic_block label_bb = label_to_block (label);
+ basic_block label_bb = label_to_block (cfun, label);
make_edge (bb, label_bb, 0);
}
}
static tree
main_block_label (tree label)
{
- basic_block bb = label_to_block (label);
+ basic_block bb = label_to_block (cfun, label);
tree main_label = label_for_bb[bb->index].label;
/* label_to_block possibly inserted undefined label into the chain. */
int i, next_index, new_size;
basic_block default_bb = NULL;
- default_bb = label_to_block (CASE_LABEL (gimple_switch_default_label (stmt)));
+ default_bb = gimple_switch_default_bb (cfun, stmt);
/* Look for possible opportunities to merge cases. */
new_size = i = 1;
base_case = gimple_switch_label (stmt, i);
gcc_assert (base_case);
- base_bb = label_to_block (CASE_LABEL (base_case));
+ base_bb = label_to_block (cfun, CASE_LABEL (base_case));
/* Discard cases that have the same destination as the default case or
whose destiniation blocks have already been removed as unreachable. */
while (next_index < old_size)
{
tree merge_case = gimple_switch_label (stmt, next_index);
- basic_block merge_bb = label_to_block (CASE_LABEL (merge_case));
+ basic_block merge_bb = label_to_block (cfun, CASE_LABEL (merge_case));
wide_int bhp1 = wi::to_wide (base_high) + 1;
/* Merge the cases if they jump to the same place,
basic_block dest;
edge e = NULL;
- dest = label_to_block (val);
+ dest = label_to_block (cfun, val);
if (dest)
e = find_edge (bb, dest);
else
taken_case = find_case_label_for_value (switch_stmt, val);
}
- dest_bb = label_to_block (CASE_LABEL (taken_case));
+ dest_bb = label_to_block (cfun, CASE_LABEL (taken_case));
e = find_edge (gimple_bb (switch_stmt), dest_bb);
gcc_assert (e);
err = 1;
}
- if (label_to_block (label) != bb)
+ if (label_to_block (cfun, label) != bb)
{
error ("label ");
print_generic_expr (stderr, label);
/* Mark all the destination basic blocks. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i));
- basic_block label_bb = label_to_block (lab);
+ basic_block label_bb = gimple_switch_label_bb (cfun, switch_stmt, i);
gcc_assert (!label_bb->aux || label_bb->aux == (void *)1);
label_bb->aux = (void *)1;
}
/* Check that we have all of them. */
for (i = 0; i < n; ++i)
{
- tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i));
- basic_block label_bb = label_to_block (lab);
+ basic_block label_bb = gimple_switch_label_bb (cfun,
+ switch_stmt, i);
if (label_bb->aux != (void *)2)
{
for (i = 0; i < n; i++)
{
tree elt = gimple_switch_label (switch_stmt, i);
- if (label_to_block (CASE_LABEL (elt)) == e->dest)
+ if (label_to_block (cfun, CASE_LABEL (elt)) == e->dest)
CASE_LABEL (elt) = label;
}
}
for (i = 0; i < n; ++i)
{
tree cons = gimple_asm_label_op (asm_stmt, i);
- if (label_to_block (TREE_VALUE (cons)) == e->dest)
+ if (label_to_block (cfun, TREE_VALUE (cons)) == e->dest)
{
if (!label)
label = gimple_block_label (dest);
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
}
+/* Return the basic block that belongs to label numbered INDEX
+ of a switch statement. */
+
+basic_block
+gimple_switch_label_bb (function *ifun, gswitch *gs, unsigned index)
+{
+ return label_to_block (ifun, CASE_LABEL (gimple_switch_label (gs, index)));
+}
+
+/* Return the default basic block of a switch statement. */
+
+basic_block
+gimple_switch_default_bb (function *ifun, gswitch *gs)
+{
+ return gimple_switch_label_bb (ifun, gs, 0);
+}
+
+/* Return the edge that belongs to label numbered INDEX
+ of a switch statement. */
+
+edge
+gimple_switch_edge (function *ifun, gswitch *gs, unsigned index)
+{
+ return find_edge (gimple_bb (gs), gimple_switch_label_bb (ifun, gs, index));
+}
+
+/* Return the default edge of a switch statement. */
+
+edge
+gimple_switch_default_edge (function *ifun, gswitch *gs)
+{
+ return gimple_switch_edge (ifun, gs, 0);
+}
+
+
/* Emit return warnings. */
namespace {
extern void init_empty_tree_cfg (void);
extern void start_recording_case_labels (void);
extern void end_recording_case_labels (void);
-extern basic_block label_to_block_fn (struct function *, tree);
-#define label_to_block(t) (label_to_block_fn (cfun, t))
+extern basic_block label_to_block (struct function *, tree);
extern void cleanup_dead_labels (void);
extern bool group_case_labels_stmt (gswitch *);
extern bool group_case_labels (void);
edge *, edge *);
extern void generate_range_test (basic_block bb, tree index, tree low,
tree high, tree *lhs, tree *rhs);
+extern basic_block gimple_switch_label_bb (function *, gswitch *, unsigned);
+extern basic_block gimple_switch_default_bb (function *, gswitch *);
+extern edge gimple_switch_edge (function *, gswitch *, unsigned);
+extern edge gimple_switch_default_edge (function *, gswitch *);
/* Return true if the LHS of a call should be removed. */
return false;
tree index = gimple_switch_index (swtch);
- tree default_label = CASE_LABEL (gimple_switch_default_label (swtch));
tree label = gimple_switch_label (swtch, 1);
tree low = CASE_LOW (label);
tree high = CASE_HIGH (label);
- basic_block default_bb = label_to_block_fn (cfun, default_label);
- basic_block case_bb = label_to_block_fn (cfun, CASE_LABEL (label));
+ basic_block default_bb = gimple_switch_default_bb (cfun, swtch);
+ basic_block case_bb = label_to_block (cfun, CASE_LABEL (label));
basic_block bb = gimple_bb (swtch);
gcond *cond;
label = TREE_OPERAND (gimple_goto_dest (stmt), 0);
if (DECL_CONTEXT (label) != cfun->decl)
return retval;
- target_block = label_to_block (label);
+ target_block = label_to_block (cfun, label);
for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
{
if (e->dest != target_block)
case ERT_TRY:
for (c = r->u.eh_try.first_catch; c ; c = c->next_catch)
{
- dst = label_to_block (c->label);
+ dst = label_to_block (cfun, c->label);
make_edge (src, dst, 0);
/* A catch-all handler doesn't have a fallthru. */
break;
case ERT_ALLOWED_EXCEPTIONS:
- dst = label_to_block (r->u.allowed.label);
+ dst = label_to_block (cfun, r->u.allowed.label);
make_edge (src, dst, 0);
break;
gcc_assert (lp != NULL);
src = gimple_bb (stmt);
- dst = label_to_block (lp->post_landing_pad);
+ dst = label_to_block (cfun, lp->post_landing_pad);
make_edge (src, dst, EDGE_EH);
}
case ERT_TRY:
for (c = r->u.eh_try.first_catch; c ; c = c->next_catch)
{
- old_bb = label_to_block (c->label);
+ old_bb = label_to_block (cfun, c->label);
if (old_bb == e->dest)
{
c->label = new_lab;
break;
case ERT_ALLOWED_EXCEPTIONS:
- old_bb = label_to_block (r->u.allowed.label);
+ old_bb = label_to_block (cfun, r->u.allowed.label);
gcc_assert (old_bb == e->dest);
r->u.allowed.label = new_lab;
any_changed = true;
else
{
lab = *slot;
- new_bb = label_to_block (lab);
+ new_bb = label_to_block (cfun, lab);
}
gcc_assert (EDGE_COUNT (bb->succs) == 0);
while (tp_node);
if (! have_label)
{
- remove_edge (find_edge (src, label_to_block (lab)));
+ remove_edge (find_edge (src, label_to_block (cfun, lab)));
redirected = true;
}
}
FOR_EACH_VEC_SAFE_ELT (cfun->eh->lp_array, i, lp)
if (lp && lp->post_landing_pad)
{
- if (label_to_block (lp->post_landing_pad) == NULL)
+ if (label_to_block (cfun, lp->post_landing_pad) == NULL)
{
remove_unreachable_handlers ();
return;
static bool
unsplit_eh (eh_landing_pad lp)
{
- basic_block bb = label_to_block (lp->post_landing_pad);
+ basic_block bb = label_to_block (cfun, lp->post_landing_pad);
gimple_stmt_iterator gsi;
edge e_in, e_out;
static bool
cleanup_empty_eh (eh_landing_pad lp)
{
- basic_block bb = label_to_block (lp->post_landing_pad);
+ basic_block bb = label_to_block (cfun, lp->post_landing_pad);
gimple_stmt_iterator gsi;
gimple *resx;
eh_region new_region;
return true;
}
- if (eh_edge->dest != label_to_block (lp->post_landing_pad))
+ if (eh_edge->dest != label_to_block (cfun, lp->post_landing_pad))
{
error ("Incorrect EH edge %i->%i", bb->index, eh_edge->dest->index);
return true;
case ERT_TRY:
for (c = r->u.eh_try.first_catch; c ; c = c->next_catch)
{
- dst = label_to_block (c->label);
+ dst = label_to_block (cfun, c->label);
e = find_edge (src, dst);
if (e == NULL)
{
break;
case ERT_ALLOWED_EXCEPTIONS:
- dst = label_to_block (r->u.allowed.label);
+ dst = label_to_block (cfun, r->u.allowed.label);
e = find_edge (src, dst);
if (e == NULL)
{
for (i = 0; i < n_labels; i++)
{
tree label = gimple_switch_label (switch_stmt, i);
- basic_block target_bb = label_to_block (CASE_LABEL (label));
+ basic_block target_bb
+ = label_to_block (cfun, CASE_LABEL (label));
if (CASE_HIGH (label)
|| !CASE_LOW (label)
|| info[target_bb->index])
for (i = 0; i < gimple_switch_num_labels (stmt); i++)
{
tree elt = gimple_switch_label (stmt, i);
- basic_block target = label_to_block (CASE_LABEL (elt));
+ basic_block target = label_to_block (cfun, CASE_LABEL (elt));
bitmap_set_bit (target_blocks, target->index);
}
for (ei = ei_start (gimple_bb (stmt)->succs); (e = ei_safe_edge (ei)); )
|| TREE_CODE (cond) == CASE_LABEL_EXPR))
{
if (TREE_CODE (cond) == CASE_LABEL_EXPR)
- taken_edge = find_edge (bb, label_to_block (CASE_LABEL (cond)));
+ taken_edge = find_edge (bb, label_to_block (cfun, CASE_LABEL (cond)));
else
taken_edge = find_taken_edge (bb, cond);
edge taken_edge;
if (TREE_CODE (cond) == CASE_LABEL_EXPR)
taken_edge = find_edge (e->dest,
- label_to_block (CASE_LABEL (cond)));
+ label_to_block (cfun, CASE_LABEL (cond)));
else
taken_edge = find_taken_edge (e->dest, cond);
for (i = 0; i < n_labels; i++)
{
tree label = gimple_switch_label (switch_stmt, i);
- basic_block bb = label_to_block (CASE_LABEL (label));
+ basic_block bb = label_to_block (cfun, CASE_LABEL (label));
if (CASE_HIGH (label)
|| !CASE_LOW (label)
for (idx = 0; idx < gimple_switch_num_labels (gs); ++idx)
{
tree tl = gimple_switch_label (gs, idx);
- if (e->dest == label_to_block (CASE_LABEL (tl)))
+ if (e->dest == label_to_block (cfun, CASE_LABEL (tl)))
{
if (!l)
l = tl;
unsigned int i;
edge e, e_default, e_first;
edge_iterator ei;
- basic_block first;
m_switch = swtch;
Collect the bits we can deduce from the CFG. */
m_index_expr = gimple_switch_index (swtch);
m_switch_bb = gimple_bb (swtch);
- m_default_bb
- = label_to_block (CASE_LABEL (gimple_switch_default_label (swtch)));
- e_default = find_edge (m_switch_bb, m_default_bb);
+ e_default = gimple_switch_default_edge (cfun, swtch);
+ m_default_bb = e_default->dest;
m_default_prob = e_default->probability;
m_default_count = e_default->count ();
FOR_EACH_EDGE (e, ei, m_switch_bb->succs)
}
if (m_contiguous_range)
- {
- first = label_to_block (CASE_LABEL (gimple_switch_label (swtch, 1)));
- e_first = find_edge (m_switch_bb, first);
- }
+ e_first = gimple_switch_edge (cfun, swtch, 1);
else
- {
- first = m_default_bb;
- e_first = e_default;
- }
+ e_first = e_default;
/* See if there is one common successor block for all branch
targets. If it exists, record it in FINAL_BB.
unsigned int branch_num = gimple_switch_num_labels (m_switch);
for (unsigned int i = 1; i < branch_num; i++)
{
- tree lab = CASE_LABEL (gimple_switch_label (m_switch, i));
- if (label_to_block (lab) == bb)
+ if (gimple_switch_label_bb (cfun, m_switch, i) == bb)
{
m_reason = reason;
return false;
switch_conversion::gather_default_values (tree default_case)
{
gphi_iterator gsi;
- basic_block bb = label_to_block (CASE_LABEL (default_case));
+ basic_block bb = label_to_block (cfun, CASE_LABEL (default_case));
edge e;
int i = 0;
for (i = 1; i < branch_num; i++)
{
tree cs = gimple_switch_label (m_switch, i);
- basic_block bb = label_to_block (CASE_LABEL (cs));
+ basic_block bb = label_to_block (cfun, CASE_LABEL (cs));
edge e;
tree high;
gphi_iterator gsi;
void
switch_decision_tree::compute_cases_per_edge ()
{
- basic_block bb = gimple_bb (m_switch);
reset_out_edges_aux ();
int ncases = gimple_switch_num_labels (m_switch);
for (int i = ncases - 1; i >= 1; --i)
{
- tree elt = gimple_switch_label (m_switch, i);
- tree lab = CASE_LABEL (elt);
- basic_block case_bb = label_to_block_fn (cfun, lab);
- edge case_edge = find_edge (bb, case_bb);
+ edge case_edge = gimple_switch_edge (cfun, m_switch, i);
case_edge->aux = (void *) ((intptr_t) (case_edge->aux) + 1);
}
}
auto_vec<cluster *> clusters;
clusters.create (l - 1);
- tree default_label = CASE_LABEL (gimple_switch_default_label (m_switch));
- basic_block default_bb = label_to_block_fn (cfun, default_label);
+ basic_block default_bb = gimple_switch_default_bb (cfun, m_switch);
m_case_bbs.reserve (l);
m_case_bbs.quick_push (default_bb);
{
tree elt = gimple_switch_label (m_switch, i);
tree lab = CASE_LABEL (elt);
- basic_block case_bb = label_to_block_fn (cfun, lab);
+ basic_block case_bb = label_to_block (cfun, lab);
edge case_edge = find_edge (bb, case_bb);
tree low = CASE_LOW (elt);
tree high = CASE_HIGH (elt);
profile_probability p
= case_edge->probability.apply_scale (1, (intptr_t) (case_edge->aux));
- clusters.quick_push (new simple_cluster (low, high, elt, case_bb, p));
- m_case_bbs.quick_push (case_bb);
+ clusters.quick_push (new simple_cluster (low, high, elt, case_edge->dest,
+ p));
+ m_case_bbs.quick_push (case_edge->dest);
}
reset_out_edges_aux ();
return false;
/* Find the default case target label. */
- tree default_label_expr = CASE_LABEL (gimple_switch_default_label (m_switch));
- m_default_bb = label_to_block_fn (cfun, default_label_expr);
- edge default_edge = find_edge (bb, m_default_bb);
+ edge default_edge = gimple_switch_default_edge (cfun, m_switch);
+ m_default_bb = default_edge->dest;
/* Do the insertion of a case label into m_case_list. The labels are
fed to us in descending order from the sorted vector of case labels used
for (idx = 0; idx < n; ++idx)
{
ci[idx].expr = gimple_switch_label (last, idx);
- ci[idx].bb = label_to_block (CASE_LABEL (ci[idx].expr));
+ ci[idx].bb = label_to_block (cfun, CASE_LABEL (ci[idx].expr));
}
edge default_edge = find_edge (bb, ci[0].bb);
qsort (ci, n, sizeof (struct case_info), compare_case_labels);
}
*taken_edge_p = find_edge (gimple_bb (stmt),
- label_to_block (CASE_LABEL (val)));
+ label_to_block (cfun, CASE_LABEL (val)));
if (dump_file && (dump_flags & TDF_DETAILS))
{
for (i = 0; i < n2; ++i)
{
e = find_edge (gimple_bb (stmt),
- label_to_block (CASE_LABEL (TREE_VEC_ELT (vec2, i))));
+ label_to_block (cfun,
+ CASE_LABEL (TREE_VEC_ELT (vec2, i))));
e->aux = (void *)-1;
}