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]

[Committed] S/390: Use fix stack slots for FPRs saved due to stdarg


Hi,

for stdarg the floating point argument registers in the register save
area must reside at an ABI-defined offset relative to the start of the save
area.  So far were not able to optimize away save instructions with
the packed stack layout since this changed the offsets.

With the attached patch we use dedicated slots when saving FPR
argument registers and are now able to get rid of unnecessary saves
that way.

Bootstrapped and regression tested.

Committed to mainline.

Bye,

-Andreas-


2013-10-09  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* config/s390/s390.c (s390_register_info_stdarg_fpr): Remove
	packed stack special handling.
	(s390_frame_info, s390_emit_prologue, s390_emit_epilogue): Switch
	back to fixed stack slots for FPRs saved due to stdarg.

---
 gcc/config/s390/s390.c |   39 ++-------!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 1 file changed, 2 insertions(+), 7 deletions(-), 30 modifications(!)

Index: gcc/config/s390/s390.c
===================================================================
*** gcc/config/s390/s390.c.orig
--- gcc/config/s390/s390.c
*************** s390_register_info_stdarg_fpr ()
*** 7589,7601 ****
    if (max_fpr > FP_ARG_NUM_REG)
      max_fpr = FP_ARG_NUM_REG;
  
-   /* The va_arg algorithm accesses the FPRs in the reg save area using
-      a constant offset from r0.  With the packed stack layout omitting
-      FPRs from the beginning would change the offset for the
-      subsequent FPRs.  */
-   if (TARGET_PACKED_STACK)
-     min_fpr = 0;
- 
    for (i = min_fpr; i < max_fpr; i++)
      cfun_set_fpr_save (i + FPR0_REGNUM);
  }
--- 7589,7594 ----
*************** s390_frame_info (void)
*** 7836,7851 ****
      }
    else
      {
        /* Packed stack layout without backchain.  */
!       cfun_frame_layout.f4_offset
! 	= (STACK_POINTER_OFFSET
! 	   - 8 * (cfun_fpr_save_p (FPR4_REGNUM)
! 		  + cfun_fpr_save_p (FPR6_REGNUM)));
! 
!       cfun_frame_layout.f0_offset
! 	= (cfun_frame_layout.f4_offset
! 	   - 8 * (cfun_fpr_save_p (FPR0_REGNUM)
! 		  + cfun_fpr_save_p (FPR2_REGNUM)));
  
        cfun_frame_layout.gprs_offset
  	= cfun_frame_layout.f0_offset - cfun_gprs_save_area_size;
--- 7829,7848 ----
      }
    else
      {
+       int num_fprs;
+ 
        /* Packed stack layout without backchain.  */
! 
!       /* With stdarg FPRs need their dedicated slots.  */
!       num_fprs = (TARGET_64BIT && cfun->stdarg ? 2
! 		  : (cfun_fpr_save_p (FPR4_REGNUM) +
! 		     cfun_fpr_save_p (FPR6_REGNUM)));
!       cfun_frame_layout.f4_offset = STACK_POINTER_OFFSET - 8 * num_fprs;
! 
!       num_fprs = (cfun->stdarg ? 2
! 		  : (cfun_fpr_save_p (FPR0_REGNUM)
! 		     + cfun_fpr_save_p (FPR2_REGNUM)));
!       cfun_frame_layout.f0_offset = cfun_frame_layout.f4_offset - 8 * num_fprs;
  
        cfun_frame_layout.gprs_offset
  	= cfun_frame_layout.f0_offset - cfun_gprs_save_area_size;
*************** s390_emit_prologue (void)
*** 8680,8687 ****
  	  save_fpr (stack_pointer_rtx, offset, i);
  	  offset += 8;
  	}
!       else if (!TARGET_PACKED_STACK)
! 	  offset += 8;
      }
  
    /* Save f4 and f6.  */
--- 8677,8684 ----
  	  save_fpr (stack_pointer_rtx, offset, i);
  	  offset += 8;
  	}
!       else if (!TARGET_PACKED_STACK || cfun->stdarg)
! 	offset += 8;
      }
  
    /* Save f4 and f6.  */
*************** s390_emit_prologue (void)
*** 8693,8704 ****
  	  insn = save_fpr (stack_pointer_rtx, offset, i);
  	  offset += 8;
  
! 	  /* If f4 and f6 are call clobbered they are saved due to stdargs and
! 	     therefore are not frame related.  */
  	  if (!call_really_used_regs[i])
  	    RTX_FRAME_RELATED_P (insn) = 1;
  	}
!       else if (!TARGET_PACKED_STACK)
  	offset += 8;
      }
  
--- 8690,8701 ----
  	  insn = save_fpr (stack_pointer_rtx, offset, i);
  	  offset += 8;
  
! 	  /* If f4 and f6 are call clobbered they are saved due to
! 	     stdargs and therefore are not frame related.  */
  	  if (!call_really_used_regs[i])
  	    RTX_FRAME_RELATED_P (insn) = 1;
  	}
!       else if (!TARGET_PACKED_STACK || call_really_used_regs[i])
  	offset += 8;
      }
  


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