This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't remap sp or fp to argp/fp if it isn't a fixed reg (PR bootstrap/43403)


Hi!

The var-tracking remapping of sp resp. hfp to a cfa base register
(argp resp. fp depending on whether FRAME_POINTER_CFA_OFFSET or
ARG_POINTER_CFA_OFFSET is defined) I've added recently relies on
the reg we remap to being actually eliminated from code - that it will be
only present in MEM addresses where sp/hfp has been remapped to it.
I thought the eliminate_regs (reg, VOIDmode, 0) != reg check would be
sufficient for it, but apparently that's not the case at least on pa,
which has just sp and fp == hfp == argp and for !frame_pointer_needed
says fp has been eliminated to sp, yet the register 3 (REGNO (hfp) == 3)
is used in the code.  The following patch fixes that by not doing the
remapping if cfa_base_rtx is not a fixed register (it is not fixed reg
on pa, it is fixed on x86_64/i386/ppc/ppc64/s390/s390x at least).
Perhaps just the second test would be sufficient.

I've bootstrapped/regtested this on x86_64-linux and i686-linux, but
of course the patch does nothing there, since the condition is never
true.

2010-03-18  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/43403
	* var-tracking.c (vt_init_cfa_base): Do nothing if
	cfa_base_rtx would be hard_frame_pointer_rtx or non-fixed
	register.

--- gcc/var-tracking.c.jj	2010-03-17 15:29:42.000000000 +0100
+++ gcc/var-tracking.c	2010-03-17 21:54:58.000000000 +0100
@@ -7942,6 +7942,12 @@ vt_init_cfa_base (void)
 #else
   cfa_base_rtx = arg_pointer_rtx;
 #endif
+  if (cfa_base_rtx == hard_frame_pointer_rtx
+      || !fixed_regs[REGNO (cfa_base_rtx)])
+    {
+      cfa_base_rtx = NULL_RTX;
+      return;
+    }
   if (!MAY_HAVE_DEBUG_INSNS)
     return;
 

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]