Commit 43c7dca8 by Richard Sandiford Committed by Richard Sandiford

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

gcc/
	* target-insns.def (untyped_call, untyped_return): New targetm
	instruction patterns.
	* builtins.c (expand_builtin_apply): Use them instead of
	HAVE_*/gen_* interface.
	(result_vector): Define unconditionally.

From-SVN: r225423
parent 95a3fb9d
2015-07-05 Richard Sandiford <richard.sandiford@arm.com> 2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* target-insns.def (untyped_call, untyped_return): New targetm
instruction patterns.
* builtins.c (expand_builtin_apply): Use them instead of
HAVE_*/gen_* interface.
(result_vector): Define unconditionally.
2015-07-05 Richard Sandiford <richard.sandiford@arm.com>
* target-insns.def (builtin_longjmp, builtin_setjmp_receiver) * target-insns.def (builtin_longjmp, builtin_setjmp_receiver)
(builtin_setjmp_setup, exception_receiver, nonlocal_goto) (builtin_setjmp_setup, exception_receiver, nonlocal_goto)
(nonlocal_goto_receiver): New targetm instruction patterns. (nonlocal_goto_receiver): New targetm instruction patterns.
......
...@@ -104,9 +104,7 @@ static int target_char_cast (tree, char *); ...@@ -104,9 +104,7 @@ static int target_char_cast (tree, char *);
static rtx get_memory_rtx (tree, tree); static rtx get_memory_rtx (tree, tree);
static int apply_args_size (void); static int apply_args_size (void);
static int apply_result_size (void); static int apply_result_size (void);
#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return)
static rtx result_vector (int, rtx); static rtx result_vector (int, rtx);
#endif
static void expand_builtin_prefetch (tree); static void expand_builtin_prefetch (tree);
static rtx expand_builtin_apply_args (void); static rtx expand_builtin_apply_args (void);
static rtx expand_builtin_apply_args_1 (void); static rtx expand_builtin_apply_args_1 (void);
...@@ -1448,7 +1446,6 @@ apply_result_size (void) ...@@ -1448,7 +1446,6 @@ apply_result_size (void)
return size; return size;
} }
#if defined (HAVE_untyped_call) || defined (HAVE_untyped_return)
/* Create a vector describing the result block RESULT. If SAVEP is true, /* Create a vector describing the result block RESULT. If SAVEP is true,
the result block is used to save the values; otherwise it is used to the result block is used to save the values; otherwise it is used to
restore the values. */ restore the values. */
...@@ -1477,7 +1474,6 @@ result_vector (int savep, rtx result) ...@@ -1477,7 +1474,6 @@ result_vector (int savep, rtx result)
} }
return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec)); return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec));
} }
#endif /* HAVE_untyped_call or HAVE_untyped_return */
/* Save the state required to perform an untyped call with the same /* Save the state required to perform an untyped call with the same
arguments as were passed to the current function. */ arguments as were passed to the current function. */
...@@ -1698,12 +1694,13 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize) ...@@ -1698,12 +1694,13 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
function = memory_address (FUNCTION_MODE, function); function = memory_address (FUNCTION_MODE, function);
/* Generate the actual call instruction and save the return value. */ /* Generate the actual call instruction and save the return value. */
#ifdef HAVE_untyped_call if (targetm.have_untyped_call ())
if (HAVE_untyped_call) {
emit_call_insn (gen_untyped_call (gen_rtx_MEM (FUNCTION_MODE, function), rtx mem = gen_rtx_MEM (FUNCTION_MODE, function);
result, result_vector (1, result))); emit_call_insn (targetm.gen_untyped_call (mem, result,
result_vector (1, result)));
}
else else
#endif
#ifdef HAVE_call_value #ifdef HAVE_call_value
if (HAVE_call_value) if (HAVE_call_value)
{ {
...@@ -1767,14 +1764,13 @@ expand_builtin_return (rtx result) ...@@ -1767,14 +1764,13 @@ expand_builtin_return (rtx result)
apply_result_size (); apply_result_size ();
result = gen_rtx_MEM (BLKmode, result); result = gen_rtx_MEM (BLKmode, result);
#ifdef HAVE_untyped_return if (targetm.have_untyped_return ())
if (HAVE_untyped_return)
{ {
emit_jump_insn (gen_untyped_return (result, result_vector (0, result))); rtx vector = result_vector (0, result);
emit_jump_insn (targetm.gen_untyped_return (result, vector));
emit_barrier (); emit_barrier ();
return; return;
} }
#endif
/* Restore the return value and note that each value is used. */ /* Restore the return value and note that each value is used. */
size = 0; size = 0;
......
...@@ -50,3 +50,5 @@ DEF_TARGET_INSN (sibcall_epilogue, (void)) ...@@ -50,3 +50,5 @@ 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))
DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1)) DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))
DEF_TARGET_INSN (untyped_call, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (untyped_return, (rtx x0, rtx x1))
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