From: Uros Bizjak Date: Sun, 21 Dec 2008 11:50:59 +0000 (+0100) Subject: alpha.c (alpha_pad_noreturn): New static function. X-Git-Tag: releases/gcc-4.4.0~1153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=76a4a1bd8db1311ffd020b5c7b900fc762b9684a;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65faf39f5dd3..98b4531d2308 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-12-21 Uros Bizjak + + * config/alpha/alpha.c (alpha_pad_noreturn): New static function. + (alpha_reorg): Call alpha_pad_noreturn. + 2008-12-21 Denis Chertykov * config/avr/avr.md ("andsi3"): Fix wrong cc attribute. @@ -152,10 +157,10 @@ 2008-12-17 Sebastian Pop - * 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 @@ -243,7 +248,7 @@ for the milli.a library. 2008-12-12 Andrew Pinski - Peter Bergner + Peter Bergner 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 52ae122f6eda..d9ed21fba497 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 ();