Commit 4476e1a0 by Richard Sandiford Committed by Richard Sandiford

gcc/

	* target-insns.def (restore_stack_block, restore_stack_function)
	(restore_stack_nonlocal, save_stack_block, save_stack_function)
	(save_stack_nonlocal): New targetm instruction patterns.
	* builtins.c (expand_builtin_apply): Use them instead of
	HAVE_*/gen_* interface.
	* explow.c (emit_stack_save, emit_stack_restore): Likewise.

From-SVN: r225426
parent eb6f47fb
2015-07-05 Richard Sandiford <richard.sandiford@arm.com> 2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* target-insns.def (restore_stack_block, restore_stack_function)
(restore_stack_nonlocal, save_stack_block, save_stack_function)
(save_stack_nonlocal): New targetm instruction patterns.
* builtins.c (expand_builtin_apply): Use them instead of
HAVE_*/gen_* interface.
* explow.c (emit_stack_save, emit_stack_restore): Likewise.
2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* target-insns.def (trap): New targetm instruction pattern. * target-insns.def (trap): New targetm instruction pattern.
* builtins.c (expand_builtin_trap): Use it instead of HAVE_*/gen_* * builtins.c (expand_builtin_trap): Use it instead of HAVE_*/gen_*
interface. interface.
......
...@@ -1611,11 +1611,9 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize) ...@@ -1611,11 +1611,9 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
NO_DEFER_POP; NO_DEFER_POP;
/* Save the stack with nonlocal if available. */ /* Save the stack with nonlocal if available. */
#ifdef HAVE_save_stack_nonlocal if (targetm.have_save_stack_nonlocal ())
if (HAVE_save_stack_nonlocal)
emit_stack_save (SAVE_NONLOCAL, &old_stack_level); emit_stack_save (SAVE_NONLOCAL, &old_stack_level);
else else
#endif
emit_stack_save (SAVE_BLOCK, &old_stack_level); 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
...@@ -1732,11 +1730,9 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize) ...@@ -1732,11 +1730,9 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
add_function_usage_to (call_insn, call_fusage); add_function_usage_to (call_insn, call_fusage);
/* Restore the stack. */ /* Restore the stack. */
#ifdef HAVE_save_stack_nonlocal if (targetm.have_save_stack_nonlocal ())
if (HAVE_save_stack_nonlocal)
emit_stack_restore (SAVE_NONLOCAL, old_stack_level); emit_stack_restore (SAVE_NONLOCAL, old_stack_level);
else else
#endif
emit_stack_restore (SAVE_BLOCK, old_stack_level); emit_stack_restore (SAVE_BLOCK, old_stack_level);
fixup_args_size_notes (call_insn, get_last_insn (), 0); fixup_args_size_notes (call_insn, get_last_insn (), 0);
......
...@@ -973,30 +973,24 @@ emit_stack_save (enum save_level save_level, rtx *psave) ...@@ -973,30 +973,24 @@ 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. */
rtx (*fcn) (rtx, rtx) = gen_move_insn_uncast; rtx_insn *(*fcn) (rtx, rtx) = gen_move_insn;
machine_mode mode = STACK_SAVEAREA_MODE (save_level); machine_mode mode = STACK_SAVEAREA_MODE (save_level);
/* See if this machine has anything special to do for this kind of save. */ /* See if this machine has anything special to do for this kind of save. */
switch (save_level) switch (save_level)
{ {
#ifdef HAVE_save_stack_block
case SAVE_BLOCK: case SAVE_BLOCK:
if (HAVE_save_stack_block) if (targetm.have_save_stack_block ())
fcn = gen_save_stack_block; fcn = targetm.gen_save_stack_block;
break; break;
#endif
#ifdef HAVE_save_stack_function
case SAVE_FUNCTION: case SAVE_FUNCTION:
if (HAVE_save_stack_function) if (targetm.have_save_stack_function ())
fcn = gen_save_stack_function; fcn = targetm.gen_save_stack_function;
break; break;
#endif
#ifdef HAVE_save_stack_nonlocal
case SAVE_NONLOCAL: case SAVE_NONLOCAL:
if (HAVE_save_stack_nonlocal) if (targetm.have_save_stack_nonlocal ())
fcn = gen_save_stack_nonlocal; fcn = targetm.gen_save_stack_nonlocal;
break; break;
#endif
default: default:
break; break;
} }
...@@ -1028,7 +1022,7 @@ void ...@@ -1028,7 +1022,7 @@ void
emit_stack_restore (enum save_level save_level, rtx sa) 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_uncast; rtx_insn *(*fcn) (rtx, rtx) = gen_move_insn;
/* If stack_realign_drap, the x86 backend emits a prologue that aligns both /* If stack_realign_drap, the x86 backend emits a prologue that aligns both
STACK_POINTER and HARD_FRAME_POINTER. STACK_POINTER and HARD_FRAME_POINTER.
...@@ -1047,24 +1041,18 @@ emit_stack_restore (enum save_level save_level, rtx sa) ...@@ -1047,24 +1041,18 @@ emit_stack_restore (enum save_level save_level, rtx sa)
/* See if this machine has anything special to do for this kind of save. */ /* See if this machine has anything special to do for this kind of save. */
switch (save_level) switch (save_level)
{ {
#ifdef HAVE_restore_stack_block
case SAVE_BLOCK: case SAVE_BLOCK:
if (HAVE_restore_stack_block) if (targetm.have_restore_stack_block ())
fcn = gen_restore_stack_block; fcn = targetm.gen_restore_stack_block;
break; break;
#endif
#ifdef HAVE_restore_stack_function
case SAVE_FUNCTION: case SAVE_FUNCTION:
if (HAVE_restore_stack_function) if (targetm.have_restore_stack_function ())
fcn = gen_restore_stack_function; fcn = targetm.gen_restore_stack_function;
break; break;
#endif
#ifdef HAVE_restore_stack_nonlocal
case SAVE_NONLOCAL: case SAVE_NONLOCAL:
if (HAVE_restore_stack_nonlocal) if (targetm.have_restore_stack_nonlocal ())
fcn = gen_restore_stack_nonlocal; fcn = targetm.gen_restore_stack_nonlocal;
break; break;
#endif
default: default:
break; break;
} }
......
...@@ -46,7 +46,13 @@ DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3)) ...@@ -46,7 +46,13 @@ DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3))
DEF_TARGET_INSN (nonlocal_goto_receiver, (void)) DEF_TARGET_INSN (nonlocal_goto_receiver, (void))
DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (prologue, (void)) DEF_TARGET_INSN (prologue, (void))
DEF_TARGET_INSN (restore_stack_block, (rtx x0, rtx x1))
DEF_TARGET_INSN (restore_stack_function, (rtx x0, rtx x1))
DEF_TARGET_INSN (restore_stack_nonlocal, (rtx x0, rtx x1))
DEF_TARGET_INSN (return, (void)) DEF_TARGET_INSN (return, (void))
DEF_TARGET_INSN (save_stack_block, (rtx x0, rtx x1))
DEF_TARGET_INSN (save_stack_function, (rtx x0, rtx x1))
DEF_TARGET_INSN (save_stack_nonlocal, (rtx x0, rtx x1))
DEF_TARGET_INSN (sibcall_epilogue, (void)) DEF_TARGET_INSN (sibcall_epilogue, (void))
DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (simple_return, (void))
DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
......
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