Commit f6366fc7 by Zdenek Dvorak

bb-reorder.c (make_reorder_chain_1): Modified.

	* bb-reorder.c (make_reorder_chain_1): Modified.
	* cfganal.c (can_fallthru, flow_call_edges_add,
	flow_preorder_transversal_compute): Modified.
	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
	find_sub_basic_blocks): Modified.
	* cfgcleanup.c (try_simplify_condjump, try_optimize_cfg): Modified.
	* cfglayout.c (skip_insns_after_block, fixup_reorder_chain,
	fixup_fallthru_exit_predecessor, cfg_layout_redirect_edge): Modified.
	* cfgrtl.c (tidy_fallthru_edges, verify_flow_info): Modified.
	* combine.c (this_basic_block): Type changed to basic_block.
	(combine_instructions, set_nonzero_bits_and_sign_copies, try_combine,
	nonzero_bits, num_sign_bit_copies, get_last_value_validate,
	get_last_value, distribute_notes, distribute_links): Modified.
	* final.c (compute_alignments): Modified.
	* flow.c (regno_uninitialized, regno_clobbered_at_setjmp): Modified.
	* function.c (thread_prologue_and_epilogue_insns): Modified.
	* gcse.c (compute_code_hoist_vbeinout): Modified.
	* global.c (build_insn_chain): Modified.
	* ifcvt.c (find_if_block, find_cond_trap): Modified.
	* predict.c (last_basic_block_p, note_prediction_to_br_prob): Modified.
	* regmove.c (regmove_optimize): Modified.
	* resource.c (find_basic_block): Modified.
	* sched-ebb.c (schedule_ebbs): Modified.
	* ssa-dce.c (find_control_dependence, find_pdom): Modified.

From-SVN: r53695
parent 68bd6dd6
...@@ -158,7 +158,7 @@ make_reorder_chain_1 (bb, prev) ...@@ -158,7 +158,7 @@ make_reorder_chain_1 (bb, prev)
restart: restart:
RBI (prev)->next = bb; RBI (prev)->next = bb;
if (rtl_dump_file && prev->index + 1 != bb->index) if (rtl_dump_file && prev->next_bb != bb)
fprintf (rtl_dump_file, "Reordering block %d after %d\n", fprintf (rtl_dump_file, "Reordering block %d after %d\n",
bb->index, prev->index); bb->index, prev->index);
} }
...@@ -214,7 +214,7 @@ make_reorder_chain_1 (bb, prev) ...@@ -214,7 +214,7 @@ make_reorder_chain_1 (bb, prev)
if (! next) if (! next)
{ {
for (e = bb->succ; e ; e = e->succ_next) for (e = bb->succ; e ; e = e->succ_next)
if (e->dest->index == bb->index + 1) if (e->dest == bb->next_bb)
{ {
if ((e->flags & EDGE_FALLTHRU) if ((e->flags & EDGE_FALLTHRU)
|| (e->dest->succ || (e->dest->succ
......
...@@ -87,7 +87,7 @@ can_fallthru (src, target) ...@@ -87,7 +87,7 @@ can_fallthru (src, target)
rtx insn = src->end; rtx insn = src->end;
rtx insn2 = target->head; rtx insn2 = target->head;
if (src->index + 1 != target->index) if (src->next_bb != target)
return 0; return 0;
if (!active_insn_p (insn2)) if (!active_insn_p (insn2))
...@@ -296,7 +296,7 @@ flow_call_edges_add (blocks) ...@@ -296,7 +296,7 @@ flow_call_edges_add (blocks)
Handle this by adding a dummy instruction in a new last basic block. */ Handle this by adding a dummy instruction in a new last basic block. */
if (check_last_block) if (check_last_block)
{ {
basic_block bb = BASIC_BLOCK (n_basic_blocks - 1); basic_block bb = EXIT_BLOCK_PTR->prev_bb;
rtx insn = bb->end; rtx insn = bb->end;
/* Back up past insns that must be kept in the same block as a call. */ /* Back up past insns that must be kept in the same block as a call. */
...@@ -1088,7 +1088,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -1088,7 +1088,7 @@ flow_preorder_transversal_compute (pot_order)
walking the tree from right to left. */ walking the tree from right to left. */
i = 0; i = 0;
node = &dfst[0]; node = &dfst[ENTRY_BLOCK_PTR->next_bb->index];
pot_order[i++] = 0; pot_order[i++] = 0;
while (node) while (node)
......
...@@ -50,7 +50,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -50,7 +50,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static int count_basic_blocks PARAMS ((rtx)); static int count_basic_blocks PARAMS ((rtx));
static void find_basic_blocks_1 PARAMS ((rtx)); static void find_basic_blocks_1 PARAMS ((rtx));
static rtx find_label_refs PARAMS ((rtx, rtx)); static rtx find_label_refs PARAMS ((rtx, rtx));
static void make_edges PARAMS ((rtx, int, int, int)); static void make_edges PARAMS ((rtx, basic_block,
basic_block, int));
static void make_label_edge PARAMS ((sbitmap *, basic_block, static void make_label_edge PARAMS ((sbitmap *, basic_block,
rtx, int)); rtx, int));
static void make_eh_edge PARAMS ((sbitmap *, basic_block, rtx)); static void make_eh_edge PARAMS ((sbitmap *, basic_block, rtx));
...@@ -280,7 +281,8 @@ make_eh_edge (edge_cache, src, insn) ...@@ -280,7 +281,8 @@ make_eh_edge (edge_cache, src, insn)
static void static void
make_edges (label_value_list, min, max, update_p) make_edges (label_value_list, min, max, update_p)
rtx label_value_list; rtx label_value_list;
int min, max, update_p; basic_block min, max;
int update_p;
{ {
int i; int i;
sbitmap *edge_cache = NULL; sbitmap *edge_cache = NULL;
...@@ -297,7 +299,7 @@ make_edges (label_value_list, min, max, update_p) ...@@ -297,7 +299,7 @@ make_edges (label_value_list, min, max, update_p)
sbitmap_vector_zero (edge_cache, n_basic_blocks); sbitmap_vector_zero (edge_cache, n_basic_blocks);
if (update_p) if (update_p)
for (i = min; i <= max; ++i) for (i = min->index; i <= max->index; ++i)
{ {
edge e; edge e;
...@@ -308,11 +310,11 @@ make_edges (label_value_list, min, max, update_p) ...@@ -308,11 +310,11 @@ make_edges (label_value_list, min, max, update_p)
} }
/* By nature of the way these get numbered, block 0 is always the entry. */ /* By nature of the way these get numbered, block 0 is always the entry. */
if (min == 0) if (min == ENTRY_BLOCK_PTR->next_bb)
cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, BASIC_BLOCK (0), cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
EDGE_FALLTHRU); EDGE_FALLTHRU);
for (i = min; i <= max; ++i) for (i = min->index; i <= max->index; ++i)
{ {
basic_block bb = BASIC_BLOCK (i); basic_block bb = BASIC_BLOCK (i);
rtx insn, x; rtx insn, x;
...@@ -443,16 +445,15 @@ make_edges (label_value_list, min, max, update_p) ...@@ -443,16 +445,15 @@ make_edges (label_value_list, min, max, update_p)
/* Find out if we can drop through to the next block. */ /* Find out if we can drop through to the next block. */
insn = next_nonnote_insn (insn); insn = next_nonnote_insn (insn);
if (!insn || (i + 1 == n_basic_blocks && force_fallthru)) if (!insn || (bb->next_bb == EXIT_BLOCK_PTR && force_fallthru))
cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU); cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
else if (i + 1 < n_basic_blocks) else if (bb->next_bb != EXIT_BLOCK_PTR)
{ {
rtx tmp = BLOCK_HEAD (i + 1); rtx tmp = bb->next_bb->head;
if (GET_CODE (tmp) == NOTE) if (GET_CODE (tmp) == NOTE)
tmp = next_nonnote_insn (tmp); tmp = next_nonnote_insn (tmp);
if (force_fallthru || insn == tmp) if (force_fallthru || insn == tmp)
cached_make_edge (edge_cache, bb, BASIC_BLOCK (i + 1), cached_make_edge (edge_cache, bb, bb->next_bb, EDGE_FALLTHRU);
EDGE_FALLTHRU);
} }
} }
...@@ -664,7 +665,7 @@ find_basic_blocks (f, nregs, file) ...@@ -664,7 +665,7 @@ find_basic_blocks (f, nregs, file)
compute_bb_for_insn (max_uid); compute_bb_for_insn (max_uid);
/* Discover the edges of our cfg. */ /* Discover the edges of our cfg. */
make_edges (label_value_list, 0, n_basic_blocks - 1, 0); make_edges (label_value_list, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, 0);
/* Do very simple cleanup now, for the benefit of code that runs between /* Do very simple cleanup now, for the benefit of code that runs between
here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */ here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns. */
...@@ -815,7 +816,7 @@ find_many_sub_basic_blocks (blocks) ...@@ -815,7 +816,7 @@ find_many_sub_basic_blocks (blocks)
/* Now re-scan and wire in all edges. This expect simple (conditional) /* Now re-scan and wire in all edges. This expect simple (conditional)
jumps at the end of each new basic blocks. */ jumps at the end of each new basic blocks. */
make_edges (NULL, min, max, 1); make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
/* Update branch probabilities. Expect only (un)conditional jumps /* Update branch probabilities. Expect only (un)conditional jumps
to be created with only the forward edges. */ to be created with only the forward edges. */
...@@ -852,16 +853,15 @@ find_sub_basic_blocks (bb) ...@@ -852,16 +853,15 @@ find_sub_basic_blocks (bb)
{ {
int i; int i;
int min, max; int min, max;
basic_block next = (bb->index == n_basic_blocks - 1 basic_block next = bb->next_bb;
? NULL : BASIC_BLOCK (bb->index + 1));
min = bb->index; min = bb->index;
find_bb_boundaries (bb); find_bb_boundaries (bb);
max = (next ? next->index : n_basic_blocks) - 1; max = next->prev_bb->index;
/* Now re-scan and wire in all edges. This expect simple (conditional) /* Now re-scan and wire in all edges. This expect simple (conditional)
jumps at the end of each new basic blocks. */ jumps at the end of each new basic blocks. */
make_edges (NULL, min, max, 1); make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
/* Update branch probabilities. Expect only (un)conditional jumps /* Update branch probabilities. Expect only (un)conditional jumps
to be created with only the forward edges. */ to be created with only the forward edges. */
......
...@@ -147,7 +147,7 @@ try_simplify_condjump (cbranch_block) ...@@ -147,7 +147,7 @@ try_simplify_condjump (cbranch_block)
unconditional jump. */ unconditional jump. */
jump_block = cbranch_fallthru_edge->dest; jump_block = cbranch_fallthru_edge->dest;
if (jump_block->pred->pred_next if (jump_block->pred->pred_next
|| jump_block->index == n_basic_blocks - 1 || jump_block->next_bb == EXIT_BLOCK_PTR
|| !FORWARDER_BLOCK_P (jump_block)) || !FORWARDER_BLOCK_P (jump_block))
return false; return false;
jump_dest_block = jump_block->succ->dest; jump_dest_block = jump_block->succ->dest;
...@@ -1615,7 +1615,7 @@ try_optimize_cfg (mode) ...@@ -1615,7 +1615,7 @@ try_optimize_cfg (mode)
/* Delete trivially dead basic blocks. */ /* Delete trivially dead basic blocks. */
while (b->pred == NULL) while (b->pred == NULL)
{ {
c = BASIC_BLOCK (b->index - 1); c = b->prev_bb;
if (rtl_dump_file) if (rtl_dump_file)
fprintf (rtl_dump_file, "Deleting block %i.\n", fprintf (rtl_dump_file, "Deleting block %i.\n",
b->index); b->index);
...@@ -1669,7 +1669,7 @@ try_optimize_cfg (mode) ...@@ -1669,7 +1669,7 @@ try_optimize_cfg (mode)
"Deleting fallthru block %i.\n", "Deleting fallthru block %i.\n",
b->index); b->index);
c = BASIC_BLOCK (b->index ? b->index - 1 : 1); c = b->prev_bb == ENTRY_BLOCK_PTR ? b->next_bb : b->prev_bb;
redirect_edge_succ_nodup (b->pred, b->succ->dest); redirect_edge_succ_nodup (b->pred, b->succ->dest);
flow_delete_block (b); flow_delete_block (b);
changed = true; changed = true;
......
...@@ -86,8 +86,8 @@ skip_insns_after_block (bb) ...@@ -86,8 +86,8 @@ skip_insns_after_block (bb)
rtx insn, last_insn, next_head, prev; rtx insn, last_insn, next_head, prev;
next_head = NULL_RTX; next_head = NULL_RTX;
if (bb->index + 1 != n_basic_blocks) if (bb->next_bb != EXIT_BLOCK_PTR)
next_head = BASIC_BLOCK (bb->index + 1)->head; next_head = bb->next_bb->head;
for (last_insn = insn = bb->end; (insn = NEXT_INSN (insn)) != 0; ) for (last_insn = insn = bb->end; (insn = NEXT_INSN (insn)) != 0; )
{ {
...@@ -364,7 +364,7 @@ fixup_reorder_chain () ...@@ -364,7 +364,7 @@ fixup_reorder_chain ()
/* First do the bulk reordering -- rechain the blocks without regard to /* First do the bulk reordering -- rechain the blocks without regard to
the needed changes to jumps and labels. */ the needed changes to jumps and labels. */
for (bb = BASIC_BLOCK (0), index = 0; for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0;
bb != 0; bb != 0;
bb = RBI (bb)->next, index++) bb = RBI (bb)->next, index++)
{ {
...@@ -412,7 +412,7 @@ fixup_reorder_chain () ...@@ -412,7 +412,7 @@ fixup_reorder_chain ()
/* Now add jumps and labels as needed to match the blocks new /* Now add jumps and labels as needed to match the blocks new
outgoing edges. */ outgoing edges. */
for (bb = BASIC_BLOCK (0); bb ; bb = RBI (bb)->next) for (bb = ENTRY_BLOCK_PTR->next_bb; bb ; bb = RBI (bb)->next)
{ {
edge e_fall, e_taken, e; edge e_fall, e_taken, e;
rtx bb_end_insn; rtx bb_end_insn;
...@@ -527,7 +527,7 @@ fixup_reorder_chain () ...@@ -527,7 +527,7 @@ fixup_reorder_chain ()
if (rtl_dump_file) if (rtl_dump_file)
{ {
fprintf (rtl_dump_file, "Reordered sequence:\n"); fprintf (rtl_dump_file, "Reordered sequence:\n");
for (bb = BASIC_BLOCK (0), index = 0; bb; bb = RBI (bb)->next, index ++) for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0; bb; bb = RBI (bb)->next, index ++)
{ {
fprintf (rtl_dump_file, " %i ", index); fprintf (rtl_dump_file, " %i ", index);
if (RBI (bb)->original) if (RBI (bb)->original)
...@@ -542,7 +542,7 @@ fixup_reorder_chain () ...@@ -542,7 +542,7 @@ fixup_reorder_chain ()
} }
prev_bb = ENTRY_BLOCK_PTR; prev_bb = ENTRY_BLOCK_PTR;
bb = BASIC_BLOCK (0); bb = ENTRY_BLOCK_PTR->next_bb;
index = 0; index = 0;
for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++) for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++)
...@@ -611,7 +611,9 @@ cleanup_unconditional_jumps () ...@@ -611,7 +611,9 @@ cleanup_unconditional_jumps ()
rtx insn; rtx insn;
if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i) if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
{ {
basic_block prev = BASIC_BLOCK (--i); basic_block prev = bb->prev_bb;
i--;
if (rtl_dump_file) if (rtl_dump_file)
fprintf (rtl_dump_file, "Removing forwarder BB %i\n", fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
...@@ -672,7 +674,7 @@ fixup_fallthru_exit_predecessor () ...@@ -672,7 +674,7 @@ fixup_fallthru_exit_predecessor ()
if (bb && RBI (bb)->next) if (bb && RBI (bb)->next)
{ {
basic_block c = BASIC_BLOCK (0); basic_block c = ENTRY_BLOCK_PTR->next_bb;
while (RBI (c)->next != bb) while (RBI (c)->next != bb)
c = RBI (c)->next; c = RBI (c)->next;
...@@ -822,14 +824,14 @@ cfg_layout_redirect_edge (e, dest) ...@@ -822,14 +824,14 @@ cfg_layout_redirect_edge (e, dest)
edge e; edge e;
basic_block dest; basic_block dest;
{ {
int old_index = dest->index;
basic_block src = e->src; basic_block src = e->src;
basic_block old_next_bb = src->next_bb;
/* Redirect_edge_and_branch may decide to turn branch into fallthru edge /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
in the case the basic block appears to be in sequence. Avoid this in the case the basic block appears to be in sequence. Avoid this
transformation. */ transformation. */
dest->index = n_basic_blocks + 1; src->next_bb = NULL;
if (e->flags & EDGE_FALLTHRU) if (e->flags & EDGE_FALLTHRU)
{ {
/* In case we are redirecting fallthru edge to the branch edge /* In case we are redirecting fallthru edge to the branch edge
...@@ -855,7 +857,7 @@ cfg_layout_redirect_edge (e, dest) ...@@ -855,7 +857,7 @@ cfg_layout_redirect_edge (e, dest)
delete_barrier (NEXT_INSN (src->end)); delete_barrier (NEXT_INSN (src->end));
src->succ->flags |= EDGE_FALLTHRU; src->succ->flags |= EDGE_FALLTHRU;
} }
dest->index = old_index; src->next_bb = old_next_bb;
} }
/* Create an duplicate of the basic block BB and redirect edge E into it. */ /* Create an duplicate of the basic block BB and redirect edge E into it. */
......
...@@ -1172,8 +1172,8 @@ tidy_fallthru_edges () ...@@ -1172,8 +1172,8 @@ tidy_fallthru_edges ()
for (i = 1; i < n_basic_blocks; i++) for (i = 1; i < n_basic_blocks; i++)
{ {
basic_block b = BASIC_BLOCK (i - 1);
basic_block c = BASIC_BLOCK (i); basic_block c = BASIC_BLOCK (i);
basic_block b = c->prev_bb;
edge s; edge s;
/* We care about simple conditional or unconditional jumps with /* We care about simple conditional or unconditional jumps with
...@@ -1887,7 +1887,7 @@ verify_flow_info () ...@@ -1887,7 +1887,7 @@ verify_flow_info ()
{ {
rtx insn; rtx insn;
if (e->src->index + 1 != e->dest->index) if (e->src->next_bb != e->dest)
{ {
error error
("verify_flow_info: Incorrect blocks for fallthru %i->%i", ("verify_flow_info: Incorrect blocks for fallthru %i->%i",
...@@ -1952,7 +1952,7 @@ verify_flow_info () ...@@ -1952,7 +1952,7 @@ verify_flow_info ()
err = 1; err = 1;
} }
if (n_branch != 1 && any_condjump_p (bb->end) if (n_branch != 1 && any_condjump_p (bb->end)
&& JUMP_LABEL (bb->end) != BASIC_BLOCK (bb->index + 1)->head) && JUMP_LABEL (bb->end) != bb->next_bb->head)
{ {
error ("Wrong amount of branch edges after conditional jump %i", bb->index); error ("Wrong amount of branch edges after conditional jump %i", bb->index);
err = 1; err = 1;
......
...@@ -192,8 +192,8 @@ static HARD_REG_SET newpat_used_regs; ...@@ -192,8 +192,8 @@ static HARD_REG_SET newpat_used_regs;
static rtx added_links_insn; static rtx added_links_insn;
/* Basic block number of the block in which we are performing combines. */ /* Basic block in which we are performing combines. */
static int this_basic_block; static basic_block this_basic_block;
/* A bitmap indicating which blocks had registers go dead at entry. /* A bitmap indicating which blocks had registers go dead at entry.
After combine, we'll need to re-do global life analysis with After combine, we'll need to re-do global life analysis with
...@@ -610,7 +610,7 @@ combine_instructions (f, nregs) ...@@ -610,7 +610,7 @@ combine_instructions (f, nregs)
/* Now scan all the insns in forward order. */ /* Now scan all the insns in forward order. */
this_basic_block = -1; this_basic_block = ENTRY_BLOCK_PTR;
label_tick = 1; label_tick = 1;
last_call_cuid = 0; last_call_cuid = 0;
mem_last_set = 0; mem_last_set = 0;
...@@ -622,9 +622,9 @@ combine_instructions (f, nregs) ...@@ -622,9 +622,9 @@ combine_instructions (f, nregs)
next = 0; next = 0;
/* If INSN starts a new basic block, update our basic block number. */ /* If INSN starts a new basic block, update our basic block number. */
if (this_basic_block + 1 < n_basic_blocks if (this_basic_block->next_bb != EXIT_BLOCK_PTR
&& BLOCK_HEAD (this_basic_block + 1) == insn) && this_basic_block->next_bb->head == insn)
this_basic_block++; this_basic_block = this_basic_block->next_bb;
if (GET_CODE (insn) == CODE_LABEL) if (GET_CODE (insn) == CODE_LABEL)
label_tick++; label_tick++;
...@@ -741,8 +741,8 @@ combine_instructions (f, nregs) ...@@ -741,8 +741,8 @@ combine_instructions (f, nregs)
} }
clear_bb_flags (); clear_bb_flags ();
EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, this_basic_block, EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i,
BASIC_BLOCK (this_basic_block)->flags |= BB_DIRTY); BASIC_BLOCK (i)->flags |= BB_DIRTY);
new_direct_jump_p |= purge_all_dead_edges (0); new_direct_jump_p |= purge_all_dead_edges (0);
delete_noop_moves (f); delete_noop_moves (f);
...@@ -860,7 +860,7 @@ set_nonzero_bits_and_sign_copies (x, set, data) ...@@ -860,7 +860,7 @@ set_nonzero_bits_and_sign_copies (x, set, data)
&& REGNO (x) >= FIRST_PSEUDO_REGISTER && REGNO (x) >= FIRST_PSEUDO_REGISTER
/* If this register is undefined at the start of the file, we can't /* If this register is undefined at the start of the file, we can't
say what its contents were. */ say what its contents were. */
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, REGNO (x)) && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, REGNO (x))
&& GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT) && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
{ {
if (set == 0 || GET_CODE (set) == CLOBBER) if (set == 0 || GET_CODE (set) == CLOBBER)
...@@ -2388,8 +2388,8 @@ try_combine (i3, i2, i1, new_direct_jump_p) ...@@ -2388,8 +2388,8 @@ try_combine (i3, i2, i1, new_direct_jump_p)
which we know will be a NOTE. */ which we know will be a NOTE. */
for (insn = NEXT_INSN (i3); for (insn = NEXT_INSN (i3);
insn && (this_basic_block == n_basic_blocks - 1 insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
|| insn != BLOCK_HEAD (this_basic_block + 1)); || insn != this_basic_block->next_bb->head);
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
{ {
if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn))) if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn)))
...@@ -2606,8 +2606,8 @@ try_combine (i3, i2, i1, new_direct_jump_p) ...@@ -2606,8 +2606,8 @@ try_combine (i3, i2, i1, new_direct_jump_p)
&& ! find_reg_note (i2, REG_UNUSED, && ! find_reg_note (i2, REG_UNUSED,
SET_DEST (XVECEXP (PATTERN (i2), 0, i)))) SET_DEST (XVECEXP (PATTERN (i2), 0, i))))
for (temp = NEXT_INSN (i2); for (temp = NEXT_INSN (i2);
temp && (this_basic_block == n_basic_blocks - 1 temp && (this_basic_block->next_bb == EXIT_BLOCK_PTR
|| BLOCK_HEAD (this_basic_block) != temp); || this_basic_block->head != temp);
temp = NEXT_INSN (temp)) temp = NEXT_INSN (temp))
if (temp != i3 && INSN_P (temp)) if (temp != i3 && INSN_P (temp))
for (link = LOG_LINKS (temp); link; link = XEXP (link, 1)) for (link = LOG_LINKS (temp); link; link = XEXP (link, 1))
...@@ -8068,7 +8068,7 @@ nonzero_bits (x, mode) ...@@ -8068,7 +8068,7 @@ nonzero_bits (x, mode)
&& (reg_last_set_label[REGNO (x)] == label_tick && (reg_last_set_label[REGNO (x)] == label_tick
|| (REGNO (x) >= FIRST_PSEUDO_REGISTER || (REGNO (x) >= FIRST_PSEUDO_REGISTER
&& REG_N_SETS (REGNO (x)) == 1 && REG_N_SETS (REGNO (x)) == 1
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
REGNO (x)))) REGNO (x))))
&& INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid) && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
return reg_last_set_nonzero_bits[REGNO (x)] & nonzero; return reg_last_set_nonzero_bits[REGNO (x)] & nonzero;
...@@ -8483,7 +8483,7 @@ num_sign_bit_copies (x, mode) ...@@ -8483,7 +8483,7 @@ num_sign_bit_copies (x, mode)
&& (reg_last_set_label[REGNO (x)] == label_tick && (reg_last_set_label[REGNO (x)] == label_tick
|| (REGNO (x) >= FIRST_PSEUDO_REGISTER || (REGNO (x) >= FIRST_PSEUDO_REGISTER
&& REG_N_SETS (REGNO (x)) == 1 && REG_N_SETS (REGNO (x)) == 1
&& ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
REGNO (x)))) REGNO (x))))
&& INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid) && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
return reg_last_set_sign_bit_copies[REGNO (x)]; return reg_last_set_sign_bit_copies[REGNO (x)];
...@@ -11492,7 +11492,7 @@ get_last_value_validate (loc, insn, tick, replace) ...@@ -11492,7 +11492,7 @@ get_last_value_validate (loc, insn, tick, replace)
|| (! (regno >= FIRST_PSEUDO_REGISTER || (! (regno >= FIRST_PSEUDO_REGISTER
&& REG_N_SETS (regno) == 1 && REG_N_SETS (regno) == 1
&& (! REGNO_REG_SET_P && (! REGNO_REG_SET_P
(BASIC_BLOCK (0)->global_live_at_start, regno))) (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))
&& reg_last_set_label[j] > tick)) && reg_last_set_label[j] > tick))
{ {
if (replace) if (replace)
...@@ -11566,7 +11566,7 @@ get_last_value (x) ...@@ -11566,7 +11566,7 @@ get_last_value (x)
&& (regno < FIRST_PSEUDO_REGISTER && (regno < FIRST_PSEUDO_REGISTER
|| REG_N_SETS (regno) != 1 || REG_N_SETS (regno) != 1
|| (REGNO_REG_SET_P || (REGNO_REG_SET_P
(BASIC_BLOCK (0)->global_live_at_start, regno))))) (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))))
return 0; return 0;
/* If the value was set in a later insn than the ones we are processing, /* If the value was set in a later insn than the ones we are processing,
...@@ -12375,7 +12375,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) ...@@ -12375,7 +12375,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
if (place == 0) if (place == 0)
{ {
basic_block bb = BASIC_BLOCK (this_basic_block); basic_block bb = this_basic_block;
for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem)) for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem))
{ {
...@@ -12519,7 +12519,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) ...@@ -12519,7 +12519,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
&& REGNO_REG_SET_P (bb->global_live_at_start, && REGNO_REG_SET_P (bb->global_live_at_start,
REGNO (XEXP (note, 0)))) REGNO (XEXP (note, 0))))
{ {
SET_BIT (refresh_blocks, this_basic_block); SET_BIT (refresh_blocks, this_basic_block->index);
need_refresh = 1; need_refresh = 1;
} }
} }
...@@ -12539,7 +12539,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) ...@@ -12539,7 +12539,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
after we remove them in delete_noop_moves. */ after we remove them in delete_noop_moves. */
if (noop_move_p (place)) if (noop_move_p (place))
{ {
SET_BIT (refresh_blocks, this_basic_block); SET_BIT (refresh_blocks, this_basic_block->index);
need_refresh = 1; need_refresh = 1;
} }
...@@ -12589,7 +12589,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) ...@@ -12589,7 +12589,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
i += HARD_REGNO_NREGS (i, reg_raw_mode[i])) i += HARD_REGNO_NREGS (i, reg_raw_mode[i]))
{ {
rtx piece = gen_rtx_REG (reg_raw_mode[i], i); rtx piece = gen_rtx_REG (reg_raw_mode[i], i);
basic_block bb = BASIC_BLOCK (this_basic_block); basic_block bb = this_basic_block;
if (! dead_or_set_p (place, piece) if (! dead_or_set_p (place, piece)
&& ! reg_bitfield_target_p (piece, && ! reg_bitfield_target_p (piece,
...@@ -12612,7 +12612,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) ...@@ -12612,7 +12612,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1)
if (tem == bb->head) if (tem == bb->head)
{ {
SET_BIT (refresh_blocks, SET_BIT (refresh_blocks,
this_basic_block); this_basic_block->index);
need_refresh = 1; need_refresh = 1;
break; break;
} }
...@@ -12717,8 +12717,8 @@ distribute_links (links) ...@@ -12717,8 +12717,8 @@ distribute_links (links)
since most links don't point very far away. */ since most links don't point very far away. */
for (insn = NEXT_INSN (XEXP (link, 0)); for (insn = NEXT_INSN (XEXP (link, 0));
(insn && (this_basic_block == n_basic_blocks - 1 (insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
|| BLOCK_HEAD (this_basic_block + 1) != insn)); || this_basic_block->next_bb->head != insn));
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn))) if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn)))
{ {
......
...@@ -984,8 +984,8 @@ compute_alignments () ...@@ -984,8 +984,8 @@ compute_alignments ()
if (!has_fallthru if (!has_fallthru
&& (branch_frequency > BB_FREQ_MAX / 10 && (branch_frequency > BB_FREQ_MAX / 10
|| (bb->frequency > BASIC_BLOCK (i - 1)->frequency * 10 || (bb->frequency > bb->prev_bb->frequency * 10
&& (BASIC_BLOCK (i - 1)->frequency && (bb->prev_bb->frequency
<= ENTRY_BLOCK_PTR->frequency / 2)))) <= ENTRY_BLOCK_PTR->frequency / 2))))
{ {
log = JUMP_ALIGN (label); log = JUMP_ALIGN (label);
......
...@@ -2349,7 +2349,7 @@ regno_uninitialized (regno) ...@@ -2349,7 +2349,7 @@ regno_uninitialized (regno)
|| FUNCTION_ARG_REGNO_P (regno)))) || FUNCTION_ARG_REGNO_P (regno))))
return 0; return 0;
return REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno); return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno);
} }
/* 1 if register REGNO was alive at a place where `setjmp' was called /* 1 if register REGNO was alive at a place where `setjmp' was called
...@@ -2364,7 +2364,7 @@ regno_clobbered_at_setjmp (regno) ...@@ -2364,7 +2364,7 @@ regno_clobbered_at_setjmp (regno)
return 0; return 0;
return ((REG_N_SETS (regno) > 1 return ((REG_N_SETS (regno) > 1
|| REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno)) || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno))
&& REGNO_REG_SET_P (regs_live_at_setjmp, regno)); && REGNO_REG_SET_P (regs_live_at_setjmp, regno));
} }
......
...@@ -7817,7 +7817,7 @@ epilogue_done: ...@@ -7817,7 +7817,7 @@ epilogue_done:
} }
/* Find the last line number note in the first block. */ /* Find the last line number note in the first block. */
for (insn = BASIC_BLOCK (0)->end; for (insn = ENTRY_BLOCK_PTR->next_bb->end;
insn != prologue_end && insn; insn != prologue_end && insn;
insn = PREV_INSN (insn)) insn = PREV_INSN (insn))
if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
......
...@@ -5586,7 +5586,7 @@ compute_code_hoist_vbeinout () ...@@ -5586,7 +5586,7 @@ compute_code_hoist_vbeinout ()
{ {
changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb], changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
hoist_vbeout[bb], transp[bb]); hoist_vbeout[bb], transp[bb]);
if (bb != n_basic_blocks - 1) if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb); sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
} }
......
...@@ -1794,7 +1794,7 @@ build_insn_chain (first) ...@@ -1794,7 +1794,7 @@ build_insn_chain (first)
{ {
struct insn_chain **p = &reload_insn_chain; struct insn_chain **p = &reload_insn_chain;
struct insn_chain *prev = 0; struct insn_chain *prev = 0;
int b = 0; basic_block b = ENTRY_BLOCK_PTR->next_bb;
regset_head live_relevant_regs_head; regset_head live_relevant_regs_head;
live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head); live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head);
...@@ -1803,14 +1803,14 @@ build_insn_chain (first) ...@@ -1803,14 +1803,14 @@ build_insn_chain (first)
{ {
struct insn_chain *c; struct insn_chain *c;
if (first == BLOCK_HEAD (b)) if (first == b->head)
{ {
int i; int i;
CLEAR_REG_SET (live_relevant_regs); CLEAR_REG_SET (live_relevant_regs);
EXECUTE_IF_SET_IN_BITMAP EXECUTE_IF_SET_IN_BITMAP
(BASIC_BLOCK (b)->global_live_at_start, 0, i, (b->global_live_at_start, 0, i,
{ {
if (i < FIRST_PSEUDO_REGISTER if (i < FIRST_PSEUDO_REGISTER
? ! TEST_HARD_REG_BIT (eliminable_regset, i) ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
...@@ -1827,7 +1827,7 @@ build_insn_chain (first) ...@@ -1827,7 +1827,7 @@ build_insn_chain (first)
*p = c; *p = c;
p = &c->next; p = &c->next;
c->insn = first; c->insn = first;
c->block = b; c->block = b->index;
if (INSN_P (first)) if (INSN_P (first))
{ {
...@@ -1865,8 +1865,8 @@ build_insn_chain (first) ...@@ -1865,8 +1865,8 @@ build_insn_chain (first)
} }
} }
if (first == BLOCK_END (b)) if (first == b->end)
b++; b = b->next_bb;
/* Stop after we pass the end of the last basic block. Verify that /* Stop after we pass the end of the last basic block. Verify that
no real insns are after the end of the last basic block. no real insns are after the end of the last basic block.
...@@ -1874,7 +1874,7 @@ build_insn_chain (first) ...@@ -1874,7 +1874,7 @@ build_insn_chain (first)
We may want to reorganize the loop somewhat since this test should We may want to reorganize the loop somewhat since this test should
always be the right exit test. Allow an ADDR_VEC or ADDR_DIF_VEC if always be the right exit test. Allow an ADDR_VEC or ADDR_DIF_VEC if
the previous real insn is a JUMP_INSN. */ the previous real insn is a JUMP_INSN. */
if (b == n_basic_blocks) if (b == EXIT_BLOCK_PTR)
{ {
for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first)) for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
if (INSN_P (first) if (INSN_P (first)
......
...@@ -1973,7 +1973,7 @@ find_if_block (test_bb, then_edge, else_edge) ...@@ -1973,7 +1973,7 @@ find_if_block (test_bb, then_edge, else_edge)
basic_block join_bb = NULL_BLOCK; basic_block join_bb = NULL_BLOCK;
edge then_succ = then_bb->succ; edge then_succ = then_bb->succ;
edge else_succ = else_bb->succ; edge else_succ = else_bb->succ;
int next_index; basic_block next;
/* The THEN block of an IF-THEN combo must have exactly one predecessor. */ /* The THEN block of an IF-THEN combo must have exactly one predecessor. */
if (then_bb->pred->pred_next != NULL_EDGE) if (then_bb->pred->pred_next != NULL_EDGE)
...@@ -2057,10 +2057,10 @@ find_if_block (test_bb, then_edge, else_edge) ...@@ -2057,10 +2057,10 @@ find_if_block (test_bb, then_edge, else_edge)
/* ??? As an enhancement, move the ELSE block. Have to deal with /* ??? As an enhancement, move the ELSE block. Have to deal with
BLOCK notes, if by no other means than aborting the merge if they BLOCK notes, if by no other means than aborting the merge if they
exist. Sticky enough I don't want to think about it now. */ exist. Sticky enough I don't want to think about it now. */
next_index = then_bb->index; next = then_bb;
if (else_bb && ++next_index != else_bb->index) if (else_bb && (next = next->next_bb) != else_bb)
return FALSE; return FALSE;
if (++next_index != join_bb->index && join_bb->index != EXIT_BLOCK) if ((next = next->next_bb) != join_bb && join_bb != EXIT_BLOCK_PTR)
{ {
if (else_bb) if (else_bb)
join_bb = NULL; join_bb = NULL;
...@@ -2146,7 +2146,7 @@ find_cond_trap (test_bb, then_edge, else_edge) ...@@ -2146,7 +2146,7 @@ find_cond_trap (test_bb, then_edge, else_edge)
/* If the non-trap block and the test are now adjacent, merge them. /* If the non-trap block and the test are now adjacent, merge them.
Otherwise we must insert a direct branch. */ Otherwise we must insert a direct branch. */
if (test_bb->index + 1 == other_bb->index) if (test_bb->next_bb == other_bb)
{ {
delete_insn (jump); delete_insn (jump);
merge_if_block (test_bb, NULL, NULL, other_bb); merge_if_block (test_bb, NULL, NULL, other_bb);
......
...@@ -695,10 +695,13 @@ static bool ...@@ -695,10 +695,13 @@ static bool
last_basic_block_p (bb) last_basic_block_p (bb)
basic_block bb; basic_block bb;
{ {
return (bb->index == n_basic_blocks - 1 if (bb == EXIT_BLOCK_PTR)
|| (bb->index == n_basic_blocks - 2 return false;
return (bb->next_bb == EXIT_BLOCK_PTR
|| (bb->next_bb->next_bb == EXIT_BLOCK_PTR
&& bb->succ && !bb->succ->succ_next && bb->succ && !bb->succ->succ_next
&& bb->succ->dest->index == n_basic_blocks - 1)); && bb->succ->dest->next_bb == EXIT_BLOCK_PTR));
} }
/* Sets branch probabilities according to PREDiction and FLAGS. HEADS[bb->index] /* Sets branch probabilities according to PREDiction and FLAGS. HEADS[bb->index]
...@@ -847,7 +850,7 @@ note_prediction_to_br_prob () ...@@ -847,7 +850,7 @@ note_prediction_to_br_prob ()
heads = xmalloc (sizeof (int) * n_basic_blocks); heads = xmalloc (sizeof (int) * n_basic_blocks);
memset (heads, -1, sizeof (int) * n_basic_blocks); memset (heads, -1, sizeof (int) * n_basic_blocks);
heads[0] = n_basic_blocks; heads[ENTRY_BLOCK_PTR->next_bb->index] = n_basic_blocks;
/* Process all prediction notes. */ /* Process all prediction notes. */
......
...@@ -1506,13 +1506,14 @@ regmove_optimize (f, nregs, regmove_dump_file) ...@@ -1506,13 +1506,14 @@ regmove_optimize (f, nregs, regmove_dump_file)
ends. Fix that here. */ ends. Fix that here. */
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
{ {
rtx end = BLOCK_END (i); basic_block bb = BASIC_BLOCK (i);
rtx end = bb->end;
rtx new = end; rtx new = end;
rtx next = NEXT_INSN (new); rtx next = NEXT_INSN (new);
while (next != 0 && INSN_UID (next) >= old_max_uid while (next != 0 && INSN_UID (next) >= old_max_uid
&& (i == n_basic_blocks - 1 || BLOCK_HEAD (i + 1) != next)) && (bb->next_bb == EXIT_BLOCK_PTR || bb->next_bb->head != next))
new = next, next = NEXT_INSN (new); new = next, next = NEXT_INSN (new);
BLOCK_END (i) = new; bb->end = new;
} }
done: done:
......
...@@ -146,9 +146,9 @@ find_basic_block (insn, search_limit) ...@@ -146,9 +146,9 @@ find_basic_block (insn, search_limit)
if (search_limit == 0) if (search_limit == 0)
return -1; return -1;
/* The start of the function is basic block zero. */ /* The start of the function. */
else if (insn == 0) else if (insn == 0)
return 0; return ENTRY_BLOCK_PTR->next_bb->index;
/* See if any of the upcoming CODE_LABELs start a basic block. If we reach /* See if any of the upcoming CODE_LABELs start a basic block. If we reach
anything other than a CODE_LABEL or note, we can't find this code. */ anything other than a CODE_LABEL or note, we can't find this code. */
......
...@@ -306,8 +306,8 @@ schedule_ebbs (dump_file) ...@@ -306,8 +306,8 @@ schedule_ebbs (dump_file)
basic_block b = BASIC_BLOCK (i); basic_block b = BASIC_BLOCK (i);
edge e; edge e;
tail = b->end; tail = b->end;
if (i + 1 == n_basic_blocks if (b->next_bb == EXIT_BLOCK_PTR
|| GET_CODE (BLOCK_HEAD (i + 1)) == CODE_LABEL) || GET_CODE (b->next_bb->head) == CODE_LABEL)
break; break;
for (e = b->succ; e; e = e->succ_next) for (e = b->succ; e; e = e->succ_next)
if ((e->flags & EDGE_FALLTHRU) != 0) if ((e->flags & EDGE_FALLTHRU) != 0)
......
...@@ -247,7 +247,7 @@ find_control_dependence (el, edge_index, pdom, cdbte) ...@@ -247,7 +247,7 @@ find_control_dependence (el, edge_index, pdom, cdbte)
abort (); abort ();
ending_block = ending_block =
(INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR) (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
? BASIC_BLOCK (0) ? ENTRY_BLOCK_PTR->next_bb
: find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index)); : find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index); for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
...@@ -275,7 +275,7 @@ find_pdom (pdom, block) ...@@ -275,7 +275,7 @@ find_pdom (pdom, block)
abort (); abort ();
if (block == ENTRY_BLOCK_PTR) if (block == ENTRY_BLOCK_PTR)
return BASIC_BLOCK (0); return ENTRY_BLOCK_PTR->next_bb;
else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK) else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK)
return EXIT_BLOCK_PTR; return EXIT_BLOCK_PTR;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment