]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: sh.c (sh_expand_epilogue): Fix interrupt handler register popping order.
authorKaz Kojima <kkojima@gcc.gnu.org>
Tue, 23 Mar 2010 23:07:42 +0000 (23:07 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Tue, 23 Mar 2010 23:07:42 +0000 (23:07 +0000)
Backport from mainline:
2010-01-08  DJ Delorie  <dj@redhat.com>

* config/sh/sh.c (sh_expand_epilogue): Fix interrupt handler
register popping order.

From-SVN: r157684

gcc/ChangeLog
gcc/config/sh/sh.c

index 92e531f886b6d91c70a2f4043b5e66fe82dfe4f7..3b6692cc69baffe9543f26cddea04d0d967a8702 100644 (file)
@@ -1,3 +1,11 @@
+2010-03-23  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       Backport from mainline:
+       2010-01-08  DJ Delorie  <dj@redhat.com>
+
+       * config/sh/sh.c (sh_expand_epilogue): Fix interrupt handler
+       register popping order.
+
 2010-03-21  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR middle-end/42718
index 2db614209a404d6a1608e2da79455c7712e350cd..7748153343e5ecb8a0c3a3d2ef3167d6952e0dbf 100644 (file)
@@ -1,6 +1,6 @@
 /* Output routines for GCC for Renesas / SuperH SH.
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
    Contributed by Steve Chamberlain (sac@cygnus.com).
    Improved by Jim Wilson (wilson@cygnus.com).
 
@@ -6720,13 +6720,13 @@ sh_expand_epilogue (bool sibcall_p)
          pop (PR_REG);
        }
 
-      /* Banked registers are poped first to avoid being scheduled in the
+      /* Banked registers are popped first to avoid being scheduled in the
         delay slot. RTE switches banks before the ds instruction.  */
       if (current_function_interrupt)
        {
-         for (i = FIRST_BANKED_REG; i <= LAST_BANKED_REG; i++)
-           if (TEST_HARD_REG_BIT (live_regs_mask, i)) 
-             pop (LAST_BANKED_REG - i);
+         for (i = LAST_BANKED_REG; i >= FIRST_BANKED_REG; i--)
+           if (TEST_HARD_REG_BIT (live_regs_mask, i))
+             pop (i);
 
          last_reg = FIRST_PSEUDO_REGISTER - LAST_BANKED_REG - 1;
        }