Commit 0d8442b8 by Bob Wilson Committed by Bob Wilson

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: r128443
parent a0124624
2007-09-12 Bob Wilson <bob.wilson@acm.org>
* 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 Sandiford <richard@codesourcery.com> 2007-09-12 Richard Sandiford <richard@codesourcery.com>
* c-tree.h (grokfield): Add a "tree *" argument. * c-tree.h (grokfield): Add a "tree *" argument.
...@@ -94,6 +94,7 @@ struct machine_function GTY(()) ...@@ -94,6 +94,7 @@ struct machine_function GTY(())
int accesses_prev_frame; int accesses_prev_frame;
bool need_a7_copy; bool need_a7_copy;
bool vararg_a7; bool vararg_a7;
rtx vararg_a7_copy;
rtx set_frame_ptr_insn; rtx set_frame_ptr_insn;
}; };
...@@ -1004,7 +1005,7 @@ xtensa_copy_incoming_a7 (rtx opnd) ...@@ -1004,7 +1005,7 @@ xtensa_copy_incoming_a7 (rtx opnd)
/* Copy a7 to a new pseudo at the function entry. Use gen_raw_REG to /* 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. */ 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); tmp = gen_reg_rtx (mode);
switch (mode) switch (mode)
...@@ -1038,10 +1039,11 @@ xtensa_copy_incoming_a7 (rtx opnd) ...@@ -1038,10 +1039,11 @@ xtensa_copy_incoming_a7 (rtx opnd)
if (cfun->machine->vararg_a7) if (cfun->machine->vararg_a7)
{ {
/* This is called from within builtin_savereg, so we're already /* This is called from within builtin_saveregs, which will insert the
inside a start_sequence that will be placed at the start of saveregs code at the function entry, ahead of anything placed at
the function. */ the function entry now. Instead, save the sequence to be inserted
emit_insn (entry_insns); at the beginning of the saveregs code. */
cfun->machine->vararg_a7_copy = entry_insns;
} }
else else
{ {
...@@ -1050,6 +1052,8 @@ xtensa_copy_incoming_a7 (rtx opnd) ...@@ -1050,6 +1052,8 @@ xtensa_copy_incoming_a7 (rtx opnd)
chain current, so the code is placed at the start of the chain current, so the code is placed at the start of the
function. */ function. */
push_topmost_sequence (); 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 ()); emit_insn_after (entry_insns, get_insns ());
pop_topmost_sequence (); pop_topmost_sequence ();
} }
...@@ -2454,6 +2458,8 @@ xtensa_builtin_saveregs (void) ...@@ -2454,6 +2458,8 @@ xtensa_builtin_saveregs (void)
adjust_address (gp_regs, BLKmode, adjust_address (gp_regs, BLKmode,
arg_words * UNITS_PER_WORD), arg_words * UNITS_PER_WORD),
gp_left); 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); return XEXP (gp_regs, 0);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment