This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix register numbering in debug info on SPARC
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 23 Dec 2006 18:23:00 +0100
- Subject: Fix register numbering in debug info on SPARC
The patch
2005-09-07 Richard Henderson <rth@redhat.com>
[...]
* dwarf2out.c (dbx_reg_number): Assert register elimination performed; do
leaf register remapping.
[...]
(rtl_for_decl_location): Don't do register elimination or
leaf register remapping here.
contains an oversight:
@@ -8409,8 +8431,18 @@ dbx_reg_number (rtx rtl)
+#ifdef LEAF_REG_REMAP
+ regno = LEAF_REG_REMAP (regno);
+#endif
+
return DBX_REGISTER_NUMBER (regno);
}
@@ -10073,19 +10091,10 @@ rtl_for_decl_location (tree decl)
plus_constant (XEXP (rtl, 0), rsize-dsize));
}
- if (rtl != NULL_RTX)
- {
- rtl = eliminate_regs (rtl, 0, NULL_RTX);
-#ifdef LEAF_REG_REMAP
- if (current_function_uses_only_leaf_regs)
- leaf_renumber_regs_insn (rtl);
-#endif
- }
which breaks register numbering in debug info on SPARC for non-leaf functions.
Tested on SPARC/Solaris 8, applied to mainline/4.2/4.1 branches as obvious.
I've also backported the fix for another fallout of the aforementioned patch:
2006-05-13 Nick Clifton <nickc@redhat.com>
* dwarf2out.c (dbx_reg_number): Check return value from
LEAF_REG_REMAP and only use it if it is valid.
(multiple_reg_loc_descriptor): Likewise.
to the 4.1 branch. All this stuff affects only the SPARC architecture.
2006-12-23 Eric Botcazou <ebotcazou@adacore.com>
* dwarf2out.c (dbx_reg_number): Do leaf register remapping
only if the function is leaf.
(multiple_reg_loc_descriptor): Likewise.
--
Eric Botcazou
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 120045)
+++ dwarf2out.c (working copy)
@@ -8611,13 +8611,12 @@ dbx_reg_number (rtx rtl)
gcc_assert (regno < FIRST_PSEUDO_REGISTER);
#ifdef LEAF_REG_REMAP
- {
- int leaf_reg;
-
- leaf_reg = LEAF_REG_REMAP (regno);
- if (leaf_reg != -1)
- regno = (unsigned) leaf_reg;
- }
+ if (current_function_uses_only_leaf_regs)
+ {
+ int leaf_reg = LEAF_REG_REMAP (regno);
+ if (leaf_reg != -1)
+ regno = (unsigned) leaf_reg;
+ }
#endif
return DBX_REGISTER_NUMBER (regno);
@@ -8686,13 +8685,12 @@ multiple_reg_loc_descriptor (rtx rtl, rt
reg = REGNO (rtl);
#ifdef LEAF_REG_REMAP
- {
- int leaf_reg;
-
- leaf_reg = LEAF_REG_REMAP (reg);
- if (leaf_reg != -1)
- reg = (unsigned) leaf_reg;
- }
+ if (current_function_uses_only_leaf_regs)
+ {
+ int leaf_reg = LEAF_REG_REMAP (reg);
+ if (leaf_reg != -1)
+ reg = (unsigned) leaf_reg;
+ }
#endif
gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];