diff options
Diffstat (limited to 'gcc/ira.c')
-rw-r--r-- | gcc/ira.c | 48 |
1 files changed, 40 insertions, 8 deletions
@@ -1,5 +1,5 @@ /* Integrated Register Allocator (IRA) entry point. - Copyright (C) 2006, 2007, 2008, 2009 + Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Vladimir Makarov <vmakarov@redhat.com>. @@ -2282,6 +2282,22 @@ no_equiv (rtx reg, const_rtx store ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED } } +/* In DEBUG_INSN location adjust REGs from CLEARED_REGS bitmap to the + equivalent replacement. */ + +static rtx +adjust_cleared_regs (rtx loc, const_rtx old_rtx ATTRIBUTE_UNUSED, void *data) +{ + if (REG_P (loc)) + { + bitmap cleared_regs = (bitmap) data; + if (bitmap_bit_p (cleared_regs, REGNO (loc))) + return simplify_replace_fn_rtx (*reg_equiv[REGNO (loc)].src_p, + NULL_RTX, adjust_cleared_regs, data); + } + return NULL_RTX; +} + /* Nonzero if we recorded an equivalence for a LABEL_REF. */ static int recorded_label_ref; @@ -2717,13 +2733,29 @@ update_equiv_regs (void) } if (!bitmap_empty_p (cleared_regs)) - FOR_EACH_BB (bb) - { - bitmap_and_compl_into (DF_LIVE_IN (bb), cleared_regs); - bitmap_and_compl_into (DF_LIVE_OUT (bb), cleared_regs); - bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs); - bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs); - } + { + FOR_EACH_BB (bb) + { + bitmap_and_compl_into (DF_LIVE_IN (bb), cleared_regs); + bitmap_and_compl_into (DF_LIVE_OUT (bb), cleared_regs); + bitmap_and_compl_into (DF_LR_IN (bb), cleared_regs); + bitmap_and_compl_into (DF_LR_OUT (bb), cleared_regs); + } + + /* Last pass - adjust debug insns referencing cleared regs. */ + if (MAY_HAVE_DEBUG_INSNS) + for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) + if (DEBUG_INSN_P (insn)) + { + rtx old_loc = INSN_VAR_LOCATION_LOC (insn); + INSN_VAR_LOCATION_LOC (insn) + = simplify_replace_fn_rtx (old_loc, NULL_RTX, + adjust_cleared_regs, + (void *) cleared_regs); + if (old_loc != INSN_VAR_LOCATION_LOC (insn)) + df_insn_rescan (insn); + } + } BITMAP_FREE (cleared_regs); |