From ffd386b033448135e9648b773a09680932edcec7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 4 Apr 2002 22:57:53 +0200 Subject: [PATCH] sparc.md (pic): New attribute. * config/sparc/sparc.md (pic): New attribute. (do_builtin_setjmp_setup): Save %fp, %i7 and %l7 for TARGET_V9 into stack slots. (split after do_builtin_setjmp_setup): New. From-SVN: r51870 --- gcc/ChangeLog | 7 +++++++ gcc/config/sparc/sparc.md | 42 +++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8510f081fc8..2566a78a80c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-04-04 Jakub Jelinek + + * config/sparc/sparc.md (pic): New attribute. + (do_builtin_setjmp_setup): Save %fp, %i7 and %l7 for TARGET_V9 + into stack slots. + (split after do_builtin_setjmp_setup): New. + 2002-04-04 Jakub Jelinek PR fortran/6106 diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index d783fea8a2f..981249f8c20 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -93,6 +93,9 @@ (define_attr "branch_type" "none,icc,fcc,reg" (const_string "none")) +(define_attr "pic" "false,true" + (symbol_ref "flag_pic != 0")) + ;; Length (in # of insns). (define_attr "length" "" (cond [(eq_attr "type" "uncond_branch,call,sibcall") @@ -8877,22 +8880,41 @@ DONE; }") -;; ??? Should set length to zero when !current_function_calls_alloca, -;; ??? but there is no easy way to get at that definition. It would -;; ??? require including function.h into sparc-protos.h and that is -;; ??? likely not a good idea. -DaveM (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\"; + if (! current_function_calls_alloca || ! TARGET_V9 || TARGET_FLAT) + return \"#\"; + fputs (\"\tflushw\n\", asm_out_file); + if (flag_pic) + fprintf (asm_out_file, \"\tst%c\t%%l7, [%%sp+%d]\n\", + TARGET_ARCH64 ? 'x' : 'w', + SPARC_STACK_BIAS + 7 * UNITS_PER_WORD); + fprintf (asm_out_file, \"\tst%c\t%%fp, [%%sp+%d]\n\", + TARGET_ARCH64 ? 'x' : 'w', + SPARC_STACK_BIAS + 14 * UNITS_PER_WORD); + fprintf (asm_out_file, \"\tst%c\t%%i7, [%%sp+%d]\n\", + TARGET_ARCH64 ? 'x' : 'w', + SPARC_STACK_BIAS + 15 * UNITS_PER_WORD); + return \"\"; }" - [(set_attr "type" "misc")]) + [(set_attr "type" "misc") + (set (attr "length") (if_then_else (eq_attr "pic" "true") + (const_int 4) + (const_int 3)))]) + +(define_split + [(unspec_volatile [(const_int 0)] 5)] + "! current_function_calls_alloca || ! TARGET_V9 || TARGET_FLAT" + [(const_int 0)] + " +{ + if (current_function_calls_alloca) + emit_insn (gen_flush_register_windows ()); + DONE; +}") ;; Pattern for use after a setjmp to store FP and the return register ;; into the stack area. -- 2.30.2