caller-save update part 2

Jan Hubicka jh@suse.cz
Fri Mar 2 03:06:00 GMT 2001


Hi
This patch updates caller-save to use proper modes for allocating stack space.
This is needed for proper stack alignment in i386.c

Honza

Fri Mar  2 12:04:15 CET 2001  Jan Hubicka  <jh@suse.cz>
	* caller-save.c (setup_save_areas): Allocate areas in the proper mode.
Index: caller-save.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/caller-save.c,v
retrieving revision 1.35
diff -c -3 -p -r1.35 caller-save.c
*** caller-save.c	2001/02/28 21:32:54	1.35
--- caller-save.c	2001/03/02 11:04:03
*************** setup_save_areas ()
*** 270,276 ****
--- 270,279 ----
    int i, j, k;
    unsigned int r;
    HARD_REG_SET hard_regs_used;
+   enum machine_mode save_mode [FIRST_PSEUDO_REGISTER];
  
+   for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+       save_mode [i] = VOIDmode;
    /* Allocate space in the save area for the largest multi-register
       pseudos first, then work backwards to single register
       pseudos.  */
*************** setup_save_areas ()
*** 281,288 ****
      if (reg_renumber[i] >= 0 && REG_N_CALLS_CROSSED (i) > 0)
        {
  	unsigned int regno = reg_renumber[i];
! 	unsigned int endregno 
! 	  = regno + HARD_REGNO_NREGS (regno, GET_MODE (regno_reg_rtx[i]));
  
  	for (r = regno; r < endregno; r++)
  	  if (call_used_regs[r])
--- 284,298 ----
      if (reg_renumber[i] >= 0 && REG_N_CALLS_CROSSED (i) > 0)
        {
  	unsigned int regno = reg_renumber[i];
! 	unsigned int nregs = HARD_REGNO_NREGS (regno,
! 					       GET_MODE (regno_reg_rtx[i]));
! 	unsigned int endregno = regno + nregs;
! 	enum machine_mode mode;
! 
! 	mode = HARD_REGNO_CALLER_SAVE_MODE
! 		 (regno, nregs, PSEUDO_REGNO_MODE (i));
! 	if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (save_mode[regno]))
! 	  save_mode[regno] = mode;
  
  	for (r = regno; r < endregno; r++)
  	  if (call_used_regs[r])
*************** setup_save_areas ()
*** 297,302 ****
--- 307,313 ----
      for (j = MOVE_MAX_WORDS; j > 0; j--)
        {
  	int do_save = 1;
+ 	enum machine_mode mode;
  
  	/* If no mode exists for this size, try another.  Also break out
  	   if we have already saved this hard register.  */
*************** setup_save_areas ()
*** 322,331 ****
  	if (! do_save)
  	  continue;
  
  	/* We have found an acceptable mode to store in.  */
  	regno_save_mem[i][j]
! 	  = assign_stack_local (regno_save_mode[i][j],
! 				GET_MODE_SIZE (regno_save_mode[i][j]), 0);
  
  	/* Setup single word save area just in case...  */
  	for (k = 0; k < j; k++)
--- 333,347 ----
  	if (! do_save)
  	  continue;
  
+ 	mode = regno_save_mode[i][j];
+ 	if (save_mode [i] != VOIDmode
+ 	    && save_mode [i] != mode
+ 	    && j == HARD_REGNO_NREGS (i, save_mode [i]))
+ 	  mode = save_mode[i];
+ 
  	/* We have found an acceptable mode to store in.  */
  	regno_save_mem[i][j]
! 	  = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
  
  	/* Setup single word save area just in case...  */
  	for (k = 0; k < j; k++)
*************** save_call_clobbered_regs ()
*** 417,423 ****
  		   int r = reg_renumber[regno];
  		   int nregs;
  
! 		   if (r >= 0)
  		     {
  		       enum machine_mode mode;
  
--- 433,439 ----
  		   int r = reg_renumber[regno];
  		   int nregs;
  
! 		   if (r > 0)
  		     {
  		       enum machine_mode mode;
  



More information about the Gcc-patches mailing list