rs6000.c (rs6000_stack_info): Don't zero offsets when not saving registers.
authorAlan Modra <amodra@gmail.com>
Wed, 20 May 2015 01:15:59 +0000 (10:45 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Wed, 20 May 2015 01:15:59 +0000 (10:45 +0930)
* config/rs6000/rs6000.c (rs6000_stack_info): Don't zero offsets
when not saving registers.
(debug_stack_info): Adjust to omit printing unused offsets,
as before.
(rs6000_emit_epilogue): Adjust use_backchain_to_restore_sp
expression.

From-SVN: r223424

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

index 4131b902311344790df6ca89f43715ed5780013e..5fa48fa7d33bcff184ea2885c1562c3dee2cd4f6 100644 (file)
@@ -1,3 +1,12 @@
+2015-05-20  Alan Modra  <amodra@gmail.com>
+
+       * config/rs6000/rs6000.c (rs6000_stack_info): Don't zero offsets
+       when not saving registers.
+       (debug_stack_info): Adjust to omit printing unused offsets,
+       as before.
+       (rs6000_emit_epilogue): Adjust use_backchain_to_restore_sp
+       expression.
+
 2015-05-19  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
 
        PR c++/65835
index 66f78a1f329c3c2e72872ad290a41eee04b08712..488799efd639b7a4b9dbec491ca391d01460fe26 100644 (file)
@@ -22013,31 +22013,6 @@ rs6000_stack_info (void)
   else
     info_ptr->push_p = non_fixed_size > (TARGET_32BIT ? 220 : 288);
 
-  /* Zero offsets if we're not saving those registers.  */
-  if (info_ptr->fp_size == 0)
-    info_ptr->fp_save_offset = 0;
-
-  if (info_ptr->gp_size == 0)
-    info_ptr->gp_save_offset = 0;
-
-  if (! TARGET_ALTIVEC_ABI || info_ptr->altivec_size == 0)
-    info_ptr->altivec_save_offset = 0;
-
-  /* Zero VRSAVE offset if not saved and restored.  */
-  if (! TARGET_ALTIVEC_VRSAVE || info_ptr->vrsave_mask == 0)
-    info_ptr->vrsave_save_offset = 0;
-
-  if (! TARGET_SPE_ABI
-      || info_ptr->spe_64bit_regs_used == 0
-      || info_ptr->spe_gp_size == 0)
-    info_ptr->spe_gp_save_offset = 0;
-
-  if (! info_ptr->lr_save_p)
-    info_ptr->lr_save_offset = 0;
-
-  if (! info_ptr->cr_save_p)
-    info_ptr->cr_save_offset = 0;
-
   return info_ptr;
 }
 
@@ -22143,28 +22118,28 @@ debug_stack_info (rs6000_stack_t *info)
   if (info->calls_p)
     fprintf (stderr, "\tcalls_p             = %5d\n", info->calls_p);
 
-  if (info->gp_save_offset)
+  if (info->gp_size)
     fprintf (stderr, "\tgp_save_offset      = %5d\n", info->gp_save_offset);
 
-  if (info->fp_save_offset)
+  if (info->fp_size)
     fprintf (stderr, "\tfp_save_offset      = %5d\n", info->fp_save_offset);
 
-  if (info->altivec_save_offset)
+  if (info->altivec_size)
     fprintf (stderr, "\taltivec_save_offset = %5d\n",
             info->altivec_save_offset);
 
-  if (info->spe_gp_save_offset)
+  if (info->spe_gp_size == 0)
     fprintf (stderr, "\tspe_gp_save_offset  = %5d\n",
             info->spe_gp_save_offset);
 
-  if (info->vrsave_save_offset)
+  if (info->vrsave_size)
     fprintf (stderr, "\tvrsave_save_offset  = %5d\n",
             info->vrsave_save_offset);
 
-  if (info->lr_save_offset)
+  if (info->lr_save_p)
     fprintf (stderr, "\tlr_save_offset      = %5d\n", info->lr_save_offset);
 
-  if (info->cr_save_offset)
+  if (info->cr_save_p)
     fprintf (stderr, "\tcr_save_offset      = %5d\n", info->cr_save_offset);
 
   if (info->varargs_save_offset)
@@ -24735,7 +24710,9 @@ rs6000_emit_epilogue (int sibcall)
      here will not trigger at the moment;  We don't actually need a
      frame pointer for alloca, but the generic parts of the compiler
      give us one anyway.  */
-  use_backchain_to_restore_sp = (info->total_size > 32767 - info->lr_save_offset
+  use_backchain_to_restore_sp = (info->total_size + (info->lr_save_p
+                                                    ? info->lr_save_offset
+                                                    : 0) > 32767
                                 || (cfun->calls_alloca
                                     && !frame_pointer_needed));
   restore_lr = (info->lr_save_p