Commit c65aa042 by Richard Sandiford Committed by Richard Sandiford

target-insns.def (stack_protect_set, [...]): New targetm instruction patterns.

gcc/
	* target-insns.def (stack_protect_set, stack_protect_test): New
	targetm instruction patterns.
	* cfgexpand.c (stack_protect_prologue): Use them instead of
	HAVE_*/gen_* interface.
	* function.c (stack_protect_epilogue): Likewise.

From-SVN: r225428
parent 9c58793a
2015-07-05 Richard Sandiford <richard.sandiford@arm.com> 2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* target-insns.def (stack_protect_set, stack_protect_test): New
targetm instruction patterns.
* cfgexpand.c (stack_protect_prologue): Use them instead of
HAVE_*/gen_* interface.
* function.c (stack_protect_epilogue): Likewise.
2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* expr.h (gen_move_insn_uncast): Delete. * expr.h (gen_move_insn_uncast): Delete.
* expr.c (gen_move_insn_uncast): Delete. * expr.c (gen_move_insn_uncast): Delete.
......
...@@ -5767,11 +5767,6 @@ expand_main_function (void) ...@@ -5767,11 +5767,6 @@ expand_main_function (void)
/* Expand code to initialize the stack_protect_guard. This is invoked at /* Expand code to initialize the stack_protect_guard. This is invoked at
the beginning of a function to be protected. */ the beginning of a function to be protected. */
#ifndef HAVE_stack_protect_set
# define HAVE_stack_protect_set 0
# define gen_stack_protect_set(x,y) (gcc_unreachable (), NULL_RTX)
#endif
static void static void
stack_protect_prologue (void) stack_protect_prologue (void)
{ {
...@@ -5783,15 +5778,12 @@ stack_protect_prologue (void) ...@@ -5783,15 +5778,12 @@ stack_protect_prologue (void)
/* Allow the target to copy from Y to X without leaking Y into a /* Allow the target to copy from Y to X without leaking Y into a
register. */ register. */
if (HAVE_stack_protect_set) if (targetm.have_stack_protect_set ())
{ if (rtx_insn *insn = targetm.gen_stack_protect_set (x, y))
rtx insn = gen_stack_protect_set (x, y); {
if (insn) emit_insn (insn);
{ return;
emit_insn (insn); }
return;
}
}
/* Otherwise do a straight move. */ /* Otherwise do a straight move. */
emit_move_insn (x, y); emit_move_insn (x, y);
......
...@@ -4874,11 +4874,6 @@ init_function_start (tree subr) ...@@ -4874,11 +4874,6 @@ init_function_start (tree subr)
/* Expand code to verify the stack_protect_guard. This is invoked at /* Expand code to verify the stack_protect_guard. This is invoked at
the end of a function to be protected. */ the end of a function to be protected. */
#ifndef HAVE_stack_protect_test
# define HAVE_stack_protect_test 0
# define gen_stack_protect_test(x, y, z) (gcc_unreachable (), NULL_RTX)
#endif
void void
stack_protect_epilogue (void) stack_protect_epilogue (void)
{ {
...@@ -4891,13 +4886,12 @@ stack_protect_epilogue (void) ...@@ -4891,13 +4886,12 @@ stack_protect_epilogue (void)
/* Allow the target to compare Y with X without leaking either into /* Allow the target to compare Y with X without leaking either into
a register. */ a register. */
switch (HAVE_stack_protect_test != 0) switch (targetm.have_stack_protect_test ())
{ {
case 1: case 1:
tmp = gen_stack_protect_test (x, y, label); if (rtx_insn *seq = targetm.gen_stack_protect_test (x, y, label))
if (tmp)
{ {
emit_insn (tmp); emit_insn (seq);
break; break;
} }
/* FALLTHRU */ /* FALLTHRU */
......
...@@ -55,6 +55,8 @@ DEF_TARGET_INSN (save_stack_function, (rtx x0, rtx x1)) ...@@ -55,6 +55,8 @@ DEF_TARGET_INSN (save_stack_function, (rtx x0, rtx x1))
DEF_TARGET_INSN (save_stack_nonlocal, (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 (stack_protect_set, (rtx x0, rtx x1))
DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2)) DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
DEF_TARGET_INSN (trap, (void)) DEF_TARGET_INSN (trap, (void))
......
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