redirect_edge_and_branch_force, tidy_fallthru_edge, force_nonfallthru
- Edge splitting and commiting to edges
split_edge, insert_insn_on_edge, commit_edge_insertions
- - Dumpipng and debugging
+ - Dumping and debugging
print_rtl_with_bb, dump_bb, debug_bb, debug_bb_n
- Consistency checking
verify_flow_info
}
/* Create new basic block consisting of instructions in between HEAD and
- END and place it to the BB chain at possition INDEX.
+ END and place it to the BB chain at position INDEX.
END can be NULL in to create new empty basic block before HEAD.
Both END and HEAD can be NULL to create basic block at the end of
INSN chain. */
fprintf (rtl_dump_file, "Removing jump %i.\n", INSN_UID (insn));
fallthru = 1;
- /* Selectivly unlink whole insn chain. */
+ /* Selectively unlink whole insn chain. */
delete_insn_chain (kill_from, PREV_INSN (target->head));
}
/* If this already is simplejump, redirect it. */
rtx target_label = block_label (target);
rtx barrier;
- emit_jump_insn_after (gen_jump (target_label), kill_from);
+ emit_jump_insn_after (gen_jump (target_label), insn);
JUMP_LABEL (src->end) = target_label;
LABEL_NUSES (target_label)++;
if (rtl_dump_file)
/* Return last loop_beg note appearing after INSN, before start of next
basic block. Return INSN if there are no such notes.
- When emmiting jump to redirect an fallthru edge, it should always
+ When emitting jump to redirect an fallthru edge, it should always
appear after the LOOP_BEG notes, as loop optimizer expect loop to
- eighter start by fallthru edge or jump following the LOOP_BEG note
+ either start by fallthru edge or jump following the LOOP_BEG note
jumping to the loop exit test. */
static rtx
Don't do that on expense of adding new instructions or reordering
basic blocks.
- Function can be also called with edge destionation equivalent to the
+ Function can be also called with edge destination equivalent to the
TARGET. Then it should try the simplifications and do nothing if
none is possible.
- Return true if transformation suceeded. We still return flase in case
+ Return true if transformation succeeded. We still return false in case
E already destinated TARGET and we didn't managed to simplify instruction
stream. */
/* Redirect edge even at the expense of creating new jump insn or
basic block. Return new basic block if created, NULL otherwise.
- Abort if converison is impossible. */
+ Abort if conversion is impossible. */
basic_block
redirect_edge_and_branch_force (e, target)
abort ();
/* We are going to place the new block in front of edge destination.
- Avoid existence of fallthru predecesors. */
+ Avoid existence of fallthru predecessors. */
if ((edge_in->flags & EDGE_FALLTHRU) == 0)
{
edge e;
}
if (!has_fallthru)
{
- rtx insn = bb->end;
+ rtx insn;
/* Ensure existence of barrier in BB with no fallthru edges. */
- for (insn = bb->end; GET_CODE (insn) != BARRIER;
+ for (insn = bb->end; !insn || GET_CODE (insn) != BARRIER;
insn = NEXT_INSN (insn))
if (!insn
|| (GET_CODE (insn) == NOTE
{
error ("Missing barrier after block %i", bb->index);
err = 1;
+ break;
}
}
free (edge_checksum);
}
\f
-/* Assume that the preceeding pass has possibly eliminated jump instructions
+/* Assume that the preceding pass has possibly eliminated jump instructions
or converted the unconditional jumps. Eliminate the edges from CFG.
Return true if any edges are eliminated. */
basic_block bb;
{
edge e, next;
- rtx insn = bb->end;
+ rtx insn = bb->end, note;
bool purged = false;
if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn))
{
next = e->succ_next;
+ /* Avoid abnormal flags to leak from computed jumps turned
+ into simplejumps. */
+
+ e->flags &= EDGE_ABNORMAL;
+
/* Check purposes we can have edge. */
if ((e->flags & EDGE_FALLTHRU)
&& any_condjump_p (insn))
return purged;
}
+ /* If this instruction cannot trap, remove REG_EH_REGION notes. */
+ if (GET_CODE (insn) == INSN
+ && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
+ {
+ rtx eqnote;
+ if (! may_trap_p (PATTERN (insn))
+ || ((eqnote = find_reg_equal_equiv_note (insn))
+ && ! may_trap_p (XEXP (eqnote, 0))))
+ remove_note (insn, note);
+ }
+
/* Cleanup abnormal edges caused by throwing insns that have been
eliminated. */
if (! can_throw_internal (bb->end))
return purged;
}
-/* Search all basic blocks for potentionally dead edges and purge them.
+/* Search all basic blocks for potentially dead edges and purge them.
- Return true ifif some edge has been elliminated.
+ Return true iff some edge has been eliminated.
*/
bool
-purge_all_dead_edges ()
+purge_all_dead_edges (update_life_p)
+ int update_life_p;
{
int i, purged = false;
+ sbitmap blocks;
+
+ if (update_life_p)
+ {
+ blocks = sbitmap_alloc (n_basic_blocks);
+ sbitmap_zero (blocks);
+ }
for (i = 0; i < n_basic_blocks; i++)
- purged |= purge_dead_edges (BASIC_BLOCK (i));
+ {
+ bool purged_here;
+ purged_here = purge_dead_edges (BASIC_BLOCK (i));
+ purged |= purged_here;
+ if (purged_here && update_life_p)
+ SET_BIT (blocks, i);
+ }
+ if (update_life_p && purged)
+ update_life_info (blocks, UPDATE_LIFE_GLOBAL,
+ PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
+ | PROP_KILL_DEAD_CODE);
+ if (update_life_p)
+ sbitmap_free (blocks);
return purged;
}