OSDN Git Service

PR debug/43479
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Mar 2010 16:50:11 +0000 (16:50 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 24 Mar 2010 16:50:11 +0000 (16:50 +0000)
* ira.c (adjust_cleared_regs): New function.
(update_equiv_regs): Adjust cleared_regs in DEBUG_INSNs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157702 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/ira.c

index a89e069..d11614a 100644 (file)
@@ -1,5 +1,9 @@
 2010-03-24  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/43479
+       * ira.c (adjust_cleared_regs): New function.
+       (update_equiv_regs): Adjust cleared_regs in DEBUG_INSNs.
+
        PR debug/19192
        PR debug/43479
        * cfgexpand.c (gimple_assign_rhs_to_tree): Also set TREE_BLOCK
index e5a6171..b4397c8 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -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);