aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-08-20 08:50:59 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-08-20 08:50:59 +0000
commitfde65a89fad742c2dca8ad50452e482d22f3c1b2 (patch)
treea1289bba8e74147f153b1d6b186772b35160a7aa /gcc
parentf386ca413862152954a0ac73a7a2294fd6bbae1a (diff)
downloadgcc-fde65a89fad742c2dca8ad50452e482d22f3c1b2.zip
gcc-fde65a89fad742c2dca8ad50452e482d22f3c1b2.tar.gz
gcc-fde65a89fad742c2dca8ad50452e482d22f3c1b2.tar.bz2
Add pass_va_arg_by_reference
This patch splits out a common 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 (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. * config/alpha/alpha.c (alpha_gimplify_va_arg): Likewise. * config/gcn/gcn.c (gcn_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Likewise. (mips_gimplify_va_arg_expr): Likewise. * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000-call.c (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_gimplify_va_arg): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise. * config/tilegx/tilegx.c (tilegx_gimplify_va_arg_expr): Likewise. * config/tilepro/tilepro.c (tilepro_gimplify_va_arg_expr): Likewise. * config/visium/visium.c (visium_gimplify_va_arg): Likewise. * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise. * targhooks.c (std_gimplify_va_arg_expr): Likewise. From-SVN: r274695
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/calls.c9
-rw-r--r--gcc/calls.h1
-rw-r--r--gcc/config/aarch64/aarch64.c2
-rw-r--r--gcc/config/alpha/alpha.c2
-rw-r--r--gcc/config/gcn/gcn.c2
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/config/ia64/ia64.c2
-rw-r--r--gcc/config/mips/mips.c4
-rw-r--r--gcc/config/msp430/msp430.c2
-rw-r--r--gcc/config/pa/pa.c2
-rw-r--r--gcc/config/rs6000/rs6000-call.c2
-rw-r--r--gcc/config/s390/s390.c2
-rw-r--r--gcc/config/sparc/sparc.c2
-rw-r--r--gcc/config/spu/spu.c3
-rw-r--r--gcc/config/tilegx/tilegx.c3
-rw-r--r--gcc/config/tilepro/tilepro.c3
-rw-r--r--gcc/config/visium/visium.c3
-rw-r--r--gcc/config/xtensa/xtensa.c2
-rw-r--r--gcc/targhooks.c2
20 files changed, 51 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7975480..81d672f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+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.
+ * config/alpha/alpha.c (alpha_gimplify_va_arg): Likewise.
+ * config/gcn/gcn.c (gcn_gimplify_va_arg_expr): Likewise.
+ * config/i386/i386.c (ix86_gimplify_va_arg): Likewise.
+ * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
+ * config/mips/mips.c (mips_std_gimplify_va_arg_expr): Likewise.
+ (mips_gimplify_va_arg_expr): Likewise.
+ * config/msp430/msp430.c (msp430_gimplify_va_arg_expr): Likewise.
+ * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
+ * config/rs6000/rs6000-call.c (rs6000_gimplify_va_arg): Likewise.
+ * config/s390/s390.c (s390_gimplify_va_arg): Likewise.
+ * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise.
+ * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise.
+ * config/tilegx/tilegx.c (tilegx_gimplify_va_arg_expr): Likewise.
+ * config/tilepro/tilepro.c (tilepro_gimplify_va_arg_expr): Likewise.
+ * config/visium/visium.c (visium_gimplify_va_arg): Likewise.
+ * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise.
+ * targhooks.c (std_gimplify_va_arg_expr): Likewise.
+
2019-08-20 Richard Biener <rguenther@suse.de>
PR target/91498
diff --git a/gcc/calls.c b/gcc/calls.c
index 54e30e6..f49f052 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -927,6 +927,15 @@ pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode,
type, named_arg);
}
+/* Return true if TYPE should be passed by reference when passed to
+ the "..." arguments of a function. */
+
+bool
+pass_va_arg_by_reference (tree type)
+{
+ return pass_by_reference (NULL, TYPE_MODE (type), type, false);
+}
+
/* Return true if TYPE, which is passed by reference, should be callee
copied instead of caller copied. */
diff --git a/gcc/calls.h b/gcc/calls.h
index 128bb51..2f41fa3 100644
--- a/gcc/calls.h
+++ b/gcc/calls.h
@@ -35,6 +35,7 @@ extern void fixup_tail_calls (void);
extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
tree, bool);
+extern bool pass_va_arg_by_reference (tree);
extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
tree, bool);
extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]);
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index be01622..bbcafa9 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -14271,7 +14271,7 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
HOST_WIDE_INT size, rsize, adjust, align;
tree t, u, cond1, cond2;
- indirect_p = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect_p = pass_va_arg_by_reference (type);
if (indirect_p)
type = build_pointer_type (type);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index d551af7..74ca95e 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -6330,7 +6330,7 @@ alpha_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
t = fold_convert (build_nonstandard_integer_type (64, 0), offset_field);
offset = get_initialized_tmp_var (t, pre_p, NULL);
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
{
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index 2c1158f..0826c81 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -2493,7 +2493,7 @@ gcn_gimplify_va_arg_expr (tree valist, tree type,
tree t, u;
bool indirect;
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
{
type = ptr;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 647bcbe..e6244ea 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4307,7 +4307,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
ovf = build3 (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
sav = build3 (COMPONENT_REF, TREE_TYPE (f_sav), valist, f_sav, NULL_TREE);
- indirect_p = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect_p = pass_va_arg_by_reference (type);
if (indirect_p)
type = build_pointer_type (type);
size = arg_int_size_in_bytes (type);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index a07244e..4449151 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -5147,7 +5147,7 @@ ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
gimple_seq *post_p)
{
/* Variable sized types are passed by reference. */
- if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
+ if (pass_va_arg_by_reference (type))
{
tree ptrtype = build_pointer_type (type);
tree addr = std_gimplify_va_arg_expr (valist, ptrtype, pre_p, post_p);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 45ddec1..fd5d78d 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -6780,7 +6780,7 @@ mips_std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
unsigned HOST_WIDE_INT align, boundary;
bool indirect;
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
type = build_pointer_type (type);
@@ -6867,7 +6867,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
tree addr;
bool indirect_p;
- indirect_p = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
+ indirect_p = pass_va_arg_by_reference (type);
if (indirect_p)
type = build_pointer_type (type);
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index fedbdf5..84762f9 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -856,7 +856,7 @@ msp430_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
unsigned HOST_WIDE_INT align, boundary;
bool indirect;
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
type = build_pointer_type (type);
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 0ab95d8..778e136 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -6377,7 +6377,7 @@ hppa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
unsigned int size, ofs;
bool indirect;
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
{
type = ptr;
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 62aa4bf..f7c5384 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -2690,7 +2690,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
int regalign = 0;
gimple *stmt;
- if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
+ if (pass_va_arg_by_reference (type))
{
t = rs6000_gimplify_va_arg (valist, ptrtype, pre_p, post_p);
return build_va_arg_indirect_ref (t);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 74f1d25..4ea600a 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -12476,7 +12476,7 @@ s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
s390_check_type_for_vector_abi (type, true, false);
- if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
+ if (pass_va_arg_by_reference (type))
{
if (TARGET_DEBUG_ARG)
{
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index a15f27f..e5cf9a8 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -7935,7 +7935,7 @@ sparc_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
bool indirect;
tree ptrtype = build_pointer_type (type);
- if (pass_by_reference (NULL, TYPE_MODE (type), type, false))
+ if (pass_va_arg_by_reference (type))
{
indirect = true;
size = rsize = UNITS_PER_WORD;
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index f88ad19..50bf40e 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -4053,8 +4053,7 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
/* if an object is dynamically sized, a pointer to it is passed
instead of the object itself. */
- pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
- false);
+ pass_by_reference_p = pass_va_arg_by_reference (type);
if (pass_by_reference_p)
type = build_pointer_type (type);
size = int_size_in_bytes (type);
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index 575780f..849fda5 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -471,8 +471,7 @@ tilegx_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
/* If an object is dynamically sized, a pointer to it is passed
instead of the object itself. */
- pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
- false);
+ pass_by_reference_p = pass_va_arg_by_reference (type);
if (pass_by_reference_p)
type = build_pointer_type (type);
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index b4adfa4..8091ee0 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -419,8 +419,7 @@ tilepro_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p,
/* if an object is dynamically sized, a pointer to it is passed
instead of the object itself. */
- pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
- false);
+ pass_by_reference_p = pass_va_arg_by_reference (type);
if (pass_by_reference_p)
type = build_pointer_type (type);
diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c
index 431f64c..4ff3313 100644
--- a/gcc/config/visium/visium.c
+++ b/gcc/config/visium/visium.c
@@ -1637,8 +1637,7 @@ visium_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
tree f_ovfl, f_gbase, f_fbase, f_gbytes, f_fbytes;
tree ovfl, base, bytes;
HOST_WIDE_INT size, rsize;
- const bool by_reference_p
- = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ const bool by_reference_p = pass_va_arg_by_reference (type);
const bool float_reg_arg_p
= (TARGET_FPU && !by_reference_p
&& ((GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index a999567..9c90c14 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -3252,7 +3252,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
tree lab_false, lab_over, lab_false2;
bool indirect;
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
type = build_pointer_type (type);
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 111ed2e..8a83ce8 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -2177,7 +2177,7 @@ std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
if (ARGS_GROW_DOWNWARD)
gcc_unreachable ();
- indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ indirect = pass_va_arg_by_reference (type);
if (indirect)
type = build_pointer_type (type);