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
This commit is contained in:
parent
f386ca4138
commit
fde65a89fa
@ -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>
|
2019-08-20 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR target/91498
|
PR target/91498
|
||||||
|
@ -927,6 +927,15 @@ pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode,
|
|||||||
type, named_arg);
|
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
|
/* Return true if TYPE, which is passed by reference, should be callee
|
||||||
copied instead of caller copied. */
|
copied instead of caller copied. */
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ extern void fixup_tail_calls (void);
|
|||||||
|
|
||||||
extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
|
extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
|
||||||
tree, bool);
|
tree, bool);
|
||||||
|
extern bool pass_va_arg_by_reference (tree);
|
||||||
extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
|
extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
|
||||||
tree, bool);
|
tree, bool);
|
||||||
extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]);
|
extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]);
|
||||||
|
@ -14271,7 +14271,7 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
HOST_WIDE_INT size, rsize, adjust, align;
|
HOST_WIDE_INT size, rsize, adjust, align;
|
||||||
tree t, u, cond1, cond2;
|
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)
|
if (indirect_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
|
@ -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);
|
t = fold_convert (build_nonstandard_integer_type (64, 0), offset_field);
|
||||||
offset = get_initialized_tmp_var (t, pre_p, NULL);
|
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)
|
if (indirect)
|
||||||
{
|
{
|
||||||
|
@ -2493,7 +2493,7 @@ gcn_gimplify_va_arg_expr (tree valist, tree type,
|
|||||||
tree t, u;
|
tree t, u;
|
||||||
bool indirect;
|
bool indirect;
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
{
|
{
|
||||||
type = ptr;
|
type = ptr;
|
||||||
|
@ -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);
|
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);
|
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)
|
if (indirect_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
size = arg_int_size_in_bytes (type);
|
size = arg_int_size_in_bytes (type);
|
||||||
|
@ -5147,7 +5147,7 @@ ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
gimple_seq *post_p)
|
gimple_seq *post_p)
|
||||||
{
|
{
|
||||||
/* Variable sized types are passed by reference. */
|
/* 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 ptrtype = build_pointer_type (type);
|
||||||
tree addr = std_gimplify_va_arg_expr (valist, ptrtype, pre_p, post_p);
|
tree addr = std_gimplify_va_arg_expr (valist, ptrtype, pre_p, post_p);
|
||||||
|
@ -6780,7 +6780,7 @@ mips_std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
unsigned HOST_WIDE_INT align, boundary;
|
unsigned HOST_WIDE_INT align, boundary;
|
||||||
bool indirect;
|
bool indirect;
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
@ -6867,7 +6867,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
tree addr;
|
tree addr;
|
||||||
bool indirect_p;
|
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)
|
if (indirect_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
|
@ -856,7 +856,7 @@ msp430_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
unsigned HOST_WIDE_INT align, boundary;
|
unsigned HOST_WIDE_INT align, boundary;
|
||||||
bool indirect;
|
bool indirect;
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
|
@ -6377,7 +6377,7 @@ hppa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
unsigned int size, ofs;
|
unsigned int size, ofs;
|
||||||
bool indirect;
|
bool indirect;
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, 0);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
{
|
{
|
||||||
type = ptr;
|
type = ptr;
|
||||||
|
@ -2690,7 +2690,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
int regalign = 0;
|
int regalign = 0;
|
||||||
gimple *stmt;
|
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);
|
t = rs6000_gimplify_va_arg (valist, ptrtype, pre_p, post_p);
|
||||||
return build_va_arg_indirect_ref (t);
|
return build_va_arg_indirect_ref (t);
|
||||||
|
@ -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);
|
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)
|
if (TARGET_DEBUG_ARG)
|
||||||
{
|
{
|
||||||
|
@ -7935,7 +7935,7 @@ sparc_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
bool indirect;
|
bool indirect;
|
||||||
tree ptrtype = build_pointer_type (type);
|
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;
|
indirect = true;
|
||||||
size = rsize = UNITS_PER_WORD;
|
size = rsize = UNITS_PER_WORD;
|
||||||
|
@ -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
|
/* if an object is dynamically sized, a pointer to it is passed
|
||||||
instead of the object itself. */
|
instead of the object itself. */
|
||||||
pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
|
pass_by_reference_p = pass_va_arg_by_reference (type);
|
||||||
false);
|
|
||||||
if (pass_by_reference_p)
|
if (pass_by_reference_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
size = int_size_in_bytes (type);
|
size = int_size_in_bytes (type);
|
||||||
|
@ -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
|
/* If an object is dynamically sized, a pointer to it is passed
|
||||||
instead of the object itself. */
|
instead of the object itself. */
|
||||||
pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
|
pass_by_reference_p = pass_va_arg_by_reference (type);
|
||||||
false);
|
|
||||||
|
|
||||||
if (pass_by_reference_p)
|
if (pass_by_reference_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
@ -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
|
/* if an object is dynamically sized, a pointer to it is passed
|
||||||
instead of the object itself. */
|
instead of the object itself. */
|
||||||
pass_by_reference_p = pass_by_reference (NULL, TYPE_MODE (type), type,
|
pass_by_reference_p = pass_va_arg_by_reference (type);
|
||||||
false);
|
|
||||||
|
|
||||||
if (pass_by_reference_p)
|
if (pass_by_reference_p)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
@ -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 f_ovfl, f_gbase, f_fbase, f_gbytes, f_fbytes;
|
||||||
tree ovfl, base, bytes;
|
tree ovfl, base, bytes;
|
||||||
HOST_WIDE_INT size, rsize;
|
HOST_WIDE_INT size, rsize;
|
||||||
const bool by_reference_p
|
const bool by_reference_p = pass_va_arg_by_reference (type);
|
||||||
= pass_by_reference (NULL, TYPE_MODE (type), type, false);
|
|
||||||
const bool float_reg_arg_p
|
const bool float_reg_arg_p
|
||||||
= (TARGET_FPU && !by_reference_p
|
= (TARGET_FPU && !by_reference_p
|
||||||
&& ((GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT
|
&& ((GET_MODE_CLASS (TYPE_MODE (type)) == MODE_FLOAT
|
||||||
|
@ -3252,7 +3252,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
tree lab_false, lab_over, lab_false2;
|
tree lab_false, lab_over, lab_false2;
|
||||||
bool indirect;
|
bool indirect;
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
|
@ -2177,7 +2177,7 @@ std_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
|
|||||||
if (ARGS_GROW_DOWNWARD)
|
if (ARGS_GROW_DOWNWARD)
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
|
|
||||||
indirect = pass_by_reference (NULL, TYPE_MODE (type), type, false);
|
indirect = pass_va_arg_by_reference (type);
|
||||||
if (indirect)
|
if (indirect)
|
||||||
type = build_pointer_type (type);
|
type = build_pointer_type (type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user