From 8a723db2df8ea2a336691f2c3288a642bc8b0063 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 26 Dec 2001 14:54:44 -0500 Subject: [PATCH] function.c (expand_main_function): Make sure stack adjustments happen before sjlj exception setup. * function.c (expand_main_function): Make sure stack adjustments happen before sjlj exception setup. From-SVN: r48316 --- gcc/ChangeLog | 5 +++++ gcc/function.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0a7b1138bb0..44e13a8cea5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-12-26 DJ Delorie + + * function.c (expand_main_function): Make sure stack adjustments + happen before sjlj exception setup. + 2001-12-26 David Edelsohn * rs6000.md (indirect_jump): Prefer CTR over LR. diff --git a/gcc/function.c b/gcc/function.c index b84fc1e544f..f5a3102bf4d 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6278,8 +6278,9 @@ expand_main_function () if (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN) { int align = PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT; - rtx tmp; + rtx tmp, seq; + start_sequence (); /* Forcibly align the stack. */ #ifdef STACK_GROWS_DOWNWARD tmp = expand_simple_binop (Pmode, AND, stack_pointer_rtx, GEN_INT(-align), @@ -6296,6 +6297,16 @@ expand_main_function () /* Enlist allocate_dynamic_stack_space to pick up the pieces. */ tmp = force_reg (Pmode, const0_rtx); allocate_dynamic_stack_space (tmp, NULL_RTX, BIGGEST_ALIGNMENT); + seq = gen_sequence (); + end_sequence (); + + for (tmp = get_last_insn (); tmp; tmp = PREV_INSN (tmp)) + if (NOTE_P (tmp) && NOTE_LINE_NUMBER (tmp) == NOTE_INSN_FUNCTION_BEG) + break; + if (tmp) + emit_insn_before (seq, tmp); + else + emit_insn (seq); } #endif