Commit 1150a841 by Richard Henderson Committed by Richard Henderson

sparc.c (eligible_for_epilogue_delay): False if current_function_calls_eh_return.

        * config/sparc/sparc.c (eligible_for_epilogue_delay): False if
        current_function_calls_eh_return.
        (output_function_epilogue): Handle eh_return.
        * config/sparc/sparc.h (DOESNT_NEED_UNWINDER): Remove.
        (EH_RETURN_DATA_REGNO): New.
        (EH_RETURN_STACKADJ_RTX): New.
        (EH_RETURN_HANDLER_RTX): New.
        * config/sparc/sparc.md (call/short branch peepholes): Check
        can_throw_internal instead of in_same_eh_region.

From-SVN: r40928
parent 83720594
2001-03-28 Richard Henderson <rth@redhat.com> 2001-03-28 Richard Henderson <rth@redhat.com>
* config/sparc/sparc.c (eligible_for_epilogue_delay): False if
current_function_calls_eh_return.
(output_function_epilogue): Handle eh_return.
* config/sparc/sparc.h (DOESNT_NEED_UNWINDER): Remove.
(EH_RETURN_DATA_REGNO): New.
(EH_RETURN_STACKADJ_RTX): New.
(EH_RETURN_HANDLER_RTX): New.
* config/sparc/sparc.md (call/short branch peepholes): Check
can_throw_internal instead of in_same_eh_region.
* config/rs6000/rs6000.c (rs6000_stack_info): Allocate space * config/rs6000/rs6000.c (rs6000_stack_info): Allocate space
for eh_return data registers. for eh_return data registers.
(rs6000_emit_prologue): Save eh_return data registers. (rs6000_emit_prologue): Save eh_return data registers.
......
...@@ -2377,6 +2377,11 @@ eligible_for_epilogue_delay (trial, slot) ...@@ -2377,6 +2377,11 @@ eligible_for_epilogue_delay (trial, slot)
if (num_gfregs) if (num_gfregs)
return 0; return 0;
/* If the function uses __builtin_eh_return, the eh_return machinery
occupies the delay slot. */
if (current_function_calls_eh_return)
return 0;
/* In the case of a true leaf function, anything can go into the delay slot. /* In the case of a true leaf function, anything can go into the delay slot.
A delay slot only exists however if the frame size is zero, otherwise A delay slot only exists however if the frame size is zero, otherwise
we will put an insn to adjust the stack after the return. */ we will put an insn to adjust the stack after the return. */
...@@ -3594,8 +3599,17 @@ output_function_epilogue (file, size, leaf_function) ...@@ -3594,8 +3599,17 @@ output_function_epilogue (file, size, leaf_function)
if (! leaf_function) if (! leaf_function)
{ {
/* If we wound up with things in our delay slot, flush them here. */ if (current_function_calls_eh_return)
{
if (current_function_epilogue_delay_list) if (current_function_epilogue_delay_list)
abort ();
if (SKIP_CALLERS_UNIMP_P)
abort ();
fputs ("\trestore\n\tretl\n\tadd\t%sp, %g1, %sp\n", file);
}
/* If we wound up with things in our delay slot, flush them here. */
else if (current_function_epilogue_delay_list)
{ {
rtx delay = PATTERN (XEXP (current_function_epilogue_delay_list, 0)); rtx delay = PATTERN (XEXP (current_function_epilogue_delay_list, 0));
...@@ -3635,6 +3649,8 @@ output_function_epilogue (file, size, leaf_function) ...@@ -3635,6 +3649,8 @@ output_function_epilogue (file, size, leaf_function)
else else
fprintf (file, "\t%s\n\trestore\n", ret); fprintf (file, "\t%s\n\trestore\n", ret);
} }
else if (current_function_calls_eh_return)
abort ();
/* All of the following cases are for leaf functions. */ /* All of the following cases are for leaf functions. */
else if (current_function_epilogue_delay_list) else if (current_function_epilogue_delay_list)
{ {
......
...@@ -2235,7 +2235,10 @@ LFLGRET"ID":\n\ ...@@ -2235,7 +2235,10 @@ LFLGRET"ID":\n\
bias if present. */ bias if present. */
#define INCOMING_FRAME_SP_OFFSET SPARC_STACK_BIAS #define INCOMING_FRAME_SP_OFFSET SPARC_STACK_BIAS
#define DOESNT_NEED_UNWINDER (! TARGET_FLAT) /* Describe how we implement __builtin_eh_return. */
#define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 24 : INVALID_REGNUM)
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 1) /* %g1 */
#define EH_RETURN_HANDLER_RTX gen_rtx_REG (Pmode, 31) /* %i7 */
/* Addressing modes, and classification of registers for them. */ /* Addressing modes, and classification of registers for them. */
......
...@@ -9453,8 +9453,7 @@ ...@@ -9453,8 +9453,7 @@
(clobber (reg:SI 15))]) (clobber (reg:SI 15))])
(set (pc) (label_ref (match_operand 3 "" "")))] (set (pc) (label_ref (match_operand 3 "" "")))]
"short_branch (INSN_UID (insn), INSN_UID (operands[3])) "short_branch (INSN_UID (insn), INSN_UID (operands[3]))
&& in_same_eh_region (insn, operands[3]) && (USING_SJLJ_EXCEPTIONS || ! can_throw_internal (insn))"
&& in_same_eh_region (insn, ins1)"
"call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7") "call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7")
(define_peephole (define_peephole
...@@ -9463,8 +9462,7 @@ ...@@ -9463,8 +9462,7 @@
(clobber (reg:SI 15))]) (clobber (reg:SI 15))])
(set (pc) (label_ref (match_operand 2 "" "")))] (set (pc) (label_ref (match_operand 2 "" "")))]
"short_branch (INSN_UID (insn), INSN_UID (operands[2])) "short_branch (INSN_UID (insn), INSN_UID (operands[2]))
&& in_same_eh_region (insn, operands[2]) && (USING_SJLJ_EXCEPTIONS || ! can_throw_internal (insn))"
&& in_same_eh_region (insn, ins1)"
"call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7") "call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7")
(define_peephole (define_peephole
...@@ -9475,8 +9473,7 @@ ...@@ -9475,8 +9473,7 @@
(set (pc) (label_ref (match_operand 3 "" "")))] (set (pc) (label_ref (match_operand 3 "" "")))]
"TARGET_ARCH64 "TARGET_ARCH64
&& short_branch (INSN_UID (insn), INSN_UID (operands[3])) && short_branch (INSN_UID (insn), INSN_UID (operands[3]))
&& in_same_eh_region (insn, operands[3]) && (USING_SJLJ_EXCEPTIONS || ! can_throw_internal (insn))"
&& in_same_eh_region (insn, ins1)"
"call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7") "call\\t%a1, %2\\n\\tadd\\t%%o7, (%l3-.-4), %%o7")
(define_peephole (define_peephole
...@@ -9486,8 +9483,7 @@ ...@@ -9486,8 +9483,7 @@
(set (pc) (label_ref (match_operand 2 "" "")))] (set (pc) (label_ref (match_operand 2 "" "")))]
"TARGET_ARCH64 "TARGET_ARCH64
&& short_branch (INSN_UID (insn), INSN_UID (operands[2])) && short_branch (INSN_UID (insn), INSN_UID (operands[2]))
&& in_same_eh_region (insn, operands[2]) && (USING_SJLJ_EXCEPTIONS || ! can_throw_internal (insn))"
&& in_same_eh_region (insn, ins1)"
"call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7") "call\\t%a0, %1\\n\\tadd\\t%%o7, (%l2-.-4), %%o7")
(define_expand "prologue" (define_expand "prologue"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment