From: Eric Botcazou Date: Sat, 21 May 2011 22:50:20 +0000 (+0000) Subject: sparc.md (setjmp): Handle PIC mode and use the hard frame pointer. X-Git-Tag: releases/gcc-4.5.4~630 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28786603a552c4954b6197216a0306ab020174df;p=thirdparty%2Fgcc.git sparc.md (setjmp): Handle PIC mode and use the hard frame pointer. * config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard frame pointer. From-SVN: r174015 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 70023d476c5f..9cbe84247d78 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-21 Eric Botcazou + + * config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard + frame pointer. + 2011-05-21 Eric Botcazou * config/sparc/sparc.c (eligible_for_return_delay): Do not return diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index 5c2db0399ebf..1b4fd8d3dcb2 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -6491,8 +6491,8 @@ (const_int 4)))]) ;; For __builtin_setjmp we need to flush register windows iff the function -;; calls alloca as well, because otherwise the register window might be -;; saved after %sp adjustment and thus setjmp would crash +;; calls alloca as well, because otherwise the current register window might +;; be saved after the %sp adjustment and thus setjmp would crash. (define_expand "builtin_setjmp_setup" [(match_operand 0 "register_operand" "r")] "" @@ -6531,19 +6531,26 @@ (eq_attr "pic" "true") (const_int 4)] (const_int 3)))]) -;; Pattern for use after a setjmp to store FP and the return register -;; into the stack area. +;; Pattern for use after a setjmp to store registers into the save area. (define_expand "setjmp" [(const_int 0)] "" { rtx mem; - + + if (flag_pic) + { + mem = gen_rtx_MEM (Pmode, + plus_constant (stack_pointer_rtx, + SPARC_STACK_BIAS + 7 * UNITS_PER_WORD)); + emit_insn (gen_rtx_SET (VOIDmode, mem, pic_offset_table_rtx)); + } + mem = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, SPARC_STACK_BIAS + 14 * UNITS_PER_WORD)); - emit_insn (gen_rtx_SET (VOIDmode, mem, frame_pointer_rtx)); + emit_insn (gen_rtx_SET (VOIDmode, mem, hard_frame_pointer_rtx)); mem = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,