aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2008-12-21 12:50:59 +0100
committerUros Bizjak <uros@gcc.gnu.org>2008-12-21 12:50:59 +0100
commit76a4a1bd8db1311ffd020b5c7b900fc762b9684a (patch)
tree477e3223d4d59a6aa0cf9dc954bf161be0ddc611
parent10bcc2b8a11290732e186b2d795a1ce439993e6d (diff)
downloadgcc-76a4a1bd8db1311ffd020b5c7b900fc762b9684a.zip
gcc-76a4a1bd8db1311ffd020b5c7b900fc762b9684a.tar.gz
gcc-76a4a1bd8db1311ffd020b5c7b900fc762b9684a.tar.bz2
alpha.c (alpha_pad_noreturn): New static function.
* config/alpha/alpha.c (alpha_pad_noreturn): New static function. (alpha_reorg): Call alpha_pad_noreturn. From-SVN: r142858
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/config/alpha/alpha.c54
2 files changed, 64 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 65faf39..98b4531 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2008-12-21 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_pad_noreturn): New static function.
+ (alpha_reorg): Call alpha_pad_noreturn.
+
2008-12-21 Denis Chertykov <denisc@overta.ru>
* config/avr/avr.md ("andsi3"): Fix wrong cc attribute.
@@ -152,10 +157,10 @@
2008-12-17 Sebastian Pop <sebastian.pop@amd.com>
- * doc/install.texi (Prerequisites): Document PPL and CLooG-PPL
- dependences and the configure options.
- (Configuration): Document --with-cloog, --with-ppl, --with-cloog-lib,
- --with-ppl-lib, --with-cloog-incude, --with-ppl-include.
+ * doc/install.texi (Prerequisites): Document PPL and CLooG-PPL
+ dependences and the configure options.
+ (Configuration): Document --with-cloog, --with-ppl, --with-cloog-lib,
+ --with-ppl-lib, --with-cloog-incude, --with-ppl-include.
2008-12-17 H.J. Lu <hongjiu.lu@intel.com>
@@ -243,7 +248,7 @@
for the milli.a library.
2008-12-12 Andrew Pinski <andrew_pinskia@playstation.sony.com>
- Peter Bergner <bergner@vnet.ibm.com>
+ Peter Bergner <bergner@vnet.ibm.com>
PR target/24779
* config/rs6000/rs6000.md (call_indirect_aix32): Move the load of the
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 52ae122..d9ed21f 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -9299,12 +9299,66 @@ alpha_align_insns (unsigned int max_align,
i = next;
}
}
+
+/* Insert an unop between a noreturn function call and GP load. */
+
+static void
+alpha_pad_noreturn (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;
+
+ next = next_active_insn (insn);
+
+ if (next)
+ {
+ rtx pat = PATTERN (next);
+
+ if (GET_CODE (pat) == SET
+ && GET_CODE (SET_SRC (pat)) == UNSPEC_VOLATILE
+ && XINT (SET_SRC (pat), 1) == UNSPECV_LDGP1)
+ emit_insn_after (gen_unop (), insn);
+ }
+ }
+}
/* Machine dependent reorg pass. */
static void
alpha_reorg (void)
{
+ /* Workaround for a linker error that triggers when an
+ exception handler immediatelly follows a noreturn function.
+
+ The instruction stream from an object file:
+
+ 54: 00 40 5b 6b jsr ra,(t12),58 <__func+0x58>
+ 58: 00 00 ba 27 ldah gp,0(ra)
+ 5c: 00 00 bd 23 lda gp,0(gp)
+ 60: 00 00 7d a7 ldq t12,0(gp)
+ 64: 00 40 5b 6b jsr ra,(t12),68 <__func+0x68>
+
+ was converted in the final link pass to:
+
+ fdb24: a0 03 40 d3 bsr ra,fe9a8 <_called_func+0x8>
+ fdb28: 00 00 fe 2f unop
+ fdb2c: 00 00 fe 2f unop
+ fdb30: 30 82 7d a7 ldq t12,-32208(gp)
+ fdb34: 00 40 5b 6b jsr ra,(t12),fdb38 <__func+0x68>
+
+ 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
+ exception handler prologue. */
+
+ if (current_function_has_exception_handlers ())
+ alpha_pad_noreturn ();
+
if (alpha_tp != ALPHA_TP_PROG || flag_exceptions)
alpha_handle_trap_shadows ();