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  <ni...@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;

Reply via email to