builtins.c (expand_builtin_setjmp): Set current_function_calls_setjmp.
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Nov 2000 18:05:45 +0000 (19:05 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 14 Nov 2000 18:05:45 +0000 (19:05 +0100)
* builtins.c (expand_builtin_setjmp): Set
current_function_calls_setjmp.
(expand_builtin_longjmp): Set current_function_calls_longjmp.

* config/sparc/sparc.md (builtin_setjmp_setup): New expand.
(do_builtin_setjmp_setup): New insn.

From-SVN: r37461

gcc/ChangeLog
gcc/builtins.c
gcc/config/sparc/sparc.md

index 613a7b2894230bd6af264b2466895955ff2d2811..570dbe5d8e3b8bb21ddb937d9a941814ba031319 100644 (file)
@@ -1,3 +1,12 @@
+2000-11-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * builtins.c (expand_builtin_setjmp): Set
+       current_function_calls_setjmp.
+       (expand_builtin_longjmp): Set current_function_calls_longjmp.
+
+       * config/sparc/sparc.md (builtin_setjmp_setup): New expand.
+       (do_builtin_setjmp_setup): New insn.
+
 Tue Nov 14 12:34:56 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * tree.c (get_unwidened): Use host_integerp and tree_low_cst.
index 68677b5295031d2a64f8ec2d6e97e09eb847c03a..8daf963a6b2178babd5ed2d7dc1c2fb9873dc9c8 100644 (file)
@@ -446,6 +446,7 @@ expand_builtin_setjmp (buf_addr, target, first_label, next_label)
      calls may traverse the arc back to this label.  */
 
   current_function_has_nonlocal_label = 1;
+  current_function_calls_setjmp = 1;
   nonlocal_goto_handler_labels
     = gen_rtx_EXPR_LIST (VOIDmode, lab1, nonlocal_goto_handler_labels);
 
@@ -547,6 +548,8 @@ expand_builtin_longjmp (buf_addr, value)
   if (value != const1_rtx)
     abort ();
 
+  current_function_calls_longjmp = 1;
+
 #ifdef HAVE_builtin_longjmp
   if (HAVE_builtin_longjmp)
     emit_insn (gen_builtin_longjmp (buf_addr));
index 93734f9d3866e8c957ab32a3f62b998d76a2f94f..861a9f32faf794bc4296a995797f20f3f6997d4e 100644 (file)
@@ -50,6 +50,7 @@
 ;;                     2       goto_handler_and_restore
 ;;                     3       goto_handler_and_restore_v9*
 ;;                     4       flush
+;;                     5       do_builtin_setjmp_setup
 ;;
 
 ;; The upper 32 fp regs on the v9 can't hold SFmode values.  To deal with this
 ;;  [(set_attr "type" "misc")
 ;;   (set_attr "length" "2,3")])
 
+;; 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 adjustement and thus setjmp would crash
+(define_expand "builtin_setjmp_setup"
+  [(match_operand 0 "register_operand" "r")]
+  ""
+  "
+{
+  emit_insn (gen_do_builtin_setjmp_setup ());
+  DONE;
+}")
+
+(define_insn "do_builtin_setjmp_setup"
+  [(unspec_volatile [(const_int 0)] 5)]
+  ""
+  "*
+{
+  if (!current_function_calls_alloca)
+    return \"\";
+  if (TARGET_V9)
+    return \"flushw\";
+  return \"ta\\t3\";
+}"
+  [(set_attr "type" "misc")
+   (set_attr "length" "1")])
+
 ;; Pattern for use after a setjmp to store FP and the return register
 ;; into the stack area.