rs6000.c (rs6000_stack_info): Allocate space for the GOT pointer only if there is...
authorDaniel Jacobowitz <dan@codesourcery.com>
Tue, 4 Sep 2007 13:46:47 +0000 (13:46 +0000)
committerDaniel Jacobowitz <drow@gcc.gnu.org>
Tue, 4 Sep 2007 13:46:47 +0000 (13:46 +0000)
* config/rs6000/rs6000.c (rs6000_stack_info): Allocate space for the
GOT pointer only if there is a constant pool.  Use the allocated space
for SPE also.

From-SVN: r128080

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 530f5421e8800dee89f2080e19618948600286ba..1dd19c04c985ad4274b6bd538cb10529df32a7c7 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-04  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * config/rs6000/rs6000.c (rs6000_stack_info): Allocate space for the
+       GOT pointer only if there is a constant pool.  Use the allocated space
+       for SPE also.
+
 2007-09-04  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Correct
index 83b4ed2d83a6a5d8364bb0a13fdec58299ca105f..9768a3f4909c38517ced90033412b0cc846e5284 100644 (file)
@@ -13910,6 +13910,7 @@ rs6000_stack_info (void)
   int reg_size = TARGET_32BIT ? 4 : 8;
   int ehrd_size;
   int save_align;
+  int first_gp;
   HOST_WIDE_INT non_fixed_size;
 
   memset (&info, 0, sizeof (info));
@@ -13929,14 +13930,19 @@ rs6000_stack_info (void)
   /* Calculate which registers need to be saved & save area size.  */
   info_ptr->first_gp_reg_save = first_reg_to_save ();
   /* Assume that we will have to save RS6000_PIC_OFFSET_TABLE_REGNUM,
-     even if it currently looks like we won't.  */
+     even if it currently looks like we won't.  Reload may need it to
+     get at a constant; if so, it will have already created a constant
+     pool entry for it.  */
   if (((TARGET_TOC && TARGET_MINIMAL_TOC)
        || (flag_pic == 1 && DEFAULT_ABI == ABI_V4)
        || (flag_pic && DEFAULT_ABI == ABI_DARWIN))
+      && current_function_uses_const_pool
       && info_ptr->first_gp_reg_save > RS6000_PIC_OFFSET_TABLE_REGNUM)
-    info_ptr->gp_size = reg_size * (32 - RS6000_PIC_OFFSET_TABLE_REGNUM);
+    first_gp = RS6000_PIC_OFFSET_TABLE_REGNUM;
   else
-    info_ptr->gp_size = reg_size * (32 - info_ptr->first_gp_reg_save);
+    first_gp = info_ptr->first_gp_reg_save;
+
+  info_ptr->gp_size = reg_size * (32 - first_gp);
 
   /* For the SPE, we have an additional upper 32-bits on each GPR.
      Ideally we should save the entire 64-bits only when the upper
@@ -14024,7 +14030,7 @@ rs6000_stack_info (void)
            + info_ptr->parm_size);
 
   if (TARGET_SPE_ABI && info_ptr->spe_64bit_regs_used != 0)
-    info_ptr->spe_gp_size = 8 * (32 - info_ptr->first_gp_reg_save);
+    info_ptr->spe_gp_size = 8 * (32 - first_gp);
   else
     info_ptr->spe_gp_size = 0;