+2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
+
+ * target.def (function_arg, function_incoming_arg): Take a
+ function_arg_info instead of a mode, tree and named flag.
+ * doc/tm.texi: Regenerate.
+ * targhooks.h (default_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ (default_function_incoming_arg): Likewise.
+ * targhooks.c (default_function_arg): Likewise.
+ (default_function_incoming_arg): Likewise.
+ * calls.h (function_arg_info::end_marker_p): New function.
+ (function_arg_info::end_marker): Likewise.
+ * calls.c (prepare_call_address, initialize_argument_information)
+ (expand_call, emit_library_call_value_1): Update calls to
+ targetm.calls.function_arg and targetm.calls.function_incoming_arg.
+ * dse.c: Include calls.h.
+ (get_call_args): Update call to targetm.calls.function_arg.
+ * expr.c (block_move_libcall_safe_for_call_parm): Likewise.
+ * var-tracking.c (prepare_call_arguments): Likewise.
+ * function.c (assign_parm_find_entry_rtl): Update call to
+ targetm.calls.function_incoming_arg.
+ * config/aarch64/aarch64.c (aarch64_function_arg): Take a
+ function_arg_info instead of a mode, tree and named flag.
+ * config/alpha/alpha.c (alpha_function_arg): Likewise.
+ * config/arc/arc.c (arc_function_arg): Likewise.
+ * config/arm/arm.c (arm_function_arg): Likewise.
+ (cmse_func_args_or_return_in_stack): Update call accordingly.
+ (arm_function_ok_for_sibcall): Likewise.
+ (cmse_nonsecure_call_clear_caller_saved): Likewise.
+ * config/avr/avr.c (avr_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ * config/bfin/bfin.c (bfin_function_arg): Likewise.
+ * config/c6x/c6x.c (c6x_function_arg): Likewise.
+ (c6x_call_saved_register_used): Update call accordingly.
+ * config/cr16/cr16.c (cr16_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ * config/cris/cris.c (cris_function_arg, cris_function_incoming_arg)
+ (cris_function_arg_1): Likewise.
+ * config/csky/csky.c (csky_function_arg): Likewise.
+ * config/epiphany/epiphany.c (epiphany_function_arg): Likewise.
+ * config/fr30/fr30.c (fr30_function_arg): Likewise.
+ * config/frv/frv.c (frv_function_arg, frv_function_incoming_arg)
+ (frv_function_arg_1): Likewise.
+ * config/ft32/ft32.c (ft32_function_arg): Likewise.
+ * config/gcn/gcn.c (gcn_function_arg): Likewise.
+ * config/h8300/h8300.c (h8300_function_arg): Likewise.
+ * config/i386/i386.c (ix86_function_arg): Likewise.
+ * config/ia64/ia64.c (ia64_function_arg, ia64_function_incoming_arg)
+ (ia64_function_arg_1): Likewise.
+ * config/iq2000/iq2000.c (iq2000_function_arg): Likewise.
+ (iq2000_expand_prologue, iq2000_pass_by_reference): Update call
+ accordingly.
+ * config/lm32/lm32.c (lm32_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ * config/m32c/m32c.c (m32c_function_arg): Likewise.
+ * config/m32r/m32r.c (m32r_function_arg): Likewise.
+ * config/m68k/m68k.c (m68k_function_arg): Likewise.
+ * config/mcore/mcore.c (mcore_function_arg): Likewise.
+ * config/microblaze/microblaze.c (microblaze_function_arg): Likewise.
+ (microblaze_expand_prologue): Update call accordingly.
+ * config/mips/mips.c (mips_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ * config/mmix/mmix.c (mmix_function_incoming_arg, mmix_function_arg)
+ (mmix_function_arg_1): Likewise.
+ * config/mn10300/mn10300.c (mn10300_function_arg): Likewise.
+ * config/moxie/moxie.c (moxie_function_arg): Likewise.
+ * config/msp430/msp430.c (msp430_function_arg): Likewise.
+ * config/nds32/nds32.c (nds32_function_arg): Likewise.
+ * config/nios2/nios2.c (nios2_function_arg): Likewise.
+ * config/nvptx/nvptx.c (nvptx_function_arg): Likewise.
+ (nvptx_function_incoming_arg): Likewise.
+ * config/or1k/or1k.c (or1k_function_arg): Likewise.
+ * config/pa/pa.c (pa_function_arg): Likewise.
+ * config/pdp11/pdp11.c (pdp11_function_arg): Likewise.
+ * config/pru/pru.c (pru_function_arg): Likewise.
+ * config/riscv/riscv.c (riscv_function_arg): Likewise.
+ * config/rl78/rl78.c (rl78_function_arg): Likewise.
+ * config/rs6000/rs6000-internal.h (rs6000_function_arg): Likewise.
+ * config/rs6000/rs6000-call.c (rs6000_function_arg): Likewise.
+ (rs6000_parm_needs_stack): Update call accordingly.
+ * config/rx/rx.c (rx_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ * config/s390/s390.c (s390_function_arg): Likewise.
+ (s390_call_saved_register_used): Update call accordingly.
+ * config/sh/sh.c (sh_function_arg): Take a function_arg_info
+ instead of a mode, tree and named flag.
+ (sh_output_mi_thunk): Update call accordingly.
+ * config/sparc/sparc.c (sparc_function_arg_1, sparc_function_arg)
+ (sparc_function_incoming_arg): Take a function_arg_info instead of
+ a mode, tree and named flag.
+ * config/spu/spu.c (spu_function_arg): Likewise.
+ * config/stormy16/stormy16.c (xstormy16_function_arg): Likewise.
+ * config/tilegx/tilegx.c (tilegx_function_arg): Likewise.
+ * config/tilepro/tilepro.c (tilepro_function_arg): Likewise.
+ * config/v850/v850.c (v850_function_arg): Likewise.
+ * config/vax/vax.c (vax_function_arg): Likewise.
+ * config/visium/visium.c (visium_function_arg): Likewise.
+ * config/xtensa/xtensa.c (xtensa_function_arg_1, xtensa_function_arg)
+ (xtensa_function_incoming_arg): Likewise.
+
2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
* target.def (setup_incoming_varargs): Take a function_arg_info
It is zero if this call doesn't want a structure value.
NEXT_ARG_REG is the rtx that results from executing
- targetm.calls.function_arg (&args_so_far, VOIDmode, void_type_node, true)
+ targetm.calls.function_arg (&args_so_far,
+ function_arg_info::end_marker ());
just after all the args have had their registers assigned.
This could be whatever you like, but normally it is the first
arg-register beyond those used for args in this call,
targetm.calls.warn_parameter_passing_abi (args_so_far, type);
- args[i].reg = targetm.calls.function_arg (args_so_far, mode, type,
- argpos < n_named_args);
+ function_arg_info arg (type, mode, argpos < n_named_args);
+ args[i].reg = targetm.calls.function_arg (args_so_far, arg);
if (args[i].reg && CONST_INT_P (args[i].reg))
args[i].reg = NULL;
arguments have to go into the incoming registers. */
if (targetm.calls.function_incoming_arg != targetm.calls.function_arg)
args[i].tail_call_reg
- = targetm.calls.function_incoming_arg (args_so_far, mode, type,
- argpos < n_named_args);
+ = targetm.calls.function_incoming_arg (args_so_far, arg);
else
args[i].tail_call_reg = args[i].reg;
- function_arg_info arg (type, mode, argpos < n_named_args);
if (args[i].reg)
args[i].partial = targetm.calls.arg_partial_bytes (args_so_far, arg);
/* Set up next argument register. For sibling calls on machines
with register windows this should be the incoming register. */
if (pass == 0)
- next_arg_reg = targetm.calls.function_incoming_arg (args_so_far,
- VOIDmode,
- void_type_node,
- true);
+ next_arg_reg = targetm.calls.function_incoming_arg
+ (args_so_far, function_arg_info::end_marker ());
else
- next_arg_reg = targetm.calls.function_arg (args_so_far,
- VOIDmode, void_type_node,
- true);
+ next_arg_reg = targetm.calls.function_arg
+ (args_so_far, function_arg_info::end_marker ());
if (pass == 1 && (return_flags & ERF_RETURNS_ARG))
{
argvec[count].partial = 0;
function_arg_info ptr_arg (Pmode, /*named=*/true);
- argvec[count].reg = targetm.calls.function_arg (args_so_far,
- Pmode, NULL_TREE, true);
+ argvec[count].reg = targetm.calls.function_arg (args_so_far, ptr_arg);
gcc_assert (targetm.calls.arg_partial_bytes (args_so_far, ptr_arg) == 0);
locate_and_pad_parm (Pmode, NULL_TREE,
function_arg_info arg (mode, /*named=*/true);
argvec[count].mode = mode;
argvec[count].value = convert_modes (mode, GET_MODE (val), val, unsigned_p);
- argvec[count].reg = targetm.calls.function_arg (args_so_far, mode,
- NULL_TREE, true);
+ argvec[count].reg = targetm.calls.function_arg (args_so_far, arg);
argvec[count].partial
= targetm.calls.arg_partial_bytes (args_so_far, arg);
original_args_size.constant, args_size.constant,
struct_value_size,
targetm.calls.function_arg (args_so_far,
- VOIDmode, void_type_node, true),
+ function_arg_info::end_marker ()),
valreg,
old_inhibit_defer_pop + 1, call_fusage, flags, args_so_far);
return GET_MODE_SIZE (mode);
}
+ /* True if the argument represents the end of the argument list,
+ as returned by end_marker (). */
+ bool end_marker_p () const { return mode == VOIDmode; }
+
+ /* Return a function_arg_info that represents the end of the
+ argument list. */
+ static function_arg_info end_marker ()
+ {
+ return function_arg_info (void_type_node, /*named=*/true);
+ }
+
/* The type of the argument, or null if not known (which is true for
libgcc support functions). */
tree type;
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-aarch64_function_arg (cumulative_args_t pcum_v, machine_mode mode,
- const_tree type, bool named)
+aarch64_function_arg (cumulative_args_t pcum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v);
gcc_assert (pcum->pcs_variant == ARM_PCS_AAPCS64);
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return NULL_RTX;
- aarch64_layout_arg (pcum_v, mode, type, named);
+ aarch64_layout_arg (pcum_v, arg.mode, arg.type, arg.named);
return pcum->aapcs_reg;
}
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On Alpha the first 6 words of args are normally in registers
and the rest are pushed. */
static rtx
-alpha_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+alpha_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int basereg;
int num_args;
/* Don't get confused and pass small structures in FP registers. */
- if (type && AGGREGATE_TYPE_P (type))
+ if (arg.aggregate_type_p ())
basereg = 16;
else
{
/* With alpha_split_complex_arg, we shouldn't see any raw complex
values here. */
- gcc_checking_assert (!COMPLEX_MODE_P (mode));
+ gcc_checking_assert (!COMPLEX_MODE_P (arg.mode));
/* Set up defaults for FP operands passed in FP registers, and
integral operands passed in integer registers. */
- if (TARGET_FPREGS && GET_MODE_CLASS (mode) == MODE_FLOAT)
+ if (TARGET_FPREGS && GET_MODE_CLASS (arg.mode) == MODE_FLOAT)
basereg = 32 + 16;
else
basereg = 16;
the two platforms, so we can't avoid conditional compilation. */
#if TARGET_ABI_OPEN_VMS
{
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return alpha_arg_info_reg_val (*cum);
num_args = cum->num_args;
if (num_args >= 6
- || targetm.calls.must_pass_in_stack (mode, type))
+ || targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return NULL_RTX;
}
#elif TARGET_ABI_OSF
return NULL_RTX;
num_args = *cum;
- /* VOID is passed as a special flag for "last argument". */
- if (type == void_type_node)
+ if (arg.end_marker_p ())
basereg = 16;
- else if (targetm.calls.must_pass_in_stack (mode, type))
+ else if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return NULL_RTX;
}
#else
#error Unhandled ABI
#endif
- return gen_rtx_REG (mode, num_args + basereg);
+ return gen_rtx_REG (arg.mode, num_args + basereg);
}
/* Update the data in CUM to advance over an argument
return ret;
}
-/* This function is used to control a function argument is passed in a
- register, and which register.
-
- The arguments are CUM, of type CUMULATIVE_ARGS, which summarizes
- (in a way defined by INIT_CUMULATIVE_ARGS and FUNCTION_ARG_ADVANCE)
- all of the previous arguments so far passed in registers; MODE, the
- machine mode of the argument; TYPE, the data type of the argument
- as a tree node or 0 if that is not known (which happens for C
- support library functions); and NAMED, which is 1 for an ordinary
- argument and 0 for nameless arguments that correspond to `...' in
- the called function's prototype.
-
- The returned value should either be a `reg' RTX for the hard
- register in which to pass the argument, or zero to pass the
- argument on the stack.
-
- For machines like the Vax and 68000, where normally all arguments
- are pushed, zero suffices as a definition.
-
- The usual way to make the ANSI library `stdarg.h' work on a machine
- where some arguments are usually passed in registers, is to cause
- nameless arguments to be passed on the stack instead. This is done
- by making the function return 0 whenever NAMED is 0.
-
- You may use the macro `MUST_PASS_IN_STACK (MODE, TYPE)' in the
- definition of this function to determine if this argument is of a
- type that must be passed in the stack. If `REG_PARM_STACK_SPACE'
- is not defined and the function returns non-zero for such an
- argument, the compiler will abort. If `REG_PARM_STACK_SPACE' is
- defined, the argument will be computed in the stack and then loaded
- into a register.
-
- The function is used to implement macro FUNCTION_ARG. */
-/* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers
- and the rest are pushed. */
+/* Implement TARGET_FUNCTION_ARG. On the ARC the first MAX_ARC_PARM_REGS
+ args are normally in registers and the rest are pushed. */
static rtx
-arc_function_arg (cumulative_args_t cum_v,
- machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+arc_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int arg_num = *cum;
rtx ret;
const char *debstr ATTRIBUTE_UNUSED;
- arg_num = ROUND_ADVANCE_CUM (arg_num, mode, type);
+ arg_num = ROUND_ADVANCE_CUM (arg_num, arg.mode, arg.type);
/* Return a marker for use in the call instruction. */
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
{
ret = const0_rtx;
debstr = "<0>";
}
else if (GPR_REST_ARG_REGS (arg_num) > 0)
{
- ret = gen_rtx_REG (mode, arg_num);
+ ret = gen_rtx_REG (arg.mode, arg_num);
debstr = reg_names [arg_num];
}
else
static rtx emit_multi_reg_push (unsigned long, unsigned long);
static int arm_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
-static rtx arm_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx arm_function_arg (cumulative_args_t, const function_arg_info &);
static void arm_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static pad_direction arm_function_arg_padding (machine_mode, const_tree);
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On the ARM, normally the first 16 bytes are passed in registers r0-r3; all
other arguments are passed on the stack. If (NAMED == 0) (which happens
indeed make it pass in the stack if necessary). */
static rtx
-arm_function_arg (cumulative_args_t pcum_v, machine_mode mode,
- const_tree type, bool named)
+arm_function_arg (cumulative_args_t pcum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v);
int nregs;
/* Handle the special case quickly. Pick an arbitrary value for op2 of
a call insn (op3 of a call_value insn). */
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return const0_rtx;
if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
{
- aapcs_layout_arg (pcum, mode, type, named);
+ aapcs_layout_arg (pcum, arg.mode, arg.type, arg.named);
return pcum->aapcs_reg;
}
/* Varargs vectors are treated the same as long long.
named_count avoids having to change the way arm handles 'named' */
if (TARGET_IWMMXT_ABI
- && arm_vector_mode_supported_p (mode)
+ && arm_vector_mode_supported_p (arg.mode)
&& pcum->named_count > pcum->nargs + 1)
{
if (pcum->iwmmxt_nregs <= 9)
- return gen_rtx_REG (mode, pcum->iwmmxt_nregs + FIRST_IWMMXT_REGNUM);
+ return gen_rtx_REG (arg.mode,
+ pcum->iwmmxt_nregs + FIRST_IWMMXT_REGNUM);
else
{
pcum->can_split = false;
/* Put doubleword aligned quantities in even register pairs. */
if ((pcum->nregs & 1) && ARM_DOUBLEWORD_ALIGN)
{
- int res = arm_needs_doubleword_align (mode, type);
+ int res = arm_needs_doubleword_align (arg.mode, arg.type);
if (res < 0 && warn_psabi)
inform (input_location, "parameter passing for argument of type "
- "%qT changed in GCC 7.1", type);
+ "%qT changed in GCC 7.1", arg.type);
else if (res > 0)
{
pcum->nregs++;
if (res > 1 && warn_psabi)
inform (input_location, "parameter passing for argument of type "
- "%qT changed in GCC 9.1", type);
+ "%qT changed in GCC 9.1", arg.type);
}
}
if (pcum->can_split)
nregs = 1;
else
- nregs = ARM_NUM_REGS2 (mode, type);
+ nregs = ARM_NUM_REGS2 (arg.mode, arg.type);
- if (!named || pcum->nregs + nregs > NUM_ARG_REGS)
+ if (!arg.named || pcum->nregs + nregs > NUM_ARG_REGS)
return NULL_RTX;
- return gen_rtx_REG (mode, pcum->nregs);
+ return gen_rtx_REG (arg.mode, pcum->nregs);
}
static unsigned int
function_arg_info arg (arg_type, /*named=*/true);
if (!first_param)
arm_function_arg_advance (args_so_far, arg_mode, arg_type, true);
- arg_rtx = arm_function_arg (args_so_far, arg_mode, arg_type, true);
+ arg_rtx = arm_function_arg (args_so_far, arg);
if (!arg_rtx || arm_arg_partial_bytes (args_so_far, arg))
{
error ("%qE attribute not available to functions with arguments "
arm_function_arg_advance (cum_v, TYPE_MODE (type), type, true);
}
- if (!arm_function_arg (cum_v, SImode, integer_type_node, true))
+ function_arg_info arg (integer_type_node, /*named=*/true);
+ if (!arm_function_arg (cum_v, arg))
return false;
}
if (VOID_TYPE_P (arg_type))
continue;
+ function_arg_info arg (arg_type, /*named=*/true);
if (!first_param)
arm_function_arg_advance (args_so_far, arg_mode, arg_type,
true);
- arg_rtx = arm_function_arg (args_so_far, arg_mode, arg_type,
- true);
+ arg_rtx = arm_function_arg (args_so_far, arg);
gcc_assert (REG_P (arg_rtx));
to_clear_args_mask
= compute_not_to_clear_mask (arg_type, arg_rtx,
in a register, and which register. */
static rtx
-avr_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+avr_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- int bytes = avr_num_arg_regs (mode, type);
+ int bytes = avr_num_arg_regs (arg.mode, arg.type);
if (cum->nregs && bytes <= cum->nregs)
- return gen_rtx_REG (mode, cum->regno - bytes);
+ return gen_rtx_REG (arg.mode, cum->regno - bytes);
return NULL_RTX;
}
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
static rtx
-bfin_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+bfin_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- int bytes
- = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+ int bytes = arg.promoted_size_in_bytes ();
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
/* Compute operand 2 of the call insn. */
return GEN_INT (cum->call_cookie);
return NULL_RTX;
if (cum->nregs)
- return gen_rtx_REG (mode, *(cum->arg_regs));
+ return gen_rtx_REG (arg.mode, *(cum->arg_regs));
return NULL_RTX;
}
}
}
-/* Implements the macro FUNCTION_ARG defined in c6x.h. */
+/* Implement TARGET_FUNCTION_ARG. */
static rtx
-c6x_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+c6x_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (cum->count >= cum->nregs)
return NULL_RTX;
- if (type)
+ if (tree type = arg.type)
{
HOST_WIDE_INT size = int_size_in_bytes (type);
if (TARGET_BIG_ENDIAN && AGGREGATE_TYPE_P (type))
rtx reg2 = gen_rtx_REG (SImode, argument_registers[cum->count]);
rtvec vec = gen_rtvec (2, gen_rtx_EXPR_LIST (VOIDmode, reg1, const0_rtx),
gen_rtx_EXPR_LIST (VOIDmode, reg2, GEN_INT (4)));
- return gen_rtx_PARALLEL (mode, vec);
+ return gen_rtx_PARALLEL (arg.mode, vec);
}
}
}
- return gen_rtx_REG (mode, argument_registers[cum->count]);
+ return gen_rtx_REG (arg.mode, argument_registers[cum->count]);
}
static void
type = build_pointer_type (type);
}
- parm_rtx = c6x_function_arg (cum, mode, type, 0);
+ function_arg_info arg (type, mode, /*named=*/false);
+ parm_rtx = c6x_function_arg (cum, arg);
c6x_function_arg_advance (cum, mode, type, 0);
return 0;
}
-/* Implements the macro FUNCTION_ARG defined in cr16.h. */
+/* Implement TARGET_FUNCTION_ARG. */
static rtx
-cr16_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+cr16_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
cum->last_parm_in_reg = 0;
had their registers assigned. The rtx that function_arg returns from
this type is supposed to pass to 'gen_call' but currently it is not
implemented. */
- if (type == void_type_node)
+ if (arg.end_marker_p ())
return NULL_RTX;
- if (targetm.calls.must_pass_in_stack (mode, type) || (cum->ints < 0))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type) || (cum->ints < 0))
return NULL_RTX;
- if (mode == BLKmode)
+ if (arg.mode == BLKmode)
{
/* Enable structures that need padding bytes at the end to pass to a
function in registers. */
- if (enough_regs_for_param (cum, type, mode) != 0)
+ if (enough_regs_for_param (cum, arg.type, arg.mode) != 0)
{
cum->last_parm_in_reg = 1;
- return gen_rtx_REG (mode, MIN_REG_FOR_PASSING_ARGS + cum->ints);
+ return gen_rtx_REG (arg.mode, MIN_REG_FOR_PASSING_ARGS + cum->ints);
}
}
return NULL_RTX;
else
{
- if (enough_regs_for_param (cum, type, mode) != 0)
+ if (enough_regs_for_param (cum, arg.type, arg.mode) != 0)
{
cum->last_parm_in_reg = 1;
- return gen_rtx_REG (mode, MIN_REG_FOR_PASSING_ARGS + cum->ints);
+ return gen_rtx_REG (arg.mode, MIN_REG_FOR_PASSING_ARGS + cum->ints);
}
}
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,
- const_tree, bool);
+static rtx cris_function_arg (cumulative_args_t, const function_arg_info &);
static rtx cris_function_incoming_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static void cris_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static rtx_insn *cris_md_asm_adjust (vec<rtx> &, vec<rtx> &,
}
static rtx
-cris_function_arg_1 (cumulative_args_t ca_v,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named, bool incoming)
+cris_function_arg_1 (cumulative_args_t ca_v, const function_arg_info &arg,
+ bool incoming)
{
const CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v);
- if ((!incoming || named) && ca->regs < CRIS_MAX_ARGS_IN_REGS)
- return gen_rtx_REG (mode, CRIS_FIRST_ARG_REG + ca->regs);
+ if ((!incoming || arg.named) && ca->regs < CRIS_MAX_ARGS_IN_REGS)
+ return gen_rtx_REG (arg.mode, CRIS_FIRST_ARG_REG + ca->regs);
else
return NULL_RTX;
}
The void_type_node is sent as a "closing" call. */
static rtx
-cris_function_arg (cumulative_args_t ca, machine_mode mode,
- const_tree type, bool named)
+cris_function_arg (cumulative_args_t ca, const function_arg_info &arg)
{
- return cris_function_arg_1 (ca, mode, type, named, false);
+ return cris_function_arg_1 (ca, arg, false);
}
/* Worker function for TARGET_FUNCTION_INCOMING_ARG.
The differences between this and the previous, is that this one checks
that an argument is named, since incoming stdarg/varargs arguments are
pushed onto the stack, and we don't have to check against the "closing"
- void_type_node TYPE parameter. */
+ function_arg_info::end_marker parameter. */
static rtx
-cris_function_incoming_arg (cumulative_args_t ca, machine_mode mode,
- const_tree type, bool named)
+cris_function_incoming_arg (cumulative_args_t ca, const function_arg_info &arg)
{
- return cris_function_arg_1 (ca, mode, type, named, true);
+ return cris_function_arg_1 (ca, arg, true);
}
/* Worker function for TARGET_FUNCTION_ARG_ADVANCE. */
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
static rtx
-csky_function_arg (cumulative_args_t pcum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+csky_function_arg (cumulative_args_t pcum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v);
if (*pcum < CSKY_NPARM_REGS)
- return gen_rtx_REG (mode, CSKY_FIRST_PARM_REGNUM + *pcum);
+ return gen_rtx_REG (arg.mode, CSKY_FIRST_PARM_REGNUM + *pcum);
return NULL_RTX;
}
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
/* On the EPIPHANY the first MAX_EPIPHANY_PARM_REGS args are normally in
registers and the rest are pushed. */
static rtx
-epiphany_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+epiphany_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS cum = *get_cumulative_args (cum_v);
- if (PASS_IN_REG_P (cum, mode, type))
- return gen_rtx_REG (mode, ROUND_ADVANCE_CUM (cum, mode, type));
+ if (PASS_IN_REG_P (cum, arg.mode, arg.type))
+ return gen_rtx_REG (arg.mode, ROUND_ADVANCE_CUM (cum, arg.mode, arg.type));
return 0;
}
static bool fr30_must_pass_in_stack (machine_mode, const_tree);
static int fr30_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
-static rtx fr30_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx fr30_function_arg (cumulative_args_t, const function_arg_info &);
static void fr30_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static bool fr30_frame_pointer_required (void);
}
static rtx
-fr30_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+fr30_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (!named
- || fr30_must_pass_in_stack (mode, type)
+ if (!arg.named
+ || fr30_must_pass_in_stack (arg.mode, arg.type)
|| *cum >= FR30_NUM_ARG_REGS)
return NULL_RTX;
else
- return gen_rtx_REG (mode, *cum + FIRST_ARG_REGNUM);
+ return gen_rtx_REG (arg.mode, *cum + FIRST_ARG_REGNUM);
}
/* A C statement (sans semicolon) to update the summarizer variable CUM to
static bool frv_must_pass_in_stack (machine_mode mode, const_tree type);
static int frv_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
-static rtx frv_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
-static rtx frv_function_incoming_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx frv_function_arg (cumulative_args_t, const function_arg_info &);
+static rtx frv_function_incoming_arg (cumulative_args_t,
+ const function_arg_info &);
static void frv_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static unsigned int frv_function_arg_boundary (machine_mode,
}
static rtx
-frv_function_arg_1 (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED, bool named,
+frv_function_arg_1 (cumulative_args_t cum_v, const function_arg_info &arg,
bool incoming ATTRIBUTE_UNUSED)
{
const CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- machine_mode xmode = (mode == BLKmode) ? SImode : mode;
+ machine_mode xmode = (arg.mode == BLKmode) ? SImode : arg.mode;
int arg_num = *cum;
rtx ret;
const char *debstr;
if (TARGET_DEBUG_ARG)
fprintf (stderr,
"function_arg: words = %2d, mode = %4s, named = %d, size = %3d, arg = %s\n",
- arg_num, GET_MODE_NAME (mode), named, GET_MODE_SIZE (mode), debstr);
+ arg_num, GET_MODE_NAME (arg.mode), arg.named,
+ GET_MODE_SIZE (arg.mode), debstr);
return ret;
}
static rtx
-frv_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+frv_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
- return frv_function_arg_1 (cum, mode, type, named, false);
+ return frv_function_arg_1 (cum, arg, false);
}
static rtx
-frv_function_incoming_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+frv_function_incoming_arg (cumulative_args_t cum, const function_arg_info &arg)
{
- return frv_function_arg_1 (cum, mode, type, named, true);
+ return frv_function_arg_1 (cum, arg, true);
}
\f
NULL_RTX if there's no more space. */
static rtx
-ft32_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+ft32_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (*cum < 8)
- return gen_rtx_REG (mode, *cum);
+ return gen_rtx_REG (arg.mode, *cum);
else
return NULL_RTX;
}
and if so, which register. */
static rtx
-gcn_function_arg (cumulative_args_t cum_v, machine_mode mode, const_tree type,
- bool named)
+gcn_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (cum->normal_function)
{
- if (!named || mode == VOIDmode)
+ if (!arg.named || arg.end_marker_p ())
return 0;
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return 0;
int reg_num = FIRST_PARM_REG + cum->num;
- int num_regs = num_arg_regs (mode, type);
+ int num_regs = num_arg_regs (arg.mode, arg.type);
if (num_regs > 0)
while (reg_num % num_regs != 0)
reg_num++;
if (reg_num + num_regs <= FIRST_PARM_REG + NUM_PARM_REGS)
- return gen_rtx_REG (mode, reg_num);
+ return gen_rtx_REG (arg.mode, reg_num);
}
else
{
if (cum->num >= cum->args.nargs)
{
- cum->offset = (cum->offset + TYPE_ALIGN (type) / 8 - 1)
- & -(TYPE_ALIGN (type) / 8);
+ cum->offset = (cum->offset + TYPE_ALIGN (arg.type) / 8 - 1)
+ & -(TYPE_ALIGN (arg.type) / 8);
cfun->machine->kernarg_segment_alignment
= MAX ((unsigned) cfun->machine->kernarg_segment_alignment,
- TYPE_ALIGN (type) / 8);
+ TYPE_ALIGN (arg.type) / 8);
rtx addr = gen_rtx_REG (DImode,
cum->args.reg[KERNARG_SEGMENT_PTR_ARG]);
if (cum->offset)
addr = gen_rtx_PLUS (DImode, addr,
gen_int_mode (cum->offset, DImode));
- rtx mem = gen_rtx_MEM (mode, addr);
- set_mem_attributes (mem, const_cast<tree>(type), 1);
+ rtx mem = gen_rtx_MEM (arg.mode, addr);
+ set_mem_attributes (mem, arg.type, 1);
set_mem_addr_space (mem, ADDR_SPACE_SCALAR_FLAT);
MEM_READONLY_P (mem) = 1;
return mem;
}
int a = cum->args.order[cum->num];
- if (mode != gcn_kernel_arg_types[a].mode)
+ if (arg.mode != gcn_kernel_arg_types[a].mode)
{
error ("wrong type of argument %s", gcn_kernel_arg_types[a].name);
return 0;
pragma_saveall = 1;
}
-/* If the next function argument with MODE and TYPE is to be passed in
- a register, return a reg RTX for the hard register in which to pass
- the argument. CUM represents the state after the last argument.
- If the argument is to be pushed, NULL_RTX is returned.
+/* If the next function argument ARG is to be passed in a register, return
+ a reg RTX for the hard register in which to pass the argument. CUM
+ represents the state after the last argument. If the argument is to
+ be pushed, NULL_RTX is returned.
On the H8/300 all normal args are pushed, unless -mquickcall in which
case the first 3 arguments are passed in registers. */
static rtx
-h8300_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+h8300_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int regpass = 0;
/* Never pass unnamed arguments in registers. */
- if (!named)
+ if (!arg.named)
return NULL_RTX;
/* Pass 3 regs worth of data in regs when user asked on the command line. */
if (regpass)
{
- int size;
-
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ int size = arg.promoted_size_in_bytes ();
if (size + cum->nbytes <= regpass * UNITS_PER_WORD
&& cum->nbytes / UNITS_PER_WORD <= 3)
- result = gen_rtx_REG (mode, cum->nbytes / UNITS_PER_WORD);
+ result = gen_rtx_REG (arg.mode, cum->nbytes / UNITS_PER_WORD);
}
return result;
/* Return where to put the arguments to a function.
Return zero to push the argument on the stack, or a hard register in which to store the argument.
- MODE is the argument's machine mode. TYPE is the data type of the
- argument. It is null for libcalls where that information may not be
- available. CUM gives information about the preceding args and about
- the function being called. NAMED is nonzero if this argument is a
- named parameter (otherwise it is an extra parameter matching an
- ellipsis). */
+ ARG describes the argument while CUM gives information about the
+ preceding args and about the function being called. */
static rtx
-ix86_function_arg (cumulative_args_t cum_v, machine_mode omode,
- const_tree type, bool named)
+ix86_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- machine_mode mode = omode;
+ machine_mode mode = arg.mode;
HOST_WIDE_INT bytes, words;
- rtx arg;
+ rtx reg;
if (!cum->caller && cfun->machine->func_type != TYPE_NORMAL)
{
- gcc_assert (type != NULL_TREE);
- if (POINTER_TYPE_P (type))
+ gcc_assert (arg.type != NULL_TREE);
+ if (POINTER_TYPE_P (arg.type))
{
/* This is the pointer argument. */
- gcc_assert (TYPE_MODE (type) == Pmode);
+ gcc_assert (TYPE_MODE (arg.type) == Pmode);
/* It is at -WORD(AP) in the current frame in interrupt and
exception handlers. */
- arg = plus_constant (Pmode, arg_pointer_rtx, -UNITS_PER_WORD);
+ reg = plus_constant (Pmode, arg_pointer_rtx, -UNITS_PER_WORD);
}
else
{
gcc_assert (cfun->machine->func_type == TYPE_EXCEPTION
- && TREE_CODE (type) == INTEGER_TYPE
- && TYPE_MODE (type) == word_mode);
+ && TREE_CODE (arg.type) == INTEGER_TYPE
+ && TYPE_MODE (arg.type) == word_mode);
/* The error code is the word-mode integer argument at
-2 * WORD(AP) in the current frame of the exception
handler. */
- arg = gen_rtx_MEM (word_mode,
+ reg = gen_rtx_MEM (word_mode,
plus_constant (Pmode,
arg_pointer_rtx,
-2 * UNITS_PER_WORD));
}
- return arg;
+ return reg;
}
- if (mode == BLKmode)
- bytes = int_size_in_bytes (type);
- else
- bytes = GET_MODE_SIZE (mode);
+ bytes = arg.promoted_size_in_bytes ();
words = CEIL (bytes, UNITS_PER_WORD);
/* To simplify the code below, represent vector types with a vector mode
even if MMX/SSE are not active. */
- if (type && TREE_CODE (type) == VECTOR_TYPE)
- mode = type_natural_mode (type, cum, false);
+ if (arg.type && TREE_CODE (arg.type) == VECTOR_TYPE)
+ mode = type_natural_mode (arg.type, cum, false);
if (TARGET_64BIT)
{
enum calling_abi call_abi = cum ? cum->call_abi : ix86_abi;
if (call_abi == MS_ABI)
- arg = function_arg_ms_64 (cum, mode, omode, named, bytes);
+ reg = function_arg_ms_64 (cum, mode, arg.mode, arg.named, bytes);
else
- arg = function_arg_64 (cum, mode, omode, type, named);
+ reg = function_arg_64 (cum, mode, arg.mode, arg.type, arg.named);
}
else
- arg = function_arg_32 (cum, mode, omode, type, bytes, words);
+ reg = function_arg_32 (cum, mode, arg.mode, arg.type, bytes, words);
/* Track if there are outgoing arguments on stack. */
- if (arg == NULL_RTX && cum->caller)
+ if (reg == NULL_RTX && cum->caller)
cfun->machine->outgoing_args_on_stack = true;
- return arg;
+ return reg;
}
/* A C expression that indicates when an argument must be passed by
int *, int);
static int ia64_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
-static rtx ia64_function_arg_1 (cumulative_args_t, machine_mode,
- const_tree, bool, bool);
-static rtx ia64_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx ia64_function_arg (cumulative_args_t, const function_arg_info &);
static rtx ia64_function_incoming_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static void ia64_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static pad_direction ia64_function_arg_padding (machine_mode, const_tree);
registers. */
static rtx
-ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named, bool incoming)
+ia64_function_arg_1 (cumulative_args_t cum_v, const function_arg_info &arg,
+ bool incoming)
{
const CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int basereg = (incoming ? GR_ARG_FIRST : AR_ARG_FIRST);
- int words = ia64_function_arg_words (type, mode);
- int offset = ia64_function_arg_offset (cum, type, words);
+ int words = ia64_function_arg_words (arg.type, arg.mode);
+ int offset = ia64_function_arg_offset (cum, arg.type, words);
machine_mode hfa_mode = VOIDmode;
/* For OPEN VMS, emit the instruction setting up the argument register here,
insns. This is not the conceptually best place to do this, but this is
the easiest as we have convenient access to cumulative args info. */
- if (TARGET_ABI_OPEN_VMS && mode == VOIDmode && type == void_type_node
- && named == 1)
+ if (TARGET_ABI_OPEN_VMS && arg.end_marker_p ())
{
unsigned HOST_WIDE_INT regval = cum->words;
int i;
/* On OpenVMS argument is either in Rn or Fn. */
if (TARGET_ABI_OPEN_VMS)
{
- if (FLOAT_MODE_P (mode))
- return gen_rtx_REG (mode, FR_ARG_FIRST + cum->words);
+ if (FLOAT_MODE_P (arg.mode))
+ return gen_rtx_REG (arg.mode, FR_ARG_FIRST + cum->words);
else
- return gen_rtx_REG (mode, basereg + cum->words);
+ return gen_rtx_REG (arg.mode, basereg + cum->words);
}
/* Check for and handle homogeneous FP aggregates. */
- if (type)
- hfa_mode = hfa_element_mode (type, 0);
+ if (arg.type)
+ hfa_mode = hfa_element_mode (arg.type, 0);
/* Unnamed prototyped hfas are passed as usual. Named prototyped hfas
and unprototyped hfas are passed specially. */
- if (hfa_mode != VOIDmode && (! cum->prototype || named))
+ if (hfa_mode != VOIDmode && (! cum->prototype || arg.named))
{
rtx loc[16];
int i = 0;
/* Fill the FP regs. We do this always. We stop if we reach the end
of the argument, the last FP register, or the last argument slot. */
- byte_size = ((mode == BLKmode)
- ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ byte_size = arg.promoted_size_in_bytes ();
args_byte_size = int_regs * UNITS_PER_WORD;
offset = 0;
for (; (offset < byte_size && fp_regs < MAX_ARGUMENT_SLOTS
else if (gr_size > UNITS_PER_WORD)
int_regs += gr_size / UNITS_PER_WORD;
}
- return gen_rtx_PARALLEL (mode, gen_rtvec_v (i, loc));
+ return gen_rtx_PARALLEL (arg.mode, gen_rtvec_v (i, loc));
}
/* Integral and aggregates go in general registers. If we have run out of
FR registers, then FP values must also go in general registers. This can
happen when we have a SFmode HFA. */
- else if (mode == TFmode || mode == TCmode
- || (! FLOAT_MODE_P (mode) || cum->fp_regs == MAX_ARGUMENT_SLOTS))
+ else if (arg.mode == TFmode || arg.mode == TCmode
+ || !FLOAT_MODE_P (arg.mode)
+ || cum->fp_regs == MAX_ARGUMENT_SLOTS)
{
- int byte_size = ((mode == BLKmode)
- ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ int byte_size = arg.promoted_size_in_bytes ();
if (BYTES_BIG_ENDIAN
- && (mode == BLKmode || (type && AGGREGATE_TYPE_P (type)))
- && byte_size < UNITS_PER_WORD
- && byte_size > 0)
+ && (arg.mode == BLKmode || arg.aggregate_type_p ())
+ && byte_size < UNITS_PER_WORD
+ && byte_size > 0)
{
rtx gr_reg = gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (DImode,
(basereg + cum->words
+ offset)),
const0_rtx);
- return gen_rtx_PARALLEL (mode, gen_rtvec (1, gr_reg));
+ return gen_rtx_PARALLEL (arg.mode, gen_rtvec (1, gr_reg));
}
else
- return gen_rtx_REG (mode, basereg + cum->words + offset);
+ return gen_rtx_REG (arg.mode, basereg + cum->words + offset);
}
named, and in a GR register when unnamed. */
else if (cum->prototype)
{
- if (named)
- return gen_rtx_REG (mode, FR_ARG_FIRST + cum->fp_regs);
+ if (arg.named)
+ return gen_rtx_REG (arg.mode, FR_ARG_FIRST + cum->fp_regs);
/* In big-endian mode, an anonymous SFmode value must be represented
as (parallel:SF [(expr_list (reg:DI n) (const_int 0))]) to force
the value into the high half of the general register. */
- else if (BYTES_BIG_ENDIAN && mode == SFmode)
- return gen_rtx_PARALLEL (mode,
+ else if (BYTES_BIG_ENDIAN && arg.mode == SFmode)
+ return gen_rtx_PARALLEL (arg.mode,
gen_rtvec (1,
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (DImode, basereg + cum->words + offset),
const0_rtx)));
else
- return gen_rtx_REG (mode, basereg + cum->words + offset);
+ return gen_rtx_REG (arg.mode, basereg + cum->words + offset);
}
/* If there is no prototype, then FP values go in both FR and GR
registers. */
{
/* See comment above. */
machine_mode inner_mode =
- (BYTES_BIG_ENDIAN && mode == SFmode) ? DImode : mode;
+ (BYTES_BIG_ENDIAN && arg.mode == SFmode) ? DImode : arg.mode;
rtx fp_reg = gen_rtx_EXPR_LIST (VOIDmode,
- gen_rtx_REG (mode, (FR_ARG_FIRST
+ gen_rtx_REG (arg.mode, (FR_ARG_FIRST
+ cum->fp_regs)),
const0_rtx);
rtx gr_reg = gen_rtx_EXPR_LIST (VOIDmode,
+ offset)),
const0_rtx);
- return gen_rtx_PARALLEL (mode, gen_rtvec (2, fp_reg, gr_reg));
+ return gen_rtx_PARALLEL (arg.mode, gen_rtvec (2, fp_reg, gr_reg));
}
}
/* Implement TARGET_FUNCION_ARG target hook. */
static rtx
-ia64_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+ia64_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
- return ia64_function_arg_1 (cum, mode, type, named, false);
+ return ia64_function_arg_1 (cum, arg, false);
}
/* Implement TARGET_FUNCION_INCOMING_ARG target hook. */
static rtx
ia64_function_incoming_arg (cumulative_args_t cum,
- machine_mode mode,
- const_tree type, bool named)
+ const function_arg_info &arg)
{
- return ia64_function_arg_1 (cum, mode, type, named, true);
+ return ia64_function_arg_1 (cum, arg, true);
}
/* Return number of bytes, at the beginning of the argument, that must be
static int iq2000_arg_partial_bytes (cumulative_args_t,
const function_arg_info &arg);
static rtx iq2000_function_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static void iq2000_function_arg_advance (cumulative_args_t,
machine_mode, const_tree, bool);
static pad_direction iq2000_function_arg_padding (machine_mode, const_tree);
}
}
-/* Return an RTL expression containing the register for the given mode MODE
- and type TYPE in CUM, or 0 if the argument is to be passed on the stack. */
+/* Return an RTL expression containing the register for argument ARG in CUM,
+ or 0 if the argument is to be passed on the stack. */
static rtx
-iq2000_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
rtx ret;
int regbase = -1;
int bias = 0;
cum->gp_reg_found, cum->arg_number, cum->arg_words,
GET_MODE_NAME (mode));
fprintf (stderr, "%p", (const void *) type);
- fprintf (stderr, ", %d ) = ", named);
+ fprintf (stderr, ", %d ) = ", arg.named);
}
gcc_assert (regbase != -1);
if (! type || TREE_CODE (type) != RECORD_TYPE
- || ! named || ! TYPE_SIZE_UNIT (type)
+ || ! arg.named || ! TYPE_SIZE_UNIT (type)
|| ! tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
ret = gen_rtx_REG (mode, regbase + *arg_words + bias);
else
struct_p ? ", [struct]" : "");
}
- /* We will be called with a mode of VOIDmode after the last argument
+ /* We will be called with an end marker after the last argument
has been seen. Whatever we return will be passed to the call
insn. If we need any shifts for small structures, return them in
a PARALLEL. */
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
{
if (cum->num_adjusts > 0)
ret = gen_rtx_PARALLEL ((machine_mode) cum->fp_code,
passed_mode = Pmode;
}
- entry_parm = iq2000_function_arg (args_so_far, passed_mode,
- passed_type, true);
+ function_arg_info arg (passed_type, passed_mode, /*named=*/true);
+ entry_parm = iq2000_function_arg (args_so_far, arg);
iq2000_function_arg_advance (args_so_far, passed_mode,
passed_type, true);
iq2000_unction_arg has encoded a PARALLEL rtx, holding a vector of
adjustments to be made as the next_arg_reg variable, so we split up
the insns, and emit them separately. */
- next_arg_reg = iq2000_function_arg (args_so_far, VOIDmode,
- void_type_node, true);
+ next_arg_reg = iq2000_function_arg (args_so_far,
+ function_arg_info::end_marker ());
if (next_arg_reg != 0 && GET_CODE (next_arg_reg) == PARALLEL)
{
rtvec adjust = XVEC (next_arg_reg, 0);
CUMULATIVE_ARGS temp;
temp = *cum;
- if (iq2000_function_arg (pack_cumulative_args (&temp), arg.mode,
- arg.type, arg.named) != 0)
+ if (iq2000_function_arg (pack_cumulative_args (&temp), arg) != 0)
return 1;
}
lm32_legitimate_address_p (machine_mode mode, rtx x, bool strict);
static HOST_WIDE_INT lm32_compute_frame_size (int size);
static void lm32_option_override (void);
-static rtx lm32_function_arg (cumulative_args_t cum,
- machine_mode mode, const_tree type,
- bool named);
+static rtx lm32_function_arg (cumulative_args_t, const function_arg_info &);
static void lm32_function_arg_advance (cumulative_args_t cum,
machine_mode mode,
const_tree type, bool named);
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
static rtx
-lm32_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+lm32_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
/* Compute operand 2 of the call insn. */
return GEN_INT (0);
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return NULL_RTX;
- if (!named || (*cum + LM32_NUM_REGS2 (mode, type) > LM32_NUM_ARG_REGS))
+ if (!arg.named
+ || *cum + LM32_NUM_REGS2 (arg.mode, arg.type) > LM32_NUM_ARG_REGS)
return NULL_RTX;
- return gen_rtx_REG (mode, *cum + LM32_FIRST_ARG_REG);
+ return gen_rtx_REG (arg.mode, *cum + LM32_FIRST_ARG_REG);
}
static void
static void m32c_insert_attributes (tree, tree *);
static bool m32c_legitimate_address_p (machine_mode, rtx, bool);
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 rtx m32c_function_arg (cumulative_args_t, const function_arg_info &);
static bool m32c_pass_by_reference (cumulative_args_t,
const function_arg_info &);
static void m32c_function_arg_advance (cumulative_args_t, machine_mode,
#undef TARGET_FUNCTION_ARG
#define TARGET_FUNCTION_ARG m32c_function_arg
static rtx
-m32c_function_arg (cumulative_args_t ca_v,
- machine_mode mode, const_tree type, bool named)
+m32c_function_arg (cumulative_args_t ca_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v);
rtx rv = NULL_RTX;
#if DEBUG0
fprintf (stderr, "func_arg %d (%s, %d)\n",
- ca->parm_num, mode_name[mode], named);
- debug_tree ((tree)type);
+ ca->parm_num, mode_name[arg.mode], arg.named);
+ debug_tree (arg.type);
#endif
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return GEN_INT (0);
- if (ca->force_mem || !named)
+ if (ca->force_mem || !arg.named)
{
#if DEBUG0
fprintf (stderr, "func arg: force %d named %d, mem\n", ca->force_mem,
- named);
+ arg.named);
#endif
return NULL_RTX;
}
- if (type && INTEGRAL_TYPE_P (type) && POINTER_TYPE_P (type))
+ if (arg.type && INTEGRAL_TYPE_P (arg.type) && POINTER_TYPE_P (arg.type))
return NULL_RTX;
- if (type && AGGREGATE_TYPE_P (type))
+ if (arg.aggregate_type_p ())
return NULL_RTX;
switch (ca->parm_num)
{
case 1:
- if (GET_MODE_SIZE (mode) == 1 || GET_MODE_SIZE (mode) == 2)
- rv = gen_rtx_REG (mode, TARGET_A16 ? R1_REGNO : R0_REGNO);
+ if (GET_MODE_SIZE (arg.mode) == 1 || GET_MODE_SIZE (arg.mode) == 2)
+ rv = gen_rtx_REG (arg.mode, TARGET_A16 ? R1_REGNO : R0_REGNO);
break;
case 2:
- if (TARGET_A16 && GET_MODE_SIZE (mode) == 2)
- rv = gen_rtx_REG (mode, R2_REGNO);
+ if (TARGET_A16 && GET_MODE_SIZE (arg.mode) == 2)
+ rv = gen_rtx_REG (arg.mode, R2_REGNO);
break;
}
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,
- const_tree, bool);
+static rtx m32r_function_arg (cumulative_args_t, const function_arg_info &);
static void m32r_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static bool m32r_can_eliminate (const int, const int);
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
/* On the M32R the first M32R_MAX_PARM_REGS args are normally in registers
and the rest are pushed. */
static rtx
-m32r_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+m32r_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- return (PASS_IN_REG_P (*cum, mode, type)
- ? gen_rtx_REG (mode, ROUND_ADVANCE_CUM (*cum, mode, type))
+ return (PASS_IN_REG_P (*cum, arg.mode, arg.type)
+ ? gen_rtx_REG (arg.mode,
+ ROUND_ADVANCE_CUM (*cum, arg.mode, arg.type))
: NULL_RTX);
}
static rtx m68k_delegitimize_address (rtx);
static void m68k_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
-static rtx m68k_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx m68k_function_arg (cumulative_args_t, const function_arg_info &);
static bool m68k_cannot_force_const_mem (machine_mode mode, rtx x);
static bool m68k_output_addr_const_extra (FILE *, rtx);
static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
/* On the m68k all args are always pushed. */
static rtx
-m68k_function_arg (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+m68k_function_arg (cumulative_args_t, const function_arg_info &)
{
return NULL_RTX;
}
static int mcore_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
static rtx mcore_function_arg (cumulative_args_t,
- machine_mode,
- const_tree, bool);
+ const function_arg_info &);
static void mcore_function_arg_advance (cumulative_args_t,
machine_mode,
const_tree, bool);
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On MCore the first args are normally in registers
and the rest are pushed. Any arg that starts within the first
its data type forbids. */
static rtx
-mcore_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+mcore_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
int arg_reg;
- if (! named || mode == VOIDmode)
+ if (!arg.named || arg.end_marker_p ())
return 0;
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type))
return 0;
- arg_reg = ROUND_REG (*get_cumulative_args (cum), mode);
+ arg_reg = ROUND_REG (*get_cumulative_args (cum), arg.mode);
if (arg_reg < NPARM_REGS)
- return handle_structs_in_regs (mode, type, FIRST_PARM_REG + arg_reg);
+ return handle_structs_in_regs (arg.mode, arg.type,
+ FIRST_PARM_REG + arg_reg);
return 0;
}
}
}
-/* Return an RTL expression containing the register for the given mode,
+/* Return an RTL expression containing the register for the given argument
or 0 if the argument is to be passed on the stack. */
static rtx
-microblaze_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+microblaze_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int *arg_words = &cum->arg_words;
cum->last_arg_fp = 0;
- switch (mode)
+ switch (arg.mode)
{
case E_SFmode:
case E_DFmode:
regbase = GP_ARG_FIRST;
break;
default:
- gcc_assert (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT
- || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT);
+ gcc_assert (GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_INT
+ || GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_FLOAT);
/* FALLTHRU */
case E_BLKmode:
regbase = GP_ARG_FIRST;
{
gcc_assert (regbase != -1);
- ret = gen_rtx_REG (mode, regbase + *arg_words);
+ ret = gen_rtx_REG (arg.mode, regbase + *arg_words);
}
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
{
if (cum->num_adjusts > 0)
ret = gen_rtx_PARALLEL ((machine_mode) cum->fp_code,
passed_mode = Pmode;
}
- entry_parm = targetm.calls.function_arg (args_so_far, passed_mode,
- passed_type, true);
+ function_arg_info arg (passed_type, passed_mode, /*named=*/true);
+ entry_parm = targetm.calls.function_arg (args_so_far, arg);
if (entry_parm)
{
/* Split parallel insn into a sequence of insns. */
- next_arg_reg = targetm.calls.function_arg (args_so_far, VOIDmode,
- void_type_node, true);
+ next_arg_reg = targetm.calls.function_arg (args_so_far,
+ function_arg_info::end_marker ());
if (next_arg_reg != 0 && GET_CODE (next_arg_reg) == PARALLEL)
{
rtvec adjust = XVEC (next_arg_reg, 0);
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-mips_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+mips_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
struct mips_arg_info info;
- /* We will be called with a mode of VOIDmode after the last argument
+ /* We will be called with an end marker after the last argument
has been seen. Whatever we return will be passed to the call expander.
If we need a MIPS16 fp_code, return a REG with the code stored as
the mode. */
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
{
if (TARGET_MIPS16 && cum->fp_code != 0)
return gen_rtx_REG ((machine_mode) cum->fp_code, 0);
return NULL;
}
- mips_get_arg_info (&info, cum, mode, type, named);
+ mips_get_arg_info (&info, cum, arg.mode, arg.type, arg.named);
/* Return straight away if the whole argument is passed on the stack. */
if (info.reg_offset == MAX_ARGS_IN_REGISTERS)
in a floating-point register. */
if (TARGET_NEWABI
&& TARGET_HARD_FLOAT
- && named
- && type != 0
- && TREE_CODE (type) == RECORD_TYPE
- && TYPE_SIZE_UNIT (type)
- && tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)))
+ && arg.named
+ && arg.type != 0
+ && TREE_CODE (arg.type) == RECORD_TYPE
+ && TYPE_SIZE_UNIT (arg.type)
+ && tree_fits_uhwi_p (TYPE_SIZE_UNIT (arg.type)))
{
tree field;
/* First check to see if there is any such field. */
- for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
+ for (field = TYPE_FIELDS (arg.type); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL
&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (field))
&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
/* assign_parms checks the mode of ENTRY_PARM, so we must
use the actual mode here. */
- ret = gen_rtx_PARALLEL (mode, rtvec_alloc (info.reg_words));
+ ret = gen_rtx_PARALLEL (arg.mode, rtvec_alloc (info.reg_words));
bitpos = 0;
- field = TYPE_FIELDS (type);
+ field = TYPE_FIELDS (arg.type);
for (i = 0; i < info.reg_words; i++)
{
rtx reg;
and the imaginary part goes in the upper register. */
if (TARGET_NEWABI
&& info.fpr_p
- && GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
+ && GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_FLOAT)
{
rtx real, imag;
machine_mode inner;
unsigned int regno;
- inner = GET_MODE_INNER (mode);
+ inner = GET_MODE_INNER (arg.mode);
regno = FP_ARG_FIRST + info.reg_offset;
if (info.reg_words * UNITS_PER_WORD == GET_MODE_SIZE (inner))
{
gen_rtx_REG (inner,
regno + info.reg_words / 2),
GEN_INT (GET_MODE_SIZE (inner)));
- return gen_rtx_PARALLEL (mode, gen_rtvec (2, real, imag));
+ return gen_rtx_PARALLEL (arg.mode, gen_rtvec (2, real, imag));
}
}
- return gen_rtx_REG (mode, mips_arg_regno (&info, TARGET_HARD_FLOAT));
+ return gen_rtx_REG (arg.mode, mips_arg_regno (&info, TARGET_HARD_FLOAT));
}
/* Implement TARGET_FUNCTION_ARG_ADVANCE. */
int *, const_tree, int);
static void mmix_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
-static rtx mmix_function_arg_1 (const cumulative_args_t, machine_mode,
- const_tree, bool, bool);
-static rtx mmix_function_incoming_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
-static rtx mmix_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx mmix_function_incoming_arg (cumulative_args_t,
+ const function_arg_info &);
+static rtx mmix_function_arg (cumulative_args_t, const function_arg_info &);
static rtx mmix_function_value (const_tree, const_tree, bool);
static rtx mmix_libcall_value (machine_mode, const_rtx);
static bool mmix_function_value_regno_p (const unsigned int);
static rtx
mmix_function_arg_1 (const cumulative_args_t argsp_v,
- machine_mode mode,
- const_tree type,
- bool named ATTRIBUTE_UNUSED,
- bool incoming)
+ const function_arg_info &arg, bool incoming)
{
CUMULATIVE_ARGS *argsp = get_cumulative_args (argsp_v);
/* Last-argument marker. */
- if (type == void_type_node)
+ if (arg.end_marker_p ())
return (argsp->regs < MMIX_MAX_ARGS_IN_REGS)
- ? gen_rtx_REG (mode,
+ ? gen_rtx_REG (arg.mode,
(incoming
? MMIX_FIRST_INCOMING_ARG_REGNUM
: MMIX_FIRST_ARG_REGNUM) + argsp->regs)
: NULL_RTX;
return (argsp->regs < MMIX_MAX_ARGS_IN_REGS
- && !targetm.calls.must_pass_in_stack (mode, type)
- && (GET_MODE_BITSIZE (mode) <= 64
+ && !targetm.calls.must_pass_in_stack (arg.mode, arg.type)
+ && (GET_MODE_BITSIZE (arg.mode) <= 64
|| argsp->lib
|| TARGET_LIBFUNC))
- ? gen_rtx_REG (mode,
+ ? gen_rtx_REG (arg.mode,
(incoming
? MMIX_FIRST_INCOMING_ARG_REGNUM
: MMIX_FIRST_ARG_REGNUM)
one that must go on stack. */
static rtx
-mmix_function_arg (cumulative_args_t argsp,
- machine_mode mode,
- const_tree type,
- bool named)
+mmix_function_arg (cumulative_args_t argsp, const function_arg_info &arg)
{
- return mmix_function_arg_1 (argsp, mode, type, named, false);
+ return mmix_function_arg_1 (argsp, arg, false);
}
static rtx
mmix_function_incoming_arg (cumulative_args_t argsp,
- machine_mode mode,
- const_tree type,
- bool named)
+ const function_arg_info &arg)
{
- return mmix_function_arg_1 (argsp, mode, type, named, true);
+ return mmix_function_arg_1 (argsp, arg, true);
}
/* Returns nonzero for everything that goes by reference, 0 for
return (size > 8 || size == 0);
}
-/* Return an RTX to represent where a value with mode MODE will be returned
- from a function. If the result is NULL_RTX, the argument is pushed. */
+/* Return an RTX to represent where argument ARG will be passed to a function.
+ If the result is NULL_RTX, the argument is pushed. */
static rtx
-mn10300_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+mn10300_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
rtx result = NULL_RTX;
int nregs = 2;
/* Figure out the size of the object to be passed. */
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ size = arg.promoted_size_in_bytes ();
cum->nbytes = (cum->nbytes + 3) & ~3;
/* Don't pass this arg via a register if all the argument registers
/* Don't pass this arg via a register if it would be split between
registers and memory. */
- if (type == NULL_TREE
+ if (arg.type == NULL_TREE
&& cum->nbytes + size > nregs * UNITS_PER_WORD)
return result;
switch (cum->nbytes / UNITS_PER_WORD)
{
case 0:
- result = gen_rtx_REG (mode, FIRST_ARGUMENT_REGNUM);
+ result = gen_rtx_REG (arg.mode, FIRST_ARGUMENT_REGNUM);
break;
case 1:
- result = gen_rtx_REG (mode, FIRST_ARGUMENT_REGNUM + 1);
+ result = gen_rtx_REG (arg.mode, FIRST_ARGUMENT_REGNUM + 1);
break;
default:
break;
NULL_RTX if there's no more space. */
static rtx
-moxie_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+moxie_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (*cum < 8)
- return gen_rtx_REG (mode, *cum);
+ return gen_rtx_REG (arg.mode, *cum);
else
return NULL_RTX;
}
rtx
msp430_function_arg (cumulative_args_t cap,
- machine_mode mode,
- const_tree type,
- bool named)
+ const function_arg_info &arg)
{
CUMULATIVE_ARGS *ca = get_cumulative_args (cap);
- msp430_evaluate_arg (cap, mode, type, named);
+ msp430_evaluate_arg (cap, arg.mode, arg.type, arg.named);
if (ca->reg_count)
- return gen_rtx_REG (mode, ca->start_reg);
+ return gen_rtx_REG (arg.mode, ca->start_reg);
return 0;
}
/* -- Passing Arguments in Registers. */
static rtx
-nds32_function_arg (cumulative_args_t ca, machine_mode mode,
- const_tree type, bool named)
+nds32_function_arg (cumulative_args_t ca, const function_arg_info &arg)
{
unsigned int regno;
CUMULATIVE_ARGS *cum = get_cumulative_args (ca);
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
/* The last time this hook is called,
- it is called with MODE == VOIDmode. */
- if (mode == VOIDmode)
+ it is called with an end marker. */
+ if (arg.end_marker_p ())
return NULL_RTX;
/* For nameless arguments, we need to take care it individually. */
- if (!named)
+ if (!arg.named)
{
/* If we are under hard float abi, we have arguments passed on the
stack and all situation can be handled by GCC itself. */
push the argument on the stack, or a hard register in which to
store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
static rtx
-nios2_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+nios2_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
rtx return_rtx = NULL_RTX;
if (cum->regs_used < NUM_ARG_REGS)
- return_rtx = gen_rtx_REG (mode, FIRST_ARG_REGNO + cum->regs_used);
+ return_rtx = gen_rtx_REG (arg.mode, FIRST_ARG_REGNO + cum->regs_used);
return return_rtx;
}
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-nvptx_function_arg (cumulative_args_t ARG_UNUSED (cum_v), machine_mode mode,
- const_tree, bool named)
+nvptx_function_arg (cumulative_args_t, const function_arg_info &arg)
{
- if (mode == VOIDmode || !named)
+ if (arg.end_marker_p () || !arg.named)
return NULL_RTX;
- return gen_reg_rtx (mode);
+ return gen_reg_rtx (arg.mode);
}
/* Implement TARGET_FUNCTION_INCOMING_ARG. */
static rtx
-nvptx_function_incoming_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree, bool named)
+nvptx_function_incoming_arg (cumulative_args_t cum_v,
+ const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (mode == VOIDmode || !named)
+ if (arg.end_marker_p () || !arg.named)
return NULL_RTX;
/* No need to deal with split modes here, the only case that can
happen is complex modes and those are dealt with by
TARGET_SPLIT_COMPLEX_ARG. */
- return gen_rtx_UNSPEC (mode,
+ return gen_rtx_UNSPEC (arg.mode,
gen_rtvec (1, GEN_INT (cum->count)),
UNSPEC_ARG_REG);
}
maybe be passed in registers r3 to r8. */
static rtx
-or1k_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree /* type */, bool named)
+or1k_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
- /* VOIDmode is passed as a special flag for "last argument". */
- if (mode == VOIDmode)
+ /* Handle the special marker for the end of the arguments. */
+ if (arg.end_marker_p ())
return NULL_RTX;
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- int nreg = CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD);
+ int nreg = CEIL (GET_MODE_SIZE (arg.mode), UNITS_PER_WORD);
/* Note that all large arguments are passed by reference. */
gcc_assert (nreg <= 2);
- if (named && *cum + nreg <= 6)
- return gen_rtx_REG (mode, *cum + 3);
+ if (arg.named && *cum + nreg <= 6)
+ return gen_rtx_REG (arg.mode, *cum + 3);
else
return NULL_RTX;
}
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);
-static rtx pa_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx pa_function_arg (cumulative_args_t, const function_arg_info &);
static pad_direction pa_function_arg_padding (machine_mode, const_tree);
static unsigned int pa_function_arg_boundary (machine_mode, const_tree);
static struct machine_function * pa_init_machine_status (void);
??? We might want to restructure this so that it looks more like other
ports. */
static rtx
-pa_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+pa_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
int max_arg_words = (TARGET_64BIT ? 8 : 4);
int alignment = 0;
int arg_size;
int gpr_reg_base;
rtx retval;
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return NULL_RTX;
arg_size = pa_function_arg_size (mode, type);
static rtx pdp11_libcall_value (machine_mode, const_rtx);
static bool pdp11_function_value_regno_p (const unsigned int);
static void pdp11_trampoline_init (rtx, tree, rtx);
-static rtx pdp11_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx pdp11_function_arg (cumulative_args_t, const function_arg_info &);
static void pdp11_function_arg_advance (cumulative_args_t,
machine_mode, const_tree, bool);
static void pdp11_conditional_register_usage (void);
emit_move_insn (mem, fnaddr);
}
-/* Worker function for TARGET_FUNCTION_ARG.
-
- Determine where to put an argument to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+/* Worker function for TARGET_FUNCTION_ARG. */
static rtx
-pdp11_function_arg (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+pdp11_function_arg (cumulative_args_t, const function_arg_info &)
{
return NULL_RTX;
}
push the argument on the stack, or a hard register in which to
store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
+ ARG is a description of the argument. */
static rtx
-pru_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type,
- bool named)
+pru_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
rtx return_rtx = NULL_RTX;
- int regi = pru_function_arg_regi (cum_v, mode, type, named);
+ int regi = pru_function_arg_regi (cum_v, arg.mode, arg.type, arg.named);
if (regi >= 0)
- return_rtx = gen_rtx_REG (mode, regi);
+ return_rtx = gen_rtx_REG (arg.mode, regi);
return return_rtx;
}
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-riscv_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+riscv_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
struct riscv_arg_info info;
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return NULL;
- return riscv_get_arg_info (&info, cum, mode, type, named, false);
+ return riscv_get_arg_info (&info, cum, arg.mode, arg.type, arg.named, false);
}
/* Implement TARGET_FUNCTION_ARG_ADVANCE. */
return mode;
}
-/* Return an RTL expression describing the register holding a function
- parameter of mode MODE and type TYPE or NULL_RTX if the parameter should
- be passed on the stack. CUM describes the previous parameters to the
- function and NAMED is false if the parameter is part of a variable
- parameter list, or the last named parameter before the start of a
- variable parameter list. */
-
#undef TARGET_FUNCTION_ARG
#define TARGET_FUNCTION_ARG rl78_function_arg
static rtx
-rl78_function_arg (cumulative_args_t cum_v ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+rl78_function_arg (cumulative_args_t, const function_arg_info &)
{
return NULL_RTX;
}
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called. It is
not modified in this routine.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On RS/6000 the first eight words of non-FP are normally in registers
and the rest are pushed. Under AIX, the first 13 FP args are in registers.
doesn't support PARALLEL anyway.
Note that for args passed by reference, function_arg will be called
- with MODE and TYPE set to that of the pointer to the arg, not the arg
- itself. */
+ with ARG describing the pointer to the arg, not the arg itself. */
rtx
-rs6000_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
+ bool named = arg.named;
enum rs6000_abi abi = DEFAULT_ABI;
machine_mode elt_mode;
int n_elts;
bit that V.4 uses to say fp args were passed in registers.
Assume that we don't need the marker for software floating point,
or compiler generated library calls. */
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
{
if (abi == ABI_V4
&& (cum->call_cookie & CALL_LIBCALL) == 0
return true;
/* If there is no incoming register, we need a stack. */
- entry_parm = rs6000_function_arg (args_so_far, mode, type, true);
+ function_arg_info arg (type, mode, /*named=*/true);
+ entry_parm = rs6000_function_arg (args_so_far, arg);
if (entry_parm == NULL)
return true;
return true;
/* Also true if we're partially in registers and partially not. */
- function_arg_info arg (type, mode, /*named=*/true);
if (rs6000_arg_partial_bytes (args_so_far, arg) != 0)
return true;
const_tree type, bool named);
extern pad_direction rs6000_function_arg_padding (machine_mode mode,
const_tree type);
-extern rtx rs6000_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named);
+extern rtx rs6000_function_arg (cumulative_args_t, const function_arg_info &);
extern rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, const_tree,
bool, bool);
extern rtx rs6000_internal_arg_pointer (void);
#define NUM_ARG_REGS 4
#define MAX_NUM_ARG_BYTES (NUM_ARG_REGS * UNITS_PER_WORD)
-/* Return an RTL expression describing the register holding a function
- parameter of mode MODE and type TYPE or NULL_RTX if the parameter should
- be passed on the stack. CUM describes the previous parameters to the
- function and NAMED is false if the parameter is part of a variable
- parameter list, or the last named parameter before the start of a
- variable parameter list. */
+/* Return an RTL expression describing the register holding function
+ argument ARG or NULL_RTX if the parameter should be passed on the
+ stack. CUM describes the previous parameters to the function. */
static rtx
-rx_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+rx_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
unsigned int next_reg;
unsigned int bytes_so_far = *get_cumulative_args (cum);
unsigned int size;
unsigned int rounded_size;
- /* An exploded version of rx_function_arg_size. */
- size = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode);
+ size = arg.promoted_size_in_bytes ();
/* If the size is not known it cannot be passed in registers. */
if (size < 1)
return NULL_RTX;
/* Unnamed arguments and the last named argument in a
variadic function are always passed on the stack. */
- if (!named)
+ if (!arg.named)
return NULL_RTX;
/* Structures must occupy an exact number of registers,
otherwise they are passed on the stack. */
- if ((type == NULL || AGGREGATE_TYPE_P (type))
+ if ((arg.type == NULL || AGGREGATE_TYPE_P (arg.type))
&& (size % UNITS_PER_WORD) != 0)
return NULL_RTX;
next_reg = (bytes_so_far / UNITS_PER_WORD) + 1;
- return gen_rtx_REG (mode, next_reg);
+ return gen_rtx_REG (arg.mode, next_reg);
}
static void
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On S/390, we use general purpose registers 2 through 6 to
pass integer, pointer, and certain structure arguments, and
are pushed to the stack. */
static rtx
-s390_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+s390_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (!named)
- s390_check_type_for_vector_abi (type, true, false);
+ if (!arg.named)
+ s390_check_type_for_vector_abi (arg.type, true, false);
- if (s390_function_arg_vector (mode, type))
+ if (s390_function_arg_vector (arg.mode, arg.type))
{
/* Vector arguments being part of the ellipsis are passed on the
stack. */
- if (!named || (cum->vrs + 1 > VEC_ARG_NUM_REG))
+ if (!arg.named || (cum->vrs + 1 > VEC_ARG_NUM_REG))
return NULL_RTX;
- return gen_rtx_REG (mode, cum->vrs + FIRST_VEC_ARG_REGNO);
+ return gen_rtx_REG (arg.mode, cum->vrs + FIRST_VEC_ARG_REGNO);
}
- else if (s390_function_arg_float (mode, type))
+ else if (s390_function_arg_float (arg.mode, arg.type))
{
if (cum->fprs + 1 > FP_ARG_NUM_REG)
return NULL_RTX;
else
- return gen_rtx_REG (mode, cum->fprs + 16);
+ return gen_rtx_REG (arg.mode, cum->fprs + 16);
}
- else if (s390_function_arg_integer (mode, type))
+ else if (s390_function_arg_integer (arg.mode, arg.type))
{
- int size = s390_function_arg_size (mode, type);
+ int size = s390_function_arg_size (arg.mode, arg.type);
int n_gprs = (size + UNITS_PER_LONG - 1) / UNITS_PER_LONG;
if (cum->gprs + n_gprs > GP_ARG_NUM_REG)
return NULL_RTX;
else if (n_gprs == 1 || UNITS_PER_WORD == UNITS_PER_LONG)
- return gen_rtx_REG (mode, cum->gprs + 2);
+ return gen_rtx_REG (arg.mode, cum->gprs + 2);
else if (n_gprs == 2)
{
rtvec p = rtvec_alloc (2);
= gen_rtx_EXPR_LIST (SImode, gen_rtx_REG (SImode, cum->gprs + 3),
GEN_INT (4));
- return gen_rtx_PARALLEL (mode, p);
+ return gen_rtx_PARALLEL (arg.mode, p);
}
}
- /* After the real arguments, expand_call calls us once again
- with a void_type_node type. Whatever we return here is
- passed as operand 2 to the call expanders.
+ /* After the real arguments, expand_call calls us once again with an
+ end marker. Whatever we return here is passed as operand 2 to the
+ call expanders.
We don't need this feature ... */
- else if (type == void_type_node)
+ else if (arg.end_marker_p ())
return const0_rtx;
gcc_unreachable ();
type = build_pointer_type (type);
}
- parm_rtx = s390_function_arg (cum, mode, type, true);
+ function_arg_info arg (type, mode, /*named=*/true);
+ parm_rtx = s390_function_arg (cum, arg);
s390_function_arg_advance (cum, mode, type, true);
static int sh_arg_partial_bytes (cumulative_args_t, const function_arg_info &);
static void sh_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
-static rtx sh_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx sh_function_arg (cumulative_args_t, const function_arg_info &);
static int sh_dwarf_calling_convention (const_tree);
static void sh_encode_section_info (tree, rtx, int);
static bool sh2a_function_vector_p (tree);
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
On SH the first args are normally in registers
and the rest are pushed. Any arg that starts within the first
NPARM_REGS words is at least partially passed in a register unless
its data type forbids. */
static rtx
-sh_function_arg (cumulative_args_t ca_v, machine_mode mode,
- const_tree type, bool named)
+sh_function_arg (cumulative_args_t ca_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v);
+ machine_mode mode = arg.mode;
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return ca->renesas_abi ? const1_rtx : const0_rtx;
- if (sh_pass_in_reg_p (*ca, mode, type)
- && (named || ! (TARGET_HITACHI || ca->renesas_abi)))
+ if (sh_pass_in_reg_p (*ca, mode, arg.type)
+ && (arg.named || ! (TARGET_HITACHI || ca->renesas_abi)))
{
int regno;
sh_function_arg_advance (pack_cumulative_args (&cum), Pmode, ptype, true);
}
- this_rtx
- = sh_function_arg (pack_cumulative_args (&cum), Pmode, ptr_type_node, true);
+ function_arg_info ptr_arg (ptr_type_node, Pmode, /*named=*/true);
+ this_rtx = sh_function_arg (pack_cumulative_args (&cum), ptr_arg);
/* For SHcompact, we only have r0 for a scratch register: r1 is the
static chain pointer (even if you can't have nested virtual functions
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,
- machine_mode, const_tree, bool, bool);
-static rtx sparc_function_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+static rtx sparc_function_arg (cumulative_args_t, const function_arg_info &);
static rtx sparc_function_incoming_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static pad_direction sparc_function_arg_padding (machine_mode, const_tree);
static unsigned int sparc_function_arg_boundary (machine_mode,
const_tree);
CUM is a variable of type CUMULATIVE_ARGS which gives info about
the preceding args and about the function being called.
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- NAMED is true if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis).
+ ARG is a description of the argument.
INCOMING_P is false for TARGET_FUNCTION_ARG, true for
TARGET_FUNCTION_INCOMING_ARG. */
static rtx
-sparc_function_arg_1 (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named, bool incoming)
+sparc_function_arg_1 (cumulative_args_t cum_v, const function_arg_info &arg,
+ bool incoming)
{
const CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
const int regbase
= incoming ? SPARC_INCOMING_INT_ARG_FIRST : SPARC_OUTGOING_INT_ARG_FIRST;
int slotno, regno, padding;
+ tree type = arg.type;
+ machine_mode mode = arg.mode;
enum mode_class mclass = GET_MODE_CLASS (mode);
+ bool named = arg.named;
slotno
= function_arg_slotno (cum, mode, type, named, incoming, ®no, &padding);
/* Handle the TARGET_FUNCTION_ARG target hook. */
static rtx
-sparc_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+sparc_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
- return sparc_function_arg_1 (cum, mode, type, named, false);
+ return sparc_function_arg_1 (cum, arg, false);
}
/* Handle the TARGET_FUNCTION_INCOMING_ARG target hook. */
static rtx
-sparc_function_incoming_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named)
+sparc_function_incoming_arg (cumulative_args_t cum,
+ const function_arg_info &arg)
{
- return sparc_function_arg_1 (cum, mode, type, named, true);
+ return sparc_function_arg_1 (cum, arg, true);
}
/* For sparc64, objects requiring 16 byte alignment are passed that way. */
}
static rtx
-spu_function_arg (cumulative_args_t cum_v,
- machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+spu_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int byte_size;
if (*cum >= MAX_REGISTER_ARGS)
return 0;
- byte_size = ((mode == BLKmode)
- ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ byte_size = arg.promoted_size_in_bytes ();
/* The ABI does not allow parameters to be passed partially in
reg and partially in stack. */
return 0;
/* Make sure small structs are left justified in a register. */
- if ((mode == BLKmode || (type && AGGREGATE_TYPE_P (type)))
+ if ((arg.mode == BLKmode || arg.aggregate_type_p ())
&& byte_size < UNITS_PER_WORD && byte_size > 0)
{
machine_mode smode;
gr_reg = gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (smode, FIRST_ARG_REGNUM + *cum),
const0_rtx);
- return gen_rtx_PARALLEL (mode, gen_rtvec (1, gr_reg));
+ return gen_rtx_PARALLEL (arg.mode, gen_rtvec (1, gr_reg));
}
else
- return gen_rtx_REG (mode, FIRST_ARG_REGNUM + *cum);
+ return gen_rtx_REG (arg.mode, FIRST_ARG_REGNUM + *cum);
}
static void
}
static rtx
-xstormy16_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+xstormy16_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
- if (mode == VOIDmode)
+ if (arg.end_marker_p ())
return const0_rtx;
- if (targetm.calls.must_pass_in_stack (mode, type)
- || *cum + XSTORMY16_WORD_SIZE (type, mode) > NUM_ARGUMENT_REGISTERS)
+ if (targetm.calls.must_pass_in_stack (arg.mode, arg.type)
+ || (*cum + XSTORMY16_WORD_SIZE (arg.type, arg.mode)
+ > NUM_ARGUMENT_REGISTERS))
return NULL_RTX;
- return gen_rtx_REG (mode, *cum + FIRST_ARGUMENT_REGISTER);
+ return gen_rtx_REG (arg.mode, *cum + FIRST_ARGUMENT_REGISTER);
}
/* Build the va_list type.
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-tilegx_function_arg (cumulative_args_t cum_v,
- machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+tilegx_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS cum = *get_cumulative_args (cum_v);
- int byte_size = ((mode == BLKmode)
- ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ int byte_size = arg.promoted_size_in_bytes ();
bool doubleword_aligned_p;
if (cum >= TILEGX_NUM_ARG_REGS)
/* See whether the argument has doubleword alignment. */
doubleword_aligned_p =
- tilegx_function_arg_boundary (mode, type) > BITS_PER_WORD;
+ tilegx_function_arg_boundary (arg.mode, arg.type) > BITS_PER_WORD;
if (doubleword_aligned_p)
cum += cum & 1;
> TILEGX_NUM_ARG_REGS)
return NULL_RTX;
- return gen_rtx_REG (mode, cum);
+ return gen_rtx_REG (arg.mode, cum);
}
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-tilepro_function_arg (cumulative_args_t cum_v,
- machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+tilepro_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS cum = *get_cumulative_args (cum_v);
- int byte_size = ((mode == BLKmode)
- ? int_size_in_bytes (type) : GET_MODE_SIZE (mode));
+ int byte_size = arg.promoted_size_in_bytes ();
bool doubleword_aligned_p;
if (cum >= TILEPRO_NUM_ARG_REGS)
/* See whether the argument has doubleword alignment. */
doubleword_aligned_p =
- tilepro_function_arg_boundary (mode, type) > BITS_PER_WORD;
+ tilepro_function_arg_boundary (arg.mode, arg.type) > BITS_PER_WORD;
if (doubleword_aligned_p)
cum += cum & 1;
> TILEPRO_NUM_ARG_REGS)
return NULL_RTX;
- return gen_rtx_REG (mode, cum);
+ return gen_rtx_REG (arg.mode, cum);
}
return size > 8;
}
-/* Return an RTX to represent where an argument with mode MODE
- and type TYPE will be passed to a function. If the result
- is NULL_RTX, the argument will be pushed. */
+/* Return an RTX to represent where argument ARG will be passed to a function.
+ If the result is NULL_RTX, the argument will be pushed. */
static rtx
-v850_function_arg (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool named)
+v850_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
rtx result = NULL_RTX;
int size, align;
- if (!named)
+ if (!arg.named)
return NULL_RTX;
- if (mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ size = arg.promoted_size_in_bytes ();
size = (size + UNITS_PER_WORD -1) & ~(UNITS_PER_WORD -1);
if (size < 1)
if (!TARGET_GCC_ABI)
align = UNITS_PER_WORD;
- else if (size <= UNITS_PER_WORD && type)
- align = TYPE_ALIGN (type) / BITS_PER_UNIT;
+ else if (size <= UNITS_PER_WORD && arg.type)
+ align = TYPE_ALIGN (arg.type) / BITS_PER_UNIT;
else
align = size;
if (cum->nbytes > 4 * UNITS_PER_WORD)
return NULL_RTX;
- if (type == NULL_TREE
+ if (arg.type == NULL_TREE
&& cum->nbytes + size > 4 * UNITS_PER_WORD)
return NULL_RTX;
switch (cum->nbytes / UNITS_PER_WORD)
{
case 0:
- result = gen_rtx_REG (mode, 6);
+ result = gen_rtx_REG (arg.mode, 6);
break;
case 1:
- result = gen_rtx_REG (mode, 7);
+ result = gen_rtx_REG (arg.mode, 7);
break;
case 2:
- result = gen_rtx_REG (mode, 8);
+ result = gen_rtx_REG (arg.mode, 8);
break;
case 3:
- result = gen_rtx_REG (mode, 9);
+ result = gen_rtx_REG (arg.mode, 9);
break;
default:
result = NULL_RTX;
static int vax_address_cost_1 (rtx);
static int vax_address_cost (rtx, machine_mode, addr_space_t, bool);
static bool vax_rtx_costs (rtx, machine_mode, int, int, int *, bool);
-static rtx vax_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx vax_function_arg (cumulative_args_t, const function_arg_info &);
static void vax_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
static rtx vax_struct_value_rtx (tree, int);
return size > 255 * 4 ? 0 : (HOST_WIDE_INT) size;
}
-/* Define where to put the arguments to a function.
- Value is zero to push the argument on the stack,
- or a hard register in which to store the argument.
-
- MODE is the argument's machine mode.
- TYPE is the data type of the argument (as a tree).
- This is null for libcalls where that information may
- not be available.
- CUM is a variable of type CUMULATIVE_ARGS which gives info about
- the preceding args and about the function being called.
- NAMED is nonzero if this argument is a named parameter
- (otherwise it is an extra parameter matching an ellipsis). */
-
-/* On the VAX all args are pushed. */
+/* Implement TARGET_FUNCTION_ARG. On the VAX all args are pushed. */
static rtx
-vax_function_arg (cumulative_args_t cum ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+vax_function_arg (cumulative_args_t, const function_arg_info &)
{
return NULL_RTX;
}
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);
+static rtx visium_function_arg (cumulative_args_t, const function_arg_info &);
static void visium_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
in general registers. */
static rtx
-visium_function_arg (cumulative_args_t pcum_v, machine_mode mode,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+visium_function_arg (cumulative_args_t pcum_v, const function_arg_info &arg)
{
int size;
CUMULATIVE_ARGS *ca = get_cumulative_args (pcum_v);
- size = (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
- if (mode == VOIDmode)
+ size = (GET_MODE_SIZE (arg.mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+ if (arg.end_marker_p ())
return GEN_INT (0);
/* Scalar or complex single precision floating point arguments are returned
in floating registers. */
if (TARGET_FPU
- && ((GET_MODE_CLASS (mode) == MODE_FLOAT
- && GET_MODE_SIZE (mode) <= UNITS_PER_HWFPVALUE)
- || (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT
- && GET_MODE_SIZE (mode) <= UNITS_PER_HWFPVALUE * 2)))
+ && ((GET_MODE_CLASS (arg.mode) == MODE_FLOAT
+ && GET_MODE_SIZE (arg.mode) <= UNITS_PER_HWFPVALUE)
+ || (GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_FLOAT
+ && GET_MODE_SIZE (arg.mode) <= UNITS_PER_HWFPVALUE * 2)))
{
if (ca->frcount + size <= MAX_ARGS_IN_FP_REGISTERS)
- return gen_rtx_REG (mode, FP_ARG_FIRST + ca->frcount);
+ return gen_rtx_REG (arg.mode, FP_ARG_FIRST + ca->frcount);
else
return NULL_RTX;
}
if (ca->grcount + size <= MAX_ARGS_IN_GP_REGISTERS)
- return gen_rtx_REG (mode, ca->grcount + GP_ARG_FIRST);
+ return gen_rtx_REG (arg.mode, ca->grcount + GP_ARG_FIRST);
return NULL_RTX;
}
gimple_seq *);
static void xtensa_function_arg_advance (cumulative_args_t, machine_mode,
const_tree, bool);
-static rtx xtensa_function_arg (cumulative_args_t, machine_mode,
- const_tree, bool);
+static rtx xtensa_function_arg (cumulative_args_t, const function_arg_info &);
static rtx xtensa_function_incoming_arg (cumulative_args_t,
- machine_mode, const_tree, bool);
+ const function_arg_info &);
static rtx xtensa_function_value (const_tree, const_tree, bool);
static rtx xtensa_libcall_value (machine_mode, const_rtx);
static bool xtensa_function_value_regno_p (const unsigned int);
}
-/* Return an RTL expression containing the register for the given mode,
+/* Return an RTL expression containing the register for the given argument,
or 0 if the argument is to be passed on the stack. INCOMING_P is nonzero
if this is an incoming argument to the current function. */
static rtx
-xtensa_function_arg_1 (cumulative_args_t cum_v, machine_mode mode,
- const_tree type, bool incoming_p)
+xtensa_function_arg_1 (cumulative_args_t cum_v, const function_arg_info &arg,
+ bool incoming_p)
{
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
int regbase, words, max;
regbase = (incoming_p ? GP_ARG_FIRST : GP_OUTGOING_ARG_FIRST);
max = MAX_ARGS_IN_REGISTERS;
- words = (((mode != BLKmode)
- ? (int) GET_MODE_SIZE (mode)
- : int_size_in_bytes (type)) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+ words = ((arg.promoted_size_in_bytes () + UNITS_PER_WORD - 1)
+ / UNITS_PER_WORD);
- if (type && (TYPE_ALIGN (type) > BITS_PER_WORD))
+ if (arg.type && (TYPE_ALIGN (arg.type) > BITS_PER_WORD))
{
- int align = MIN (TYPE_ALIGN (type), STACK_BOUNDARY) / BITS_PER_WORD;
+ int align = MIN (TYPE_ALIGN (arg.type), STACK_BOUNDARY) / BITS_PER_WORD;
*arg_words = (*arg_words + align - 1) & -align;
}
if (cum->incoming && regno <= A7_REG && regno + words > A7_REG)
cfun->machine->need_a7_copy = TARGET_WINDOWED_ABI;
- return gen_rtx_REG (mode, regno);
+ return gen_rtx_REG (arg.mode, regno);
}
/* Implement TARGET_FUNCTION_ARG. */
static rtx
-xtensa_function_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+xtensa_function_arg (cumulative_args_t cum, const function_arg_info &arg)
{
- return xtensa_function_arg_1 (cum, mode, type, false);
+ return xtensa_function_arg_1 (cum, arg, false);
}
/* Implement TARGET_FUNCTION_INCOMING_ARG. */
static rtx
-xtensa_function_incoming_arg (cumulative_args_t cum, machine_mode mode,
- const_tree type, bool named ATTRIBUTE_UNUSED)
+xtensa_function_incoming_arg (cumulative_args_t cum,
+ const function_arg_info &arg)
{
- return xtensa_function_arg_1 (cum, mode, type, true);
+ return xtensa_function_arg_1 (cum, arg, true);
}
static unsigned int
types of arguments are passed in registers or how they are arranged in
the stack.
-@deftypefn {Target Hook} rtx TARGET_FUNCTION_ARG (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
-Return an RTX indicating whether a function argument is passed in a
-register and if so, which register.
-
-The arguments are @var{ca}, which summarizes all the previous
-arguments; @var{mode}, the machine mode of the argument; @var{type},
-the data type of the argument as a tree node or 0 if that is not known
-(which happens for C support library functions); and @var{named},
-which is @code{true} for an ordinary argument and @code{false} for
-nameless arguments that correspond to @samp{@dots{}} in the called
-function's prototype. @var{type} can be an incomplete type if a
-syntax error has previously occurred.
+@deftypefn {Target Hook} rtx TARGET_FUNCTION_ARG (cumulative_args_t @var{ca}, const function_arg_info @var{&arg})
+Return an RTX indicating whether function argument @var{arg} is passed
+in a register and if so, which register. Argument @var{ca} summarizes all
+the previous arguments.
The return value is usually either a @code{reg} RTX for the hard
register in which to pass the argument, or zero to pass the argument
documentation.
@end deftypefn
-@deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named})
+@deftypefn {Target Hook} rtx TARGET_FUNCTION_INCOMING_ARG (cumulative_args_t @var{ca}, const function_arg_info @var{&arg})
Define this hook if the caller and callee on the target have different
views of where arguments are passed. Also define this hook if there are
functions that are never directly called, but are invoked by the hardware
#include "params.h"
#include "rtl-iter.h"
#include "cfgcleanup.h"
+#include "calls.h"
/* This file contains three techniques for performing Dead Store
Elimination (dse).
if (!is_int_mode (TYPE_MODE (TREE_VALUE (arg)), &mode))
return false;
- reg = targetm.calls.function_arg (args_so_far, mode, NULL_TREE, true);
+ function_arg_info arg (mode, /*named=*/true);
+ reg = targetm.calls.function_arg (args_so_far, arg);
if (!reg || !REG_P (reg) || GET_MODE (reg) != mode)
return false;
{
machine_mode mode = TYPE_MODE (TREE_VALUE (arg));
function_arg_info arg_info (mode, /*named=*/true);
- rtx tmp = targetm.calls.function_arg (args_so_far, mode,
- NULL_TREE, true);
+ rtx tmp = targetm.calls.function_arg (args_so_far, arg_info);
if (!tmp || !REG_P (tmp))
return false;
if (targetm.calls.arg_partial_bytes (args_so_far, arg_info))
targetm.calls.warn_parameter_passing_abi (all->args_so_far,
data->passed_type);
- entry_parm = targetm.calls.function_incoming_arg (all->args_so_far,
- data->promoted_mode,
- data->passed_type,
- data->named_arg);
-
+ function_arg_info arg (data->passed_type, data->promoted_mode,
+ data->named_arg);
+ entry_parm = targetm.calls.function_incoming_arg (all->args_so_far, arg);
if (entry_parm == 0)
data->promoted_mode = data->passed_mode;
if (targetm.calls.pretend_outgoing_varargs_named (all->args_so_far))
{
rtx tem;
+ function_arg_info named_arg (data->passed_type, data->promoted_mode,
+ /*named=*/true);
tem = targetm.calls.function_incoming_arg (all->args_so_far,
- data->promoted_mode,
- data->passed_type, true);
+ named_arg);
in_regs = tem != NULL;
}
}
argument. */
DEFHOOK
(function_arg,
- "Return an RTX indicating whether a function argument is passed in a\n\
-register and if so, which register.\n\
-\n\
-The arguments are @var{ca}, which summarizes all the previous\n\
-arguments; @var{mode}, the machine mode of the argument; @var{type},\n\
-the data type of the argument as a tree node or 0 if that is not known\n\
-(which happens for C support library functions); and @var{named},\n\
-which is @code{true} for an ordinary argument and @code{false} for\n\
-nameless arguments that correspond to @samp{@dots{}} in the called\n\
-function's prototype. @var{type} can be an incomplete type if a\n\
-syntax error has previously occurred.\n\
+ "Return an RTX indicating whether function argument @var{arg} is passed\n\
+in a register and if so, which register. Argument @var{ca} summarizes all\n\
+the previous arguments.\n\
\n\
The return value is usually either a @code{reg} RTX for the hard\n\
register in which to pass the argument, or zero to pass the argument\n\
argument, the compiler will abort. If @code{REG_PARM_STACK_SPACE} is\n\
defined, the argument will be computed in the stack and then loaded into\n\
a register.",
- rtx, (cumulative_args_t ca, machine_mode mode, const_tree type,
- bool named),
+ rtx, (cumulative_args_t ca, const function_arg_info &arg),
default_function_arg)
DEFHOOK
\n\
If @code{TARGET_FUNCTION_INCOMING_ARG} is not defined,\n\
@code{TARGET_FUNCTION_ARG} serves both purposes.",
- rtx, (cumulative_args_t ca, machine_mode mode, const_tree type,
- bool named),
+ rtx, (cumulative_args_t ca, const function_arg_info &arg),
default_function_incoming_arg)
DEFHOOK
}
rtx
-default_function_arg (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+default_function_arg (cumulative_args_t, const function_arg_info &)
{
gcc_unreachable ();
}
rtx
-default_function_incoming_arg (cumulative_args_t ca ATTRIBUTE_UNUSED,
- machine_mode mode ATTRIBUTE_UNUSED,
- const_tree type ATTRIBUTE_UNUSED,
- bool named ATTRIBUTE_UNUSED)
+default_function_incoming_arg (cumulative_args_t, const function_arg_info &)
{
gcc_unreachable ();
}
(cumulative_args_t, machine_mode, const_tree, bool);
extern HOST_WIDE_INT default_function_arg_offset (machine_mode, const_tree);
extern pad_direction default_function_arg_padding (machine_mode, const_tree);
-extern rtx default_function_arg
- (cumulative_args_t, machine_mode, const_tree, bool);
-extern rtx default_function_incoming_arg
- (cumulative_args_t, machine_mode, const_tree, bool);
+extern rtx default_function_arg (cumulative_args_t, const function_arg_info &);
+extern rtx default_function_incoming_arg (cumulative_args_t,
+ const function_arg_info &);
extern unsigned int default_function_arg_boundary (machine_mode,
const_tree);
extern unsigned int default_function_arg_round_boundary (machine_mode,
{
tree struct_addr = build_pointer_type (TREE_TYPE (type));
machine_mode mode = TYPE_MODE (struct_addr);
+ function_arg_info arg (struct_addr, /*named=*/true);
rtx reg;
INIT_CUMULATIVE_ARGS (args_so_far_v, type, NULL_RTX, fndecl,
nargs + 1);
- reg = targetm.calls.function_arg (args_so_far, mode,
- struct_addr, true);
+ reg = targetm.calls.function_arg (args_so_far, arg);
targetm.calls.function_arg_advance (args_so_far, mode,
struct_addr, true);
if (reg == NULL_RTX)
nargs);
if (obj_type_ref && TYPE_ARG_TYPES (type) != void_list_node)
{
- machine_mode mode;
t = TYPE_ARG_TYPES (type);
- mode = TYPE_MODE (TREE_VALUE (t));
- this_arg = targetm.calls.function_arg (args_so_far, mode,
- TREE_VALUE (t), true);
+ function_arg_info arg (TREE_VALUE (t), /*named=*/true);
+ this_arg = targetm.calls.function_arg (args_so_far, arg);
if (this_arg && !REG_P (this_arg))
this_arg = NULL_RTX;
else if (this_arg == NULL_RTX)
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);
+ function_arg_info arg (argtype, /*named=*/true);
+ reg = targetm.calls.function_arg (args_so_far, arg);
if (TREE_CODE (argtype) == REFERENCE_TYPE
&& INTEGRAL_TYPE_P (TREE_TYPE (argtype))
&& reg