public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [DWARF] Fix multiple register spanning location.
@ 2013-05-07  7:55 Christian Bruel
  2013-05-15 22:27 ` Cary Coutant
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Bruel @ 2013-05-07  7:55 UTC (permalink / raw)
  To: Cary Coutant; +Cc: gcc-patches, Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

Hello,

On 04/30/2013 09:05 PM, Cary Coutant wrote
>
> How about using dbx_reg_number (XVECEXP (regs, 0, i)) instead? The
> bare use of DBX_REGISTER_NUMBER earlier in that function is protected
> by a gcc_assert, but this one isn't.

OK  dbx_reg_number better than  DBX_REGISTER_NUMBER here.
while we are on it, it looks like the spanning case code could be
simplified :
  - size is loop invariant (I don't think we can span across registers
of different modes)
  - rtl is only used in the "Simple, contiguous registers." case.
  - current_function_uses_only_leaf_regs is not handled for the spanning
case.

Does that seem OK with the attached patch ?

Thanks

Christian

> -cary

[-- Attachment #2: spanning.patch --]
[-- Type: text/x-patch, Size: 1916 bytes --]

2013-04-26  Christian Bruel  <christian.bruel@st.com>

        * dwarf2out.c (multiple_reg_loc_descriptor): Use DBX_REGISTER_NUMBER
        for spanning registers.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 198410)
+++ dwarf2out.c	(working copy)
@@ -10612,25 +10612,27 @@ static dw_loc_descr_ref
 multiple_reg_loc_descriptor (rtx rtl, rtx regs,
 			     enum var_init_status initialized)
 {
-  int nregs, size, i;
-  unsigned reg;
+  int size, i;
   dw_loc_descr_ref loc_result = NULL;
 
-  reg = REGNO (rtl);
+  /* Simple, contiguous registers.  */
+  if (regs == NULL_RTX)
+    {
+      unsigned reg = REGNO (rtl);
+      int nregs;
+
 #ifdef LEAF_REG_REMAP
-  if (crtl->uses_only_leaf_regs)
-    {
-      int leaf_reg = LEAF_REG_REMAP (reg);
-      if (leaf_reg != -1)
-	reg = (unsigned) leaf_reg;
-    }
+      if (crtl->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)];
 
-  /* Simple, contiguous registers.  */
-  if (regs == NULL_RTX)
-    {
+      gcc_assert ((unsigned) DBX_REGISTER_NUMBER (reg) == dbx_reg_number (rtl));
+      nregs = hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)];
+
       size = GET_MODE_SIZE (GET_MODE (rtl)) / nregs;
 
       loc_result = NULL;
@@ -10658,10 +10660,9 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
     {
       dw_loc_descr_ref t;
 
-      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
+      t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
 				  VAR_INIT_STATUS_INITIALIZED);
       add_loc_descr (&loc_result, t);
-      size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));
       add_loc_descr_op_piece (&loc_result, size);
     }
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [DWARF] Fix multiple register spanning location.
  2013-05-07  7:55 [DWARF] Fix multiple register spanning location Christian Bruel
@ 2013-05-15 22:27 ` Cary Coutant
  2013-05-21  7:51   ` Christian Bruel
  2013-05-27 15:46   ` Christian Bruel
  0 siblings, 2 replies; 7+ messages in thread
From: Cary Coutant @ 2013-05-15 22:27 UTC (permalink / raw)
  To: Christian Bruel; +Cc: gcc-patches, Jason Merrill

> > How about using dbx_reg_number (XVECEXP (regs, 0, i)) instead? The
> > bare use of DBX_REGISTER_NUMBER earlier in that function is protected
> > by a gcc_assert, but this one isn't.
>
> OK  dbx_reg_number better than  DBX_REGISTER_NUMBER here.
> while we are on it, it looks like the spanning case code could be
> simplified :
>   - size is loop invariant (I don't think we can span across registers
> of different modes)
>   - rtl is only used in the "Simple, contiguous registers." case.
>   - current_function_uses_only_leaf_regs is not handled for the spanning
> case.
>
> Does that seem OK with the attached patch ?

Yes, this looks good. OK for trunk, but please add a note about those
additional changes you made to the ChangeLog entry. Thanks!

2013-04-26  Christian Bruel  <christian.bruel@st.com>

        * dwarf2out.c (multiple_reg_loc_descriptor): Use DBX_REGISTER_NUMBER
        for spanning registers.

-cary

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [DWARF] Fix multiple register spanning location.
  2013-05-15 22:27 ` Cary Coutant
@ 2013-05-21  7:51   ` Christian Bruel
  2013-05-27 15:46   ` Christian Bruel
  1 sibling, 0 replies; 7+ messages in thread
From: Christian Bruel @ 2013-05-21  7:51 UTC (permalink / raw)
  To: Cary Coutant; +Cc: gcc-patches, Jason Merrill


> Yes, this looks good. OK for trunk, but please add a note about those
> additional changes you made to the ChangeLog entry. Thanks!
>
>
Thanks, done with this entry:

2013-05-21  Christian Bruel  <christian.bruel@st.com>

         * dwarf2out.c (multiple_reg_loc_descriptor): Use dbx_reg_number for
         spanning registers. LEAF_REG_REMAP is supported only for contiguous
         registers. Set register size out of the PARALLEL loop.

Cheers


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [DWARF] Fix multiple register spanning location.
  2013-05-15 22:27 ` Cary Coutant
  2013-05-21  7:51   ` Christian Bruel
@ 2013-05-27 15:46   ` Christian Bruel
  2013-05-28 23:19     ` Kaz Kojima
  1 sibling, 1 reply; 7+ messages in thread
From: Christian Bruel @ 2013-05-27 15:46 UTC (permalink / raw)
  To: gcc-patches
  Cc: Kaz Kojima, Ramana Radhakrishnan, rmansfield at qnx dot com,
	ktkachov at gcc dot gnu.org, Cary Coutant

[-- Attachment #1: Type: text/plain, Size: 2644 bytes --]


On 05/16/2013 12:27 AM, Cary Coutant wrote:
>>> How about using dbx_reg_number (XVECEXP (regs, 0, i)) instead? The
>>> bare use of DBX_REGISTER_NUMBER earlier in that function is protected
>>> by a gcc_assert, but this one isn't.
>>
For the respective targets maintainers that drop into the thread: Here
is a summary of the problem:

Since http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00209.html, dwarf
double floating point registers are not correctly described for the SH.
But this patch was needed to fix an assertion in the dwarf2cfi.

Therefore, we have a discrepancy between the different targets, that can
result in assertions, (or possibly silent wrong unwind code I believe)

SH,MIPS,C6X   ; dwarf_register_span returns hard_reg numbers. regno is
never translated for DBX
ARM  NEON     ;                                  converts regno into DBX
numbers
POWERPC        ;                                 ? returns boths.

So a second set of patches
http://gcc.gnu.org/ml/gcc-patches/2013-05/msg01230.html
http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00312.html

fixed it with a common rule. All interfaces are changed to return
hard_reg numbers only. multiple_reg_location is in charge of calling 
DBX_REGISTER_NUMBER with an assertion check.

Well, in fact this was not doing some good for the powerpc, that now
asserts here. The problem is that rs6000_dwarf_register_span stores in
the PARALLEL rtx both the hard reg and the dbx reg, so we can't call
dbx_reg_number in it.
Using DBX_REGISTER_NUMBER instead of dbx_reg_number restores the
previous working status for all targets. This is
dwarf-span-assert-rs6000.patch for reference.

However I feel a little bit uncomfortable with this solution that
doesn't seem to fix the root cause. The dbx_register_number hooks is
called basically from two places : dwarf2cfi.c and dwarf2out.c. That
show different uses: either we want to refer to the hard regno when
dealing with the cfa description (whereas we want DWARF_FRAME_REGNUM,
not DBX_REGISTER_NUMBER). or we use the DBX_REGISTER_NUMBER for output
register locations.

Since this information cannot be detected contextually, I'd like to
extend the dwarf_register_span target hook  to return a dbx number or
not. This is dwarf-span-target-dbx.patch

build tested with the configurations that failed at one time or the other:
  - sh64-unknown-elf  (The original sh64-elf build failure assertion in
dwarf2cfi is fixed.)
  - arm-none-eabi -with-fpu=neon-vfpv4
  - powerpc-e500v2-linux-gnuspe
  - x86_64-unknown-linux-gnu sanity build OK

Is dwarf-span-target-dbx.patch OK for trunk ?. More comments ?

Many Thanks,

Christian










  

[-- Attachment #2: dwarf-span-target-dbx.patch --]
[-- Type: text/x-patch, Size: 9122 bytes --]

2013-05-23  Christian Bruel  <christian.bruel@st.com>

	PR debug/57351
	PR debug/57389
	* config/arm/arm.c (arm_dwarf_register_span): Add bool dbx parameter.
	* config/c6x/c6x.c (c6x_dwarf_register_span): Likewise.
	* config/mips/mips (mips_dwarf_register_span): Likewise.
	* config/rs6000/rs6000.c (rs6000_dwarf_register_span): Likewise.
	* config/sh/sh.c (sh_dwarf_register_span): Likewise. Declare static.
	* config/sh/sh-protos.h (sh_dwarf_register_span): Remove declaration.
	* gcc/doc/tm.texi: Add bool dbx parameter.
	* gcc/target.def: Likewise,
	* gcc/dwarf2cfi.c (dwarf2out_frame_debug_cfa_offset): Don't span dbx.
	(dwarf2out_frame_debug_cfa_expression): Don't span dbx.
	* gcc/dwarf2out.c (reg_loc_descriptor): Span dbx.
	* gcc/hooks.c: (hook_rtx_bool_null): Define.
	* gcc/hooks.h: (hook_rtx_bool_null): Declare.

Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(revision 199354)
+++ gcc/config/arm/arm.c	(working copy)
@@ -213,7 +213,7 @@ static bool arm_output_ttype (rtx);
 static void arm_asm_emit_except_personality (rtx);
 static void arm_asm_init_sections (void);
 #endif
-static rtx arm_dwarf_register_span (rtx);
+static rtx arm_dwarf_register_span (rtx, bool);
 
 static tree arm_cxx_guard_type (void);
 static bool arm_cxx_guard_mask_bit (void);
@@ -25855,7 +25855,7 @@ arm_dbx_register_number (unsigned int regno)
    GCC models tham as 64 32-bit registers, so we need to describe this to
    the DWARF generation code.  Other registers can use the default.  */
 static rtx
-arm_dwarf_register_span (rtx rtl)
+arm_dwarf_register_span (rtx rtl, bool dbx)
 {
   unsigned regno;
   int nregs;
@@ -25878,6 +25878,8 @@ static rtx
 
   nregs = GET_MODE_SIZE (GET_MODE (rtl)) / 8;
   p = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs));
+  if (dbx)
+    regno = 256 + (regno - FIRST_VFP_REGNUM) / 2;
   for (i = 0; i < nregs; i++)
     XVECEXP (p, 0, i) = gen_rtx_REG (DImode, regno + i);
 
Index: gcc/config/c6x/c6x.c
===================================================================
--- gcc/config/c6x/c6x.c	(revision 199354)
+++ gcc/config/c6x/c6x.c	(working copy)
@@ -6304,7 +6304,7 @@ c6x_set_return_address (rtx source, rtx scratch)
    registers for DWARF generation code.  */
 
 static rtx
-c6x_dwarf_register_span (rtx rtl)
+c6x_dwarf_register_span (rtx rtl, bool dbx ATTRIBUTE_UNUSED)
 {
     unsigned regno;
     unsigned real_regno;
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(revision 199354)
+++ gcc/config/mips/mips.c	(working copy)
@@ -8533,7 +8533,7 @@ mips_output_dwarf_dtprel (FILE *file, int size, rt
 /* Implement TARGET_DWARF_REGISTER_SPAN.  */
 
 static rtx
-mips_dwarf_register_span (rtx reg)
+mips_dwarf_register_span (rtx reg, bool dbx ATTRIBUTE_UNUSED)
 {
   rtx high, low;
   enum machine_mode mode;
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 199354)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -27738,7 +27738,7 @@ rs6000_initial_elimination_offset (int from, int t
 }
 
 static rtx
-rs6000_dwarf_register_span (rtx reg)
+rs6000_dwarf_register_span (rtx reg, bool dbx ATTRIBUTE_UNUSED)
 {
   rtx parts[8];
   int i, words;
Index: gcc/config/sh/sh-protos.h
===================================================================
--- gcc/config/sh/sh-protos.h	(revision 199354)
+++ gcc/config/sh/sh-protos.h	(working copy)
@@ -214,7 +214,6 @@ extern rtx sh_get_pr_initial_val (void);
 
 extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree,
 				     signed int, enum machine_mode);
-extern rtx sh_dwarf_register_span (rtx);
 
 extern rtx replace_n_hard_rtx (rtx, rtx *, int , int);
 extern int shmedia_cleanup_truncate (rtx *, void *);
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 199354)
+++ gcc/config/sh/sh.c	(working copy)
@@ -303,6 +303,7 @@ static rtx sh_function_arg (cumulative_args_t, enu
 			    const_tree, bool);
 static bool sh_scalar_mode_supported_p (enum machine_mode);
 static int sh_dwarf_calling_convention (const_tree);
+static rtx sh_dwarf_register_span (rtx, bool);
 static void sh_encode_section_info (tree, rtx, int);
 static bool sh2a_function_vector_p (tree);
 static void sh_trampoline_init (rtx, tree, rtx);
@@ -8760,14 +8761,17 @@ sh_gimplify_va_arg_expr (tree valist, tree type, g
 /* 64 bit floating points memory transfers are paired single precision loads
    or store.  So DWARF information needs fixing in little endian (unless
    PR=SZ=1 in FPSCR).  */
-rtx
-sh_dwarf_register_span (rtx reg)
+static rtx
+sh_dwarf_register_span (rtx reg, bool dbx)
 {
   unsigned regno = REGNO (reg);
 
   if (WORDS_BIG_ENDIAN || GET_MODE (reg) != DFmode)
     return NULL_RTX;
 
+  if (dbx)
+    regno = DBX_REGISTER_NUMBER (regno);
+
   return
     gen_rtx_PARALLEL (VOIDmode,
 		      gen_rtvec (2,
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 199354)
+++ gcc/doc/tm.texi	(working copy)
@@ -8971,7 +8971,7 @@ Default value is false if @code{EH_FRAME_SECTION_N
 true otherwise.
 @end deftypevr
 
-@deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg})
+@deftypefn {Target Hook} rtx TARGET_DWARF_REGISTER_SPAN (rtx @var{reg}, @var{bool})
 Given a register, this hook should return a parallel of registers to
 represent where to find the register pieces.  Define this hook if the
 register and its mode are represented in Dwarf in non-contiguous
Index: gcc/dwarf2cfi.c
===================================================================
--- gcc/dwarf2cfi.c	(revision 199354)
+++ gcc/dwarf2cfi.c	(working copy)
@@ -1134,7 +1134,7 @@ dwarf2out_frame_debug_cfa_offset (rtx set)
     }
   else
     {
-      span = targetm.dwarf_register_span (src);
+      span = targetm.dwarf_register_span (src, false);
       sregno = dwf_regno (src);
     }
 
@@ -1203,7 +1203,7 @@ dwarf2out_frame_debug_cfa_expression (rtx set)
   gcc_assert (REG_P (src));
   gcc_assert (MEM_P (dest));
 
-  span = targetm.dwarf_register_span (src);
+  span = targetm.dwarf_register_span (src, false);
   gcc_assert (!span);
 
   regno = dwf_regno (src);
@@ -1882,7 +1882,7 @@ dwarf2out_frame_debug_expr (rtx expr)
 
       span = NULL;
       if (REG_P (src))
-	span = targetm.dwarf_register_span (src);
+	span = targetm.dwarf_register_span (src, false);
       if (!span)
 	queue_reg_save (src, NULL_RTX, offset);
       else
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 199354)
+++ gcc/dwarf2out.c	(working copy)
@@ -10572,7 +10572,7 @@ reg_loc_descriptor (rtx rtl, enum var_init_status
       return result;
     }
 
-  regs = targetm.dwarf_register_span (rtl);
+  regs = targetm.dwarf_register_span (rtl, true);
 
   if (hard_regno_nregs[REGNO (rtl)][GET_MODE (rtl)] > 1 || regs)
     return multiple_reg_loc_descriptor (rtl, regs, initialized);
@@ -10660,7 +10660,7 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
     {
       dw_loc_descr_ref t;
 
-      t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
+      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
 				  VAR_INIT_STATUS_INITIALIZED);
       add_loc_descr (&loc_result, t);
       add_loc_descr_op_piece (&loc_result, size);
Index: gcc/hooks.c
===================================================================
--- gcc/hooks.c	(revision 199354)
+++ gcc/hooks.c	(working copy)
@@ -338,13 +338,20 @@ hook_rtx_rtx_identity (rtx x)
   return x;
 }
 
-/* Generic hook that takes an rtx and returns NULL_RTX.  */
+/* Generic hook that takes a rtx and returns NULL_RTX.  */
 rtx
 hook_rtx_rtx_null (rtx x ATTRIBUTE_UNUSED)
 {
   return NULL;
 }
 
+/* Generic hook that takes a rtx and a bool and returns NULL_RTX.  */
+rtx
+hook_rtx_bool_null (rtx x ATTRIBUTE_UNUSED, bool dbx ATTRIBUTE_UNUSED)
+{
+  return NULL;
+}
+
 /* Generic hook that takes a tree and an int and returns NULL_RTX.  */
 rtx
 hook_rtx_tree_int_null (tree a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED)
Index: gcc/hooks.h
===================================================================
--- gcc/hooks.h	(revision 199354)
+++ gcc/hooks.h	(working copy)
@@ -95,6 +95,7 @@ extern bool default_can_output_mi_thunk_no_vcall (
 
 extern rtx hook_rtx_rtx_identity (rtx);
 extern rtx hook_rtx_rtx_null (rtx);
+extern rtx hook_rtx_bool_null (rtx, bool dbx);
 extern rtx hook_rtx_tree_int_null (tree, int);
 
 extern const char *hook_constcharptr_void_null (void);
Index: gcc/target.def
===================================================================
--- gcc/target.def	(revision 199354)
+++ gcc/target.def	(working copy)
@@ -1850,8 +1850,8 @@ DEFHOOK
 DEFHOOK
 (dwarf_register_span,
  "",
- rtx, (rtx reg),
- hook_rtx_rtx_null)
+ rtx, (rtx reg, bool),
+ hook_rtx_bool_null)
 
 /* If expand_builtin_init_dwarf_reg_sizes needs to fill in table
    entries not corresponding directly to registers below

[-- Attachment #3: dwarf-span-assert-rs6000.patch --]
[-- Type: text/x-patch, Size: 898 bytes --]

2013-05-23  Christian Bruel  <christian.bruel@st.com>

	PR debug/57389
        * dwarf2out.c (multiple_reg_loc_descriptor): Use DBX_REGISTER_NUMBER
	instead	of dbx_reg_number.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c	(revision 199354)
+++ gcc/dwarf2out.c	(working copy)
@@ -10660,8 +10660,11 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
     {
       dw_loc_descr_ref t;
 
-      t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),
+      /* Cannot use dbx_reg_number here because regno could be out of the hard-reg
+	 range and not handled by DBX_REGISTER_NUMBER. See rs6000.h.  */
+      t = one_reg_loc_descriptor (DBX_REGISTER_NUMBER (REGNO (XVECEXP (regs, 0, i))),
 				  VAR_INIT_STATUS_INITIALIZED);
+
       add_loc_descr (&loc_result, t);
       add_loc_descr_op_piece (&loc_result, size);
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [DWARF] Fix multiple register spanning location.
  2013-05-27 15:46   ` Christian Bruel
@ 2013-05-28 23:19     ` Kaz Kojima
  2013-06-11  7:43       ` Ping: " Christian Bruel
  0 siblings, 1 reply; 7+ messages in thread
From: Kaz Kojima @ 2013-05-28 23:19 UTC (permalink / raw)
  To: christian.bruel; +Cc: gcc-patches

Christian Bruel <christian.bruel@st.com> wrote:
> However I feel a little bit uncomfortable with this solution that
> doesn't seem to fix the root cause. The dbx_register_number hooks is
> called basically from two places : dwarf2cfi.c and dwarf2out.c. That
> show different uses: either we want to refer to the hard regno when
> dealing with the cfa description (whereas we want DWARF_FRAME_REGNUM,
> not DBX_REGISTER_NUMBER). or we use the DBX_REGISTER_NUMBER for output
> register locations.
> 
> Since this information cannot be detected contextually, I'd like to
> extend the dwarf_register_span target hook  to return a dbx number or
> not. This is dwarf-span-target-dbx.patch
> 
> build tested with the configurations that failed at one time or the other:
>   - sh64-unknown-elf  (The original sh64-elf build failure assertion in
> dwarf2cfi is fixed.)
>   - arm-none-eabi -with-fpu=neon-vfpv4
>   - powerpc-e500v2-linux-gnuspe
>   - x86_64-unknown-linux-gnu sanity build OK
> 
> Is dwarf-span-target-dbx.patch OK for trunk ?. More comments ?

SH portion looks fine.  I've tested the patch with the top level
"make -k check" also on sh4-unknown-linux-gnu with no new failures.  

Regards,
	kaz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping: Re: [DWARF] Fix multiple register spanning location.
  2013-05-28 23:19     ` Kaz Kojima
@ 2013-06-11  7:43       ` Christian Bruel
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Bruel @ 2013-06-11  7:43 UTC (permalink / raw)
  To: gcc-patches

Hello,

May I have a review from the DWARF, the ARM and RS6000 maintainers for
comments/approval ?

http://gcc.gnu.org/ml/gcc-patches/2013-05/msg01613.html

Needed to fix the powerpc-spe bootstrap referenced in bugzilla #57389

Many Thanks

Christian


Christian Bruel <christian.bruel@st.com> wrote:
>> However I feel a little bit uncomfortable with this solution that
>> doesn't seem to fix the root cause. The dbx_register_number hooks is
>> called basically from two places : dwarf2cfi.c and dwarf2out.c. That
>> show different uses: either we want to refer to the hard regno when
>> dealing with the cfa description (whereas we want DWARF_FRAME_REGNUM,
>> not DBX_REGISTER_NUMBER). or we use the DBX_REGISTER_NUMBER for output
>> register locations.
>>
>> Since this information cannot be detected contextually, I'd like to
>> extend the dwarf_register_span target hook  to return a dbx number or
>> not. This is dwarf-span-target-dbx.patch
>>
>> build tested with the configurations that failed at one time or the other:
>>   - sh64-unknown-elf  (The original sh64-elf build failure assertion in
>> dwarf2cfi is fixed.)
>>   - arm-none-eabi -with-fpu=neon-vfpv4
>>   - powerpc-e500v2-linux-gnuspe
>>   - x86_64-unknown-linux-gnu sanity build OK
>>
>> Is dwarf-span-target-dbx.patch OK for trunk ?. More comments ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [DWARF] Fix multiple register spanning location.
@ 2013-04-29  9:57 Christian Bruel
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Bruel @ 2013-04-29  9:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: ccoutant, jason

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Hello,

We noticed a few failures with the gdb testsuite due to incorrect
mapping of floating point, noticed on SH that defines both
TARGET_DWARF_REGISTER_SPAN and DBX_REGISTER_NUMBER.

The problem was that the converted pseudo reg was never converted to the
dbx format when fed from 'multiple_reg_loc_descriptor'

reg tested for sh-elf (including gdb). bootstrap OK for arm-none-eabi,
sh64-elf and x86_64-unknown-linux-gnu

Note that this could apply to the ARM, C6X, RS6000, MIPS targets that
also defines the same macro combination. Although asking approval from
the DWARF maintainers, feedback from the respective arch maintainers
would be appreciated as I don't run the gdb testsuite on those targets.

Many thanks,

Christian

[-- Attachment #2: dwarf-span.patch --]
[-- Type: text/x-patch, Size: 1500 bytes --]

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	* dwarf2out.c (multiple_reg_loc_descriptor): Use DBX_REGISTER_NUMBER
	 for spaning registers.

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	* gcc.dg/debug/dwarf2/dwarf_span.c: New test case.

Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 198287)
+++ dwarf2out.c	(working copy)
@@ -10656,7 +10656,8 @@ multiple_reg_loc_descriptor (rtx rtl, rtx regs,
     {
       dw_loc_descr_ref t;
 
-      t = one_reg_loc_descriptor (REGNO (XVECEXP (regs, 0, i)),
+      reg = REGNO (XVECEXP (regs, 0, i));
+      t = one_reg_loc_descriptor (DBX_REGISTER_NUMBER (reg),
 				  VAR_INIT_STATUS_INITIALIZED);
       add_loc_descr (&loc_result, t);
       size = GET_MODE_SIZE (GET_MODE (XVECEXP (regs, 0, 0)));

Index: testsuite/gcc.dg/debug/dwarf2/dwarf_span.c
===================================================================
--- testsuite/gcc.dg/debug/dwarf2/dwarf_span.c	(revision 0)
+++ testsuite/gcc.dg/debug/dwarf2/dwarf_span.c	(revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-require-effective-target hard_float } */
+/* { dg-options "-g -dA" } */
+/* { dg-final { scan-assembler-times "DW_OP_regx" 4 } } */
+
+double
+add_double (register double u, register double v)
+{
+  return u + v;
+}
+
+double
+wack_double (register double u, register double v)
+{
+  register double l = u, r = v;
+  l = add_double (l, r);
+  return l + r;
+}


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-11  7:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07  7:55 [DWARF] Fix multiple register spanning location Christian Bruel
2013-05-15 22:27 ` Cary Coutant
2013-05-21  7:51   ` Christian Bruel
2013-05-27 15:46   ` Christian Bruel
2013-05-28 23:19     ` Kaz Kojima
2013-06-11  7:43       ` Ping: " Christian Bruel
  -- strict thread matches above, loose matches on Subject: below --
2013-04-29  9:57 Christian Bruel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).