aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index a2192cb..9c126102 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -134,7 +134,7 @@ try_simplify_condjump (basic_block cbranch_block)
unconditional jump. */
jump_block = cbranch_fallthru_edge->dest;
if (!single_pred_p (jump_block)
- || jump_block->next_bb == EXIT_BLOCK_PTR
+ || jump_block->next_bb == EXIT_BLOCK_PTR_FOR_FN (cfun)
|| !FORWARDER_BLOCK_P (jump_block))
return false;
jump_dest_block = single_succ (jump_block);
@@ -157,7 +157,7 @@ try_simplify_condjump (basic_block cbranch_block)
unconditional branch. */
cbranch_dest_block = cbranch_jump_edge->dest;
- if (cbranch_dest_block == EXIT_BLOCK_PTR
+ if (cbranch_dest_block == EXIT_BLOCK_PTR_FOR_FN (cfun)
|| !can_fallthru (jump_block, cbranch_dest_block))
return false;
@@ -455,7 +455,7 @@ try_forward_edges (int mode, basic_block b)
bb-reorder.c:partition_hot_cold_basic_blocks for complete
details. */
- if (first != EXIT_BLOCK_PTR
+ if (first != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& find_reg_note (BB_END (first), REG_CROSSING_JUMP, NULL_RTX))
return changed;
@@ -467,7 +467,7 @@ try_forward_edges (int mode, basic_block b)
if (FORWARDER_BLOCK_P (target)
&& !(single_succ_edge (target)->flags & EDGE_CROSSING)
- && single_succ (target) != EXIT_BLOCK_PTR)
+ && single_succ (target) != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
/* Bypass trivial infinite loops. */
new_target = single_succ (target);
@@ -580,7 +580,7 @@ try_forward_edges (int mode, basic_block b)
e->goto_locus = goto_locus;
/* Don't force if target is exit block. */
- if (threaded && target != EXIT_BLOCK_PTR)
+ if (threaded && target != EXIT_BLOCK_PTR_FOR_FN (cfun))
{
notice_new_block (redirect_edge_and_branch_force (e, target));
if (dump_file)
@@ -793,7 +793,7 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode)
fprintf (dump_file, "Merged %d and %d without moving.\n",
b_index, c_index);
- return b->prev_bb == ENTRY_BLOCK_PTR ? b : b->prev_bb;
+ return b->prev_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun) ? b : b->prev_bb;
}
/* Otherwise we will need to move code around. Do that only if expensive
@@ -831,7 +831,7 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode)
if (! c_has_outgoing_fallthru)
{
merge_blocks_move_successor_nojumps (b, c);
- return next == ENTRY_BLOCK_PTR ? next->next_bb : next;
+ return next == ENTRY_BLOCK_PTR_FOR_FN (cfun) ? next->next_bb : next;
}
/* If B does not have an incoming fallthru, then it can be moved
@@ -843,7 +843,7 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode)
{
basic_block bb;
- if (b_fallthru_edge->src == ENTRY_BLOCK_PTR)
+ if (b_fallthru_edge->src == ENTRY_BLOCK_PTR_FOR_FN (cfun))
return NULL;
bb = force_nonfallthru (b_fallthru_edge);
if (bb)
@@ -851,7 +851,7 @@ merge_blocks_move (edge e, basic_block b, basic_block c, int mode)
}
merge_blocks_move_predecessor_nojumps (b, c);
- return next == ENTRY_BLOCK_PTR ? next->next_bb : next;
+ return next == ENTRY_BLOCK_PTR_FOR_FN (cfun) ? next->next_bb : next;
}
return NULL;
@@ -1267,7 +1267,7 @@ walk_to_nondebug_insn (rtx *i1, basic_block *bb1, bool follow_fallthru,
return;
fallthru = find_fallthru_edge ((*bb1)->preds);
- if (!fallthru || fallthru->src == ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun)
+ if (!fallthru || fallthru->src == ENTRY_BLOCK_PTR_FOR_FN (cfun)
|| !single_succ_p (fallthru->src))
return;
@@ -1540,7 +1540,8 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
whether they went through the prologue. Sibcalls are fine, we know
that we either didn't need or inserted an epilogue before them. */
if (crtl->shrink_wrapped
- && single_succ_p (bb1) && single_succ (bb1) == EXIT_BLOCK_PTR
+ && single_succ_p (bb1)
+ && single_succ (bb1) == EXIT_BLOCK_PTR_FOR_FN (cfun)
&& !JUMP_P (BB_END (bb1))
&& !(CALL_P (BB_END (bb1)) && SIBLING_CALL_P (BB_END (bb1))))
return false;
@@ -1902,7 +1903,8 @@ try_crossjump_to_edge (int mode, edge e1, edge e2,
e2 = single_pred_edge (src2), src2 = e2->src;
/* Nothing to do if we reach ENTRY, or a common source block. */
- if (src1 == ENTRY_BLOCK_PTR || src2 == ENTRY_BLOCK_PTR)
+ if (src1 == ENTRY_BLOCK_PTR_FOR_FN (cfun) || src2
+ == ENTRY_BLOCK_PTR_FOR_FN (cfun))
return false;
if (src1 == src2)
return false;
@@ -2146,7 +2148,7 @@ try_crossjump_bb (int mode, basic_block bb)
/* Don't crossjump if this block ends in a computed jump,
unless we are optimizing for size. */
if (optimize_bb_for_size_p (bb)
- && bb != EXIT_BLOCK_PTR
+ && bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& computed_jump_p (BB_END (bb)))
return false;
@@ -2287,7 +2289,7 @@ try_head_merge_bb (basic_block bb)
/* Don't crossjump if this block ends in a computed jump,
unless we are optimizing for size. */
if (optimize_bb_for_size_p (bb)
- && bb != EXIT_BLOCK_PTR
+ && bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& computed_jump_p (BB_END (bb)))
return false;
@@ -2303,7 +2305,7 @@ try_head_merge_bb (basic_block bb)
}
for (ix = 0; ix < nedges; ix++)
- if (EDGE_SUCC (bb, ix)->dest == EXIT_BLOCK_PTR)
+ if (EDGE_SUCC (bb, ix)->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
return false;
for (ix = 0; ix < nedges; ix++)
@@ -2623,7 +2625,8 @@ try_optimize_cfg (int mode)
"\n\ntry_optimize_cfg iteration %i\n\n",
iterations);
- for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR;)
+ for (b = ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb; b
+ != EXIT_BLOCK_PTR_FOR_FN (cfun);)
{
basic_block c;
edge s;
@@ -2640,7 +2643,8 @@ try_optimize_cfg (int mode)
if (EDGE_COUNT (b->preds) == 0
|| (EDGE_COUNT (b->succs) == 0
&& trivially_empty_bb_p (b)
- && single_succ_edge (ENTRY_BLOCK_PTR)->dest != b))
+ && single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun))->dest
+ != b))
{
c = b->prev_bb;
if (EDGE_COUNT (b->preds) > 0)
@@ -2681,7 +2685,7 @@ try_optimize_cfg (int mode)
delete_basic_block (b);
changed = true;
/* Avoid trying to remove ENTRY_BLOCK_PTR. */
- b = (c == ENTRY_BLOCK_PTR ? c->next_bb : c);
+ b = (c == ENTRY_BLOCK_PTR_FOR_FN (cfun) ? c->next_bb : c);
continue;
}
@@ -2696,7 +2700,7 @@ try_optimize_cfg (int mode)
if CASE_DROPS_THRU, this can be a tablejump with
some element going to the same place as the
default (fallthru). */
- && (single_pred (b) == ENTRY_BLOCK_PTR
+ && (single_pred (b) == ENTRY_BLOCK_PTR_FOR_FN (cfun)
|| !JUMP_P (BB_END (single_pred (b)))
|| ! label_is_jump_target_p (BB_HEAD (b),
BB_END (single_pred (b)))))
@@ -2723,7 +2727,8 @@ try_optimize_cfg (int mode)
"Deleting fallthru block %i.\n",
b->index);
- c = b->prev_bb == ENTRY_BLOCK_PTR ? b->next_bb : b->prev_bb;
+ c = ((b->prev_bb == ENTRY_BLOCK_PTR_FOR_FN (cfun))
+ ? b->next_bb : b->prev_bb);
redirect_edge_succ_nodup (single_pred_edge (b),
single_succ (b));
delete_basic_block (b);
@@ -2736,7 +2741,7 @@ try_optimize_cfg (int mode)
if (single_succ_p (b)
&& (s = single_succ_edge (b))
&& !(s->flags & EDGE_COMPLEX)
- && (c = s->dest) != EXIT_BLOCK_PTR
+ && (c = s->dest) != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& single_pred_p (c)
&& b != c)
{
@@ -2780,7 +2785,7 @@ try_optimize_cfg (int mode)
can either delete the jump entirely, or replace it
with a simple unconditional jump. */
if (single_succ_p (b)
- && single_succ (b) != EXIT_BLOCK_PTR
+ && single_succ (b) != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& onlyjump_p (BB_END (b))
&& !find_reg_note (BB_END (b), REG_CROSSING_JUMP, NULL_RTX)
&& try_redirect_by_replacing_jump (single_succ_edge (b),
@@ -2819,7 +2824,7 @@ try_optimize_cfg (int mode)
}
if ((mode & CLEANUP_CROSSJUMP)
- && try_crossjump_bb (mode, EXIT_BLOCK_PTR))
+ && try_crossjump_bb (mode, EXIT_BLOCK_PTR_FOR_FN (cfun)))
changed = true;
if (block_was_dirty)
@@ -2876,7 +2881,8 @@ delete_unreachable_blocks (void)
if (MAY_HAVE_DEBUG_INSNS && current_ir_type () == IR_GIMPLE
&& dom_info_available_p (CDI_DOMINATORS))
{
- for (b = EXIT_BLOCK_PTR->prev_bb; b != ENTRY_BLOCK_PTR; b = prev_bb)
+ for (b = EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb;
+ b != ENTRY_BLOCK_PTR_FOR_FN (cfun); b = prev_bb)
{
prev_bb = b->prev_bb;
@@ -2912,7 +2918,8 @@ delete_unreachable_blocks (void)
}
else
{
- for (b = EXIT_BLOCK_PTR->prev_bb; b != ENTRY_BLOCK_PTR; b = prev_bb)
+ for (b = EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb;
+ b != ENTRY_BLOCK_PTR_FOR_FN (cfun); b = prev_bb)
{
prev_bb = b->prev_bb;