aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/fr30
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-08-20 08:53:39 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-08-20 08:53:39 +0000
commit0ffef2005fd7536efbc9c3a572701998c8a8080c (patch)
tree37282f18d957368ef636c6d4d1086678207d6f8d /gcc/config/fr30
parent7256c7194e186fce6ff866a124a77b08196c2a5f (diff)
downloadgcc-0ffef2005fd7536efbc9c3a572701998c8a8080c.zip
gcc-0ffef2005fd7536efbc9c3a572701998c8a8080c.tar.gz
gcc-0ffef2005fd7536efbc9c3a572701998c8a8080c.tar.bz2
Use function_arg_info for TARGET_MUST_PASS_IN_STACK
The hook is passed the promoted mode instead of the original type mode. The expr.h reference in the documentation is no longer correct, but pointing to calls.h or calls.c doesn't help much either. I just left this as-is since it's not related to the point of the series. After previous changes, most places already pass arg.mode and arg.type. Only i386 and mcore needed to construct a new one out of nothing. rs6000 needs to construct one slightly earlier than before. 2019-08-20 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.def (must_pass_in_stack): Take a function_arg_info instead of a mode and a type. * doc/tm.texi: Regenerate. * calls.h (must_pass_in_stack_var_size): Take a function_arg_info instead of a mode and a type. (must_pass_in_stack_var_size_or_pad): Likewise. * calls.c (must_pass_in_stack_var_size): Likewise. (must_pass_in_stack_var_size_or_pad): Likewise. (initialize_argument_information): Update call to targetm.calls.must_pass_in_stack. (must_pass_va_arg_on_stack): Likewise. * function.c (assign_parm_find_entry_rtl): Likewise. * targhooks.c (hook_pass_by_reference_must_pass_in_stack): Likewise. * config/alpha/alpha.c (alpha_function_arg): Likewise. (alpha_function_arg_advance): Likewise. * config/cr16/cr16.c (cr16_function_arg): Likewise. (cr16_function_arg_advance): Likewise. * config/cris/cris.c (cris_pass_by_reference): Likewise. (cris_arg_partial_bytes): Likewise. * config/iq2000/iq2000.c (iq2000_pass_by_reference): Likewise. * config/lm32/lm32.c (lm32_function_arg): Likewise. * config/mcore/mcore.c (mcore_num_arg_regs): Likewise. (mcore_function_arg, mcore_arg_partial_bytes): Likewise. * config/mips/mips.c (mips_pass_by_reference): Likewise. * config/mmix/mmix.c (mmix_function_arg_advance): Likewise. (mmix_function_arg_1, mmix_pass_by_reference): Likewise. * config/sh/sh.c (sh_pass_by_reference): Likewise. * config/stormy16/stormy16.c (xstormy16_function_arg): Likewise. * config/xtensa/xtensa.c (xtensa_function_arg_advance): Likewise. * config/arm/arm.c (arm_must_pass_in_stack): Take a function_arg_info instead of a mode and a type. * config/fr30/fr30.c (fr30_must_pass_in_stack): Likewise. (fr30_num_arg_regs): Likewise. (fr30_setup_incoming_varargs): Update calls accordingly. (fr30_arg_partial_bytes, fr30_function_arg): Likewise. (fr30_function_arg_advance): Likewise. * config/frv/frv.c (frv_must_pass_in_stack): Take a function_arg_info instead of a mode and a type. * config/gcn/gcn.c (num_arg_regs): Likewise. (gcn_function_arg, gcn_function_arg_advance): Update calls to num_arg_regs and targetm.calls.must_pass_in_stack. (gcn_arg_partial_bytes): Likewise. * config/i386/i386.c (ix86_must_pass_in_stack): Take a function_arg_info instead of a mode and a type. (classify_argument): Update call accordingly. * config/nds32/nds32.c (nds32_must_pass_in_stack): Take a function_arg_info instead of a mode and a type. * config/rs6000/rs6000-internal.h (rs6000_must_pass_in_stack): Likewise. * config/rs6000/rs6000-call.c (rs6000_must_pass_in_stack): Likewise. (rs6000_parm_needs_stack): Update call accordingly. (setup_incoming_varargs): Likewise. From-SVN: r274703
Diffstat (limited to 'gcc/config/fr30')
-rw-r--r--gcc/config/fr30/fr30.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 7f1eae1..675198f 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -116,7 +116,7 @@ static struct fr30_frame_info zero_frame_info;
static void fr30_setup_incoming_varargs (cumulative_args_t,
const function_arg_info &,
int *, int);
-static bool fr30_must_pass_in_stack (machine_mode, const_tree);
+static bool fr30_must_pass_in_stack (const function_arg_info &);
static int fr30_arg_partial_bytes (cumulative_args_t,
const function_arg_info &);
static rtx fr30_function_arg (cumulative_args_t, const function_arg_info &);
@@ -129,7 +129,7 @@ static bool fr30_function_value_regno_p (const unsigned int);
static bool fr30_can_eliminate (const int, const int);
static void fr30_asm_trampoline_template (FILE *);
static void fr30_trampoline_init (rtx, tree, rtx);
-static int fr30_num_arg_regs (machine_mode, const_tree);
+static int fr30_num_arg_regs (const function_arg_info &);
#define FRAME_POINTER_MASK (1 << (FRAME_POINTER_REGNUM))
#define RETURN_POINTER_MASK (1 << (RETURN_POINTER_REGNUM))
@@ -480,7 +480,7 @@ fr30_setup_incoming_varargs (cumulative_args_t arg_regs_used_so_far_v,
/* If TARGET_STRICT_ARGUMENT_NAMING returns true, then the last named
arg must not be treated as an anonymous arg. */
/* ??? This is a pointer increment, which makes no sense. */
- arg_regs_used_so_far += fr30_num_arg_regs (arg.mode, arg.type);
+ arg_regs_used_so_far += fr30_num_arg_regs (arg);
size = FR30_NUM_ARG_REGS - (* arg_regs_used_so_far);
@@ -743,30 +743,20 @@ fr30_function_value_regno_p (const unsigned int regno)
in registers. */
static bool
-fr30_must_pass_in_stack (machine_mode mode, const_tree type)
+fr30_must_pass_in_stack (const function_arg_info &arg)
{
- if (mode == BLKmode)
- return true;
- if (type == NULL)
- return false;
- return AGGREGATE_TYPE_P (type);
+ return arg.mode == BLKmode || arg.aggregate_type_p ();
}
-/* Compute the number of word sized registers needed to hold a
- function argument of mode INT_MODE and tree type TYPE. */
+/* Compute the number of word sized registers needed to hold function
+ argument ARG. */
static int
-fr30_num_arg_regs (machine_mode mode, const_tree type)
+fr30_num_arg_regs (const function_arg_info &arg)
{
- int size;
-
- if (targetm.calls.must_pass_in_stack (mode, type))
+ if (targetm.calls.must_pass_in_stack (arg))
return 0;
- if (type && mode == BLKmode)
- size = int_size_in_bytes (type);
- else
- size = GET_MODE_SIZE (mode);
-
+ int size = arg.promoted_size_in_bytes ();
return (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
}
@@ -792,7 +782,7 @@ fr30_arg_partial_bytes (cumulative_args_t cum_v, const function_arg_info &arg)
are needed because the parameter must be passed on the stack)
then return zero, as this parameter does not require partial
register, partial stack stack space. */
- if (*cum + fr30_num_arg_regs (arg.mode, arg.type) <= FR30_NUM_ARG_REGS)
+ if (*cum + fr30_num_arg_regs (arg) <= FR30_NUM_ARG_REGS)
return 0;
return (FR30_NUM_ARG_REGS - *cum) * UNITS_PER_WORD;
@@ -804,7 +794,7 @@ fr30_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
if (!arg.named
- || fr30_must_pass_in_stack (arg.mode, arg.type)
+ || fr30_must_pass_in_stack (arg)
|| *cum >= FR30_NUM_ARG_REGS)
return NULL_RTX;
else
@@ -817,7 +807,7 @@ fr30_function_arg_advance (cumulative_args_t cum,
const function_arg_info &arg)
{
if (arg.named)
- *get_cumulative_args (cum) += fr30_num_arg_regs (arg.mode, arg.type);
+ *get_cumulative_args (cum) += fr30_num_arg_regs (arg);
}
/*}}}*/