{
return (NOTE_LINE_NUMBER (note) == NOTE_INSN_DELETED
|| NOTE_LINE_NUMBER (note) == NOTE_INSN_BASIC_BLOCK
- || NOTE_LINE_NUMBER (note) == NOTE_INSN_PREDICTION);
+ || NOTE_LINE_NUMBER (note) == NOTE_INSN_PREDICTION);
}
/* True if a given label can be deleted. */
if (GET_CODE (insn) == CODE_LABEL)
{
/* Some labels can't be directly removed from the INSN chain, as they
- might be references via variables, constant pool etc.
+ might be references via variables, constant pool etc.
Convert them to the special NOTE_INSN_DELETED_LABEL note. */
if (! can_delete_label_p (insn))
{
bb->head = head;
bb->end = end;
- bb->sindex = index;
+ bb->index = index;
bb->flags = BB_NEW;
link_block (bb, after);
BASIC_BLOCK (index) = bb;
basic_block bb;
int index = last_basic_block++;
- /* Place the new block to the end. */
+ /* Place the new block just after the end. */
VARRAY_GROW (basic_block_info, last_basic_block);
- num_basic_blocks++;
+ n_basic_blocks++;
+
bb = create_basic_block_structure (index, head, end, NULL, after);
bb->aux = NULL;
return bb;
NOTE_INSN_EH_REGION_END notes. */
/* Get rid of all NOTE_INSN_PREDICTIONs hanging before the block. */
-
+
for (insn = PREV_INSN (b->head); insn; insn = PREV_INSN (insn))
{
if (GET_CODE (insn) != NOTE)
- break;
+ break;
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
- NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
}
insn = b->head;
basic_block b;
{
int deleted_handler = flow_delete_block_noexpunge (b);
-
+
/* Remove the basic block from the array. */
expunge_block (b);
VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
- FOR_ALL_BB (bb)
+ FOR_EACH_BB (bb)
{
rtx end = bb->end;
rtx insn;
return false;
if (rtl_dump_file)
fprintf (rtl_dump_file, "Redirecting jump %i from %i to %i.\n",
- INSN_UID (insn), e->dest->sindex, target->sindex);
+ INSN_UID (insn), e->dest->index, target->index);
if (!redirect_jump (insn, block_label (target), 0))
{
if (target == EXIT_BLOCK_PTR)
if (rtl_dump_file)
fprintf (rtl_dump_file, "Edge %i->%i redirected to %i\n",
- e->src->sindex, e->dest->sindex, target->sindex);
+ e->src->index, e->dest->index, target->index);
if (e->dest != target)
redirect_edge_succ_nodup (e, target);
{
/* Create the new structures. */
note = last_loop_beg_note (e->src->end);
- jump_block = create_basic_block (NEXT_INSN (note), NULL, e->src);
+ jump_block
+ = create_basic_block (NEXT_INSN (note), NULL, e->src);
jump_block->count = e->count;
jump_block->frequency = EDGE_FREQUENCY (e);
jump_block->loop_depth = target->loop_depth;
{
basic_block b, c;
- for (b = ENTRY_BLOCK_PTR->next_bb, c = b->next_bb;
- c && c != EXIT_BLOCK_PTR; b = c, c = c->next_bb)
+ if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
+ return;
+
+ FOR_BB_BETWEEN (b, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, next_bb)
{
edge s;
+ c = b->next_bb;
+
/* We care about simple conditional or unconditional jumps with
a single successor.
if (bb1 == bb2)
return true;
+ /* ??? Could we guarantee that bb indices are monotone, so that we could
+ just compare them? */
for (bb = bb1; bb && bb != bb2; bb = bb->next_bb)
- {
- }
-
+ continue;
+
if (!bb)
return false;
/* The first insn after the call may be a stack pop, skip it. */
while (next
&& keep_with_call_p (next))
- {
- after = next;
+ {
+ after = next;
next = next_nonnote_insn (next);
}
bb = e->dest;
e->flags &= ~EDGE_FALLTHRU;
emit_barrier_after (last);
-
+
if (before)
delete_insn (before);
}
void
commit_edge_insertions ()
{
- int i;
basic_block bb;
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
- i = -1;
-
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
{
edge e, next;
void
commit_edge_insertions_watch_calls ()
{
- int i;
basic_block bb;
#ifdef ENABLE_CHECKING
verify_flow_info ();
#endif
- i = -1;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
{
edge e, next;
edge e;
fprintf (outf, ";; Basic block %d, loop depth %d, count ",
- bb->sindex, bb->loop_depth);
+ bb->index, bb->loop_depth);
fprintf (outf, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) bb->count);
putc ('\n', outf);
= (basic_block *) xcalloc (max_uid, sizeof (basic_block));
enum bb_state *in_bb_p
= (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state));
+
basic_block bb;
- FOR_ALL_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE (bb)
{
rtx x;
if ((bb = start[INSN_UID (tmp_rtx)]) != NULL)
{
fprintf (outf, ";; Start of basic block %d, registers live:",
- bb->sindex);
+ bb->index);
dump_regset (bb->global_live_at_start, outf);
putc ('\n', outf);
}
if ((bb = end[INSN_UID (tmp_rtx)]) != NULL)
{
fprintf (outf, ";; End of basic block %d, registers live:\n",
- bb->sindex);
+ bb->index);
dump_regset (bb->global_live_at_end, outf);
putc ('\n', outf);
}
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
{
if (bb != EXIT_BLOCK_PTR
- && bb != BASIC_BLOCK (bb->sindex))
+ && bb != BASIC_BLOCK (bb->index))
{
- error ("bb %d on wrong place", bb->sindex);
+ error ("bb %d on wrong place", bb->index);
err = 1;
}
if (bb->prev_bb != last_bb_seen)
{
error ("prev_bb of %d should be %d, not %d",
- bb->sindex, last_bb_seen->sindex, bb->prev_bb->sindex);
+ bb->index, last_bb_seen->index, bb->prev_bb->index);
err = 1;
}
-
+
last_bb_seen = bb;
}
- FOR_ALL_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE (bb)
{
rtx head = bb->head;
rtx end = bb->end;
if (!x)
{
error ("end insn %d for block %d not found in the insn stream",
- INSN_UID (end), bb->sindex);
+ INSN_UID (end), bb->index);
err = 1;
}
if (bb_info[INSN_UID (x)] != NULL)
{
error ("insn %d is in multiple basic blocks (%d and %d)",
- INSN_UID (x), bb->sindex, bb_info[INSN_UID (x)]->sindex);
+ INSN_UID (x), bb->index, bb_info[INSN_UID (x)]->index);
err = 1;
}
if (!x)
{
error ("head insn %d for block %d not found in the insn stream",
- INSN_UID (head), bb->sindex);
+ INSN_UID (head), bb->index);
err = 1;
}
}
/* Now check the basic blocks (boundaries etc.) */
- FOR_ALL_BB_REVERSE (bb)
+ FOR_EACH_BB_REVERSE (bb)
{
int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
edge e;
}
}
if (bb->count < 0)
- {
- error ("verify_flow_info: Wrong count of block %i %i",
- bb->sindex, (int)bb->count);
- err = 1;
- }
+ {
+ error ("verify_flow_info: Wrong count of block %i %i",
+ bb->index, (int)bb->count);
+ err = 1;
+ }
if (bb->frequency < 0)
- {
- error ("verify_flow_info: Wrong frequency of block %i %i",
- bb->sindex, bb->frequency);
- err = 1;
- }
+ {
+ error ("verify_flow_info: Wrong frequency of block %i %i",
+ bb->index, bb->frequency);
+ err = 1;
+ }
for (e = bb->succ; e; e = e->succ_next)
{
- if (last_visited [e->dest->sindex + 2] == bb)
+ if (last_visited [e->dest->index + 2] == bb)
{
error ("verify_flow_info: Duplicate edge %i->%i",
- e->src->sindex, e->dest->sindex);
+ e->src->index, e->dest->index);
err = 1;
}
if (e->probability < 0 || e->probability > REG_BR_PROB_BASE)
{
error ("verify_flow_info: Wrong probability of edge %i->%i %i",
- e->src->sindex, e->dest->sindex, e->probability);
+ e->src->index, e->dest->index, e->probability);
err = 1;
}
if (e->count < 0)
{
error ("verify_flow_info: Wrong count of edge %i->%i %i",
- e->src->sindex, e->dest->sindex, (int)e->count);
+ e->src->index, e->dest->index, (int)e->count);
err = 1;
}
- last_visited [e->dest->sindex + 2] = bb;
+ last_visited [e->dest->index + 2] = bb;
if (e->flags & EDGE_FALLTHRU)
n_fallthru++;
{
error
("verify_flow_info: Incorrect blocks for fallthru %i->%i",
- e->src->sindex, e->dest->sindex);
+ e->src->index, e->dest->index);
err = 1;
}
else
)
{
error ("verify_flow_info: Incorrect fallthru %i->%i",
- e->src->sindex, e->dest->sindex);
+ e->src->index, e->dest->index);
fatal_insn ("wrong insn in the fallthru edge", insn);
err = 1;
}
if (e->src != bb)
{
error ("verify_flow_info: Basic block %d succ edge is corrupted",
- bb->sindex);
+ bb->index);
fprintf (stderr, "Predecessor: ");
dump_edge_info (stderr, e, 0);
fprintf (stderr, "\nSuccessor: ");
err = 1;
}
- edge_checksum[e->dest->sindex + 2] += (size_t) e;
+ edge_checksum[e->dest->index + 2] += (size_t) e;
}
if (n_eh && GET_CODE (PATTERN (bb->end)) != RESX
&& !find_reg_note (bb->end, REG_EH_REGION, NULL_RTX))
{
- error ("Missing REG_EH_REGION note in the end of bb %i", bb->sindex);
+ error ("Missing REG_EH_REGION note in the end of bb %i", bb->index);
err = 1;
}
if (n_branch
|| (n_branch > 1 && (any_uncondjump_p (bb->end)
|| any_condjump_p (bb->end)))))
{
- error ("Too many outgoing branch edges from bb %i", bb->sindex);
+ error ("Too many outgoing branch edges from bb %i", bb->index);
err = 1;
}
if (n_fallthru && any_uncondjump_p (bb->end))
{
- error ("Fallthru edge after unconditional jump %i", bb->sindex);
+ error ("Fallthru edge after unconditional jump %i", bb->index);
err = 1;
}
if (n_branch != 1 && any_uncondjump_p (bb->end))
{
- error ("Wrong amount of branch edges after unconditional jump %i", bb->sindex);
+ error ("Wrong amount of branch edges after unconditional jump %i", bb->index);
err = 1;
}
if (n_branch != 1 && any_condjump_p (bb->end)
&& JUMP_LABEL (bb->end) != bb->next_bb->head)
{
- error ("Wrong amount of branch edges after conditional jump %i", bb->sindex);
+ error ("Wrong amount of branch edges after conditional jump %i", bb->index);
err = 1;
}
if (n_call && GET_CODE (bb->end) != CALL_INSN)
{
- error ("Call edges for non-call insn in bb %i", bb->sindex);
+ error ("Call edges for non-call insn in bb %i", bb->index);
err = 1;
}
if (n_abnormal
|| any_condjump_p (bb->end)
|| any_uncondjump_p (bb->end)))
{
- error ("Abnormal edges for no purpose in bb %i", bb->sindex);
+ error ("Abnormal edges for no purpose in bb %i", bb->index);
err = 1;
}
-
+
if (!n_fallthru)
{
rtx insn;
|| (GET_CODE (insn) == NOTE
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK))
{
- error ("missing barrier after block %i", bb->sindex);
+ error ("missing barrier after block %i", bb->index);
err = 1;
break;
}
{
if (e->dest != bb)
{
- error ("basic block %d pred edge is corrupted", bb->sindex);
+ error ("basic block %d pred edge is corrupted", bb->index);
fputs ("Predecessor: ", stderr);
dump_edge_info (stderr, e, 0);
fputs ("\nSuccessor: ", stderr);
fputc ('\n', stderr);
err = 1;
}
- edge_checksum[e->dest->sindex + 2] -= (size_t) e;
+ edge_checksum[e->dest->index + 2] -= (size_t) e;
}
for (x = bb->head; x != NEXT_INSN (bb->end); x = NEXT_INSN (x))
if (! BLOCK_FOR_INSN (x))
error
("insn %d inside basic block %d but block_for_insn is NULL",
- INSN_UID (x), bb->sindex);
+ INSN_UID (x), bb->index);
else
error
("insn %d inside basic block %d but block_for_insn is %i",
- INSN_UID (x), bb->sindex, BLOCK_FOR_INSN (x)->sindex);
+ INSN_UID (x), bb->index, BLOCK_FOR_INSN (x)->index);
err = 1;
}
if (bb->end == x)
{
error ("NOTE_INSN_BASIC_BLOCK is missing for block %d",
- bb->sindex);
+ bb->index);
err = 1;
}
if (!NOTE_INSN_BASIC_BLOCK_P (x) || NOTE_BASIC_BLOCK (x) != bb)
{
error ("NOTE_INSN_BASIC_BLOCK is missing for block %d",
- bb->sindex);
+ bb->index);
err = 1;
}
if (NOTE_INSN_BASIC_BLOCK_P (x))
{
error ("NOTE_INSN_BASIC_BLOCK %d in middle of basic block %d",
- INSN_UID (x), bb->sindex);
+ INSN_UID (x), bb->index);
err = 1;
}
|| GET_CODE (x) == CODE_LABEL
|| GET_CODE (x) == BARRIER)
{
- error ("in basic block %d:", bb->sindex);
+ error ("in basic block %d:", bb->index);
fatal_insn ("flow control insn inside a basic block", x);
}
}
edge e;
for (e = ENTRY_BLOCK_PTR->succ; e ; e = e->succ_next)
- edge_checksum[e->dest->sindex + 2] += (size_t) e;
+ edge_checksum[e->dest->index + 2] += (size_t) e;
for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
- edge_checksum[e->dest->sindex + 2] -= (size_t) e;
+ edge_checksum[e->dest->index + 2] -= (size_t) e;
}
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
- if (edge_checksum[bb->sindex + 2])
+ if (edge_checksum[bb->index + 2])
{
- error ("basic block %i edge lists are corrupted", bb->sindex);
+ error ("basic block %i edge lists are corrupted", bb->index);
err = 1;
}
fatal_insn ("return not followed by barrier", x);
}
- if (num_bb_notes != num_basic_blocks)
+ if (num_bb_notes != n_basic_blocks)
internal_error
- ("number of bb notes in insn chain (%d) != num_basic_blocks (%d)",
- num_bb_notes, num_basic_blocks);
+ ("number of bb notes in insn chain (%d) != n_basic_blocks (%d)",
+ num_bb_notes, n_basic_blocks);
if (err)
internal_error ("verify_flow_info failed");
/* Avoid abnormal flags to leak from computed jumps turned
into simplejumps. */
-
+
e->flags &= ~EDGE_ABNORMAL;
/* See if this edge is one we should keep. */
return purged;
if (rtl_dump_file)
- fprintf (rtl_dump_file, "Purged edges from bb %i\n", bb->sindex);
+ fprintf (rtl_dump_file, "Purged edges from bb %i\n", bb->index);
if (!optimize)
return purged;
{
bb->succ->probability = REG_BR_PROB_BASE;
bb->succ->count = bb->count;
- }
+ }
else
{
note = find_reg_note (insn, REG_BR_PROB, NULL);
if (rtl_dump_file)
fprintf (rtl_dump_file, "Purged non-fallthru edges from bb %i\n",
- bb->sindex);
+ bb->index);
return purged;
}
sbitmap_zero (blocks);
}
- FOR_ALL_BB (bb)
+ FOR_EACH_BB (bb)
{
bool purged_here = purge_dead_edges (bb);
purged |= purged_here;
if (purged_here && update_life_p)
- SET_BIT (blocks, bb->sindex);
+ SET_BIT (blocks, bb->index);
}
if (update_life_p && purged)