aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c58
1 files changed, 43 insertions, 15 deletions
diff --git a/gcc/function.c b/gcc/function.c
index a11f248..04a2ebc 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5214,17 +5214,50 @@ emit_return_into_block (basic_block bb)
static void
thread_prologue_and_epilogue_insns (void)
{
- int inserted = 0;
+ bool inserted;
+ rtx seq, epilogue_end;
+ edge entry_edge;
edge e;
-#if defined (HAVE_sibcall_epilogue) || defined (HAVE_epilogue) || defined (HAVE_return) || defined (HAVE_prologue)
- rtx seq;
-#endif
-#if defined (HAVE_epilogue) || defined(HAVE_return)
- rtx epilogue_end = NULL_RTX;
-#endif
edge_iterator ei;
rtl_profile_for_bb (ENTRY_BLOCK_PTR);
+
+ inserted = false;
+ seq = NULL_RTX;
+ epilogue_end = NULL_RTX;
+
+ /* Can't deal with multiple successors of the entry block at the
+ moment. Function should always have at least one entry
+ point. */
+ gcc_assert (single_succ_p (ENTRY_BLOCK_PTR));
+ entry_edge = single_succ_edge (ENTRY_BLOCK_PTR);
+
+ if (flag_split_stack
+ && (lookup_attribute ("no_split_stack", DECL_ATTRIBUTES (cfun->decl))
+ == NULL))
+ {
+#ifndef HAVE_split_stack_prologue
+ gcc_unreachable ();
+#else
+ gcc_assert (HAVE_split_stack_prologue);
+
+ start_sequence ();
+ emit_insn (gen_split_stack_prologue ());
+ seq = get_insns ();
+ end_sequence ();
+
+ record_insns (seq, NULL, &prologue_insn_hash);
+ set_insn_locators (seq, prologue_locator);
+
+ /* This relies on the fact that committing the edge insertion
+ will look for basic blocks within the inserted instructions,
+ which in turn relies on the fact that we are not in CFG
+ layout mode here. */
+ insert_insn_on_edge (seq, entry_edge);
+ inserted = true;
+#endif
+ }
+
#ifdef HAVE_prologue
if (HAVE_prologue)
{
@@ -5251,13 +5284,8 @@ thread_prologue_and_epilogue_insns (void)
end_sequence ();
set_insn_locators (seq, prologue_locator);
- /* Can't deal with multiple successors of the entry block
- at the moment. Function should always have at least one
- entry point. */
- gcc_assert (single_succ_p (ENTRY_BLOCK_PTR));
-
- insert_insn_on_edge (seq, single_succ_edge (ENTRY_BLOCK_PTR));
- inserted = 1;
+ insert_insn_on_edge (seq, entry_edge);
+ inserted = true;
}
#endif
@@ -5427,7 +5455,7 @@ thread_prologue_and_epilogue_insns (void)
end_sequence ();
insert_insn_on_edge (seq, e);
- inserted = 1;
+ inserted = true;
}
else
#endif