aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-08-20 08:51:09 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-08-20 08:51:09 +0000
commit4f53599cb5b822cd7f95997861c2e064977ecb6a (patch)
tree9bd3f242894091d3344f3c78727d09c0f031167d /gcc
parentfde65a89fad742c2dca8ad50452e482d22f3c1b2 (diff)
downloadgcc-4f53599cb5b822cd7f95997861c2e064977ecb6a.zip
gcc-4f53599cb5b822cd7f95997861c2e064977ecb6a.tar.gz
gcc-4f53599cb5b822cd7f95997861c2e064977ecb6a.tar.bz2
Add must_pass_va_arg_in_stack
This patch splits out another idiom from the va_arg gimplification routines, so that there's only one place to update later. 2019-08-20 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. From-SVN: r274696
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/calls.c9
-rw-r--r--gcc/calls.h1
-rw-r--r--gcc/config/alpha/alpha.c2
-rw-r--r--gcc/config/sh/sh.c5
-rw-r--r--gcc/config/stormy16/stormy16.c2
-rw-r--r--gcc/config/xtensa/xtensa.c2
7 files changed, 25 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 81d672f..86bd73a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
+ * 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.
+
+2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
+
* calls.h (pass_va_arg_by_reference): Declare.
* calls.c (pass_va_arg_by_reference): New function.
* config/aarch64/aarch64.c (aarch64_gimplify_va_arg_expr): Use it.
diff --git a/gcc/calls.c b/gcc/calls.c
index f49f052..dd428b9 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -5900,5 +5900,14 @@ must_pass_in_stack_var_size_or_pad (machine_mode mode, const_tree type)
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"
diff --git a/gcc/calls.h b/gcc/calls.h
index 2f41fa3..b084270 100644
--- a/gcc/calls.h
+++ b/gcc/calls.h
@@ -28,6 +28,7 @@ extern bool gimple_alloca_call_p (const gimple *);
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);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 74ca95e..479d1ad 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -6243,7 +6243,7 @@ alpha_gimplify_va_arg_1 (tree type, tree base, tree offset,
/* 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,
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index e44e46d..ab01809 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -7656,9 +7656,8 @@ sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
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);
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index aec9f2d..00085d1 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -1342,7 +1342,7 @@ xstormy16_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
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);
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 9c90c14..6a3104f 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -3328,7 +3328,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
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);