From e7056ca417326a70eca05defb6a8b20b737d3417 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 20 Aug 2019 08:52:48 +0000 Subject: [PATCH] Use function_arg_info for TARGET_SETUP_INCOMING_ARGS The hook is passed the promoted mode instead of the original type mode. 2019-08-20 Richard Sandiford gcc/ * target.def (setup_incoming_varargs): Take a function_arg_info instead of a mode and tree. * doc/tm.texi: Regenerate. * targhooks.h (default_setup_incoming_varargs): Take a function_arg_info instead of a mode and tree. * targhooks.c (default_setup_incoming_varargs): Likewise. * config/aarch64/aarch64.c (aarch64_setup_incoming_varargs): Likewise. * config/alpha/alpha.c (alpha_setup_incoming_varargs): Likewise. * config/arc/arc.c (arc_setup_incoming_varargs): Likewise. * config/arm/arm.c (arm_setup_incoming_varargs): Likewise. * config/bfin/bfin.c (setup_incoming_varargs): Likewise. * config/cris/cris.c (cris_setup_incoming_varargs): Likewise. * config/csky/csky.c (csky_setup_incoming_varargs): Likewise. * config/epiphany/epiphany.c (epiphany_setup_incoming_varargs): Likewise. * config/fr30/fr30.c (fr30_setup_incoming_varargs): Likewise. * config/frv/frv.c (frv_setup_incoming_varargs): Likewise. * config/ft32/ft32.c (ft32_setup_incoming_varargs): Likewise. * config/i386/i386.c (ix86_setup_incoming_varargs): Likewise. * config/ia64/ia64.c (ia64_setup_incoming_varargs): Likewise. * config/iq2000/iq2000.c (iq2000_setup_incoming_varargs): Likewise. * config/lm32/lm32.c (lm32_setup_incoming_varargs): Likewise. * config/m32r/m32r.c (m32r_setup_incoming_varargs): Likewise. * config/mcore/mcore.c (mcore_setup_incoming_varargs): Likewise. * config/mips/mips.c (mips_setup_incoming_varargs): Likewise. * config/mmix/mmix.c (mmix_setup_incoming_varargs): Likewise. * config/moxie/moxie.c (moxie_setup_incoming_varargs): Likewise. * config/nds32/nds32.c (nds32_setup_incoming_varargs): Likewise. * config/nios2/nios2.c (nios2_setup_incoming_varargs): Likewise. * config/riscv/riscv.c (riscv_setup_incoming_varargs): Likewise. * config/rs6000/rs6000-internal.h (setup_incoming_varargs): Likewise. * config/rs6000/rs6000-call.c (setup_incoming_varargs): Likewise. * config/sh/sh.c (sh_setup_incoming_varargs): Likewise. * config/spu/spu.c (spu_setup_incoming_varargs): Likewise. * config/tilegx/tilegx.c (tilegx_setup_incoming_varargs): Likewise. * config/tilepro/tilepro.c (tilepro_setup_incoming_varargs): Likewise. * config/visium/visium.c (visium_setup_incoming_varargs): Likewise. * function.c (assign_parms_setup_varargs): Update call to targetm.calls.setup_incoming_varargs. From-SVN: r274699 --- gcc/ChangeLog | 42 +++++++++++++++++++++++++++++ gcc/config/aarch64/aarch64.c | 9 ++++--- gcc/config/alpha/alpha.c | 9 ++++--- gcc/config/arc/arc.c | 8 +++--- gcc/config/arm/arm.c | 13 +++++---- gcc/config/bfin/bfin.c | 5 ++-- gcc/config/cris/cris.c | 8 +++--- gcc/config/csky/csky.c | 5 ++-- gcc/config/epiphany/epiphany.c | 15 ++++++----- gcc/config/fr30/fr30.c | 16 +++++------ gcc/config/frv/frv.c | 13 +++++---- gcc/config/ft32/ft32.c | 5 ++-- gcc/config/i386/i386.c | 9 ++++--- gcc/config/ia64/ia64.c | 15 ++++++----- gcc/config/iq2000/iq2000.c | 9 +++---- gcc/config/lm32/lm32.c | 14 ++++------ gcc/config/m32r/m32r.c | 21 ++++++++------- gcc/config/mcore/mcore.c | 9 ++++--- gcc/config/mips/mips.c | 10 +++---- gcc/config/mmix/mmix.c | 7 +++-- gcc/config/moxie/moxie.c | 3 +-- gcc/config/nds32/nds32.c | 9 +++---- gcc/config/nios2/nios2.c | 6 ++--- gcc/config/riscv/riscv.c | 9 ++++--- gcc/config/rs6000/rs6000-call.c | 14 +++++----- gcc/config/rs6000/rs6000-internal.h | 5 ++-- gcc/config/sh/sh.c | 14 +++++----- gcc/config/spu/spu.c | 8 +++--- gcc/config/tilegx/tilegx.c | 6 ++--- gcc/config/tilepro/tilepro.c | 6 ++--- gcc/config/visium/visium.c | 10 +++---- gcc/doc/tm.texi | 6 ++--- gcc/function.c | 6 ++--- gcc/target.def | 6 ++--- gcc/targhooks.c | 7 ++--- gcc/targhooks.h | 4 ++- 36 files changed, 201 insertions(+), 160 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 026a7c8f7e8..f9cfcc0a990 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,45 @@ +2019-08-20 Richard Sandiford + + * target.def (setup_incoming_varargs): Take a function_arg_info + instead of a mode and tree. + * doc/tm.texi: Regenerate. + * targhooks.h (default_setup_incoming_varargs): Take a + function_arg_info instead of a mode and tree. + * targhooks.c (default_setup_incoming_varargs): Likewise. + * config/aarch64/aarch64.c (aarch64_setup_incoming_varargs): Likewise. + * config/alpha/alpha.c (alpha_setup_incoming_varargs): Likewise. + * config/arc/arc.c (arc_setup_incoming_varargs): Likewise. + * config/arm/arm.c (arm_setup_incoming_varargs): Likewise. + * config/bfin/bfin.c (setup_incoming_varargs): Likewise. + * config/cris/cris.c (cris_setup_incoming_varargs): Likewise. + * config/csky/csky.c (csky_setup_incoming_varargs): Likewise. + * config/epiphany/epiphany.c (epiphany_setup_incoming_varargs): + Likewise. + * config/fr30/fr30.c (fr30_setup_incoming_varargs): Likewise. + * config/frv/frv.c (frv_setup_incoming_varargs): Likewise. + * config/ft32/ft32.c (ft32_setup_incoming_varargs): Likewise. + * config/i386/i386.c (ix86_setup_incoming_varargs): Likewise. + * config/ia64/ia64.c (ia64_setup_incoming_varargs): Likewise. + * config/iq2000/iq2000.c (iq2000_setup_incoming_varargs): Likewise. + * config/lm32/lm32.c (lm32_setup_incoming_varargs): Likewise. + * config/m32r/m32r.c (m32r_setup_incoming_varargs): Likewise. + * config/mcore/mcore.c (mcore_setup_incoming_varargs): Likewise. + * config/mips/mips.c (mips_setup_incoming_varargs): Likewise. + * config/mmix/mmix.c (mmix_setup_incoming_varargs): Likewise. + * config/moxie/moxie.c (moxie_setup_incoming_varargs): Likewise. + * config/nds32/nds32.c (nds32_setup_incoming_varargs): Likewise. + * config/nios2/nios2.c (nios2_setup_incoming_varargs): Likewise. + * config/riscv/riscv.c (riscv_setup_incoming_varargs): Likewise. + * config/rs6000/rs6000-internal.h (setup_incoming_varargs): Likewise. + * config/rs6000/rs6000-call.c (setup_incoming_varargs): Likewise. + * config/sh/sh.c (sh_setup_incoming_varargs): Likewise. + * config/spu/spu.c (spu_setup_incoming_varargs): Likewise. + * config/tilegx/tilegx.c (tilegx_setup_incoming_varargs): Likewise. + * config/tilepro/tilepro.c (tilepro_setup_incoming_varargs): Likewise. + * config/visium/visium.c (visium_setup_incoming_varargs): Likewise. + * function.c (assign_parms_setup_varargs): Update call to + targetm.calls.setup_incoming_varargs. + 2019-08-20 Richard Sandiford * target.def (pass_by_reference): Take a function_arg_info instead diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5694dd796f7..4c5871c15d6 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -14511,9 +14511,9 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, /* Implement TARGET_SETUP_INCOMING_VARARGS. */ static void -aarch64_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, - tree type, int *pretend_size ATTRIBUTE_UNUSED, - int no_rtl) +aarch64_setup_incoming_varargs (cumulative_args_t cum_v, + const function_arg_info &arg, + int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); CUMULATIVE_ARGS local_cum; @@ -14524,7 +14524,8 @@ aarch64_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ local_cum = *cum; - aarch64_function_arg_advance (pack_cumulative_args(&local_cum), mode, type, true); + aarch64_function_arg_advance (pack_cumulative_args(&local_cum), + arg.mode, arg.type, arg.named); /* Found out how many registers we need to save. Honor tree-stdvar analysis results. */ diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index e4313673b4c..2aace889607 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -6090,14 +6090,15 @@ escapes: variable number of arguments. */ static void -alpha_setup_incoming_varargs (cumulative_args_t pcum, machine_mode mode, - tree type, int *pretend_size, int no_rtl) +alpha_setup_incoming_varargs (cumulative_args_t pcum, + const function_arg_info &arg, + int *pretend_size, int no_rtl) { CUMULATIVE_ARGS cum = *get_cumulative_args (pcum); /* Skip the current argument. */ - targetm.calls.function_arg_advance (pack_cumulative_args (&cum), mode, type, - true); + targetm.calls.function_arg_advance (pack_cumulative_args (&cum), + arg.mode, arg.type, arg.named); #if TARGET_ABI_OPEN_VMS /* For VMS, we allocate space for all 6 arg registers plus a count. diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 5b0d8b9b134..bfa38abcd4b 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -2415,12 +2415,12 @@ arc_double_limm_p (rtx value) create a register parameter block, and then copy any anonymous arguments in registers to memory. - CUM has not been updated for the last named argument which has type TYPE - and mode MODE, and we rely on this fact. */ + CUM has not been updated for the last named argument (which is given + by ARG), and we rely on this fact. */ static void arc_setup_incoming_varargs (cumulative_args_t args_so_far, - machine_mode mode, tree type, + const function_arg_info &arg, int *pretend_size, int no_rtl) { int first_anon_arg; @@ -2430,7 +2430,7 @@ arc_setup_incoming_varargs (cumulative_args_t args_so_far, next_cum = *get_cumulative_args (args_so_far); arc_function_arg_advance (pack_cumulative_args (&next_cum), - mode, type, true); + arg.mode, arg.type, arg.named); first_anon_arg = next_cum; if (FUNCTION_ARG_REGNO_P (first_anon_arg)) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index cceb3c7ff33..f713945a299 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -212,8 +212,8 @@ static void arm_file_end (void); static void arm_file_start (void); static void arm_insert_attributes (tree, tree *); -static void arm_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree, int *, int); +static void arm_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, int *, int); static bool arm_pass_by_reference (cumulative_args_t, const function_arg_info &); static bool arm_promote_prototypes (const_tree); @@ -27054,8 +27054,7 @@ arm_output_load_gr (rtx *operands) static void arm_setup_incoming_varargs (cumulative_args_t pcum_v, - machine_mode mode, - tree type, + const function_arg_info &arg, int *pretend_size, int second_time ATTRIBUTE_UNUSED) { @@ -27068,17 +27067,17 @@ arm_setup_incoming_varargs (cumulative_args_t pcum_v, nregs = pcum->aapcs_ncrn; if (nregs & 1) { - 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); + "type %qT changed in GCC 7.1", arg.type); else if (res > 0) { 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); } } } diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 783befff938..7dd0a24fb21 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -540,7 +540,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler) CUM is as above. - MODE and TYPE are the mode and type of the current parameter. + ARG is the last named argument. PRETEND_SIZE is a variable that should be set to the amount of stack that must be pushed by the prolog to pretend that our caller pushed @@ -559,8 +559,7 @@ expand_epilogue_reg_restore (rtx spreg, bool saveall, bool is_inthandler) static void setup_incoming_varargs (cumulative_args_t cum, - machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, int *pretend_size, + const function_arg_info &, int *pretend_size, int no_rtl) { rtx mem; diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index e2a78de5302..0b2947e2319 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -108,8 +108,9 @@ static struct machine_function * cris_init_machine_status (void); static rtx cris_struct_value_rtx (tree, int); -static void cris_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree type, int *, int); +static void cris_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, + int *, int); static int cris_initial_frame_pointer_offset (void); @@ -4021,8 +4022,7 @@ cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, static void cris_setup_incoming_varargs (cumulative_args_t ca_v, - machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, + const function_arg_info &, int *pretend_arg_size, int second_time) { diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index 98789bcfcff..c8513540633 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -1937,8 +1937,7 @@ csky_arg_partial_bytes (cumulative_args_t pcum_v, const function_arg_info &arg) static void csky_setup_incoming_varargs (cumulative_args_t pcum_v, - machine_mode mode, - tree type, + const function_arg_info &arg, int *pretend_size, int second_time ATTRIBUTE_UNUSED) { @@ -1949,7 +1948,7 @@ csky_setup_incoming_varargs (cumulative_args_t pcum_v, cfun->machine->uses_anonymous_args = 1; local_cum = *pcum; - csky_function_arg_advance (local_cum_v, mode, type, true); + csky_function_arg_advance (local_cum_v, arg.mode, arg.type, arg.named); regs_to_push = CSKY_NPARM_REGS - local_cum; if (regs_to_push) *pretend_size = regs_to_push * UNITS_PER_WORD; diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c index c98fc526919..9dd1643ddf5 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -711,24 +711,25 @@ epiphany_function_arg_boundary (machine_mode mode, const_tree type) /* Do any needed setup for a variadic function. For the EPIPHANY, we actually emit the code in epiphany_expand_prologue. - CUM has not been updated for the last named argument which has type TYPE - and mode MODE, and we rely on this fact. */ + CUM has not been updated for the last named argument (which is given + by ARG), and we rely on this fact. */ static void -epiphany_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size, int no_rtl) +epiphany_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size, int no_rtl) { int first_anon_arg; CUMULATIVE_ARGS next_cum; machine_function_t *mf = MACHINE_FUNCTION (cfun); /* All BLKmode values are passed by reference. */ - gcc_assert (mode != BLKmode); + gcc_assert (arg.mode != BLKmode); next_cum = *get_cumulative_args (cum); - next_cum - = ROUND_ADVANCE_CUM (next_cum, mode, type) + ROUND_ADVANCE_ARG (mode, type); + next_cum = (ROUND_ADVANCE_CUM (next_cum, arg.mode, arg.type) + + ROUND_ADVANCE_ARG (arg.mode, arg.type)); first_anon_arg = next_cum; if (first_anon_arg < MAX_EPIPHANY_PARM_REGS && !no_rtl) diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 59728015f14..d6c835130bb 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -113,8 +113,9 @@ static struct fr30_frame_info current_frame_info; /* Zero structure to initialize current_frame_info. */ static struct fr30_frame_info zero_frame_info; -static void fr30_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree, int *, int); +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 int fr30_arg_partial_bytes (cumulative_args_t, const function_arg_info &); @@ -459,12 +460,11 @@ fr30_expand_epilogue (void) named argument, from registers into memory. * copying actually done in fr30_expand_prologue(). - ARG_REGS_USED_SO_FAR has *not* been updated for the last named argument - which has type TYPE and mode MODE, and we rely on this fact. */ + CUM has not been updated for the last named argument which has type TYPE + and mode MODE, and we rely on this fact. */ void fr30_setup_incoming_varargs (cumulative_args_t arg_regs_used_so_far_v, - machine_mode mode, - tree type ATTRIBUTE_UNUSED, + const function_arg_info &arg, int *pretend_size, int second_time ATTRIBUTE_UNUSED) { @@ -473,7 +473,7 @@ fr30_setup_incoming_varargs (cumulative_args_t arg_regs_used_so_far_v, int size; /* All BLKmode values are passed by reference. */ - gcc_assert (mode != BLKmode); + gcc_assert (arg.mode != BLKmode); /* ??? This run-time test as well as the code inside the if statement is probably unnecessary. */ @@ -481,7 +481,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 (mode, type); + arg_regs_used_so_far += fr30_num_arg_regs (arg.mode, arg.type); size = FR30_NUM_ARG_REGS - (* arg_regs_used_so_far); diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 4560fc6f9ca..5e06cf691f3 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -359,8 +359,8 @@ static bool frv_in_small_data_p (const_tree); static void frv_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); static void frv_setup_incoming_varargs (cumulative_args_t, - machine_mode, - tree, int *, int); + const function_arg_info &, + int *, int); static rtx frv_expand_builtin_saveregs (void); static void frv_expand_builtin_va_start (tree, rtx); static bool frv_rtx_costs (rtx, machine_mode, int, int, @@ -2109,17 +2109,16 @@ frv_initial_elimination_offset (int from, int to) static void frv_setup_incoming_varargs (cumulative_args_t cum_v, - machine_mode mode, - tree type ATTRIBUTE_UNUSED, - int *pretend_size, - int second_time) + const function_arg_info &arg, + int *pretend_size, + int second_time) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); if (TARGET_DEBUG_ARG) fprintf (stderr, "setup_vararg: words = %2d, mode = %4s, pretend_size = %d, second_time = %d\n", - *cum, GET_MODE_NAME (mode), *pretend_size, second_time); + *cum, GET_MODE_NAME (arg.mode), *pretend_size, second_time); } diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c index d5b66df4a56..ee073c8c9fd 100644 --- a/gcc/config/ft32/ft32.c +++ b/gcc/config/ft32/ft32.c @@ -630,13 +630,12 @@ ft32_initial_elimination_offset (int from, int to) static void ft32_setup_incoming_varargs (cumulative_args_t cum_v, - machine_mode mode, - tree type ATTRIBUTE_UNUSED, + const function_arg_info &arg, int *pretend_size, int no_rtl ATTRIBUTE_UNUSED) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int named_size = - GET_MODE_SIZE (SImode) * (*cum - FT32_R0) + GET_MODE_SIZE (mode); + GET_MODE_SIZE (SImode) * (*cum - FT32_R0) + GET_MODE_SIZE (arg.mode); if (named_size < 24) *pretend_size = 24 - named_size; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 02a551cbc38..67959c1e34e 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4096,8 +4096,9 @@ setup_incoming_varargs_ms_64 (CUMULATIVE_ARGS *cum) } static void -ix86_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, - tree type, int *, int no_rtl) +ix86_setup_incoming_varargs (cumulative_args_t cum_v, + const function_arg_info &arg, + int *, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); CUMULATIVE_ARGS next_cum; @@ -4116,8 +4117,8 @@ ix86_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, For stdargs, we do want to skip the last named argument. */ next_cum = *cum; if (stdarg_p (fntype)) - ix86_function_arg_advance (pack_cumulative_args (&next_cum), mode, type, - true); + ix86_function_arg_advance (pack_cumulative_args (&next_cum), + arg.mode, arg.type, arg.named); if (cum->call_abi == MS_ABI) setup_incoming_varargs_ms_64 (&next_cum); diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 13dd71575e4..3bd20687e52 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -199,8 +199,9 @@ static rtx gen_fr_restore_x (rtx, rtx, rtx); static void ia64_option_override (void); static bool ia64_can_eliminate (const int, const int); static machine_mode hfa_element_mode (const_tree, bool); -static void ia64_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree, int *, int); +static void ia64_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, + 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, @@ -4585,19 +4586,21 @@ ia64_trampoline_init (rtx m_tramp, tree fndecl, rtx static_chain) } /* Do any needed setup for a variadic function. CUM has not been updated - for the last named argument which has type TYPE and mode MODE. + for the last named argument, which is given by ARG. We generate the actual spill instructions during prologue generation. */ static void -ia64_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int * pretend_size, +ia64_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size, int second_time ATTRIBUTE_UNUSED) { CUMULATIVE_ARGS next_cum = *get_cumulative_args (cum); /* Skip the current argument. */ - ia64_function_arg_advance (pack_cumulative_args (&next_cum), mode, type, 1); + ia64_function_arg_advance (pack_cumulative_args (&next_cum), + arg.mode, arg.type, arg.named); if (next_cum.words < MAX_ARGUMENT_SLOTS) { diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index db544233223..ec615df2734 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -152,8 +152,8 @@ static void iq2000_init_builtins (void); static rtx iq2000_expand_builtin (tree, rtx, rtx, machine_mode, int); static bool iq2000_return_in_memory (const_tree, const_tree); static void iq2000_setup_incoming_varargs (cumulative_args_t, - machine_mode, tree, int *, - int); + const function_arg_info &, + int *, int); static bool iq2000_rtx_costs (rtx, machine_mode, int, int, int *, bool); static int iq2000_address_cost (rtx, machine_mode, addr_space_t, bool); @@ -2894,9 +2894,8 @@ iq2000_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) static void iq2000_setup_incoming_varargs (cumulative_args_t cum_v, - machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, int * pretend_size, - int no_rtl) + const function_arg_info &, + int *pretend_size, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); unsigned int iq2000_off = ! cum->last_arg_fp; diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 7ed9ac00f08..c9d863d62f1 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -64,7 +64,7 @@ static void expand_save_restore (struct lm32_frame_info *info, int op); static void stack_adjust (HOST_WIDE_INT amount); static bool lm32_in_small_data_p (const_tree); static void lm32_setup_incoming_varargs (cumulative_args_t cum, - machine_mode mode, tree type, + const function_arg_info &, int *pretend_size, int no_rtl); static bool lm32_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *total, bool speed); @@ -684,8 +684,9 @@ lm32_compute_initial_elimination_offset (int from, int to) } static void -lm32_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, - tree type, int *pretend_size, int no_rtl) +lm32_setup_incoming_varargs (cumulative_args_t cum_v, + const function_arg_info &arg, + int *pretend_size, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int first_anon_arg; @@ -702,12 +703,7 @@ lm32_setup_incoming_varargs (cumulative_args_t cum_v, machine_mode mode, registers, if any used in passing this named paramter in order to determine which is the first registers used to pass anonymous arguments. */ - int size; - - if (mode == BLKmode) - size = int_size_in_bytes (type); - else - size = GET_MODE_SIZE (mode); + int size = arg.promoted_size_in_bytes (); first_anon_arg = *cum + LM32_FIRST_ARG_REG + diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 7ee4fed84ef..01bbec9ca0c 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -86,8 +86,9 @@ static bool m32r_return_in_memory (const_tree, const_tree); static rtx m32r_function_value (const_tree, const_tree, bool); static rtx m32r_libcall_value (machine_mode, const_rtx); static bool m32r_function_value_regno_p (const unsigned int); -static void m32r_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree, int *, int); +static void m32r_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, + int *, int); static void init_idents (void); static bool m32r_rtx_costs (rtx, machine_mode, int, int, int *, bool speed); static int m32r_memory_move_cost (machine_mode, reg_class_t, bool); @@ -1280,12 +1281,13 @@ m32r_function_value_regno_p (const unsigned int regno) create a register parameter block, and then copy any anonymous arguments in registers to memory. - CUM has not been updated for the last named argument which has type TYPE - and mode MODE, and we rely on this fact. */ + CUM has not been updated for the last named argument (which is given + by ARG), and we rely on this fact. */ static void -m32r_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size, int no_rtl) +m32r_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size, int no_rtl) { int first_anon_arg; @@ -1293,10 +1295,11 @@ m32r_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, return; /* All BLKmode values are passed by reference. */ - gcc_assert (mode != BLKmode); + gcc_assert (arg.mode != BLKmode); - first_anon_arg = (ROUND_ADVANCE_CUM (*get_cumulative_args (cum), mode, type) - + ROUND_ADVANCE_ARG (mode, type)); + first_anon_arg = (ROUND_ADVANCE_CUM (*get_cumulative_args (cum), + arg.mode, arg.type) + + ROUND_ADVANCE_ARG (arg.mode, arg.type)); if (first_anon_arg < M32R_MAX_PARM_REGS) { diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index d93c818f381..98f01117d50 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -99,7 +99,9 @@ static int calc_live_regs (int *); static int try_constant_tricks (HOST_WIDE_INT, HOST_WIDE_INT *, HOST_WIDE_INT *); static const char * output_inline_const (machine_mode, rtx *); static void layout_mcore_frame (struct mcore_frame *); -static void mcore_setup_incoming_varargs (cumulative_args_t, machine_mode, tree, int *, int); +static void mcore_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, + int *, int); static cond_type is_cond_candidate (rtx); static rtx_insn *emit_new_cond_insn (rtx_insn *, int); static rtx_insn *conditionalize_block (rtx_insn *); @@ -1942,7 +1944,7 @@ mcore_initial_elimination_offset (int from, int to) static void mcore_setup_incoming_varargs (cumulative_args_t args_so_far_v, - machine_mode mode, tree type, + const function_arg_info &arg, int * ptr_pretend_size ATTRIBUTE_UNUSED, int second_time ATTRIBUTE_UNUSED) { @@ -1953,7 +1955,8 @@ mcore_setup_incoming_varargs (cumulative_args_t args_so_far_v, /* We need to know how many argument registers are used before the varargs start, so that we can push the remaining argument registers during the prologue. */ - number_of_regs_before_varargs = *args_so_far + mcore_num_arg_regs (mode, type); + number_of_regs_before_varargs + = *args_so_far + mcore_num_arg_regs (arg.mode, arg.type); /* There is a bug somewhere in the arg handling code. Until I can find it this workaround always pushes the diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 8a8adb9a354..1427e99c7aa 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6544,9 +6544,9 @@ mips_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED) /* Implement TARGET_SETUP_INCOMING_VARARGS. */ static void -mips_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size ATTRIBUTE_UNUSED, - int no_rtl) +mips_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { CUMULATIVE_ARGS local_cum; int gp_saved, fp_saved; @@ -6555,8 +6555,8 @@ mips_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ local_cum = *get_cumulative_args (cum); - mips_function_arg_advance (pack_cumulative_args (&local_cum), mode, type, - true); + mips_function_arg_advance (pack_cumulative_args (&local_cum), + arg.mode, arg.type, arg.named); /* Found out how many registers we need to save. */ gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs; diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 1b3a6091616..cb70a2dbd40 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -138,7 +138,7 @@ static void mmix_reorg (void); static void mmix_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); static void mmix_setup_incoming_varargs - (cumulative_args_t, machine_mode, tree, int *, int); + (cumulative_args_t, const function_arg_info &, int *, int); static void mmix_file_start (void); static void mmix_file_end (void); static void mmix_init_libfuncs (void); @@ -960,8 +960,7 @@ mmix_function_profiler (FILE *stream ATTRIBUTE_UNUSED, static void mmix_setup_incoming_varargs (cumulative_args_t args_so_farp_v, - machine_mode mode, - tree vartype, + const function_arg_info &arg, int *pretend_sizep, int second_time ATTRIBUTE_UNUSED) { @@ -974,7 +973,7 @@ mmix_setup_incoming_varargs (cumulative_args_t args_so_farp_v, /* We assume that one argument takes up one register here. That should be true until we start messing with multi-reg parameters. */ - if ((7 + (MMIX_FUNCTION_ARG_SIZE (mode, vartype))) / 8 != 1) + if ((7 + (MMIX_FUNCTION_ARG_SIZE (arg.mode, arg.type))) / 8 != 1) internal_error ("MMIX Internal: Last named vararg would not fit in a register"); } diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index e8eaedf2b98..a8e1bf23c44 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -385,8 +385,7 @@ moxie_initial_elimination_offset (int from, int to) static void moxie_setup_incoming_varargs (cumulative_args_t cum_v, - machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, + const function_arg_info &, int *pretend_size, int no_rtl) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index c92a598dc5e..b076aa4a667 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2345,8 +2345,7 @@ nds32_warn_func_return (tree decl) static void nds32_setup_incoming_varargs (cumulative_args_t ca, - machine_mode mode, - tree type, + const function_arg_info &arg, int *pretend_args_size, int second_time ATTRIBUTE_UNUSED) { @@ -2370,14 +2369,14 @@ nds32_setup_incoming_varargs (cumulative_args_t ca, cum = get_cumulative_args (ca); - /* The MODE and TYPE describe the last argument. + /* ARG describes the last argument. We need those information to determine the remaining registers for varargs. */ total_args_regs = NDS32_MAX_GPR_REGS_FOR_ARGS + NDS32_GPR_ARG_FIRST_REGNUM; num_of_used_regs - = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, mode, type) - + NDS32_NEED_N_REGS_FOR_ARG (mode, type); + = NDS32_AVAILABLE_REGNUM_FOR_GPR_ARG (cum->gpr_offset, arg.mode, arg.type) + + NDS32_NEED_N_REGS_FOR_ARG (arg.mode, arg.type); remaining_reg_count = total_args_regs - num_of_used_regs; *pretend_args_size = remaining_reg_count * UNITS_PER_WORD; diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index 1e04cf96f27..b93274a12a7 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -3516,8 +3516,8 @@ nios2_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) own va_arg type. */ static void nios2_setup_incoming_varargs (cumulative_args_t cum_v, - machine_mode mode, tree type, - int *pretend_size, int second_time) + const function_arg_info &arg, + int *pretend_size, int second_time) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); CUMULATIVE_ARGS local_cum; @@ -3527,7 +3527,7 @@ nios2_setup_incoming_varargs (cumulative_args_t cum_v, cfun->machine->uses_anonymous_args = 1; local_cum = *cum; - nios2_function_arg_advance (local_cum_v, mode, type, true); + nios2_function_arg_advance (local_cum_v, arg.mode, arg.type, arg.named); regs_to_push = NUM_ARG_REGS - local_cum.regs_used; diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 659e3ed8587..47d9001187c 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -2854,9 +2854,9 @@ riscv_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED) /* Implement TARGET_SETUP_INCOMING_VARARGS. */ static void -riscv_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size ATTRIBUTE_UNUSED, - int no_rtl) +riscv_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { CUMULATIVE_ARGS local_cum; int gp_saved; @@ -2865,7 +2865,8 @@ riscv_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ local_cum = *get_cumulative_args (cum); - riscv_function_arg_advance (pack_cumulative_args (&local_cum), mode, type, 1); + riscv_function_arg_advance (pack_cumulative_args (&local_cum), + arg.mode, arg.type, arg.named); /* Found out how many registers we need to save. */ gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs; diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 4f006aa511d..874d525c73d 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -2365,7 +2365,7 @@ rs6000_move_block_from_reg (int regno, rtx x, int nregs) CUM is as above. - MODE and TYPE are the mode and type of the current parameter. + ARG is the last named argument. PRETEND_SIZE is a variable that should be set to the amount of stack that must be pushed by the prolog to pretend that our caller pushed @@ -2375,9 +2375,9 @@ rs6000_move_block_from_reg (int regno, rtx x, int nregs) stack and set PRETEND_SIZE to the length of the registers pushed. */ void -setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size ATTRIBUTE_UNUSED, - int no_rtl) +setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { CUMULATIVE_ARGS next_cum; int reg_size = TARGET_32BIT ? 4 : 8; @@ -2387,7 +2387,7 @@ setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, /* Skip the last named argument. */ next_cum = *get_cumulative_args (cum); - rs6000_function_arg_advance_1 (&next_cum, mode, type, true, 0); + rs6000_function_arg_advance_1 (&next_cum, arg.mode, arg.type, arg.named, 0); if (DEFAULT_ABI == ABI_V4) { @@ -2461,8 +2461,8 @@ setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, first_reg_offset = next_cum.words; save_area = crtl->args.internal_arg_pointer; - if (targetm.calls.must_pass_in_stack (mode, type)) - first_reg_offset += rs6000_arg_size (TYPE_MODE (type), type); + if (targetm.calls.must_pass_in_stack (arg.mode, arg.type)) + first_reg_offset += rs6000_arg_size (TYPE_MODE (arg.type), arg.type); } set = get_varargs_alias_set (); diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h index 96017825f6a..45a6a7a5e3d 100644 --- a/gcc/config/rs6000/rs6000-internal.h +++ b/gcc/config/rs6000/rs6000-internal.h @@ -152,9 +152,8 @@ extern bool rs6000_return_in_memory (const_tree type, extern bool rs6000_return_in_msb (const_tree valtype); extern bool rs6000_pass_by_reference (cumulative_args_t, const function_arg_info &); -extern void setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size ATTRIBUTE_UNUSED, - int no_rtl); +extern void setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, int *, int); extern unsigned int rs6000_function_arg_boundary (machine_mode mode, const_tree type); extern bool rs6000_must_pass_in_stack (machine_mode mode, const_tree type); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index e84a3ddc0fc..bcd82cb7598 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -280,8 +280,8 @@ static bool sh_function_value_regno_p (const unsigned int); static rtx sh_libcall_value (machine_mode, const_rtx); static bool sh_return_in_memory (const_tree, const_tree); static rtx sh_builtin_saveregs (void); -static void sh_setup_incoming_varargs (cumulative_args_t, machine_mode, - tree, int *, int); +static void sh_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, int *, int); static bool sh_strict_argument_naming (cumulative_args_t); static bool sh_pretend_outgoing_varargs_named (cumulative_args_t); static void sh_atomic_assign_expand_fenv (tree *, tree *, tree *); @@ -8184,8 +8184,7 @@ sh_return_in_memory (const_tree type, const_tree fndecl) function that tell if a function uses varargs or stdarg. */ static void sh_setup_incoming_varargs (cumulative_args_t ca, - machine_mode mode, - tree type, + const function_arg_info &arg, int *pretend_arg_size, int second_time ATTRIBUTE_UNUSED) { @@ -8194,10 +8193,9 @@ sh_setup_incoming_varargs (cumulative_args_t ca, { int named_parm_regs, anon_parm_regs; - named_parm_regs = (sh_round_reg (*get_cumulative_args (ca), mode) - + (mode == BLKmode - ? CEIL (int_size_in_bytes (type), UNITS_PER_WORD) - : CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD))); + named_parm_regs = (sh_round_reg (*get_cumulative_args (ca), arg.mode) + + CEIL (arg.promoted_size_in_bytes (), + UNITS_PER_WORD)); anon_parm_regs = NPARM_REGS (SImode) - named_parm_regs; if (anon_parm_regs > 0) *pretend_arg_size = anon_parm_regs * 4; diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 43a25c4df12..92dd556b346 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -4089,8 +4089,9 @@ spu_gimplify_va_arg_expr (tree valist, tree type, gimple_seq * pre_p, in the stack then save no registers. Set pretend_args_size to the amount of space needed to save the registers. */ static void -spu_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, - tree type, int *pretend_size, int no_rtl) +spu_setup_incoming_varargs (cumulative_args_t cum, + const function_arg_info &arg, + int *pretend_size, int no_rtl) { if (!no_rtl) { @@ -4101,7 +4102,8 @@ spu_setup_incoming_varargs (cumulative_args_t cum, machine_mode mode, /* cum currently points to the last named argument, we want to start at the next argument. */ - spu_function_arg_advance (pack_cumulative_args (&ncum), mode, type, true); + spu_function_arg_advance (pack_cumulative_args (&ncum), + arg.mode, arg.type, arg.named); offset = -STACK_POINTER_OFFSET; for (regno = ncum; regno < MAX_REGISTER_ARGS; regno++) diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index f800e9e4642..6f33482548c 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -390,8 +390,8 @@ tilegx_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Implement TARGET_SETUP_INCOMING_VARARGS. */ static void tilegx_setup_incoming_varargs (cumulative_args_t cum, - machine_mode mode, - tree type, int *pretend_args, int no_rtl) + const function_arg_info &arg, + int *pretend_args, int no_rtl) { CUMULATIVE_ARGS local_cum = *get_cumulative_args (cum); int first_reg; @@ -400,7 +400,7 @@ tilegx_setup_incoming_varargs (cumulative_args_t cum, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ targetm.calls.function_arg_advance (pack_cumulative_args (&local_cum), - mode, type, true); + arg.mode, arg.type, arg.named); first_reg = local_cum; if (local_cum < TILEGX_NUM_ARG_REGS) diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c index 483a897a6d8..dd537712a50 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -342,8 +342,8 @@ tilepro_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) /* Implement TARGET_SETUP_INCOMING_VARARGS. */ static void tilepro_setup_incoming_varargs (cumulative_args_t cum, - machine_mode mode, - tree type, int *pretend_args, int no_rtl) + const function_arg_info &arg, + int *pretend_args, int no_rtl) { CUMULATIVE_ARGS local_cum = *get_cumulative_args (cum); int first_reg; @@ -352,7 +352,7 @@ tilepro_setup_incoming_varargs (cumulative_args_t cum, argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ targetm.calls.function_arg_advance (pack_cumulative_args (&local_cum), - mode, type, true); + arg.mode, arg.type, arg.named); first_reg = local_cum; if (local_cum < TILEPRO_NUM_ARG_REGS) diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c index 456bba20001..2dd261a5d73 100644 --- a/gcc/config/visium/visium.c +++ b/gcc/config/visium/visium.c @@ -175,8 +175,8 @@ static rtx visium_function_value (const_tree, const_tree fn_decl_or_type, static rtx visium_libcall_value (machine_mode, const_rtx); static void visium_setup_incoming_varargs (cumulative_args_t, - machine_mode, - tree, int *, int); + const function_arg_info &, + int *, int); static void visium_va_start (tree valist, rtx nextarg); @@ -1460,8 +1460,7 @@ visium_libcall_value (machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) static void visium_setup_incoming_varargs (cumulative_args_t pcum_v, - machine_mode mode, - tree type, + const function_arg_info &arg, int *pretend_size ATTRIBUTE_UNUSED, int no_rtl) { @@ -1487,7 +1486,8 @@ visium_setup_incoming_varargs (cumulative_args_t pcum_v, /* The caller has advanced ARGS_SO_FAR up to, but not beyond, the last named argument. Advance a local copy of ARGS_SO_FAR past the last "real" named argument, to find out how many registers are left over. */ - TARGET_FUNCTION_ARG_ADVANCE (local_args_so_far, mode, type, 1); + TARGET_FUNCTION_ARG_ADVANCE (local_args_so_far, arg.mode, + arg.type, arg.named); /* Find how many registers we need to save. */ locargs = get_cumulative_args (local_args_so_far); diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 1a82bcc99b9..6beb578d3c9 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5202,7 +5202,7 @@ return value of this function should be an RTX that contains the value to use as the return of @code{__builtin_saveregs}. @end deftypefn -@deftypefn {Target Hook} void TARGET_SETUP_INCOMING_VARARGS (cumulative_args_t @var{args_so_far}, machine_mode @var{mode}, tree @var{type}, int *@var{pretend_args_size}, int @var{second_time}) +@deftypefn {Target Hook} void TARGET_SETUP_INCOMING_VARARGS (cumulative_args_t @var{args_so_far}, const function_arg_info @var{&arg}, int *@var{pretend_args_size}, int @var{second_time}) This target hook offers an alternative to using @code{__builtin_saveregs} and defining the hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. Use it to store the anonymous @@ -5213,8 +5213,8 @@ pass all their arguments on the stack. The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data structure, containing the values that are obtained after processing the -named arguments. The arguments @var{mode} and @var{type} describe the -last named argument---its machine mode and its data type as a tree node. +named arguments. The argument @var{arg} describes the last of these named +arguments. The target hook should do two things: first, push onto the stack all the argument registers @emph{not} used for the named arguments, and second, diff --git a/gcc/function.c b/gcc/function.c index 37223caee76..ad61662943e 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -2485,9 +2485,9 @@ assign_parms_setup_varargs (struct assign_parm_data_all *all, { int varargs_pretend_bytes = 0; - targetm.calls.setup_incoming_varargs (all->args_so_far, - data->promoted_mode, - data->passed_type, + function_arg_info last_named_arg (data->passed_type, data->promoted_mode, + /*named=*/true); + targetm.calls.setup_incoming_varargs (all->args_so_far, last_named_arg, &varargs_pretend_bytes, no_rtl); /* If the back-end has requested extra stack space, record how much is diff --git a/gcc/target.def b/gcc/target.def index 9e798bc6e00..1756314981f 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4486,8 +4486,8 @@ pass all their arguments on the stack.\n\ \n\ The argument @var{args_so_far} points to the @code{CUMULATIVE_ARGS} data\n\ structure, containing the values that are obtained after processing the\n\ -named arguments. The arguments @var{mode} and @var{type} describe the\n\ -last named argument---its machine mode and its data type as a tree node.\n\ +named arguments. The argument @var{arg} describes the last of these named\n\ +arguments.\n\ \n\ The target hook should do two things: first, push onto the stack all the\n\ argument registers @emph{not} used for the named arguments, and second,\n\ @@ -4507,7 +4507,7 @@ arguments of the function are being analyzed for the second time. This\n\ happens for an inline function, which is not actually compiled until the\n\ end of the source file. The hook @code{TARGET_SETUP_INCOMING_VARARGS} should\n\ not generate any instructions in this case.", - void, (cumulative_args_t args_so_far, machine_mode mode, tree type, + void, (cumulative_args_t args_so_far, const function_arg_info &arg, int *pretend_args_size, int second_time), default_setup_incoming_varargs) diff --git a/gcc/targhooks.c b/gcc/targhooks.c index de144bf2f5b..854f2404fae 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -193,11 +193,8 @@ default_expand_builtin_saveregs (void) } void -default_setup_incoming_varargs (cumulative_args_t ca ATTRIBUTE_UNUSED, - machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, - int *pretend_arg_size ATTRIBUTE_UNUSED, - int second_time ATTRIBUTE_UNUSED) +default_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, int *, int) { } diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 2009f183c5f..34bb3c0430d 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -40,7 +40,9 @@ extern machine_mode default_cc_modes_compatible (machine_mode, extern bool default_return_in_memory (const_tree, const_tree); extern rtx default_expand_builtin_saveregs (void); -extern void default_setup_incoming_varargs (cumulative_args_t, machine_mode, tree, int *, int); +extern void default_setup_incoming_varargs (cumulative_args_t, + const function_arg_info &, + int *, int); extern rtx default_builtin_setjmp_frame_value (void); extern bool default_pretend_outgoing_varargs_named (cumulative_args_t); -- 2.30.2