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]

-fpic on powerpc is still not quite right.



The problem is that you can't change the stack configuration after
reload has finished eliminating the frame pointer, etc., registers.

Unfortunately, reload can still generate new memory references after
this point.

So with -fpic, every function must have a stack frame capable of at
least saving r30 (the PIC offset table register), even if it probably
won't need it.

Alternatively, we could teach find_reload about PIC offset table
registers...

I attach a patch.  I've checked it on the 19990716 prerelease.  It
causes no testsuite regressions.

It may be too late to include this in 2.95, but it should go on the
release branch.

-- 
Geoffrey Keating <geoffk@cygnus.com> <geoffk@ozemail.com.au>

===File ~/patches/egcs-13.diff==============================
Fri Jul 16 23:43:36 1999    <geoffk@cygnus.com>

	* config/rs6000/rs6000.c (rs6000_stack_info): Don't allow reload
	to change the stack frame configuration.

--- egcs-19990524/gcc/config/rs6000/rs6000.c~	Fri Jul 16 13:04:38 1999
+++ egcs-19990524/gcc/config/rs6000/rs6000.c	Fri Jul 16 23:43:17 1999
@@ -3395,7 +3395,14 @@
 
   /* Calculate which registers need to be saved & save area size */
   info_ptr->first_gp_reg_save = first_reg_to_save ();
-  info_ptr->gp_size = reg_size * (32 - info_ptr->first_gp_reg_save);
+  /* Assume that we will have to save PIC_OFFSET_TABLE_REGNUM, 
+     even if it currently looks like we won't.  */
+  if (flag_pic == 1 
+      && (abi == ABI_V4 || abi == ABI_SOLARIS)
+      && info_ptr->first_gp_reg_save > PIC_OFFSET_TABLE_REGNUM)
+    info_ptr->gp_size = reg_size * (32 - PIC_OFFSET_TABLE_REGNUM);
+  else
+    info_ptr->gp_size = reg_size * (32 - info_ptr->first_gp_reg_save);
 
   info_ptr->first_fp_reg_save = first_fp_reg_to_save ();
   info_ptr->fp_size = 8 * (64 - info_ptr->first_fp_reg_save);
============================================================


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