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]

S/390: Simplify FPR save area slot accesses


Hello,

this is a minor simplification of the prolog/epilog generation code
that accesses FPR slots in the save area.  The most significant
effect of the cleanup is the removal of the assumption that the
save area contains *only* the GPR and FPR slots.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.

Bye,
Ulrich

ChangeLog:

	* config/s390/s390.c (s390_emit_prologue): Simplify accesses to
	FPR slots in the save area.
	(s390_emit_epilogue): Likewise.

Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.113
diff -c -p -r1.113 s390.c
*** gcc/config/s390/s390.c	4 Sep 2003 03:18:00 -0000	1.113
--- gcc/config/s390/s390.c	25 Sep 2003 19:40:31 -0000
*************** s390_emit_prologue (void)
*** 5493,5529 ****
    /* Save fprs for variable args.  */
  
    if (current_function_stdarg)
!     {
!       /* Save fpr 0 and 2.  */
! 
!       save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 32, 16);
!       save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 24, 17);
! 
!       if (TARGET_64BIT)
! 	{
! 	  /* Save fpr 4 and 6.  */
! 
! 	  save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 16, 18);
! 	  save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 8, 19);
! 	}
!     }
  
    /* Save fprs 4 and 6 if used (31 bit ABI).  */
  
    if (!TARGET_64BIT)
!     {
!       /* Save fpr 4 and 6.  */
!       if (regs_ever_live[18] && !global_regs[18])
! 	{
! 	  insn = save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 16, 18);
! 	  RTX_FRAME_RELATED_P (insn) = 1;
! 	}
!       if (regs_ever_live[19] && !global_regs[19])
  	{
! 	  insn = save_fpr (stack_pointer_rtx, STACK_POINTER_OFFSET - 8, 19);
  	  RTX_FRAME_RELATED_P (insn) = 1;
  	}
-     }
  
    /* Decrement stack pointer.  */
  
--- 5493,5510 ----
    /* Save fprs for variable args.  */
  
    if (current_function_stdarg)
!     for (i = 16; i < (TARGET_64BIT ? 20 : 18); i++)
!       save_fpr (stack_pointer_rtx, 16*UNITS_PER_WORD + 8*(i-16), i);
  
    /* Save fprs 4 and 6 if used (31 bit ABI).  */
  
    if (!TARGET_64BIT)
!     for (i = 18; i < 20; i++)
!       if (regs_ever_live[i] && !global_regs[i])
  	{
! 	  insn = save_fpr (stack_pointer_rtx, 16*UNITS_PER_WORD + 8*(i-16), i);
  	  RTX_FRAME_RELATED_P (insn) = 1;
  	}
  
    /* Decrement stack pointer.  */
  
*************** s390_emit_epilogue (void)
*** 5650,5655 ****
--- 5631,5637 ----
    rtx frame_pointer, return_reg;
    int area_bottom, area_top, offset = 0;
    rtvec p;
+   int i;
  
    if (TARGET_TPF)
      {
*************** s390_emit_epilogue (void)
*** 5705,5724 ****
      }
    else
      {
!       if (regs_ever_live[18] && !global_regs[18])
! 	{
! 	  if (area_bottom > STACK_POINTER_OFFSET - 16)
! 	    area_bottom = STACK_POINTER_OFFSET - 16;
! 	  if (area_top < STACK_POINTER_OFFSET - 8)
! 	    area_top = STACK_POINTER_OFFSET - 8;
! 	}
!       if (regs_ever_live[19] && !global_regs[19])
! 	{
! 	  if (area_bottom > STACK_POINTER_OFFSET - 8)
! 	    area_bottom = STACK_POINTER_OFFSET - 8;
! 	  if (area_top < STACK_POINTER_OFFSET)
! 	    area_top = STACK_POINTER_OFFSET;
! 	}
      }
  
    /* Check whether we can access the register save area.
--- 5687,5700 ----
      }
    else
      {
!       for (i = 18; i < 20; i++)
! 	if (regs_ever_live[i] && !global_regs[i])
! 	  {
! 	    if (area_bottom > 16*UNITS_PER_WORD + 8*(i-16))
! 	      area_bottom = 16*UNITS_PER_WORD + 8*(i-16);
! 	    if (area_top < 16*UNITS_PER_WORD + 8*(i-16) + 8)
! 	      area_top = 16*UNITS_PER_WORD + 8*(i-16) + 8;
! 	  } 
      }
  
    /* Check whether we can access the register save area.
*************** s390_emit_epilogue (void)
*** 5760,5767 ****
  
    if (TARGET_64BIT)
      {
-       int i;
- 
        if (cfun->machine->save_fprs_p)
  	for (i = 24; i < 32; i++)
  	  if (regs_ever_live[i] && !global_regs[i])
--- 5736,5741 ----
*************** s390_emit_epilogue (void)
*** 5770,5779 ****
      }
    else
      {
!       if (regs_ever_live[18] && !global_regs[18])
! 	restore_fpr (frame_pointer, offset + STACK_POINTER_OFFSET - 16, 18);
!       if (regs_ever_live[19] && !global_regs[19])
! 	restore_fpr (frame_pointer, offset + STACK_POINTER_OFFSET - 8, 19);
      }
  
    /* Return register.  */
--- 5744,5753 ----
      }
    else
      {
!       for (i = 18; i < 20; i++)
! 	if (regs_ever_live[i] && !global_regs[i])
! 	  restore_fpr (frame_pointer, 
! 		       offset + 16*UNITS_PER_WORD + 8*(i-16), i);
      }
  
    /* Return register.  */
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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