]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc.md (setjmp): Handle PIC mode and use the hard frame pointer.
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 21 May 2011 22:51:00 +0000 (22:51 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 21 May 2011 22:51:00 +0000 (22:51 +0000)
* config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard
frame pointer.

From-SVN: r174016

gcc/ChangeLog
gcc/config/sparc/sparc.md

index f5651f79e62711153abc578a9f7ce611143fda7b..e682781eb6968a6740557340b71cd2d99dd46ab8 100644 (file)
@@ -1,3 +1,8 @@
+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
index e5098a5592d69ac816b572145f1dbc6e8fb3e617..d7008d750af3af289e5db4194b82eda061ae596d 100644 (file)
                      (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")]
   ""
                (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,