[patch, mips, debug] Fix PR 54061, mips compiler aborts in testsuite

Steve Ellcey sellcey@mips.com
Fri Dec 7 23:17:00 GMT 2012


> On Fri, 2012-12-07 at 14:43 -0800, H.J. Lu wrote:
>
>> > I think you need a way to tell a bad register from a good register
>> > which doesn't have DWARF register number.

Here is a patch using your IGNORED_DWARF_REGNUM idea.

Steve Ellcey
sellcey@mips.com


2012-12-07  Steve Ellcey  <sellcey@mips.com>

	PR target/54061
	* rtl.h (IGNORED_DWARF_REGNUM): New.
	* dwarfwout.c (reg_loc_descriptor): Check for IGNORED_DWARF_REGNUM.
	(mem_loc_descriptor): Ditto.
	* config/mips/mips.c (mips_option_override): Set mips_dbx_regno
	coprocessor entries to IGNORED_DWARF_REGNUM.


diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index b6a2290..bc99f29 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16757,6 +16757,9 @@ mips_option_override (void)
   for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
     mips_dbx_regno[i] = i + start;
 
+  for (i = COP0_REG_FIRST; i <= COP3_REG_LAST; i++)
+    mips_dbx_regno[i] = IGNORED_DWARF_REGNUM;
+
   /* Accumulator debug registers use big-endian ordering.  */
   mips_dbx_regno[HI_REGNUM] = MD_DBX_FIRST + 0;
   mips_dbx_regno[LO_REGNUM] = MD_DBX_FIRST + 1;
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f0256ae..caedb5f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10473,6 +10473,9 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized)
   if (REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
     return 0;
 
+  if (dbx_reg_number(rtl) == IGNORED_DWARF_REGNUM)
+    return 0;
+
   /* We only use "frame base" when we're sure we're talking about the
      post-prologue local stack frame.  We do this by *not* running
      register elimination until this point, and recognizing the special
@@ -11931,6 +11934,8 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 	    break;
 	  if (REGNO (rtl) > FIRST_PSEUDO_REGISTER)
 	    break;
+	  if (dbx_reg_number(rtl) == IGNORED_DWARF_REGNUM)
+	    break;
 	  type_die = base_type_for_mode (mode,
 					 GET_MODE_CLASS (mode) == MODE_INT);
 	  if (type_die == NULL)
@@ -12133,6 +12138,9 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 	return NULL;
       if (REG_P (ENTRY_VALUE_EXP (rtl)))
 	{
+	  if (dbx_reg_number (ENTRY_VALUE_EXP (rtl)) == IGNORED_DWARF_REGNUM)
+	    return NULL;
+
 	  if (GET_MODE_CLASS (mode) != MODE_INT
 	      || GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE)
 	    op0 = mem_loc_descriptor (ENTRY_VALUE_EXP (rtl), mode,
diff --git a/gcc/rtl.h b/gcc/rtl.h
index a0fb4f7..5b9ceb8 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2439,6 +2439,9 @@ extern rtx gen_rtx_MEM (enum machine_mode, rtx);
 /* REGNUM never really appearing in the INSN stream.  */
 #define INVALID_REGNUM			(~(unsigned int) 0)
 
+/* REGNUM for which no debug information can be generated.  */
+#define IGNORED_DWARF_REGNUM            (INVALID_REGNUM - 1)
+
 extern rtx output_constant_def (tree, int);
 extern rtx lookup_constant_def (tree);
 




More information about the Gcc-patches mailing list