From 62a4a967a9ec706432d076cd352b64ca07b8445d Mon Sep 17 00:00:00 2001 From: Laurynas Biveinis Date: Fri, 7 Sep 2007 02:58:06 +0000 Subject: regrename.c (copyprop_hardreg_forward_1): New variable next. 2007-09-05 Laurynas Biveinis * 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 --- gcc/function.c | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'gcc/function.c') diff --git a/gcc/function.c b/gcc/function.c index a2956b3..23c5366 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1666,7 +1666,7 @@ instantiate_decls (tree fndecl) static unsigned int instantiate_virtual_regs (void) { - rtx insn; + rtx insn, next; /* Compute the offsets to use for this function. */ in_arg_offset = FIRST_PARM_OFFSET (current_function_decl); @@ -1684,30 +1684,34 @@ instantiate_virtual_regs (void) /* Scan through all the insns, instantiating every virtual register still present. */ - for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (INSN_P (insn)) - { - /* These patterns in the instruction stream can never be recognized. - Fortunately, they shouldn't contain virtual registers either. */ - if (GET_CODE (PATTERN (insn)) == USE - || GET_CODE (PATTERN (insn)) == CLOBBER - || GET_CODE (PATTERN (insn)) == ADDR_VEC - || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC - || GET_CODE (PATTERN (insn)) == ASM_INPUT) - continue; - - instantiate_virtual_regs_in_insn (insn); - - if (INSN_DELETED_P (insn)) - continue; - - for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx, NULL); - - /* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */ - if (GET_CODE (insn) == CALL_INSN) - for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn), - instantiate_virtual_regs_in_rtx, NULL); - } + for (insn = get_insns (); insn; insn = next) + { + next = NEXT_INSN (insn); + if (INSN_P (insn)) + { + /* These patterns in the instruction stream can never be recognized. + Fortunately, they shouldn't contain virtual registers either. */ + if (GET_CODE (PATTERN (insn)) == USE + || GET_CODE (PATTERN (insn)) == CLOBBER + || GET_CODE (PATTERN (insn)) == ADDR_VEC + || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC + || GET_CODE (PATTERN (insn)) == ASM_INPUT) + continue; + + instantiate_virtual_regs_in_insn (insn); + + if (INSN_DELETED_P (insn)) + continue; + + for_each_rtx (®_NOTES (insn), instantiate_virtual_regs_in_rtx, + NULL); + + /* Instantiate any virtual registers in CALL_INSN_FUNCTION_USAGE. */ + if (GET_CODE (insn) == CALL_INSN) + for_each_rtx (&CALL_INSN_FUNCTION_USAGE (insn), + instantiate_virtual_regs_in_rtx, NULL); + } + } /* Instantiate the virtual registers in the DECLs for debugging purposes. */ instantiate_decls (current_function_decl); -- cgit v1.1