aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-05-19 09:33:27 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-05-19 09:33:27 +0000
commitd33606c30678cbccf0e95840e7dc48918ff1e21e (patch)
tree1a601dd44371c7e5dd197e955db6b56a8a9dd835 /gcc/except.c
parent76e048a8c04e282b8eca52dedf529073ce235f38 (diff)
downloadgcc-d33606c30678cbccf0e95840e7dc48918ff1e21e.zip
gcc-d33606c30678cbccf0e95840e7dc48918ff1e21e.tar.gz
gcc-d33606c30678cbccf0e95840e7dc48918ff1e21e.tar.bz2
insn-notes.def (UPDATE_SJLJ_CONTEXT): New note.
* insn-notes.def (UPDATE_SJLJ_CONTEXT): New note. * builtins.c (expand_builtin_update_setjmp_buf): Make global. (expand_stack_restore): Call record_new_stack_level. (expand_stack_save): Do not call do_pending_stack_adjust. * builtins.h (expand_builtin_update_setjmp_buf): Declare. * calls.c (expand_call): Call record_new_stack_level for alloca. * except.c (sjlj_mark_call_sites): Expand builtin_update_setjmp_buf wherever a NOTE_INSN_UPDATE_SJLJ_CONTEXT note is present. (update_sjlj_context): New global function. * except.h (update_sjlj_context): Declare. * explow.c (record_new_stack_level): New global function. (allocate_dynamic_stack_space): Call record_new_stack_level. * explow.h (record_new_stack_level): Declare. * final.c (final_scan_insn): Deal with NOTE_INSN_UPDATE_SJLJ_CONTEXT. * cfgrtl.c (duplicate_insn_chain): Likewise. Co-Authored-By: Tristan Gingold <gingold@adacore.com> From-SVN: r223348
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/except.c b/gcc/except.c
index 770ab98..673e9c3 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1126,6 +1126,21 @@ sjlj_mark_call_sites (void)
if (LABEL_P (insn))
last_call_site = -2;
+ /* If the function allocates dynamic stack space, the context must
+ be updated after every allocation/deallocation accordingly. */
+ if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_UPDATE_SJLJ_CONTEXT)
+ {
+ rtx buf_addr;
+
+ start_sequence ();
+ buf_addr = plus_constant (Pmode, XEXP (crtl->eh.sjlj_fc, 0),
+ sjlj_fc_jbuf_ofs);
+ expand_builtin_update_setjmp_buf (buf_addr);
+ p = get_insns ();
+ end_sequence ();
+ emit_insn_before (p, insn);
+ }
+
if (! INSN_P (insn))
continue;
@@ -1495,6 +1510,18 @@ sjlj_build_landing_pads (void)
sjlj_lp_call_site_index.release ();
}
+/* Update the sjlj function context. This function should be called
+ whenever we allocate or deallocate dynamic stack space. */
+
+void
+update_sjlj_context (void)
+{
+ if (!flag_exceptions)
+ return;
+
+ emit_note (NOTE_INSN_UPDATE_SJLJ_CONTEXT);
+}
+
/* After initial rtl generation, call back to finish generating
exception support code. */