* explow.c (emit_stack_save): Remove 'after' parameter.
(emit_stack_restore): Likewise.
* expr.h: Update to match.
* builtins.c, calls.c, stmt.c: Likewise.
* config/alpha/alpha.md, config/avr/avr.md: Likewise.
* config/mips/mips.md, config/pa/pa.md, config/vax/vax.md: Likewise.
* function.c (expand_function_end): Insert the emit_stack_save
sequence before parm_birth_insn instead of after.
From-SVN: r170663
+2011-03-04 Richard Henderson <rth@redhat.com>
+
+ * explow.c (emit_stack_save): Remove 'after' parameter.
+ (emit_stack_restore): Likewise.
+ * expr.h: Update to match.
+ * builtins.c, calls.c, stmt.c: Likewise.
+ * config/alpha/alpha.md, config/avr/avr.md: Likewise.
+ * config/mips/mips.md, config/pa/pa.md, config/vax/vax.md: Likewise.
+ * function.c (expand_function_end): Insert the emit_stack_save
+ sequence before parm_birth_insn instead of after.
+
2011-03-03 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sse.md (*avx_pmaddubsw128): Fix mode of VEC_SELECT RTX.
plus_constant (buf_addr,
2 * GET_MODE_SIZE (Pmode)));
set_mem_alias_set (stack_save, setjmp_alias_set);
- emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX);
+ emit_stack_save (SAVE_NONLOCAL, &stack_save);
/* If there is further processing to do, do it. */
#ifdef HAVE_builtin_setjmp_setup
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, fp);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
The non-local goto handler will then adjust it to contain the
proper value and reload the argument pointer, if needed. */
emit_move_insn (hard_frame_pointer_rtx, r_fp);
- emit_stack_restore (SAVE_NONLOCAL, r_sp, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, r_sp);
/* USE of hard_frame_pointer_rtx added for consistency;
not clear if really needed. */
emit_insn (gen_setjmp ());
#endif
- emit_stack_save (SAVE_NONLOCAL, &stack_save, NULL_RTX);
+ emit_stack_save (SAVE_NONLOCAL, &stack_save);
}
/* Expand a call to __builtin_prefetch. For a target that does not support
/* Save the stack with nonlocal if available. */
#ifdef HAVE_save_stack_nonlocal
if (HAVE_save_stack_nonlocal)
- emit_stack_save (SAVE_NONLOCAL, &old_stack_level, NULL_RTX);
+ emit_stack_save (SAVE_NONLOCAL, &old_stack_level);
else
#endif
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
+ emit_stack_save (SAVE_BLOCK, &old_stack_level);
/* Allocate a block of memory onto the stack and copy the memory
arguments to the outgoing arguments address. We can pass TRUE
/* Restore the stack. */
#ifdef HAVE_save_stack_nonlocal
if (HAVE_save_stack_nonlocal)
- emit_stack_restore (SAVE_NONLOCAL, old_stack_level, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, old_stack_level);
else
#endif
- emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
+ emit_stack_restore (SAVE_BLOCK, old_stack_level);
OK_DEFER_POP;
if (*old_stack_level == 0)
{
- emit_stack_save (SAVE_BLOCK, old_stack_level, NULL_RTX);
+ emit_stack_save (SAVE_BLOCK, old_stack_level);
*old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0;
}
{
if (old_stack_level == 0)
{
- emit_stack_save (SAVE_BLOCK, &old_stack_level, NULL_RTX);
+ emit_stack_save (SAVE_BLOCK, &old_stack_level);
old_stack_pointer_delta = stack_pointer_delta;
old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0;
: reg_parm_stack_space));
if (old_stack_level == 0)
{
- emit_stack_save (SAVE_BLOCK, &old_stack_level,
- NULL_RTX);
+ emit_stack_save (SAVE_BLOCK, &old_stack_level);
old_stack_pointer_delta = stack_pointer_delta;
old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0;
if (old_stack_level)
{
- emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
+ emit_stack_restore (SAVE_BLOCK, old_stack_level);
stack_pointer_delta = old_stack_pointer_delta;
pending_stack_adjust = old_pending_adj;
old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
/* This bit is the same as expand_builtin_longjmp. */
emit_move_insn (hard_frame_pointer_rtx, fp);
emit_move_insn (pv, lab);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, r_fp);
- emit_stack_restore (SAVE_NONLOCAL, r_sp, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, r_sp);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
restores $gp as well. */
mips_emit_move (hard_frame_pointer_rtx, fp);
mips_emit_move (pv, lab);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
mips_emit_move (gp, gpv);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
fp = force_reg (Pmode, fp);
emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8));
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8));
/* This bit is the same as expand_builtin_longjmp. */
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, fp);
- emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
+ emit_stack_restore (SAVE_NONLOCAL, stack);
emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx);
/* Save the stack pointer for the purpose in SAVE_LEVEL. PSAVE is a pointer
to a previously-created save area. If no save area has been allocated,
this function will allocate one. If a save area is specified, it
- must be of the proper mode.
-
- The insns are emitted after insn AFTER, if nonzero, otherwise the insns
- are emitted at the current position. */
+ must be of the proper mode. */
void
-emit_stack_save (enum save_level save_level, rtx *psave, rtx after)
+emit_stack_save (enum save_level save_level, rtx *psave)
{
rtx sa = *psave;
/* The default is that we use a move insn and save in a Pmode object. */
}
}
- if (after)
- {
- rtx seq;
-
- start_sequence ();
- do_pending_stack_adjust ();
- /* We must validize inside the sequence, to ensure that any instructions
- created by the validize call also get moved to the right place. */
- if (sa != 0)
- sa = validize_mem (sa);
- emit_insn (fcn (sa, stack_pointer_rtx));
- seq = get_insns ();
- end_sequence ();
- emit_insn_after (seq, after);
- }
- else
- {
- do_pending_stack_adjust ();
- if (sa != 0)
- sa = validize_mem (sa);
- emit_insn (fcn (sa, stack_pointer_rtx));
- }
+ do_pending_stack_adjust ();
+ if (sa != 0)
+ sa = validize_mem (sa);
+ emit_insn (fcn (sa, stack_pointer_rtx));
}
/* Restore the stack pointer for the purpose in SAVE_LEVEL. SA is the save
- area made by emit_stack_save. If it is zero, we have nothing to do.
-
- Put any emitted insns after insn AFTER, if nonzero, otherwise at
- current position. */
+ area made by emit_stack_save. If it is zero, we have nothing to do. */
void
-emit_stack_restore (enum save_level save_level, rtx sa, rtx after)
+emit_stack_restore (enum save_level save_level, rtx sa)
{
/* The default is that we use a move insn. */
rtx (*fcn) (rtx, rtx) = gen_move_insn;
discard_pending_stack_adjust ();
- if (after)
- {
- rtx seq;
-
- start_sequence ();
- emit_insn (fcn (stack_pointer_rtx, sa));
- seq = get_insns ();
- end_sequence ();
- emit_insn_after (seq, after);
- }
- else
- emit_insn (fcn (stack_pointer_rtx, sa));
+ emit_insn (fcn (stack_pointer_rtx, sa));
}
/* Invoke emit_stack_save on the nonlocal_goto_save_area for the current
integer_one_node, NULL_TREE, NULL_TREE);
r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE);
- emit_stack_save (SAVE_NONLOCAL, &r_save, NULL_RTX);
+ emit_stack_save (SAVE_NONLOCAL, &r_save);
}
\f
/* Return an rtx representing the address of an area of memory dynamically
enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL};
/* Save the stack pointer at the specified level. */
-extern void emit_stack_save (enum save_level, rtx *, rtx);
+extern void emit_stack_save (enum save_level, rtx *);
/* Restore the stack pointer from a save area of the specified level. */
-extern void emit_stack_restore (enum save_level, rtx, rtx);
+extern void emit_stack_restore (enum save_level, rtx);
/* Invoke emit_stack_save for the nonlocal_goto_save_area. */
extern void update_nonlocal_goto_save_area (void);
if (! EXIT_IGNORE_STACK
&& cfun->calls_alloca)
{
- rtx tem = 0;
+ rtx tem = 0, seq;
- emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn);
- emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX);
+ start_sequence ();
+ emit_stack_save (SAVE_FUNCTION, &tem);
+ seq = get_insns ();
+ end_sequence ();
+ emit_insn_before (seq, parm_birth_insn);
+
+ emit_stack_restore (SAVE_FUNCTION, tem);
}
/* ??? This should no longer be necessary since stupid is no longer with
rtx ret = NULL_RTX;
do_pending_stack_adjust ();
- emit_stack_save (SAVE_BLOCK, &ret, NULL_RTX);
+ emit_stack_save (SAVE_BLOCK, &ret);
return ret;
}
rtx sa = expand_normal (var);
sa = convert_memory_address (Pmode, sa);
- emit_stack_restore (SAVE_BLOCK, sa, NULL_RTX);
+ emit_stack_restore (SAVE_BLOCK, sa);
}
\f
/* Do the insertion of a case label into case_list. The labels are