diff mbox

RX: Fix a few small bugs

Message ID m3r5hd7tkq.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Sept. 1, 2010, 8:32 a.m. UTC
Hi Guys,

  I am applying the patch below to fix a small problems with the RX
  backend.  The first was that interrupt handlers were not saving call
  clobbered registers in their prologue, which meant that they could not
  safely call other functions.

  The second problem was that when the accumulator was saved in the
  prologue the code was bumping the frame_size count, even though this
  was unnecessary and wrong.

Cheers
  Nick
  
gcc/ChangeLog
2010-09-01  Nick Clifton  <nickc@redhat.com>

	* config/rx/rx.c (rx_expand_prologue): Do not adjust frame size
	when pushing accumulator register.
	(rx_get_stack_layout): Always save call clobbered registers inside
	interrupt handlers.
	* config/rx/rx-modes.def: Fix descriptive comment at start of file.
diff mbox

Patch

Index: gcc/config/rx/rx.c
===================================================================
--- gcc/config/rx/rx.c	(revision 163718)
+++ gcc/config/rx/rx.c	(working copy)
@@ -1067,7 +1067,11 @@ 
 
   for (save_mask = high = low = 0, reg = 1; reg < CC_REGNUM; reg++)
     {
-      if (df_regs_ever_live_p (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)))
 	  && (! call_used_regs[reg]
 	      /* Even call clobbered registered must
 		 be pushed inside interrupt handlers.  */
@@ -1307,8 +1311,6 @@ 
 	  emit_insn (gen_stack_pushm (GEN_INT (2 * UNITS_PER_WORD),
 				      gen_rx_store_vector (acc_low, acc_high)));
 	}
-
-      frame_size += 2 * UNITS_PER_WORD;
     }
 
   /* If needed, set up the frame pointer.  */
Index: gcc/config/rx/rx-modes.def
===================================================================
--- gcc/config/rx/rx-modes.def	(revision 163718)
+++ gcc/config/rx/rx-modes.def	(working copy)
@@ -1,9 +1,6 @@ 
-/* Definitions of target machine for GNU compiler, for ARM.
-   Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
-   Contributed by Pieter `Tiggr' Schoenmakers (rcpieter@win.tue.nl)
-   and Martin Simmons (@harleqn.co.uk).
-   More major hacks by Richard Earnshaw (rearnsha@arm.com)
-   Minor hacks by Nick Clifton (nickc@cygnus.com)
+/* Definitions of target specific machine modes for the RX.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Contributed by Red Hat.
 
    This file is part of GCC.