public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: RL78: Save the frame pointer if it is used.
@ 2015-05-05 14:41 Nick Clifton
  2015-05-05 19:12 ` DJ Delorie
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2015-05-05 14:41 UTC (permalink / raw)
  To: dj; +Cc: gcc-patches

Hi DJ,

  Below is a small patch to fix a small problem with the need_to_save()
  function in the RL78 backend.  It was only marking the frame pointer
  register as needing a save if the frame pointer was in use.  But since
  the frame pointer is call-saved it needs to be saved any time it is
  used, even if it is not being used as a frame pointer.  This problem
  has not arisen before because the frame pointer is also marked as
  being fixed.  But it turns out that it can still be used inside some
  inline assembler, and so the prologue and epilogue code still need to
  save and restore it.

  Tested with no regressions on an rl78-elf toolchain.

  OK to apply ?

Cheers
  Nick

gcc/ChangeLog
2015-05-05  Nick Clifton  <nickc@redhat.com>

	* config/rl78/rl78.c (need_to_save): Save the frame pointer any
	time that it is used.

Index: gcc/config/rl78/rl78.c
===================================================================
--- gcc/config/rl78/rl78.c	(revision 222796)
+++ gcc/config/rl78/rl78.c	(working copy)
@@ -687,7 +687,8 @@
       return df_regs_ever_live_p (regno);
     }
 
-  if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed)
+  if (regno == FRAME_POINTER_REGNUM
+      && (frame_pointer_needed || df_regs_ever_live_p (regno)))
     return true;
   if (fixed_regs[regno])
     return false;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-06 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-05 14:41 RFA: RL78: Save the frame pointer if it is used Nick Clifton
2015-05-05 19:12 ` DJ Delorie
2015-05-06 10:17   ` Nicholas Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).