Patchwork RX: only safe call clobbered registers inside non-leaf interrupt handlers

login
register
mail settings
Submitter Nick Clifton
Date Jan. 31, 2011, 11:42 a.m.
Message ID <m3r5btwb87.fsf@redhat.com>
Download mbox | patch
Permalink /patch/81095/
State New
Headers show

Comments

Nick Clifton - Jan. 31, 2011, 11:42 a.m.
Hi Guys,

  I am applying the patch below to improve the prologues and epilogues
  of interrupt handlers.  Currently we always save all of the
  call-clobbered registers, even if they are not live, as there is a
  possibility that they might be used by a function call from the
  interrupt handler.  This is not necessary however if the handler is a
  leaf function, and so this patch adds that check.

Cheers
  Nick

gcc/ChangeLog
2011-01-31  Nick Clifton  <nickc@redhat.com>

	* config/rx/rx.c (rx_get_stack_layout): Only save call clobbered
	registers inside interrupt handlers if the handler is not a leaf
	function.

Patch

Index: config/rx/rx.c
===================================================================
--- config/rx/rx.c	(revision 169431)
+++ config/rx/rx.c	(working copy)
@@ -1137,10 +1137,12 @@ 
   for (save_mask = high = low = 0, reg = 1; reg < CC_REGNUM; reg++)
     {
       if ((df_regs_ever_live_p (reg)
-	   /* Always save all call clobbered registers inside interrupt
-	      handlers, even if they are not live - they may be used in
-	      routines called from this one.  */
-	   || (call_used_regs[reg] && is_interrupt_func (NULL_TREE)))
+	   /* Always save all call clobbered registers inside non-leaf
+	      interrupt handlers, even if they are not live - they may
+	      be used in (non-interrupt aware) routines called from this one.  */
+	   || (call_used_regs[reg]
+	       && is_interrupt_func (NULL_TREE)
+	       && ! current_function_is_leaf))
 	  && (! call_used_regs[reg]
 	      /* Even call clobbered registered must
 		 be pushed inside interrupt handlers.  */