diff mbox

fix ppc spe bootstrap error in dwf_regno

Message ID 53611380.4080901@mentor.com
State New
Headers show

Commit Message

Cesar Philippidis April 30, 2014, 3:15 p.m. UTC
I've been working on a patch to switch a few ppc targets to use softfp
in libgcc instead of fpbit and I noticed that ppc-none-eabispe fails to
bootstrap in both trunk and 4.9. The regression was introduced in
<http://gcc.gnu.org/ml/gcc-patches/2013-11/msg03588.html>. Essentially,
the assert for a hard register in dwf_regno () is not valid on ppc spe
targets. In rs6000_dwarf_register_span (), there is a note stating:

  /* The duality of the SPE register size wreaks all kinds of havoc.
     This is a way of distinguishing r0 in 32-bits from r0 in
     64-bits.  */

and the function adds 1200 to regno, which makes that register appear to
be a pseudo. This causes problems in dwf_regno (), which asserts that
reg is a hard register. Since the dwarf2 pass is executed after register
allocation it should, in theory, be ok for the rs6000 backend to be
using a pseudo register for this application.

Is this patch ok for trunk and 4.9? If so, please commit since I don't
have an svn account.

Cesar
2014-04-30  Cesar Philippidis  <cesar@codesourcery.com>

	gcc/
	* dwarf2cfi.c (dwf_regno): Don't assert reg is a pseudo
	register.

Comments

Jeff Law May 16, 2014, 7:33 p.m. UTC | #1
On 04/30/14 09:15, Cesar Philippidis wrote:
> I've been working on a patch to switch a few ppc targets to use softfp
> in libgcc instead of fpbit and I noticed that ppc-none-eabispe fails to
> bootstrap in both trunk and 4.9. The regression was introduced in
> <http://gcc.gnu.org/ml/gcc-patches/2013-11/msg03588.html>. Essentially,
> the assert for a hard register in dwf_regno () is not valid on ppc spe
> targets. In rs6000_dwarf_register_span (), there is a note stating:
>
>    /* The duality of the SPE register size wreaks all kinds of havoc.
>       This is a way of distinguishing r0 in 32-bits from r0 in
>       64-bits.  */
>
> and the function adds 1200 to regno, which makes that register appear to
> be a pseudo. This causes problems in dwf_regno (), which asserts that
> reg is a hard register. Since the dwarf2 pass is executed after register
> allocation it should, in theory, be ok for the rs6000 backend to be
> using a pseudo register for this application.
>
> Is this patch ok for trunk and 4.9? If so, please commit since I don't
> have an svn account.
It seems to me the real problem here is the SPE port and this silly game 
it plays with adding a large value to regno.

While it is currently safe to remove the assert, the assert is there to 
help catch cases where a pseudo has leaked through to a point where it 
shouldn't.

I'd rather look for another approach.

Jeff
diff mbox

Patch

diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 4180890..40ef0e2 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -906,7 +906,6 @@  notice_eh_throw (rtx insn)
 static inline unsigned
 dwf_regno (const_rtx reg)
 {
-  gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER);
   return DWARF_FRAME_REGNUM (REGNO (reg));
 }