Commit 9eac0f2a by Richard Henderson Committed by Richard Henderson

explow.c (emit_stack_save): Remove 'after' parameter.

        * 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
parent dfee1406
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> 2011-03-03 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sse.md (*avx_pmaddubsw128): Fix mode of VEC_SELECT RTX. * config/i386/sse.md (*avx_pmaddubsw128): Fix mode of VEC_SELECT RTX.
......
...@@ -784,7 +784,7 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label) ...@@ -784,7 +784,7 @@ expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label)
plus_constant (buf_addr, plus_constant (buf_addr,
2 * GET_MODE_SIZE (Pmode))); 2 * GET_MODE_SIZE (Pmode)));
set_mem_alias_set (stack_save, setjmp_alias_set); 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. */ /* If there is further processing to do, do it. */
#ifdef HAVE_builtin_setjmp_setup #ifdef HAVE_builtin_setjmp_setup
...@@ -932,7 +932,7 @@ expand_builtin_longjmp (rtx buf_addr, rtx value) ...@@ -932,7 +932,7 @@ expand_builtin_longjmp (rtx buf_addr, rtx value)
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, fp); 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
...@@ -1005,7 +1005,7 @@ expand_builtin_nonlocal_goto (tree exp) ...@@ -1005,7 +1005,7 @@ expand_builtin_nonlocal_goto (tree exp)
The non-local goto handler will then adjust it to contain the The non-local goto handler will then adjust it to contain the
proper value and reload the argument pointer, if needed. */ proper value and reload the argument pointer, if needed. */
emit_move_insn (hard_frame_pointer_rtx, r_fp); 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; /* USE of hard_frame_pointer_rtx added for consistency;
not clear if really needed. */ not clear if really needed. */
...@@ -1075,7 +1075,7 @@ expand_builtin_update_setjmp_buf (rtx buf_addr) ...@@ -1075,7 +1075,7 @@ expand_builtin_update_setjmp_buf (rtx buf_addr)
emit_insn (gen_setjmp ()); emit_insn (gen_setjmp ());
#endif #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 /* Expand a call to __builtin_prefetch. For a target that does not support
...@@ -1558,10 +1558,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize) ...@@ -1558,10 +1558,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
/* Save the stack with nonlocal if available. */ /* Save the stack with nonlocal if available. */
#ifdef HAVE_save_stack_nonlocal #ifdef HAVE_save_stack_nonlocal
if (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 else
#endif #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 /* Allocate a block of memory onto the stack and copy the memory
arguments to the outgoing arguments address. We can pass TRUE arguments to the outgoing arguments address. We can pass TRUE
...@@ -1677,10 +1677,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize) ...@@ -1677,10 +1677,10 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
/* Restore the stack. */ /* Restore the stack. */
#ifdef HAVE_save_stack_nonlocal #ifdef HAVE_save_stack_nonlocal
if (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 else
#endif #endif
emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX); emit_stack_restore (SAVE_BLOCK, old_stack_level);
OK_DEFER_POP; OK_DEFER_POP;
......
...@@ -1092,7 +1092,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, ...@@ -1092,7 +1092,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
if (*old_stack_level == 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_pending_adj = pending_stack_adjust; *old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0; pending_stack_adjust = 0;
} }
...@@ -2488,7 +2488,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2488,7 +2488,7 @@ expand_call (tree exp, rtx target, int ignore)
{ {
if (old_stack_level == 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_stack_pointer_delta = stack_pointer_delta;
old_pending_adj = pending_stack_adjust; old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0; pending_stack_adjust = 0;
...@@ -2643,8 +2643,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2643,8 +2643,7 @@ expand_call (tree exp, rtx target, int ignore)
: reg_parm_stack_space)); : reg_parm_stack_space));
if (old_stack_level == 0) if (old_stack_level == 0)
{ {
emit_stack_save (SAVE_BLOCK, &old_stack_level, emit_stack_save (SAVE_BLOCK, &old_stack_level);
NULL_RTX);
old_stack_pointer_delta = stack_pointer_delta; old_stack_pointer_delta = stack_pointer_delta;
old_pending_adj = pending_stack_adjust; old_pending_adj = pending_stack_adjust;
pending_stack_adjust = 0; pending_stack_adjust = 0;
...@@ -3101,7 +3100,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -3101,7 +3100,7 @@ expand_call (tree exp, rtx target, int ignore)
if (old_stack_level) 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; stack_pointer_delta = old_stack_pointer_delta;
pending_stack_adjust = old_pending_adj; pending_stack_adjust = old_pending_adj;
old_stack_allocated = stack_pointer_delta - pending_stack_adjust; old_stack_allocated = stack_pointer_delta - pending_stack_adjust;
......
...@@ -6765,7 +6765,7 @@ ...@@ -6765,7 +6765,7 @@
/* This bit is the same as expand_builtin_longjmp. */ /* This bit is the same as expand_builtin_longjmp. */
emit_move_insn (hard_frame_pointer_rtx, fp); emit_move_insn (hard_frame_pointer_rtx, fp);
emit_move_insn (pv, lab); 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, r_fp); 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
......
...@@ -5649,7 +5649,7 @@ ...@@ -5649,7 +5649,7 @@
restores $gp as well. */ restores $gp as well. */
mips_emit_move (hard_frame_pointer_rtx, fp); mips_emit_move (hard_frame_pointer_rtx, fp);
mips_emit_move (pv, lab); mips_emit_move (pv, lab);
emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX); emit_stack_restore (SAVE_NONLOCAL, stack);
mips_emit_move (gp, gpv); mips_emit_move (gp, gpv);
emit_use (hard_frame_pointer_rtx); emit_use (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
......
...@@ -6865,7 +6865,7 @@ ...@@ -6865,7 +6865,7 @@
fp = force_reg (Pmode, fp); fp = force_reg (Pmode, fp);
emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8)); 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
...@@ -8310,7 +8310,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" ...@@ -8310,7 +8310,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8)); emit_move_insn (hard_frame_pointer_rtx, plus_constant (fp, -8));
/* This bit is the same as expand_builtin_longjmp. */ /* 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
......
...@@ -1624,7 +1624,7 @@ ...@@ -1624,7 +1624,7 @@
emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
emit_move_insn (hard_frame_pointer_rtx, fp); 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 (hard_frame_pointer_rtx);
emit_use (stack_pointer_rtx); emit_use (stack_pointer_rtx);
......
...@@ -961,13 +961,10 @@ round_push (rtx size) ...@@ -961,13 +961,10 @@ round_push (rtx size)
/* Save the stack pointer for the purpose in SAVE_LEVEL. PSAVE is a pointer /* 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, 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 this function will allocate one. If a save area is specified, it
must be of the proper mode. must be of the proper mode. */
The insns are emitted after insn AFTER, if nonzero, otherwise the insns
are emitted at the current position. */
void 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; rtx sa = *psave;
/* The default is that we use a move insn and save in a Pmode object. */ /* The default is that we use a move insn and save in a Pmode object. */
...@@ -1013,38 +1010,17 @@ emit_stack_save (enum save_level save_level, rtx *psave, rtx after) ...@@ -1013,38 +1010,17 @@ emit_stack_save (enum save_level save_level, rtx *psave, rtx after)
} }
} }
if (after) do_pending_stack_adjust ();
{ if (sa != 0)
rtx seq; sa = validize_mem (sa);
emit_insn (fcn (sa, stack_pointer_rtx));
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));
}
} }
/* Restore the stack pointer for the purpose in SAVE_LEVEL. SA is the save /* 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. 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. */
void 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. */ /* The default is that we use a move insn. */
rtx (*fcn) (rtx, rtx) = gen_move_insn; rtx (*fcn) (rtx, rtx) = gen_move_insn;
...@@ -1086,18 +1062,7 @@ emit_stack_restore (enum save_level save_level, rtx sa, rtx after) ...@@ -1086,18 +1062,7 @@ emit_stack_restore (enum save_level save_level, rtx sa, rtx after)
discard_pending_stack_adjust (); discard_pending_stack_adjust ();
if (after) emit_insn (fcn (stack_pointer_rtx, sa));
{
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));
} }
/* Invoke emit_stack_save on the nonlocal_goto_save_area for the current /* Invoke emit_stack_save on the nonlocal_goto_save_area for the current
...@@ -1118,7 +1083,7 @@ update_nonlocal_goto_save_area (void) ...@@ -1118,7 +1083,7 @@ update_nonlocal_goto_save_area (void)
integer_one_node, NULL_TREE, NULL_TREE); integer_one_node, NULL_TREE, NULL_TREE);
r_save = expand_expr (t_save, NULL_RTX, VOIDmode, EXPAND_WRITE); 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);
} }
/* Return an rtx representing the address of an area of memory dynamically /* Return an rtx representing the address of an area of memory dynamically
......
...@@ -633,10 +633,10 @@ extern void anti_adjust_stack_and_probe (rtx, bool); ...@@ -633,10 +633,10 @@ extern void anti_adjust_stack_and_probe (rtx, bool);
enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL}; enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL};
/* Save the stack pointer at the specified level. */ /* 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. */ /* 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. */ /* Invoke emit_stack_save for the nonlocal_goto_save_area. */
extern void update_nonlocal_goto_save_area (void); extern void update_nonlocal_goto_save_area (void);
......
...@@ -5121,10 +5121,15 @@ expand_function_end (void) ...@@ -5121,10 +5121,15 @@ expand_function_end (void)
if (! EXIT_IGNORE_STACK if (! EXIT_IGNORE_STACK
&& cfun->calls_alloca) && cfun->calls_alloca)
{ {
rtx tem = 0; rtx tem = 0, seq;
emit_stack_save (SAVE_FUNCTION, &tem, parm_birth_insn); start_sequence ();
emit_stack_restore (SAVE_FUNCTION, tem, NULL_RTX); 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 /* ??? This should no longer be necessary since stupid is no longer with
......
...@@ -2006,7 +2006,7 @@ expand_stack_save (void) ...@@ -2006,7 +2006,7 @@ expand_stack_save (void)
rtx ret = NULL_RTX; rtx ret = NULL_RTX;
do_pending_stack_adjust (); do_pending_stack_adjust ();
emit_stack_save (SAVE_BLOCK, &ret, NULL_RTX); emit_stack_save (SAVE_BLOCK, &ret);
return ret; return ret;
} }
...@@ -2017,7 +2017,7 @@ expand_stack_restore (tree var) ...@@ -2017,7 +2017,7 @@ expand_stack_restore (tree var)
rtx sa = expand_normal (var); rtx sa = expand_normal (var);
sa = convert_memory_address (Pmode, sa); sa = convert_memory_address (Pmode, sa);
emit_stack_restore (SAVE_BLOCK, sa, NULL_RTX); emit_stack_restore (SAVE_BLOCK, sa);
} }
/* Do the insertion of a case label into case_list. The labels are /* Do the insertion of a case label into case_list. The labels are
......
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