The hook is passed the unpromoted type mode instead of the promoted mode.
2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.def (pass_by_reference): Take a function_arg_info instead
of a mode, type and named flag.
* doc/tm.texi: Regenerate.
* targhooks.h (hook_pass_by_reference_must_pass_in_stack): Update
accordingly.
(hook_bool_CUMULATIVE_ARGS_arg_info_false): Declare.
* targhooks.c (hook_pass_by_reference_must_pass_in_stack): Take a
function_arg_info instead of a mode, type and named flag.
(hook_bool_CUMULATIVE_ARGS_arg_info_false): New function.
* calls.h (pass_by_reference): Take a function_arg_info instead of a
mode, type and named flag.
* calls.c (pass_by_reference): Likewise.
(pass_va_arg_by_reference): Update call accordingly.
(initialize_argument_information): Likewise.
(emit_library_call_value_1): Likewise.
* function.c (assign_parm_find_data_types): Likewise.
* var-tracking.c (prepare_call_arguments): Likewise.
* stor-layout.c: Include calls.h.
(compute_record_mode): Update call to targetm.calls.pass_by_reference.
* config/aarch64/aarch64.c (aarch64_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/alpha/alpha.c (alpha_pass_by_reference): Likewise.
* config/arc/arc.c (arc_pass_by_reference): Likewise.
* config/arm/arm.c (arm_pass_by_reference): Likewise.
* config/bfin/bfin.c (bfin_pass_by_reference): Likewise.
* config/c6x/c6x.c (c6x_pass_by_reference): Likewise.
(c6x_call_saved_register_used): Update call to pass_by_reference.
* config/cris/cris.c (cris_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/epiphany/epiphany.c (epiphany_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
(epiphany_arg_partial_bytes): Update call accordingly.
* config/ft32/ft32.c (ft32_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
(ft32_arg_partial_bytes): Update call accordingly.
* config/i386/i386.c (ix86_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/iq2000/iq2000.c (iq2000_pass_by_reference): Likewise.
* config/m32c/m32c.c (m32c_pass_by_reference): Likewise.
* config/m32r/m32r.c (m32r_pass_by_reference): Likewise.
(m32r_return_in_memory): Update call accordingly.
* config/mips/mips.c (mips_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/mmix/mmix.c (mmix_pass_by_reference): Likewise.
* config/mn10300/mn10300.c (mn10300_pass_by_reference): Likewise.
* config/moxie/moxie.c (moxie_pass_by_reference): Likewise.
(moxie_arg_partial_bytes): Update call accordingly.
* config/msp430/msp430.c (msp430_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/nvptx/nvptx.c (nvptx_pass_by_reference): Likewise.
* config/or1k/or1k.c (or1k_pass_by_reference): Likewise.
* config/pa/pa.c (pa_pass_by_reference): Likewise.
* config/riscv/riscv.c (riscv_pass_by_reference): Likewise.
(riscv_return_in_memory): Update call accordingly.
* config/rs6000/rs6000-internal.h (rs6000_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
* config/rs6000/rs6000-call.c (rs6000_pass_by_reference): Likewise.
(rs6000_parm_needs_stack): Update call to pass_by_reference.
* config/s390/s390.c (s390_pass_by_reference): Take a
function_arg_info instead of a mode, type and named flag.
(s390_call_saved_register_used): Update call accordingly.
* config/sh/sh.c (sh_pass_by_reference): Take a function_arg_info
instead of a mode, type and named flag.
* config/sparc/sparc.c (sparc_pass_by_reference): Likewise.
* config/spu/spu.c (spu_pass_by_reference): Likewise.
* config/tilegx/tilegx.c (tilegx_pass_by_reference): Likewise.
* config/tilepro/tilepro.c (tilepro_pass_by_reference): Likewise.
* config/v850/v850.c (v850_pass_by_reference): Likewise.
* config/visium/visium.c (visium_pass_by_reference): Likewise.
gcc/ada/
* gcc-interface/misc.c (default_pass_by_ref): Update call to
pass_by_reference.
From-SVN: r274698
+2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * target.def (pass_by_reference): Take a function_arg_info instead
+ of a mode, type and named flag.
+ * doc/tm.texi: Regenerate.
+ * targhooks.h (hook_pass_by_reference_must_pass_in_stack): Update
+ accordingly.
+ (hook_bool_CUMULATIVE_ARGS_arg_info_false): Declare.
+ * targhooks.c (hook_pass_by_reference_must_pass_in_stack): Take a
+ function_arg_info instead of a mode, type and named flag.
+ (hook_bool_CUMULATIVE_ARGS_arg_info_false): New function.
+ * calls.h (pass_by_reference): Take a function_arg_info instead of a
+ mode, type and named flag.
+ * calls.c (pass_by_reference): Likewise.
+ (pass_va_arg_by_reference): Update call accordingly.
+ (initialize_argument_information): Likewise.
+ (emit_library_call_value_1): Likewise.
+ * function.c (assign_parm_find_data_types): Likewise.
+ * var-tracking.c (prepare_call_arguments): Likewise.
+ * stor-layout.c: Include calls.h.
+ (compute_record_mode): Update call to targetm.calls.pass_by_reference.
+ * config/aarch64/aarch64.c (aarch64_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/alpha/alpha.c (alpha_pass_by_reference): Likewise.
+ * config/arc/arc.c (arc_pass_by_reference): Likewise.
+ * config/arm/arm.c (arm_pass_by_reference): Likewise.
+ * config/bfin/bfin.c (bfin_pass_by_reference): Likewise.
+ * config/c6x/c6x.c (c6x_pass_by_reference): Likewise.
+ (c6x_call_saved_register_used): Update call to pass_by_reference.
+ * config/cris/cris.c (cris_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/epiphany/epiphany.c (epiphany_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ (epiphany_arg_partial_bytes): Update call accordingly.
+ * config/ft32/ft32.c (ft32_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ (ft32_arg_partial_bytes): Update call accordingly.
+ * config/i386/i386.c (ix86_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/iq2000/iq2000.c (iq2000_pass_by_reference): Likewise.
+ * config/m32c/m32c.c (m32c_pass_by_reference): Likewise.
+ * config/m32r/m32r.c (m32r_pass_by_reference): Likewise.
+ (m32r_return_in_memory): Update call accordingly.
+ * config/mips/mips.c (mips_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/mmix/mmix.c (mmix_pass_by_reference): Likewise.
+ * config/mn10300/mn10300.c (mn10300_pass_by_reference): Likewise.
+ * config/moxie/moxie.c (moxie_pass_by_reference): Likewise.
+ (moxie_arg_partial_bytes): Update call accordingly.
+ * config/msp430/msp430.c (msp430_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/nvptx/nvptx.c (nvptx_pass_by_reference): Likewise.
+ * config/or1k/or1k.c (or1k_pass_by_reference): Likewise.
+ * config/pa/pa.c (pa_pass_by_reference): Likewise.
+ * config/riscv/riscv.c (riscv_pass_by_reference): Likewise.
+ (riscv_return_in_memory): Update call accordingly.
+ * config/rs6000/rs6000-internal.h (rs6000_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ * config/rs6000/rs6000-call.c (rs6000_pass_by_reference): Likewise.
+ (rs6000_parm_needs_stack): Update call to pass_by_reference.
+ * config/s390/s390.c (s390_pass_by_reference): Take a
+ function_arg_info instead of a mode, type and named flag.
+ (s390_call_saved_register_used): Update call accordingly.
+ * config/sh/sh.c (sh_pass_by_reference): Take a function_arg_info
+ instead of a mode, type and named flag.
+ * config/sparc/sparc.c (sparc_pass_by_reference): Likewise.
+ * config/spu/spu.c (spu_pass_by_reference): Likewise.
+ * config/tilegx/tilegx.c (tilegx_pass_by_reference): Likewise.
+ * config/tilepro/tilepro.c (tilepro_pass_by_reference): Likewise.
+ * config/v850/v850.c (v850_pass_by_reference): Likewise.
+ * config/visium/visium.c (visium_pass_by_reference): Likewise.
+
2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
* target.def (arg_partial_bytes): Take a function_arg_info instead
+2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * gcc-interface/misc.c (default_pass_by_ref): Update call to
+ pass_by_reference.
+
2019-08-19 Bob Duff <duff@adacore.com>
* doc/gnat_rm/implementation_advice.rst: Fix documentation for
TYPE_ALIGN (gnu_type)) > 0))
return true;
- if (pass_by_reference (NULL, TYPE_MODE (gnu_type), gnu_type, true))
+ if (pass_by_reference (NULL, function_arg_info (gnu_type, /*named=*/true)))
return true;
if (targetm.calls.return_in_memory (gnu_type, NULL_TREE))
return flags;
}
-/* Return true if TYPE should be passed by invisible reference. */
+/* Return true if ARG should be passed by invisible reference. */
bool
-pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode,
- tree type, bool named_arg)
+pass_by_reference (CUMULATIVE_ARGS *ca, function_arg_info arg)
{
- if (type)
+ if (tree type = arg.type)
{
/* If this type contains non-trivial constructors, then it is
forbidden for the middle-end to create any new copies. */
member, use the type and mode of that member. */
if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type))
{
- type = TREE_TYPE (first_field (type));
- mode = TYPE_MODE (type);
+ arg.type = TREE_TYPE (first_field (type));
+ arg.mode = TYPE_MODE (arg.type);
}
}
- return targetm.calls.pass_by_reference (pack_cumulative_args (ca), mode,
- type, named_arg);
+ return targetm.calls.pass_by_reference (pack_cumulative_args (ca), arg);
}
/* Return true if TYPE should be passed by reference when passed to
bool
pass_va_arg_by_reference (tree type)
{
- return pass_by_reference (NULL, TYPE_MODE (type), type, false);
+ return pass_by_reference (NULL, function_arg_info (type, /*named=*/false));
}
/* Return true if TYPE, which is passed by reference, should be callee
with those made by function.c. */
/* See if this argument should be passed by invisible reference. */
- if (pass_by_reference (args_so_far_pnt, TYPE_MODE (type),
- type, argpos < n_named_args))
+ function_arg_info orig_arg (type, argpos < n_named_args);
+ if (pass_by_reference (args_so_far_pnt, orig_arg))
{
bool callee_copies;
tree base = NULL_TREE;
&& !(CONSTANT_P (val) && targetm.legitimate_constant_p (mode, val)))
val = force_operand (val, NULL_RTX);
- if (pass_by_reference (&args_so_far_v, mode, NULL_TREE, 1))
+ function_arg_info orig_arg (mode, /*named=*/true);
+ if (pass_by_reference (&args_so_far_v, orig_arg))
{
rtx slot;
int must_copy
extern rtx expand_call (tree, rtx, int);
extern void fixup_tail_calls (void);
-extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode,
- tree, bool);
+extern bool pass_by_reference (CUMULATIVE_ARGS *, function_arg_info);
extern bool pass_va_arg_by_reference (tree);
extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode,
tree, bool);
/* Implement TARGET_PASS_BY_REFERENCE. */
static bool
-aarch64_pass_by_reference (cumulative_args_t pcum ATTRIBUTE_UNUSED,
- machine_mode mode,
- const_tree type,
- bool named ATTRIBUTE_UNUSED)
+aarch64_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
HOST_WIDE_INT size;
machine_mode dummymode;
int nregs;
/* GET_MODE_SIZE (BLKmode) is useless since it is 0. */
- if (mode == BLKmode && type)
- size = int_size_in_bytes (type);
+ if (arg.mode == BLKmode && arg.type)
+ size = int_size_in_bytes (arg.type);
else
/* No frontends can create types with variable-sized modes, so we
shouldn't be asked to pass or return them. */
- size = GET_MODE_SIZE (mode).to_constant ();
+ size = GET_MODE_SIZE (arg.mode).to_constant ();
/* Aggregates are passed by reference based on their size. */
- if (type && AGGREGATE_TYPE_P (type))
- {
- size = int_size_in_bytes (type);
- }
+ if (arg.aggregate_type_p ())
+ size = int_size_in_bytes (arg.type);
/* Variable sized arguments are always returned by reference. */
if (size < 0)
return true;
/* Can this be a candidate to be passed in fp/simd register(s)? */
- if (aarch64_vfp_is_call_or_return_candidate (mode, type,
+ if (aarch64_vfp_is_call_or_return_candidate (arg.mode, arg.type,
&dummymode, &nregs,
NULL))
return false;
return size > UNITS_PER_WORD;
}
-/* Return true if TYPE should be passed by invisible reference. */
+/* Return true if ARG should be passed by invisible reference. */
static bool
-alpha_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named)
+alpha_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
/* Pass float and _Complex float variable arguments by reference.
This avoids 64-bit store from a FP register to a pretend args save area
to worry about, and passing unpromoted _Float32 and _Complex float
as a variable argument will actually work in the future. */
- if (mode == SFmode || mode == SCmode)
- return !named;
+ if (arg.mode == SFmode || arg.mode == SCmode)
+ return !arg.named;
- return mode == TFmode || mode == TCmode;
+ return arg.mode == TFmode || arg.mode == TCmode;
}
/* Define how to find the value returned by a function. VALTYPE is the
}
static bool
-arc_pass_by_reference (cumulative_args_t ca_v ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type,
- bool named ATTRIBUTE_UNUSED)
-{
- return (type != 0
- && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
- || TREE_ADDRESSABLE (type)));
+arc_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
+{
+ return (arg.type != 0
+ && (TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST
+ || TREE_ADDRESSABLE (arg.type)));
}
/* Implement TARGET_CAN_USE_DOLOOP_P. */
static void arm_setup_incoming_varargs (cumulative_args_t, machine_mode,
tree, int *, int);
static bool arm_pass_by_reference (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static bool arm_promote_prototypes (const_tree);
static bool arm_default_short_enums (void);
static bool arm_align_anon_bitfield (void);
extension to the ARM ABI. */
static bool
-arm_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+arm_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
+ return arg.type && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST;
}
\f
/* Encode the current state of the #pragma [no_]long_calls. */
/* Variable sized types are passed by reference. */
static bool
-bfin_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+bfin_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
+ return arg.type && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST;
}
/* Decide whether a type should be returned in memory (true)
reference. The callee must copy them; see c6x_callee_copies. */
static bool
-c6x_pass_by_reference (cumulative_args_t cum_v ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+c6x_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
int size = -1;
- if (type)
- size = int_size_in_bytes (type);
- else if (mode != VOIDmode)
- size = GET_MODE_SIZE (mode);
+ if (arg.type)
+ size = int_size_in_bytes (arg.type);
+ else if (arg.mode != VOIDmode)
+ size = GET_MODE_SIZE (arg.mode);
return size > 2 * UNITS_PER_WORD || size == -1;
}
mode = TYPE_MODE (type);
gcc_assert (mode);
- if (pass_by_reference (&cum_v, mode, type, true))
+ if (pass_by_reference (&cum_v, function_arg_info (type, /*named=*/true)))
{
mode = Pmode;
type = build_pointer_type (type);
static int cris_memory_move_cost (machine_mode, reg_class_t, bool);
static bool cris_rtx_costs (rtx, machine_mode, int, int, int *, bool);
static int cris_address_cost (rtx, machine_mode, addr_space_t, bool);
-static bool cris_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool cris_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static int cris_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
static rtx cris_function_arg (cumulative_args_t, machine_mode,
ca->regs, *pretend_arg_size, second_time);
}
-/* Return true if TYPE must be passed by invisible reference.
+/* Return true if ARG must be passed by invisible reference.
For cris, we pass <= 8 bytes by value, others by reference. */
static bool
-cris_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+cris_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return (targetm.calls.must_pass_in_stack (mode, type)
- || CRIS_FUNCTION_ARG_SIZE (mode, type) > 8);
+ return (targetm.calls.must_pass_in_stack (arg.mode, arg.type)
+ || CRIS_FUNCTION_ARG_SIZE (arg.mode, arg.type) > 8);
}
/* A combination of defining TARGET_PROMOTE_FUNCTION_MODE, promoting arguments
static tree epiphany_handle_interrupt_attribute (tree *, tree, tree, int, bool *);
static tree epiphany_handle_forwarder_attribute (tree *, tree, tree, int,
bool *);
-static bool epiphany_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool epiphany_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static rtx_insn *frame_insn (rtx);
\f
/* defines for the initialization of the GCC target structure. */
{
int words = 0, rounded_cum;
- gcc_assert (!epiphany_pass_by_reference (cum, arg.mode, arg.type,
- arg.named));
+ gcc_assert (!epiphany_pass_by_reference (cum, arg));
rounded_cum = ROUND_ADVANCE_CUM (*get_cumulative_args (cum),
arg.mode, arg.type);
passed by reference. */
static bool
-epiphany_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+epiphany_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- if (type)
+ if (tree type = arg.type)
{
if (AGGREGATE_TYPE_P (type)
- && (mode == BLKmode || TYPE_NEEDS_CONSTRUCTING (type)))
+ && (arg.mode == BLKmode || TYPE_NEEDS_CONSTRUCTING (type)))
return true;
}
return false;
? *cum + ((3 + FT32_FUNCTION_ARG_SIZE (mode, type)) / 4) : *cum);
}
-/* Return non-zero if the function argument described by TYPE is to be
+/* Return non-zero if the function argument described by ARG is to be
passed by reference. */
static bool
-ft32_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+ft32_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- unsigned HOST_WIDE_INT size;
-
- if (type)
- {
- if (AGGREGATE_TYPE_P (type))
- return true;
- size = int_size_in_bytes (type);
- }
- else
- size = GET_MODE_SIZE (mode);
-
+ if (arg.aggregate_type_p ())
+ return true;
+ unsigned HOST_WIDE_INT size = arg.type_size_in_bytes ();
return size > 4 * 6;
}
if (*cum >= 8)
return 0;
- if (ft32_pass_by_reference (cum_v, arg.mode, arg.type, arg.named))
+ if (ft32_pass_by_reference (cum_v, arg))
size = 4;
else if (arg.type)
{
appropriate for passing a pointer to that type. */
static bool
-ix86_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool)
+ix86_pass_by_reference (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
/* See Windows x64 Software Convention. */
if (call_abi == MS_ABI)
{
- HOST_WIDE_INT msize = GET_MODE_SIZE (mode);
+ HOST_WIDE_INT msize = GET_MODE_SIZE (arg.mode);
- if (type)
+ if (tree type = arg.type)
{
/* Arrays are passed by reference. */
if (TREE_CODE (type) == ARRAY_TYPE)
/* __m128 is passed by reference. */
return msize != 1 && msize != 2 && msize != 4 && msize != 8;
}
- else if (type && int_size_in_bytes (type) == -1)
+ else if (arg.type && int_size_in_bytes (arg.type) == -1)
return true;
}
bool);
static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
static rtx iq2000_legitimize_address (rtx, rtx, machine_mode);
-static bool iq2000_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool iq2000_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static int iq2000_arg_partial_bytes (cumulative_args_t,
const function_arg_info &arg);
static rtx iq2000_function_arg (cumulative_args_t,
/* Return true when an argument must be passed by reference. */
static bool
-iq2000_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+iq2000_pass_by_reference (cumulative_args_t cum_v,
+ const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int size;
/* We must pass by reference if we would be both passing in registers
and the stack. This is because any subsequent partial arg would be
handled incorrectly in this case. */
- if (cum && targetm.calls.must_pass_in_stack (mode, type))
+ if (cum && targetm.calls.must_pass_in_stack (arg.mode, arg.type))
{
/* Don't pass the actual CUM to FUNCTION_ARG, because we would
get double copies of any offsets generated for small structs
CUMULATIVE_ARGS temp;
temp = *cum;
- if (iq2000_function_arg (pack_cumulative_args (&temp), mode, type, named)
- != 0)
+ if (iq2000_function_arg (pack_cumulative_args (&temp), arg.mode,
+ arg.type, arg.named) != 0)
return 1;
}
- if (type == NULL_TREE || mode == DImode || mode == DFmode)
+ if (arg.type == NULL_TREE || arg.mode == DImode || arg.mode == DFmode)
return 0;
- size = int_size_in_bytes (type);
+ size = int_size_in_bytes (arg.type);
return size == -1 || size > UNITS_PER_WORD;
}
static bool m32c_addr_space_legitimate_address_p (machine_mode, rtx, bool, addr_space_t);
static rtx m32c_function_arg (cumulative_args_t, machine_mode,
const_tree, bool);
-static bool m32c_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool m32c_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static void m32c_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static unsigned int m32c_function_arg_boundary (machine_mode, const_tree);
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE m32c_pass_by_reference
static bool
-m32c_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+m32c_pass_by_reference (cumulative_args_t, const function_arg_info &)
{
return 0;
}
static void init_idents (void);
static bool m32r_rtx_costs (rtx, machine_mode, int, int, int *, bool speed);
static int m32r_memory_move_cost (machine_mode, reg_class_t, bool);
-static bool m32r_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool m32r_pass_by_reference (cumulative_args_t,
+ const function_arg_info &arg);
static int m32r_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
static rtx m32r_function_arg (cumulative_args_t, machine_mode,
return MEM_P (op) && REG_P (XEXP (op, 0));
}
-/* Return nonzero if TYPE must be passed by indirect reference. */
+/* Return nonzero if ARG must be passed by indirect reference. */
static bool
-m32r_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+m32r_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- int size;
-
- if (type)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ int size = arg.type_size_in_bytes ();
return (size < 0 || size > 8);
}
\f
m32r_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
cumulative_args_t dummy = pack_cumulative_args (NULL);
-
- return m32r_pass_by_reference (dummy, TYPE_MODE (type), type, false);
+ function_arg_info arg (const_cast<tree> (type), /*named=*/false);
+ return m32r_pass_by_reference (dummy, arg);
}
/* Worker function for TARGET_FUNCTION_VALUE. */
/* Return nonzero when an argument must be passed by reference. */
static bool
-mips_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+mips_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
if (mips_abi == ABI_EABI)
{
int size;
/* ??? How should SCmode be handled? */
- if (mode == DImode || mode == DFmode
- || mode == DQmode || mode == UDQmode
- || mode == DAmode || mode == UDAmode)
+ if (arg.mode == DImode || arg.mode == DFmode
+ || arg.mode == DQmode || arg.mode == UDQmode
+ || arg.mode == DAmode || arg.mode == UDAmode)
return 0;
- size = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+ size = arg.type_size_in_bytes ();
return size == -1 || size > UNITS_PER_WORD;
}
else
{
/* If we have a variable-sized parameter, we have no choice. */
- return targetm.calls.must_pass_in_stack (mode, type);
+ return targetm.calls.must_pass_in_stack (arg.mode, arg.type);
}
}
static rtx mmix_libcall_value (machine_mode, const_rtx);
static bool mmix_function_value_regno_p (const unsigned int);
static bool mmix_pass_by_reference (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static bool mmix_frame_pointer_required (void);
static void mmix_asm_trampoline_template (FILE *);
static void mmix_trampoline_init (rtx, tree, rtx);
everything that goes by value. */
static bool
-mmix_pass_by_reference (cumulative_args_t argsp_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+mmix_pass_by_reference (cumulative_args_t argsp_v,
+ const function_arg_info &arg)
{
CUMULATIVE_ARGS *argsp = get_cumulative_args (argsp_v);
/* FIXME: Check: I'm not sure the must_pass_in_stack check is
necessary. */
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return true;
- if (MMIX_FUNCTION_ARG_SIZE (mode, type) > 8
+ if (MMIX_FUNCTION_ARG_SIZE (arg.mode, arg.type) > 8
&& !TARGET_LIBFUNC
&& (!argsp || !argsp->lib))
return true;
/* Return true when a parameter should be passed by reference. */
static bool
-mn10300_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+mn10300_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- unsigned HOST_WIDE_INT size;
-
- if (type)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ unsigned HOST_WIDE_INT size = arg.type_size_in_bytes ();
return (size > 8 || size == 0);
}
: *cum);
}
-/* Return non-zero if the function argument described by TYPE is to be
+/* Return non-zero if the function argument described by ARG is to be
passed by reference. */
static bool
-moxie_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+moxie_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- unsigned HOST_WIDE_INT size;
-
- if (type)
- {
- if (AGGREGATE_TYPE_P (type))
- return true;
- size = int_size_in_bytes (type);
- }
- else
- size = GET_MODE_SIZE (mode);
-
+ if (arg.aggregate_type_p ())
+ return true;
+ unsigned HOST_WIDE_INT size = arg.type_size_in_bytes ();
return size > 4*6;
}
if (*cum >= 8)
return 0;
- if (moxie_pass_by_reference (cum_v, arg.mode, arg.type, arg.named))
+ if (moxie_pass_by_reference (cum_v, arg))
size = 4;
else if (arg.type)
{
#define TARGET_PASS_BY_REFERENCE msp430_pass_by_reference
static bool
-msp430_pass_by_reference (cumulative_args_t cap ATTRIBUTE_UNUSED,
- machine_mode mode,
- const_tree type,
- bool named ATTRIBUTE_UNUSED)
-{
- return (mode == BLKmode
- || (type && TREE_CODE (type) == RECORD_TYPE)
- || (type && TREE_CODE (type) == UNION_TYPE));
+msp430_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
+{
+ return (arg.mode == BLKmode
+ || (arg.type && TREE_CODE (arg.type) == RECORD_TYPE)
+ || (arg.type && TREE_CODE (arg.type) == UNION_TYPE));
}
#undef TARGET_CALLEE_COPIES
reference in memory. */
static bool
-nvptx_pass_by_reference (cumulative_args_t ARG_UNUSED (cum),
- machine_mode mode, const_tree type,
- bool ARG_UNUSED (named))
+nvptx_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return pass_in_memory (mode, type, false);
+ return pass_in_memory (arg.mode, arg.type, false);
}
/* Implement TARGET_RETURN_IN_MEMORY. */
#define TARGET_LEGITIMATE_CONSTANT_P or1k_legitimate_constant_p
/* Worker for TARGET_PASS_BY_REFERENCE.
- Returns true if an argument of TYPE in MODE should be passed by reference
- as required by the OpenRISC ABI. On OpenRISC structures, unions and
+ Returns true if an argument ARG should be passed by reference as
+ required by the OpenRISC ABI. On OpenRISC structures, unions and
arguments larger than 64-bits are passed by reference. */
static bool
-or1k_pass_by_reference (cumulative_args_t, machine_mode mode,
- const_tree type, bool)
+or1k_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- HOST_WIDE_INT size;
- if (type)
- {
- if (AGGREGATE_TYPE_P (type))
- return true;
- size = int_size_in_bytes (type);
- }
- else
- size = GET_MODE_SIZE (mode);
+ if (arg.aggregate_type_p ())
+ return true;
+ HOST_WIDE_INT size = arg.type_size_in_bytes ();
return size < 0 || size > 8;
}
static void pa_file_end (void);
static void pa_init_libfuncs (void);
static rtx pa_struct_value_rtx (tree, int);
-static bool pa_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool pa_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static int pa_arg_partial_bytes (cumulative_args_t, const function_arg_info &);
static void pa_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
or updates the ABI. */
static bool
-pa_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+pa_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- HOST_WIDE_INT size;
-
- if (type)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ HOST_WIDE_INT size = arg.type_size_in_bytes ();
if (TARGET_64BIT)
return size <= 0;
else
/* Implement TARGET_PASS_BY_REFERENCE. */
static bool
-riscv_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+riscv_pass_by_reference (cumulative_args_t cum_v, const function_arg_info &arg)
{
- HOST_WIDE_INT size = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+ HOST_WIDE_INT size = arg.type_size_in_bytes ();
struct riscv_arg_info info;
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (cum != NULL)
{
/* Don't pass by reference if we can use a floating-point register. */
- riscv_get_arg_info (&info, cum, mode, type, named, false);
+ riscv_get_arg_info (&info, cum, arg.mode, arg.type, arg.named, false);
if (info.num_fprs)
return false;
}
/* The rules for returning in memory are the same as for passing the
first named argument by reference. */
memset (&args, 0, sizeof args);
- return riscv_pass_by_reference (cum, TYPE_MODE (type), type, true);
+ function_arg_info arg (const_cast<tree> (type), /*named=*/true);
+ return riscv_pass_by_reference (cum, arg);
}
/* Implement TARGET_SETUP_INCOMING_VARARGS. */
reference. */
bool
-rs6000_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+rs6000_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- if (!type)
+ if (!arg.type)
return 0;
if (DEFAULT_ABI == ABI_V4 && TARGET_IEEEQUAD
- && FLOAT128_IEEE_P (TYPE_MODE (type)))
+ && FLOAT128_IEEE_P (TYPE_MODE (arg.type)))
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: V4 IEEE 128-bit\n");
return 1;
}
- if (DEFAULT_ABI == ABI_V4 && AGGREGATE_TYPE_P (type))
+ if (DEFAULT_ABI == ABI_V4 && AGGREGATE_TYPE_P (arg.type))
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: V4 aggregate\n");
return 1;
}
- if (int_size_in_bytes (type) < 0)
+ if (int_size_in_bytes (arg.type) < 0)
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: variable size\n");
/* Allow -maltivec -mabi=no-altivec without warning. Altivec vector
modes only exist for GCC vector types if -maltivec. */
- if (TARGET_32BIT && !TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (mode))
+ if (TARGET_32BIT && !TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (arg.mode))
{
if (TARGET_DEBUG_ARG)
fprintf (stderr, "function_arg_pass_by_reference: AltiVec\n");
}
/* Pass synthetic vectors in memory. */
- if (TREE_CODE (type) == VECTOR_TYPE
- && int_size_in_bytes (type) > (TARGET_ALTIVEC_ABI ? 16 : 8))
+ if (TREE_CODE (arg.type) == VECTOR_TYPE
+ && int_size_in_bytes (arg.type) > (TARGET_ALTIVEC_ABI ? 16 : 8))
{
static bool warned_for_pass_big_vectors = false;
if (TARGET_DEBUG_ARG)
/* See if this arg was passed by invisible reference. */
if (pass_by_reference (get_cumulative_args (args_so_far),
- TYPE_MODE (type), type, true))
+ function_arg_info (type, /*named=*/true)))
type = build_pointer_type (type);
/* Find mode as it is passed by the ABI. */
extern bool rs6000_return_in_memory (const_tree type,
const_tree fntype ATTRIBUTE_UNUSED);
extern bool rs6000_return_in_msb (const_tree valtype);
-extern bool rs6000_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED);
+extern bool rs6000_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
extern void setup_incoming_varargs (cumulative_args_t cum, machine_mode mode,
tree type, int *pretend_size ATTRIBUTE_UNUSED,
int no_rtl);
return false;
}
-/* Return 1 if a function argument of type TYPE and mode MODE
- is to be passed by reference. The ABI specifies that only
- structures of size 1, 2, 4, or 8 bytes are passed by value,
- all other structures (and complex numbers) are passed by
- reference. */
+/* Return 1 if a function argument ARG is to be passed by reference.
+ The ABI specifies that only structures of size 1, 2, 4, or 8 bytes
+ are passed by value, all other structures (and complex numbers) are
+ passed by reference. */
static bool
-s390_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+s390_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- int size = s390_function_arg_size (mode, type);
+ int size = s390_function_arg_size (arg.mode, arg.type);
- if (s390_function_arg_vector (mode, type))
+ if (s390_function_arg_vector (arg.mode, arg.type))
return false;
if (size > 8)
return true;
- if (type)
+ if (tree type = arg.type)
{
if (AGGREGATE_TYPE_P (type) && exact_log2 (size) < 0)
return true;
/* We assume that in the target function all parameters are
named. This only has an impact on vector argument register
usage none of which is call-saved. */
- if (pass_by_reference (&cum_v, mode, type, true))
+ if (pass_by_reference (&cum_v, function_arg_info (type, /*named=*/true)))
{
mode = Pmode;
type = build_pointer_type (type);
int *punsignedp,
const_tree funtype,
int for_return);
-static bool sh_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool sh_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static bool sh_callee_copies (cumulative_args_t, machine_mode,
const_tree, bool);
static int sh_arg_partial_bytes (cumulative_args_t, const function_arg_info &);
}
static bool
-sh_pass_by_reference (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+sh_pass_by_reference (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return true;
/* ??? std_gimplify_va_arg_expr passes NULL for cum. That function
static rtx sparc_delegitimize_address (rtx);
static bool sparc_mode_dependent_address_p (const_rtx, addr_space_t);
static bool sparc_pass_by_reference (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static void sparc_function_arg_advance (cumulative_args_t,
machine_mode, const_tree, bool);
static rtx sparc_function_arg_1 (cumulative_args_t,
Specify whether to pass the argument by reference. */
static bool
-sparc_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+sparc_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
if (TARGET_ARCH32)
/* Original SPARC 32-bit ABI says that structures and unions,
and quad-precision floats are passed by reference.
/* Variable sized types are passed by reference. */
static bool
-spu_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+spu_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
+ return arg.type && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST;
}
\f
/* Implement TARGET_PASS_BY_REFERENCE. Variable sized types are
passed by reference. */
static bool
-tilegx_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+tilegx_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return (type && TYPE_SIZE (type)
- && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST);
+ return (arg.type
+ && TYPE_SIZE (arg.type)
+ && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST);
}
/* Implement TARGET_PASS_BY_REFERENCE. Variable sized types are
passed by reference. */
static bool
-tilepro_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+tilepro_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- return (type && TYPE_SIZE (type)
- && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST);
+ return (arg.type
+ && TYPE_SIZE (arg.type)
+ && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST);
}
Specify whether to pass the argument by reference. */
static bool
-v850_pass_by_reference (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode, const_tree type,
- bool named ATTRIBUTE_UNUSED)
+v850_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
- unsigned HOST_WIDE_INT size;
-
if (!TARGET_GCC_ABI)
return 0;
- if (type)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ unsigned HOST_WIDE_INT size = arg.type_size_in_bytes ();
return size > 8;
}
/* Target hooks and TARGET_INITIALIZER */
-static bool visium_pass_by_reference (cumulative_args_t, machine_mode,
- const_tree, bool);
+static bool visium_pass_by_reference (cumulative_args_t,
+ const function_arg_info &);
static rtx visium_function_arg (cumulative_args_t, machine_mode,
const_tree, bool);
/* Return true if an argument must be passed by indirect reference. */
static bool
-visium_pass_by_reference (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type,
- bool named ATTRIBUTE_UNUSED)
+visium_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
{
+ tree type = arg.type;
return type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE);
}
@code{TARGET_FUNCTION_INCOMING_ARG}, for the called function.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_PASS_BY_REFERENCE (cumulative_args_t @var{cum}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
-This target hook should return @code{true} if an argument at the
+@deftypefn {Target Hook} bool TARGET_PASS_BY_REFERENCE (cumulative_args_t @var{cum}, const function_arg_info @var{&arg})
+This target hook should return @code{true} if argument @var{arg} at the
position indicated by @var{cum} should be passed by reference. This
predicate is queried after target independent reasons for being
-passed by reference, such as @code{TREE_ADDRESSABLE (type)}.
+passed by reference, such as @code{TREE_ADDRESSABLE (@var{arg}.type)}.
If the hook returns true, a copy of that argument is made in memory and a
pointer to the argument is passed instead of the argument itself.
passed_type = TREE_TYPE (first_field (passed_type));
/* See if this arg was passed by invisible reference. */
- if (pass_by_reference (&all->args_so_far_v, passed_mode,
- passed_type, data->named_arg))
- {
- passed_type = nominal_type = build_pointer_type (passed_type);
- data->passed_pointer = true;
- passed_mode = nominal_mode = TYPE_MODE (nominal_type);
- }
+ {
+ function_arg_info arg (passed_type, passed_mode, data->named_arg);
+ if (pass_by_reference (&all->args_so_far_v, arg))
+ {
+ passed_type = nominal_type = build_pointer_type (passed_type);
+ data->passed_pointer = true;
+ passed_mode = nominal_mode = TYPE_MODE (nominal_type);
+ }
+ }
/* Find mode as it is passed by the ABI. */
unsignedp = TYPE_UNSIGNED (passed_type);
#include "gimplify.h"
#include "attribs.h"
#include "debug.h"
+#include "calls.h"
/* Data type for the expressions representing sizes of data types.
It is the first integer type laid out. */
|| (TREE_CODE (type) == UNION_TYPE
&& (GET_MODE_CLASS (mode) == MODE_INT
|| (GET_MODE_CLASS (mode) == MODE_PARTIAL_INT
- && targetm.calls.pass_by_reference (pack_cumulative_args (0),
- mode, type, 0)))))
+ && (targetm.calls.pass_by_reference
+ (pack_cumulative_args (0),
+ function_arg_info (type, mode, /*named=*/false)))))))
&& mode != VOIDmode
&& poly_int_tree_p (TYPE_SIZE (type), &type_size)
&& known_eq (GET_MODE_BITSIZE (mode), type_size))
from __builtin_va_arg. */
DEFHOOK
(pass_by_reference,
- "This target hook should return @code{true} if an argument at the\n\
+ "This target hook should return @code{true} if argument @var{arg} at the\n\
position indicated by @var{cum} should be passed by reference. This\n\
predicate is queried after target independent reasons for being\n\
-passed by reference, such as @code{TREE_ADDRESSABLE (type)}.\n\
+passed by reference, such as @code{TREE_ADDRESSABLE (@var{arg}.type)}.\n\
\n\
If the hook returns true, a copy of that argument is made in memory and a\n\
pointer to the argument is passed instead of the argument itself.\n\
The pointer is passed in whatever way is appropriate for passing a pointer\n\
to that type.",
bool,
- (cumulative_args_t cum, machine_mode mode, const_tree type, bool named),
- hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false)
+ (cumulative_args_t cum, const function_arg_info &arg),
+ hook_bool_CUMULATIVE_ARGS_arg_info_false)
DEFHOOK
(expand_builtin_saveregs,
of the TARGET_PASS_BY_REFERENCE hook uses just MUST_PASS_IN_STACK. */
bool
-hook_pass_by_reference_must_pass_in_stack (cumulative_args_t c ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED, const_tree type ATTRIBUTE_UNUSED,
- bool named_arg ATTRIBUTE_UNUSED)
+hook_pass_by_reference_must_pass_in_stack (cumulative_args_t,
+ const function_arg_info &arg)
{
- return targetm.calls.must_pass_in_stack (mode, type);
+ return targetm.calls.must_pass_in_stack (arg.mode, arg.type);
}
/* Return true if a parameter follows callee copies conventions. This
return true;
}
+bool
+hook_bool_CUMULATIVE_ARGS_arg_info_false (cumulative_args_t,
+ const function_arg_info &)
+{
+ return false;
+}
+
int
hook_int_CUMULATIVE_ARGS_arg_info_0 (cumulative_args_t,
const function_arg_info &)
extern tree default_cxx_get_cookie_size (tree);
extern bool hook_pass_by_reference_must_pass_in_stack
- (cumulative_args_t, machine_mode mode, const_tree, bool);
+ (cumulative_args_t, const function_arg_info &);
extern bool hook_callee_copies_named
(cumulative_args_t ca, machine_mode, const_tree, bool);
(cumulative_args_t, machine_mode, const_tree, bool);
extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
(cumulative_args_t, machine_mode, const_tree, bool);
+extern bool hook_bool_CUMULATIVE_ARGS_arg_info_false
+ (cumulative_args_t, const function_arg_info &);
extern int hook_int_CUMULATIVE_ARGS_arg_info_0
(cumulative_args_t, const function_arg_info &);
extern void hook_void_CUMULATIVE_ARGS_tree
if (t && t != void_list_node)
{
tree argtype = TREE_VALUE (t);
- machine_mode mode = TYPE_MODE (argtype);
rtx reg;
- if (pass_by_reference (&args_so_far_v, mode, argtype, true))
- {
- argtype = build_pointer_type (argtype);
- mode = TYPE_MODE (argtype);
- }
+ function_arg_info orig_arg (argtype, /*named=*/true);
+ if (pass_by_reference (&args_so_far_v, orig_arg))
+ argtype = build_pointer_type (argtype);
+ machine_mode mode = TYPE_MODE (argtype);
reg = targetm.calls.function_arg (args_so_far, mode,
argtype, true);
if (TREE_CODE (argtype) == REFERENCE_TYPE