From faa186b202fc62913949e41bc4cc9a930d43efee Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Wed, 12 Sep 2007 21:47:59 +0000 Subject: [PATCH] xtensa.c (machine_function): Add vararg_a7_copy. * config/xtensa/xtensa.c (machine_function): Add vararg_a7_copy. (xtensa_copy_incoming_a7): Use start_sequence instead of push_to_sequence. Stash insns in vararg_a7_copy for builtin_saveregs. (xtensa_builtin_saveregs): Place code from vararg_a7_copy at the start of the saveregs sequence. From-SVN: r128447 --- gcc/ChangeLog | 8 ++++++++ gcc/config/xtensa/xtensa.c | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5a6956ed635..76f0eaf3ec15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2007-09-12 Bob Wilson + + * config/xtensa/xtensa.c (machine_function): Add vararg_a7_copy. + (xtensa_copy_incoming_a7): Use start_sequence instead of + push_to_sequence. Stash insns in vararg_a7_copy for builtin_saveregs. + (xtensa_builtin_saveregs): Place code from vararg_a7_copy at the start + of the saveregs sequence. + 2007-09-12 Richard Guenther PR middle-end/33382 diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 5e94948edbc6..91ff10964510 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -93,6 +93,7 @@ struct machine_function GTY(()) int accesses_prev_frame; bool need_a7_copy; bool vararg_a7; + rtx vararg_a7_copy; rtx set_frame_ptr_insn; }; @@ -1102,7 +1103,7 @@ xtensa_copy_incoming_a7 (rtx opnd) /* Copy a7 to a new pseudo at the function entry. Use gen_raw_REG to create the REG for a7 so that hard_frame_pointer_rtx is not used. */ - push_to_sequence (entry_insns); + start_sequence (); tmp = gen_reg_rtx (mode); switch (mode) @@ -1136,10 +1137,11 @@ xtensa_copy_incoming_a7 (rtx opnd) if (cfun->machine->vararg_a7) { - /* This is called from within builtin_savereg, so we're already - inside a start_sequence that will be placed at the start of - the function. */ - emit_insn (entry_insns); + /* This is called from within builtin_saveregs, which will insert the + saveregs code at the function entry, ahead of anything placed at + the function entry now. Instead, save the sequence to be inserted + at the beginning of the saveregs code. */ + cfun->machine->vararg_a7_copy = entry_insns; } else { @@ -1148,6 +1150,8 @@ xtensa_copy_incoming_a7 (rtx opnd) chain current, so the code is placed at the start of the function. */ push_topmost_sequence (); + /* Do not use entry_of_function() here. This is called from within + expand_function_start, when the CFG still holds GIMPLE. */ emit_insn_after (entry_insns, get_insns ()); pop_topmost_sequence (); } @@ -2100,6 +2104,8 @@ xtensa_builtin_saveregs (void) cfun->machine->need_a7_copy = true; cfun->machine->vararg_a7 = true; move_block_from_reg (GP_ARG_FIRST + arg_words, dest, gp_left); + gcc_assert (cfun->machine->vararg_a7_copy != 0); + emit_insn_before (cfun->machine->vararg_a7_copy, get_insns ()); return XEXP (gp_regs, 0); } -- 2.47.2