]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: alpha.c (alpha_pad_noreturn): Rename to ...
authorUros Bizjak <uros@gcc.gnu.org>
Thu, 9 Aug 2012 21:49:40 +0000 (23:49 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 9 Aug 2012 21:49:40 +0000 (23:49 +0200)
Backport from mainline
2012-08-09  Uros Bizjak  <ubizjak@gmail.com>

* config/alpha/alpha.c (alpha_pad_noreturn): Rename to ...
(alpha_pad_function_end): ... this.  Also insert NOP between
sibling call and GP load.
(alpha_reorg): Update call to alpha_pad_function_end.  Expand comment.

From-SVN: r190267

gcc/ChangeLog
gcc/config/alpha/alpha.c

index 6abd1c4c25a6027f2de0887e26dd2d8aed36b12c..f9790d4aee690ddba7fe9d04ebd4ce5af87536c5 100644 (file)
@@ -1,9 +1,19 @@
+2012-08-09  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2012-08-09  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/alpha/alpha.c (alpha_pad_noreturn): Rename to ...
+       (alpha_pad_function_end): ... this.  Also insert NOP between
+       sibling call and GP load.
+       (alpha_reorg): Update call to alpha_pad_function_end.  Expand comment.
+
 2012-07-22  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/33135
        * config/sh/sh.opt (mieee): Use Var instead of Mask.  Correct
        description.
-       * config/sh/sh.c (sh_option_override): Do not change 
+       * config/sh/sh.c (sh_option_override): Do not change
        flag_finite_math_only.  Set TARGET_IEEE to complement of
        flag_finite_math_only.
        * doc/invoke.texi (SH options): Add mno-ieee.  Correct
index 2f4873eb6c209d6b20e27c6332f2e3528aa0bdc0..ba6179e713771ba1270578e9bc44894ecec74e4c 100644 (file)
@@ -9648,18 +9648,19 @@ alpha_align_insns (unsigned int max_align,
     }
 }
 
-/* Insert an unop between a noreturn function call and GP load.  */
+/* Insert an unop between sibcall or noreturn function call and GP load.  */
 
 static void
-alpha_pad_noreturn (void)
+alpha_pad_function_end (void)
 {
   rtx insn, next;
 
   for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
-      if (!CALL_P (insn)
-         || !find_reg_note (insn, REG_NORETURN, NULL_RTX))
-        continue;
+      if (! (CALL_P (insn)
+            && (SIBLING_CALL_P (insn)
+                || find_reg_note (insn, REG_NORETURN, NULL_RTX))))
+       continue;
 
       next = next_active_insn (insn);
 
@@ -9680,8 +9681,28 @@ alpha_pad_noreturn (void)
 static void
 alpha_reorg (void)
 {
-  /* Workaround for a linker error that triggers when an
-     exception handler immediatelly follows a noreturn function.
+  /* Workaround for a linker error that triggers when an exception
+     handler immediatelly follows a sibcall or a noreturn function.
+
+In the sibcall case:
+
+     The instruction stream from an object file:
+
+ 1d8:   00 00 fb 6b     jmp     (t12)
+ 1dc:   00 00 ba 27     ldah    gp,0(ra)
+ 1e0:   00 00 bd 23     lda     gp,0(gp)
+ 1e4:   00 00 7d a7     ldq     t12,0(gp)
+ 1e8:   00 40 5b 6b     jsr     ra,(t12),1ec <__funcZ+0x1ec>
+
+     was converted in the final link pass to:
+
+   12003aa88:   67 fa ff c3     br      120039428 <...>
+   12003aa8c:   00 00 fe 2f     unop
+   12003aa90:   00 00 fe 2f     unop
+   12003aa94:   48 83 7d a7     ldq     t12,-31928(gp)
+   12003aa98:   00 40 5b 6b     jsr     ra,(t12),12003aa9c <__func+0x1ec>
+
+And in the noreturn case:
 
      The instruction stream from an object file:
 
@@ -9701,11 +9722,11 @@ alpha_reorg (void)
 
      GP load instructions were wrongly cleared by the linker relaxation
      pass.  This workaround prevents removal of GP loads by inserting
-     an unop instruction between a noreturn function call and
+     an unop instruction between a sibcall or noreturn function call and
      exception handler prologue.  */
 
   if (current_function_has_exception_handlers ())
-    alpha_pad_noreturn ();
+    alpha_pad_function_end ();
 
   if (alpha_tp != ALPHA_TP_PROG || flag_exceptions)
     alpha_handle_trap_shadows ();