aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-05-21 22:49:05 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-05-21 22:49:05 +0000
commitabd9a770ee9842322f245639881a4955c8d2258b (patch)
tree5d8787561526867d0b4b549db5b50814501ced81 /gcc
parentbd9a3248ab251b7ba3560b80e589cd55e05a5a8d (diff)
downloadgcc-abd9a770ee9842322f245639881a4955c8d2258b.zip
gcc-abd9a770ee9842322f245639881a4955c8d2258b.tar.gz
gcc-abd9a770ee9842322f245639881a4955c8d2258b.tar.bz2
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: r174013
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sparc/sparc.md19
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5cbd9f8..80233d7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2011-05-21 Eric Botcazou <ebotcazou@adacore.com>
+ * config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard
+ frame pointer.
+
+2011-05-21 Eric Botcazou <ebotcazou@adacore.com>
+
* config/sparc/sparc.c (eligible_for_return_delay): Do not return
false if there are call-saved registers here...
(sparc_can_use_return_insn_p): ...but here instead.
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 853bd2f..5e16179 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -6507,8 +6507,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")]
""
@@ -6547,19 +6547,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,