[PATCH] SH2A: Don't push/pop registers for functions with resbank attribute

Kaz Kojima kkojima@rr.iij4u.or.jp
Thu Mar 29 21:40:00 GMT 2012


"Naveen H. S" <Naveen.S@kpitcummins.com> wrote:
> Please find attached the patch "resbank.patch" which fixes the issue
> with "resbank" attribute. Currently, registers used in the routine are 
> also saved on using resbank attribute. These registers are saved with
> resbank instruction and need not be saved separately.
> The patch fixes the issue. 

Looks that the patch ignores the case using movml.  It could
be something like the attached patch, though I don't do any
tests.

	* config/sh/sh.c (push_regs): Skip banked registers when
	resbank attribute is specified.
	(sh_expand_epilogue): Likewise.

--- ORIG/trunk/gcc/config/sh/sh.c	2012-03-28 17:51:20.000000000 +0900
+++ trunk/gcc/config/sh/sh.c	2012-03-29 21:59:13.000000000 +0900
@@ -6487,7 +6487,9 @@ push_regs (HARD_REG_SET *mask, int inter
 	    use_movml = true;
 	}
 
-      if (use_movml)
+      if (sh_cfun_resbank_handler_p ())
+	; /* Do nothing.  */
+      else if (use_movml)
 	{
 	  rtx x, mem, reg, set;
 	  rtx sp_reg = gen_rtx_REG (SImode, STACK_POINTER_REGNUM);
@@ -7485,7 +7487,9 @@ sh_expand_epilogue (bool sibcall_p)
 		use_movml = true;
 	    }
 
-	  if (use_movml)
+	  if (sh_cfun_resbank_handler_p ())
+	    ; /* Do nothing.  */
+	  else if (use_movml)
 	    {
 	      rtx sp_reg = gen_rtx_REG (SImode, STACK_POINTER_REGNUM);
 



More information about the Gcc-patches mailing list