aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2000-11-14 19:05:45 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2000-11-14 19:05:45 +0100
commitf36d6244de2d705437102b9e3ebf34589c92edea (patch)
tree867e197b40ffd6f31ee2be7c55a538afdb3c234c /gcc
parent3401c26b5cce41f75a511d1ee60ccadb876c5fb3 (diff)
downloadgcc-f36d6244de2d705437102b9e3ebf34589c92edea.zip
gcc-f36d6244de2d705437102b9e3ebf34589c92edea.tar.gz
gcc-f36d6244de2d705437102b9e3ebf34589c92edea.tar.bz2
builtins.c (expand_builtin_setjmp): Set current_function_calls_setjmp.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/builtins.c3
-rw-r--r--gcc/config/sparc/sparc.md27
3 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 613a7b2..570dbe5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 68677b5..8daf963 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -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));
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 93734f9..861a9f3 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -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
@@ -9014,6 +9015,32 @@
;; [(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.