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]

New target macro HARD_REGNO_CALLER_SAVE_MODE



This patch introduces a new target macro HARD_REGNO_CALLER_SAVE_MODE
so that the backend can specify which modes should be used to preserve
caller save registers (or alternatively to disable caller save for
specific registers).

This patch has no effect on existing targets.


Sun Sep 27 10:27:46 1998  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>

	* regs.h (HARD_REGNO_CALLER_SAVE_MODE): New macro.
	* caller-save.c (init_caller_save): Use it.

Index: regs.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/regs.h,v
retrieving revision 1.4
diff -c -p -r1.4 regs.h
*** regs.h	1998/07/02 13:49:32	1.4
--- regs.h	1998/09/29 09:24:36
*************** extern int caller_save_needed;
*** 211,216 ****
--- 211,222 ----
  #define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1)
  #endif
  
+ /* Select a register mode required for caller save of hard regno REGNO.  */
+ #ifndef HARD_REGNO_CALLER_SAVE_MODE
+ #define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS) \
+   choose_hard_reg_mode (REGNO, NREGS)
+ #endif
+ 
  /* Allocated in local_alloc.  */
  
  /* A list of SCRATCH rtl allocated by local-alloc.  */
Index: caller-save.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/caller-save.c,v
retrieving revision 1.9
diff -c -p -r1.9 caller-save.c
*** caller-save.c	1998/06/19 23:36:53	1.9
--- caller-save.c	1998/09/29 09:24:57
*************** init_caller_save ()
*** 115,121 ****
  	{
  	  for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
  	    {
! 	      regno_save_mode[i][j] = choose_hard_reg_mode (i, j);
  	      if (regno_save_mode[i][j] == VOIDmode && j == 1)
  		{
  		  call_fixed_regs[i] = 1;
--- 115,121 ----
  	{
  	  for (j = 1; j <= MOVE_MAX / UNITS_PER_WORD; j++)
  	    {
! 	      regno_save_mode[i][j] = HARD_REGNO_CALLER_SAVE_MODE (i, j);
  	      if (regno_save_mode[i][j] == VOIDmode && j == 1)
  		{
  		  call_fixed_regs[i] = 1;
Index: tm.texi
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/tm.texi,v
retrieving revision 1.50
diff -c -p -r1.50 tm.texi
*** tm.texi	1998/09/15 19:19:00	1.50
--- tm.texi	1998/09/29 09:26:37
*************** this is worth doing, and 0 otherwise.
*** 3174,3179 ****
--- 3185,3198 ----
  
  If you don't define this macro, a default is used which is good on most
  machines: @code{4 * @var{calls} < @var{refs}}.
+ 
+ @findex HARD_REGNO_CALLER_SAVE_MODE
+ @item HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs})
+ A C expression specifying which mode is required for saving @var{nregs}
+ of a pseudo-register in call-clobbered hard register @var{regno}.  If
+ @var{regno} is unsuitable for caller save, @code{VOIDmode} should be
+ returned.  For most machines this macro need not be defined since GCC
+ will select the smallest suitable mode.
  @end table
  
  @node Function Entry


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