1. Replace PUSH_ARGS with a target calls hook, TARGET_PUSH_ARGUMENT, which
takes an integer argument. When it returns true, push instructions will
be used to pass outgoing arguments. If the argument is nonzero, it is
the number of bytes to push and indicates the PUSH instruction usage is
optional so that the backend can decide if PUSH instructions should be
generated. Otherwise, the argument is zero.
2. Implement x86 target hook which returns false when the number of bytes
to push is no less than 16 (8 for 32-bit targets) if vector load and store
can be used.
3. Remove target PUSH_ARGS definitions which return 0 as it is the same
as the default.
4. Define TARGET_PUSH_ARGUMENT of cr16 and m32c to always return true.
gcc/
PR target/100704
* calls.c (expand_call): Replace PUSH_ARGS with
targetm.calls.push_argument (0).
(emit_library_call_value_1): Likewise.
* defaults.h (PUSH_ARGS): Removed.
(PUSH_ARGS_REVERSED): Replace PUSH_ARGS with
targetm.calls.push_argument (0).
* expr.c (block_move_libcall_safe_for_call_parm): Likewise.
(emit_push_insn): Pass the number bytes to push to
targetm.calls.push_argument and pass 0 if ARGS_ADDR is 0.
* hooks.c (hook_bool_uint_true): New.
* hooks.h (hook_bool_uint_true): Likewise.
* rtlanal.c (nonzero_bits1): Replace PUSH_ARGS with
targetm.calls.push_argument (0).
* target.def (push_argument): Add a targetm.calls hook.
* targhooks.c (default_push_argument): New.
* targhooks.h (default_push_argument): Likewise.
* config/bpf/bpf.h (PUSH_ARGS): Removed.
* config/cr16/cr16.c (TARGET_PUSH_ARGUMENT): New.
* config/cr16/cr16.h (PUSH_ARGS): Removed.
* config/i386/i386.c (ix86_push_argument):
(TARGET_PUSH_ARGUMENT): Likewise.
* config/i386/i386.h (PUSH_ARGS): Removed.
* config/m32c/m32c.c (TARGET_PUSH_ARGUMENT): New.
* config/m32c/m32c.h (PUSH_ARGS): Removed.
* config/nios2/nios2.h (PUSH_ARGS): Likewise.
* config/pru/pru.h (PUSH_ARGS): Likewise.
* doc/tm.texi.in: Remove PUSH_ARGS documentation. Add
TARGET_PUSH_ARGUMENT hook.
* doc/tm.texi: Regenerated.
gcc/testsuite/
PR target/100704
* gcc.target/i386/pr100704-1.c: New test.
* gcc.target/i386/pr100704-2.c: Likewise.
* gcc.target/i386/pr100704-3.c: Likewise.
---
gcc/calls.c| 6 +++---
gcc/config/bpf/bpf.h | 3 ---
gcc/config/cr16/cr16.c | 2 ++
gcc/config/cr16/cr16.h | 2 --
gcc/config/i386/i386.c | 14 +
gcc/config/i386/i386.h | 7 +--
gcc/config/m32c/m32c.c | 3 +++
gcc/config/m32c/m32c.h | 1 -
gcc/config/nios2/nios2.h | 1 -
gcc/config/pru/pru.h | 1 -
gcc/defaults.h | 11 +-
gcc/doc/tm.texi| 19 +
gcc/doc/tm.texi.in | 9 +---
gcc/expr.c | 14 ++---
gcc/hooks.c| 8
gcc/hooks.h| 1 +
gcc/rtlanal.c | 2 +-
gcc/target.def | 14 +
gcc/targhooks.c| 12 +++
gcc/targhooks.h| 1 +
gcc/testsuite/gcc.target/i386/pr100704-1.c | 24 ++
gcc/testsuite/gcc.target/i386/pr100704-2.c | 23 +
gcc/testsuite/gcc.target/i386/pr100704-3.c | 20 ++
23 files changed, 151 insertions(+), 47 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr100704-1.c
create mode 100644 gcc/testsuite/gcc.target/i386/pr100704-2.c
create mode 100644 gcc/testsuite/gcc.target/i386/pr100704-3.c
diff --git a/gcc/calls.c b/gcc/calls.c
index f3da1839dc5..336b05f01c4 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -3727,7 +3727,7 @@ expand_call (tree exp, rtx target, int ignore)
So the entire argument block must then be preallocated (i.e., we
ignore PUSH_ROUNDING in that case). */
- int must_preallocate = !PUSH_ARGS;
+ int must_preallocate = !targetm.calls.push_argument (0);
/* Size of the stack reserved for parameter registers. */
int reg_parm_stack_space = 0;
@@ -3836,7 +3836,7 @@ expand_call (tree exp, rtx target, int ignore)
#endif
if (! OUTGOING_REG_PARM_STACK_SPACE ((!fndecl ? fntype : TREE_TYPE (fndecl)))
- && reg_parm_stack_space > 0 && PUSH_ARGS)
+ && reg_parm_stack_space > 0 && targetm.calls.push_argument (0))
must_preallocate = 1;
/* Set up a place to return a structure. */
@@ -5477,7 +5477,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx
value,
}
else
{
- if (