From: Richard Sandiford <richard.sandiford@arm.com>
To: gcc-patches@gcc.gnu.org
Subject: [02/13] Add must_pass_va_arg_in_stack
Date: Mon, 19 Aug 2019 15:17:00 -0000 [thread overview]
Message-ID: <mptsgpxchp3.fsf@arm.com> (raw)
In-Reply-To: <mpt1rxhdwbz.fsf@arm.com> (Richard Sandiford's message of "Mon, 19 Aug 2019 16:11:12 +0100")
This patch splits out another idiom from the va_arg gimplification
routines, so that there's only one place to update later.
2019-08-19 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* calls.h (must_pass_va_arg_in_stack): Declare.
* calls.c (must_pass_va_arg_in_stack): New function.
* config/alpha/alpha.c (alpha_gimplify_va_arg_1): Use it.
* config/sh/sh.c (sh_gimplify_va_arg_expr): Likewise.
* config/stormy16/stormy16.c (xstormy16_gimplify_va_arg_expr):
Likewise.
* config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise.
Index: gcc/calls.h
===================================================================
--- gcc/calls.h 2019-08-19 15:58:10.742205564 +0100
+++ gcc/calls.h 2019-08-19 15:58:16.094166837 +0100
@@ -28,6 +28,7 @@ extern bool gimple_alloca_call_p (const
extern bool alloca_call_p (const_tree);
extern bool must_pass_in_stack_var_size (machine_mode, const_tree);
extern bool must_pass_in_stack_var_size_or_pad (machine_mode, const_tree);
+extern bool must_pass_va_arg_in_stack (tree);
extern rtx prepare_call_address (tree, rtx, rtx, rtx *, int, int);
extern bool shift_return_value (machine_mode, bool, rtx);
extern rtx expand_call (tree, rtx, int);
Index: gcc/calls.c
===================================================================
--- gcc/calls.c 2019-08-19 15:58:10.742205564 +0100
+++ gcc/calls.c 2019-08-19 15:58:16.094166837 +0100
@@ -5900,5 +5900,14 @@ must_pass_in_stack_var_size_or_pad (mach
return false;
}
+/* Return true if TYPE must be passed on the stack when passed to
+ the "..." arguments of a function. */
+
+bool
+must_pass_va_arg_in_stack (tree type)
+{
+ return targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+}
+
/* Tell the garbage collector about GTY markers in this source file. */
#include "gt-calls.h"
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c 2019-08-19 15:58:10.750205506 +0100
+++ gcc/config/alpha/alpha.c 2019-08-19 15:58:16.094166837 +0100
@@ -6243,7 +6243,7 @@ alpha_gimplify_va_arg_1 (tree type, tree
/* If the type could not be passed in registers, skip the block
reserved for the registers. */
- if (targetm.calls.must_pass_in_stack (TYPE_MODE (type), type))
+ if (must_pass_va_arg_in_stack (type))
{
t = build_int_cst (TREE_TYPE (offset), 6*8);
gimplify_assign (offset,
Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c 2019-08-13 22:35:11.793251783 +0100
+++ gcc/config/sh/sh.c 2019-08-19 15:58:16.098166809 +0100
@@ -7656,9 +7656,8 @@ sh_gimplify_va_arg_expr (tree valist, tr
tree addr, lab_over = NULL, result = NULL;
tree eff_type;
- const bool pass_by_ref =
- !VOID_TYPE_P (type)
- && targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+ const bool pass_by_ref
+ = !VOID_TYPE_P (type) && must_pass_va_arg_in_stack (type);
if (pass_by_ref)
type = build_pointer_type (type);
Index: gcc/config/stormy16/stormy16.c
===================================================================
--- gcc/config/stormy16/stormy16.c 2019-08-13 22:35:11.805251695 +0100
+++ gcc/config/stormy16/stormy16.c 2019-08-19 15:58:16.098166809 +0100
@@ -1342,7 +1342,7 @@ xstormy16_gimplify_va_arg_expr (tree val
count = build3 (COMPONENT_REF, TREE_TYPE (f_count), valist, f_count,
NULL_TREE);
- must_stack = targetm.calls.must_pass_in_stack (TYPE_MODE (type), type);
+ must_stack = must_pass_va_arg_in_stack (type);
size_tree = round_up (size_in_bytes (type), UNITS_PER_WORD);
gimplify_expr (&size_tree, pre_p, NULL, is_gimple_val, fb_rvalue);
Index: gcc/config/xtensa/xtensa.c
===================================================================
--- gcc/config/xtensa/xtensa.c 2019-08-19 15:58:10.766205389 +0100
+++ gcc/config/xtensa/xtensa.c 2019-08-19 15:58:16.098166809 +0100
@@ -3328,7 +3328,7 @@ xtensa_gimplify_va_arg_expr (tree valist
array = create_tmp_var (ptr_type_node);
lab_over = NULL;
- if (!targetm.calls.must_pass_in_stack (TYPE_MODE (type), type))
+ if (!must_pass_va_arg_in_stack (type))
{
lab_false = create_artificial_label (UNKNOWN_LOCATION);
lab_over = create_artificial_label (UNKNOWN_LOCATION);
next prev parent reply other threads:[~2019-08-19 15:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 15:15 [00/13] Pass an argument descriptor to target hooks Richard Sandiford
2019-08-19 15:16 ` [01/13] Add pass_va_arg_by_reference Richard Sandiford
2019-08-19 20:04 ` Jeff Law
2019-08-19 15:17 ` Richard Sandiford [this message]
2019-08-19 20:05 ` [02/13] Add must_pass_va_arg_in_stack Jeff Law
2019-08-19 15:18 ` [03/13] Use function_arg_info for TARGET_ARG_PARTIAL_BYTES Richard Sandiford
2019-08-19 20:42 ` Jeff Law
2019-08-19 15:19 ` [04/13] Use function_arg_info for TARGET_PASS_BY_REFERENCE Richard Sandiford
2019-08-19 20:43 ` Jeff Law
2019-08-19 15:20 ` [05/13] Use function_arg_info for TARGET_SETUP_INCOMING_ARGS Richard Sandiford
2019-08-19 20:50 ` Jeff Law
2019-08-19 15:21 ` [06/13] Use function_arg_info for TARGET_FUNCTION_(INCOMING_)ARG Richard Sandiford
2019-08-19 21:07 ` Jeff Law
2019-08-19 15:22 ` [07/13] Use function_arg_info for TARGET_FUNCTION_ARG_ADVANCE Richard Sandiford
2019-08-19 21:11 ` Jeff Law
2019-08-19 15:23 ` [08/13] Use function_arg_info for TARGET_CALLEE_COPIES Richard Sandiford
2019-08-19 21:16 ` Jeff Law
2019-08-19 15:24 ` [09/13] Use function_arg_info for TARGET_MUST_PASS_IN_STACK Richard Sandiford
2019-08-19 22:04 ` Jeff Law
2019-08-19 15:47 ` [10/13] Add a apply_pass_by_reference_rules helper Richard Sandiford
2019-08-19 22:19 ` Jeff Law
2019-08-19 15:51 ` [11/13] Make function.c use function_arg_info internally Richard Sandiford
2019-08-19 22:47 ` Jeff Law
2019-08-19 15:52 ` [13/13] Add a pass_by_reference flag to function_arg_info Richard Sandiford
2019-08-19 22:54 ` Jeff Law
2019-08-19 15:52 ` [12/13] Make calls.c use function_arg_info internally Richard Sandiford
2019-08-19 22:49 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mptsgpxchp3.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).