regrename.c (copyprop_hardreg_forward_1): New variable next.
2007-09-05 Laurynas Biveinis <laurynas.biveinis@gmail.com> * regrename.c (copyprop_hardreg_forward_1): New variable next. Use FOR_BB_INSNS_SAFE instead of for loop. * cse.c (cse_extended_basic_block): Likewise. * postreload.c (reload_cse_regs_1): New variable next. Make sure that the for loop does not invoke NEXT_INSN on a deleted insn. * function.c (instantiate_virtual_regs): Likewise. * lower-subreg.c (remove_retval_note): Likewise. (decompose_multiword_subregs): Use FOR_BB_INSNS_SAFE instead of FOR_BB_INSNS. * emit-rtl.c (remove_insn): Set NEXT_INSN and PREV_INSN to NULL on a deleted insn. * cfgrtl.c (delete_insn): Set JUMP_LABEL to NULL on a deleted insn, if it's a jump. (try_redirect_by_replacing_jump): New variable jump_p. Call tablejump_p before delete_insn_chain. * reload1.c (reload): New variable next. Make sure that the for loop does not invoke NEXT_INSN on a deleted insn. (fixup_eh_region_note): Make the loop terminate if i becomes NULL. (delete_output_reload): New variable prev. Make sure the the for loops do not invoke PREV_INSN on a deleted insn. From-SVN: r128224
This commit is contained in:
parent
917948d364
commit
62a4a967a9
|
@ -1,3 +1,26 @@
|
||||||
|
2007-09-05 Laurynas Biveinis <laurynas.biveinis@gmail.com>
|
||||||
|
|
||||||
|
* regrename.c (copyprop_hardreg_forward_1): New variable next. Use
|
||||||
|
FOR_BB_INSNS_SAFE instead of for loop.
|
||||||
|
* cse.c (cse_extended_basic_block): Likewise.
|
||||||
|
* postreload.c (reload_cse_regs_1): New variable next. Make sure
|
||||||
|
that the for loop does not invoke NEXT_INSN on a deleted insn.
|
||||||
|
* function.c (instantiate_virtual_regs): Likewise.
|
||||||
|
* lower-subreg.c (remove_retval_note): Likewise.
|
||||||
|
(decompose_multiword_subregs): Use FOR_BB_INSNS_SAFE instead of
|
||||||
|
FOR_BB_INSNS.
|
||||||
|
* emit-rtl.c (remove_insn): Set NEXT_INSN and PREV_INSN to NULL on
|
||||||
|
a deleted insn.
|
||||||
|
* cfgrtl.c (delete_insn): Set JUMP_LABEL to NULL on a deleted
|
||||||
|
insn, if it's a jump.
|
||||||
|
(try_redirect_by_replacing_jump): New variable jump_p. Call
|
||||||
|
tablejump_p before delete_insn_chain.
|
||||||
|
* reload1.c (reload): New variable next. Make sure that the for
|
||||||
|
loop does not invoke NEXT_INSN on a deleted insn.
|
||||||
|
(fixup_eh_region_note): Make the loop terminate if i becomes NULL.
|
||||||
|
(delete_output_reload): New variable prev. Make sure the the for
|
||||||
|
loops do not invoke PREV_INSN on a deleted insn.
|
||||||
|
|
||||||
2007-09-06 Zdenek Dvorak <ook@ucw.cz>
|
2007-09-06 Zdenek Dvorak <ook@ucw.cz>
|
||||||
|
|
||||||
* cgraphbuild.c (rebuild_cgraph_edges): Export.
|
* cgraphbuild.c (rebuild_cgraph_edges): Export.
|
||||||
|
|
11
gcc/cfgrtl.c
11
gcc/cfgrtl.c
|
@ -141,7 +141,10 @@ delete_insn (rtx insn)
|
||||||
if (JUMP_P (insn)
|
if (JUMP_P (insn)
|
||||||
&& JUMP_LABEL (insn)
|
&& JUMP_LABEL (insn)
|
||||||
&& LABEL_P (JUMP_LABEL (insn)))
|
&& LABEL_P (JUMP_LABEL (insn)))
|
||||||
|
{
|
||||||
LABEL_NUSES (JUMP_LABEL (insn))--;
|
LABEL_NUSES (JUMP_LABEL (insn))--;
|
||||||
|
JUMP_LABEL (insn) = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Also if deleting an insn that references a label. */
|
/* Also if deleting an insn that references a label. */
|
||||||
else
|
else
|
||||||
|
@ -790,6 +793,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
|
||||||
{
|
{
|
||||||
rtx target_label = block_label (target);
|
rtx target_label = block_label (target);
|
||||||
rtx barrier, label, table;
|
rtx barrier, label, table;
|
||||||
|
bool jump_p;
|
||||||
|
|
||||||
emit_jump_insn_after_noloc (gen_jump (target_label), insn);
|
emit_jump_insn_after_noloc (gen_jump (target_label), insn);
|
||||||
JUMP_LABEL (BB_END (src)) = target_label;
|
JUMP_LABEL (BB_END (src)) = target_label;
|
||||||
|
@ -799,12 +803,13 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
|
||||||
INSN_UID (insn), INSN_UID (BB_END (src)));
|
INSN_UID (insn), INSN_UID (BB_END (src)));
|
||||||
|
|
||||||
|
|
||||||
delete_insn_chain (kill_from, insn, false);
|
|
||||||
|
|
||||||
/* Recognize a tablejump that we are converting to a
|
/* Recognize a tablejump that we are converting to a
|
||||||
simple jump and remove its associated CODE_LABEL
|
simple jump and remove its associated CODE_LABEL
|
||||||
and ADDR_VEC or ADDR_DIFF_VEC. */
|
and ADDR_VEC or ADDR_DIFF_VEC. */
|
||||||
if (tablejump_p (insn, &label, &table))
|
jump_p = tablejump_p (insn, &label, &table);
|
||||||
|
|
||||||
|
delete_insn_chain (kill_from, insn, false);
|
||||||
|
if (jump_p)
|
||||||
delete_insn_chain (label, table, false);
|
delete_insn_chain (label, table, false);
|
||||||
|
|
||||||
barrier = next_nonnote_insn (BB_END (src));
|
barrier = next_nonnote_insn (BB_END (src));
|
||||||
|
|
|
@ -6018,12 +6018,12 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
|
||||||
for (path_entry = 0; path_entry < path_size; path_entry++)
|
for (path_entry = 0; path_entry < path_size; path_entry++)
|
||||||
{
|
{
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
rtx libcall_insn = NULL_RTX;
|
rtx libcall_insn = NULL_RTX;
|
||||||
int no_conflict = 0;
|
int no_conflict = 0;
|
||||||
|
|
||||||
bb = ebb_data->path[path_entry].bb;
|
bb = ebb_data->path[path_entry].bb;
|
||||||
FOR_BB_INSNS (bb, insn)
|
FOR_BB_INSNS_SAFE (bb, insn, next)
|
||||||
{
|
{
|
||||||
/* If we have processed 1,000 insns, flush the hash table to
|
/* If we have processed 1,000 insns, flush the hash table to
|
||||||
avoid extreme quadratic behavior. We must not include NOTEs
|
avoid extreme quadratic behavior. We must not include NOTEs
|
||||||
|
|
|
@ -3688,6 +3688,8 @@ remove_insn (rtx insn)
|
||||||
if (BB_END (bb) == insn)
|
if (BB_END (bb) == insn)
|
||||||
BB_END (bb) = prev;
|
BB_END (bb) = prev;
|
||||||
}
|
}
|
||||||
|
NEXT_INSN (insn) = NULL;
|
||||||
|
PREV_INSN (insn) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append CALL_FUSAGE to the CALL_INSN_FUNCTION_USAGE for CALL_INSN. */
|
/* Append CALL_FUSAGE to the CALL_INSN_FUNCTION_USAGE for CALL_INSN. */
|
||||||
|
|
|
@ -1666,7 +1666,7 @@ instantiate_decls (tree fndecl)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
instantiate_virtual_regs (void)
|
instantiate_virtual_regs (void)
|
||||||
{
|
{
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
|
|
||||||
/* Compute the offsets to use for this function. */
|
/* Compute the offsets to use for this function. */
|
||||||
in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
|
in_arg_offset = FIRST_PARM_OFFSET (current_function_decl);
|
||||||
|
@ -1684,7 +1684,9 @@ instantiate_virtual_regs (void)
|
||||||
|
|
||||||
/* Scan through all the insns, instantiating every virtual register still
|
/* Scan through all the insns, instantiating every virtual register still
|
||||||
present. */
|
present. */
|
||||||
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
|
for (insn = get_insns (); insn; insn = next)
|
||||||
|
{
|
||||||
|
next = NEXT_INSN (insn);
|
||||||
if (INSN_P (insn))
|
if (INSN_P (insn))
|
||||||
{
|
{
|
||||||
/* These patterns in the instruction stream can never be recognized.
|
/* These patterns in the instruction stream can never be recognized.
|
||||||
|
@ -1701,13 +1703,15 @@ instantiate_virtual_regs (void)
|
||||||
if (INSN_DELETED_P (insn))
|
if (INSN_DELETED_P (insn))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx, NULL);
|
for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx,
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */
|
/* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */
|
||||||
if (GET_CODE (insn) == CALL_INSN)
|
if (GET_CODE (insn) == CALL_INSN)
|
||||||
for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn),
|
for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn),
|
||||||
instantiate_virtual_regs_in_rtx, NULL);
|
instantiate_virtual_regs_in_rtx, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Instantiate the virtual registers in the DECLs for debugging purposes. */
|
/* Instantiate the virtual registers in the DECLs for debugging purposes. */
|
||||||
instantiate_decls (current_function_decl);
|
instantiate_decls (current_function_decl);
|
||||||
|
|
|
@ -586,7 +586,7 @@ move_libcall_note (rtx old_start, rtx new_start)
|
||||||
static void
|
static void
|
||||||
remove_retval_note (rtx insn1)
|
remove_retval_note (rtx insn1)
|
||||||
{
|
{
|
||||||
rtx note0, insn0, note1, insn;
|
rtx note0, insn0, note1, insn, next;
|
||||||
|
|
||||||
note1 = find_reg_note (insn1, REG_RETVAL, NULL);
|
note1 = find_reg_note (insn1, REG_RETVAL, NULL);
|
||||||
if (note1 == NULL_RTX)
|
if (note1 == NULL_RTX)
|
||||||
|
@ -598,8 +598,9 @@ remove_retval_note (rtx insn1)
|
||||||
remove_note (insn0, note0);
|
remove_note (insn0, note0);
|
||||||
remove_note (insn1, note1);
|
remove_note (insn1, note1);
|
||||||
|
|
||||||
for (insn = insn0; insn != insn1; insn = NEXT_INSN (insn))
|
for (insn = insn0; (insn != insn1) && insn; insn = next)
|
||||||
{
|
{
|
||||||
|
next = NEXT_INSN (insn);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
rtx note;
|
rtx note;
|
||||||
|
@ -1254,9 +1255,9 @@ decompose_multiword_subregs (void)
|
||||||
|
|
||||||
FOR_EACH_BB (bb)
|
FOR_EACH_BB (bb)
|
||||||
{
|
{
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
|
|
||||||
FOR_BB_INSNS (bb, insn)
|
FOR_BB_INSNS_SAFE (bb, insn, next)
|
||||||
{
|
{
|
||||||
rtx next, pat;
|
rtx next, pat;
|
||||||
|
|
||||||
|
|
|
@ -195,14 +195,15 @@ reload_cse_simplify (rtx insn, rtx testreg)
|
||||||
static void
|
static void
|
||||||
reload_cse_regs_1 (rtx first)
|
reload_cse_regs_1 (rtx first)
|
||||||
{
|
{
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
rtx testreg = gen_rtx_REG (VOIDmode, -1);
|
rtx testreg = gen_rtx_REG (VOIDmode, -1);
|
||||||
|
|
||||||
cselib_init (true);
|
cselib_init (true);
|
||||||
init_alias_analysis ();
|
init_alias_analysis ();
|
||||||
|
|
||||||
for (insn = first; insn; insn = NEXT_INSN (insn))
|
for (insn = first; insn; insn = next)
|
||||||
{
|
{
|
||||||
|
next = NEXT_INSN (insn);
|
||||||
if (INSN_P (insn))
|
if (INSN_P (insn))
|
||||||
reload_cse_simplify (insn, testreg);
|
reload_cse_simplify (insn, testreg);
|
||||||
|
|
||||||
|
|
|
@ -1567,9 +1567,9 @@ static bool
|
||||||
copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
|
copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
|
|
||||||
for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
|
FOR_BB_INSNS_SAFE (bb, insn, next)
|
||||||
{
|
{
|
||||||
int n_ops, i, alt, predicated;
|
int n_ops, i, alt, predicated;
|
||||||
bool is_asm, any_replacements;
|
bool is_asm, any_replacements;
|
||||||
|
|
|
@ -702,7 +702,7 @@ int
|
||||||
reload (rtx first, int global)
|
reload (rtx first, int global)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
rtx insn;
|
rtx insn, next;
|
||||||
struct elim_table *ep;
|
struct elim_table *ep;
|
||||||
basic_block bb;
|
basic_block bb;
|
||||||
|
|
||||||
|
@ -1225,7 +1225,9 @@ reload (rtx first, int global)
|
||||||
are no longer useful or accurate. Strip and regenerate REG_INC notes
|
are no longer useful or accurate. Strip and regenerate REG_INC notes
|
||||||
that may have been moved around. */
|
that may have been moved around. */
|
||||||
|
|
||||||
for (insn = first; insn; insn = NEXT_INSN (insn))
|
for (insn = first; insn; insn = next)
|
||||||
|
{
|
||||||
|
next = NEXT_INSN (insn);
|
||||||
if (INSN_P (insn))
|
if (INSN_P (insn))
|
||||||
{
|
{
|
||||||
rtx *pnote;
|
rtx *pnote;
|
||||||
|
@ -1241,7 +1243,8 @@ reload (rtx first, int global)
|
||||||
|| (GET_CODE (PATTERN (insn)) == CLOBBER
|
|| (GET_CODE (PATTERN (insn)) == CLOBBER
|
||||||
&& (!MEM_P (XEXP (PATTERN (insn), 0))
|
&& (!MEM_P (XEXP (PATTERN (insn), 0))
|
||||||
|| GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode
|
|| GET_MODE (XEXP (PATTERN (insn), 0)) != BLKmode
|
||||||
|| (GET_CODE (XEXP (XEXP (PATTERN (insn), 0), 0)) != SCRATCH
|
|| (GET_CODE (XEXP (XEXP (PATTERN (insn), 0), 0))
|
||||||
|
!= SCRATCH
|
||||||
&& XEXP (XEXP (PATTERN (insn), 0), 0)
|
&& XEXP (XEXP (PATTERN (insn), 0), 0)
|
||||||
!= stack_pointer_rtx))
|
!= stack_pointer_rtx))
|
||||||
&& (!REG_P (XEXP (PATTERN (insn), 0))
|
&& (!REG_P (XEXP (PATTERN (insn), 0))
|
||||||
|
@ -1251,9 +1254,9 @@ reload (rtx first, int global)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some CLOBBERs may survive until here and still reference unassigned
|
/* Some CLOBBERs may survive until here and still reference
|
||||||
pseudos with const equivalent, which may in turn cause ICE in later
|
unassigned pseudos with const equivalent, which may in turn cause
|
||||||
passes if the reference remains in place. */
|
ICE in later passes if the reference remains in place. */
|
||||||
if (GET_CODE (PATTERN (insn)) == CLOBBER)
|
if (GET_CODE (PATTERN (insn)) == CLOBBER)
|
||||||
replace_pseudos_in (& XEXP (PATTERN (insn), 0),
|
replace_pseudos_in (& XEXP (PATTERN (insn), 0),
|
||||||
VOIDmode, PATTERN (insn));
|
VOIDmode, PATTERN (insn));
|
||||||
|
@ -1306,6 +1309,7 @@ reload (rtx first, int global)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If we are doing stack checking, give a warning if this function's
|
/* If we are doing stack checking, give a warning if this function's
|
||||||
frame size is larger than we expect. */
|
frame size is larger than we expect. */
|
||||||
|
@ -4014,7 +4018,7 @@ fixup_eh_region_note (rtx insn, rtx prev, rtx next)
|
||||||
trap_count = 0;
|
trap_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = NEXT_INSN (prev); i != next; i = NEXT_INSN (i))
|
for (i = NEXT_INSN (prev); i && (i != next); i = NEXT_INSN (i))
|
||||||
if (INSN_P (i) && i != insn && may_trap_p (PATTERN (i)))
|
if (INSN_P (i) && i != insn && may_trap_p (PATTERN (i)))
|
||||||
{
|
{
|
||||||
trap_count++;
|
trap_count++;
|
||||||
|
@ -8186,15 +8190,18 @@ delete_output_reload (rtx insn, int j, int last_reload_reg)
|
||||||
&& REG_BASIC_BLOCK (REGNO (reg)) >= NUM_FIXED_BLOCKS
|
&& REG_BASIC_BLOCK (REGNO (reg)) >= NUM_FIXED_BLOCKS
|
||||||
&& find_regno_note (insn, REG_DEAD, REGNO (reg)))
|
&& find_regno_note (insn, REG_DEAD, REGNO (reg)))
|
||||||
{
|
{
|
||||||
rtx i2;
|
rtx i2, prev;
|
||||||
|
|
||||||
/* We know that it was used only between here and the beginning of
|
/* We know that it was used only between here and the beginning of
|
||||||
the current basic block. (We also know that the last use before
|
the current basic block. (We also know that the last use before
|
||||||
INSN was the output reload we are thinking of deleting, but never
|
INSN was the output reload we are thinking of deleting, but never
|
||||||
mind that.) Search that range; see if any ref remains. */
|
mind that.) Search that range; see if any ref remains. */
|
||||||
for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
|
for (i2 = PREV_INSN (insn); i2; i2 = prev)
|
||||||
{
|
{
|
||||||
rtx set = single_set (i2);
|
rtx set;
|
||||||
|
|
||||||
|
prev = PREV_INSN (i2);
|
||||||
|
set = single_set (i2);
|
||||||
|
|
||||||
/* Uses which just store in the pseudo don't count,
|
/* Uses which just store in the pseudo don't count,
|
||||||
since if they are the only uses, they are dead. */
|
since if they are the only uses, they are dead. */
|
||||||
|
@ -8216,9 +8223,11 @@ delete_output_reload (rtx insn, int j, int last_reload_reg)
|
||||||
|
|
||||||
/* Delete the now-dead stores into this pseudo. Note that this
|
/* Delete the now-dead stores into this pseudo. Note that this
|
||||||
loop also takes care of deleting output_reload_insn. */
|
loop also takes care of deleting output_reload_insn. */
|
||||||
for (i2 = PREV_INSN (insn); i2; i2 = PREV_INSN (i2))
|
for (i2 = PREV_INSN (insn); i2; i2 = prev)
|
||||||
{
|
{
|
||||||
rtx set = single_set (i2);
|
rtx set;
|
||||||
|
prev = PREV_INSN (i2);
|
||||||
|
set = single_set (i2);
|
||||||
|
|
||||||
if (set != 0 && SET_DEST (set) == reg)
|
if (set != 0 && SET_DEST (set) == reg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue