diff options
Diffstat (limited to 'gcc/except.c')
-rw-r--r-- | gcc/except.c | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/gcc/except.c b/gcc/except.c index fe139fd85c4..cc6fc291345 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -406,6 +406,7 @@ Boston, MA 02111-1307, USA. */ #include "recog.h" #include "output.h" #include "toplev.h" +#include "intl.h" #include "obstack.h" /* One to use setjmp/longjmp method of generating code for exception @@ -722,21 +723,41 @@ static void receive_exception_label (handler_label) rtx handler_label; { + rtx around_label = NULL_RTX; + + if (! flag_new_exceptions || exceptions_via_longjmp) + { + around_label = gen_label_rtx (); + emit_jump (around_label); + emit_barrier (); + } + emit_label (handler_label); -#ifdef HAVE_exception_receiver if (! exceptions_via_longjmp) - if (HAVE_exception_receiver) - emit_insn (gen_exception_receiver ()); + { +#ifdef HAVE_exception_receiver + if (HAVE_exception_receiver) + emit_insn (gen_exception_receiver ()); + else #endif - #ifdef HAVE_nonlocal_goto_receiver - if (! exceptions_via_longjmp) - if (HAVE_nonlocal_goto_receiver) - emit_insn (gen_nonlocal_goto_receiver ()); + if (HAVE_nonlocal_goto_receiver) + emit_insn (gen_nonlocal_goto_receiver ()); + else #endif -} + { /* Nothing */ } + } + else + { +#ifndef DONT_USE_BUILTIN_SETJMP + expand_builtin_setjmp_receiver (handler_label); +#endif + } + if (around_label) + emit_label (around_label); +} struct func_eh_entry { @@ -1319,7 +1340,7 @@ static void start_dynamic_handler () { rtx dhc, dcc; - rtx x, arg, buf; + rtx arg, buf; int size; #ifndef DONT_USE_BUILTIN_SETJMP @@ -1361,18 +1382,17 @@ start_dynamic_handler () buf = plus_constant (XEXP (arg, 0), GET_MODE_SIZE (Pmode)*2); #ifdef DONT_USE_BUILTIN_SETJMP - x = emit_library_call_value (setjmp_libfunc, NULL_RTX, 1, SImode, 1, - buf, Pmode); - /* If we come back here for a catch, transfer control to the handler. */ - jumpif_rtx (x, ehstack.top->entry->exception_handler_label); -#else { - /* A label to continue execution for the no exception case. */ - rtx noex = gen_label_rtx(); - x = expand_builtin_setjmp (buf, NULL_RTX, noex, - ehstack.top->entry->exception_handler_label); - emit_label (noex); + rtx x; + x = emit_library_call_value (setjmp_libfunc, NULL_RTX, LCT_CONST, + TYPE_MODE (integer_type_node), 1, + buf, Pmode); + /* If we come back here for a catch, transfer control to the handler. */ + jumpif_rtx (x, ehstack.top->entry->exception_handler_label); } +#else + expand_builtin_setjmp_setup (buf, + ehstack.top->entry->exception_handler_label); #endif /* We are committed to this, so update the handler chain. */ @@ -2446,6 +2466,7 @@ save_eh_status (p) p->caught_return_label_stack = caught_return_label_stack; p->protect_list = protect_list; p->ehc = current_function_ehc; + p->eh_return_stub_label = eh_return_stub_label; init_eh_for_function (); } @@ -2469,6 +2490,7 @@ restore_eh_status (p) ehstack = p->ehstack; catchstack = p->catchstack; current_function_ehc = p->ehc; + eh_return_stub_label = p->eh_return_stub_label; } /* This section is for the exception handling specific optimization @@ -2792,6 +2814,8 @@ expand_eh_return () if (!eh_return_context) return; + current_function_cannot_inline = N_("function uses __builtin_eh_return"); + eh_regs (®1, ®2, ®3, 1); #ifdef POINTERS_EXTEND_UNSIGNED eh_return_context = convert_memory_address (Pmode, eh_return_context); |