public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARM] Fix wrong CFI for VFP registers with -mbig-endian
@ 2013-11-15 12:33 Eric Botcazou
  2013-11-19 17:48 ` Richard Earnshaw
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2013-11-15 12:33 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

because the compiler still uses the legacy encodings for the VFP registers in 
DWARF, when for example d8 is saved onto the stack, the CFI records a save of 
s16.  This is more or less correct in little-endian mode, but plain wrong in 
big-endian mode where s17 is saved first at that address.

Tested on arm-eabi with -mbig-endian and arm-vxworks, OK for the mainline?


2013-11-15  Eric Botcazou  <ebotcazou@adacore.com>

	* config/arm/arm.c (arm_dwarf_register_span): Take into account the
	endianness of the D registers for the legacy encodings.


-- 
Eric Botcazou

[-- Attachment #2: arm_cfi.diff --]
[-- Type: text/x-patch, Size: 1657 bytes --]

Index: config/arm/arm.c
===================================================================
--- config/arm/arm.c	(revision 204835)
+++ config/arm/arm.c	(working copy)
@@ -27924,10 +27930,11 @@ arm_dbx_register_number (unsigned int re
 static rtx
 arm_dwarf_register_span (rtx rtl)
 {
+  enum machine_mode mode;
   unsigned regno;
+  rtx parts[8];
   int nregs;
   int i;
-  rtx p;
 
   regno = REGNO (rtl);
   if (!IS_VFP_REGNUM (regno))
@@ -27940,15 +27947,33 @@ arm_dwarf_register_span (rtx rtl)
      corresponding D register.  Until GDB supports this, we shall use the
      legacy encodings.  We also use these encodings for D0-D15 for
      compatibility with older debuggers.  */
-  if (VFP_REGNO_OK_FOR_SINGLE (regno))
+  mode = GET_MODE (rtl);
+  if (GET_MODE_SIZE (mode) < 8)
     return NULL_RTX;
 
-  nregs = GET_MODE_SIZE (GET_MODE (rtl)) / 8;
-  p = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs));
-  for (i = 0; i < nregs; i++)
-    XVECEXP (p, 0, i) = gen_rtx_REG (DImode, regno + i);
+  if (VFP_REGNO_OK_FOR_SINGLE (regno))
+    {
+      nregs = GET_MODE_SIZE (mode) / 4;
+      for (i = 0; i < nregs; i += 2)
+	if (TARGET_BIG_END)
+	  {
+	    parts[i] = gen_rtx_REG (SImode, regno + i + 1);
+	    parts[i + 1] = gen_rtx_REG (SImode, regno + i);
+	  }
+	else
+	  {
+	    parts[i] = gen_rtx_REG (SImode, regno + i);
+	    parts[i + 1] = gen_rtx_REG (SImode, regno + i + 1);
+	  }
+    }
+  else
+    {
+      nregs = GET_MODE_SIZE (mode) / 8;
+      for (i = 0; i < nregs; i++)
+	parts[i] = gen_rtx_REG (DImode, regno + i);
+    }
 
-  return p;
+  return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nregs , parts));
 }
 
 #if ARM_UNWIND_INFO

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

* Re: [ARM] Fix wrong CFI for VFP registers with -mbig-endian
  2013-11-15 12:33 [ARM] Fix wrong CFI for VFP registers with -mbig-endian Eric Botcazou
@ 2013-11-19 17:48 ` Richard Earnshaw
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw @ 2013-11-19 17:48 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On 15/11/13 11:21, Eric Botcazou wrote:
> Hi,
> 
> because the compiler still uses the legacy encodings for the VFP registers in 
> DWARF, when for example d8 is saved onto the stack, the CFI records a save of 
> s16.  This is more or less correct in little-endian mode, but plain wrong in 
> big-endian mode where s17 is saved first at that address.
> 
> Tested on arm-eabi with -mbig-endian and arm-vxworks, OK for the mainline?
> 
> 
> 2013-11-15  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* config/arm/arm.c (arm_dwarf_register_span): Take into account the
> 	endianness of the D registers for the legacy encodings.
> 
> 
OK.

R.


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

end of thread, other threads:[~2013-11-19 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 12:33 [ARM] Fix wrong CFI for VFP registers with -mbig-endian Eric Botcazou
2013-11-19 17:48 ` Richard Earnshaw

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).