diff mbox

[DWARF] Fix multiple register spanning location.

Message ID 5188AFC2.1000105@st.com
State New
Headers show

Commit Message

Christian Bruel May 7, 2013, 7:55 a.m. UTC
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

Comments

Cary Coutant May 15, 2013, 10:27 p.m. UTC | #1
> > 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
Christian Bruel May 21, 2013, 7:51 a.m. UTC | #2
> 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
diff mbox

Patch

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);
     }