From 6930c98c69ad695469ee7daa74b3b6d578afdd0d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 20 Aug 2019 08:53:14 +0000 Subject: Use function_arg_info for TARGET_FUNCTION_ARG_ADVANCE There seems to be a bit of confusion around this one. Almost all callers pass the same arguments as TARGET_FUNCTION_ARG, meaning that the mode is the promoted mode rather than the type mode. But the calls.c handling for normal typed arguments instead passes the unpromoted TYPE_MODE (despite passing the promoted mode to TARGET_FUNCTION_ARG). I've kept this behaviour with a ??? comment. (The calls.c handling of libgcc functions does pass the promoted mode though, as does the function.c handling of incoming arguments.) Also, a couple of the arm callers don't seem to be using the hook correctly. Again I kept the current choices and added a ??? comment. 2019-08-20 Richard Sandiford gcc/ * target.def (function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * doc/tm.texi: Regenerate. * targhooks.h (default_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * targhooks.c (default_function_arg_advance): Likewise. * calls.c (initialize_argument_information): Update call to targetm.calls.function_arg_advance. (emit_library_call_value_1): Likewise. * dse.c (get_call_args): Likewise. * expr.c (block_move_libcall_safe_for_call_parm): Likewise. * function.c (assign_parms, gimplify_parameters): Likewise. * var-tracking.c (prepare_call_arguments): Likewise. * config/aarch64/aarch64.c (aarch64_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (aarch64_setup_incoming_varargs): Update call accordingly. * config/alpha/alpha.c (alpha_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (alpha_setup_incoming_varargs): Update call accordingly. * config/arc/arc.c (arc_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (arc_setup_incoming_varargs): Update call accordingly. * config/arm/arm.c (arm_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (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_advance): Take a function_arg_info instead of a mode, type and named flag. * config/bfin/bfin.c (bfin_function_arg_advance): Likewise. * config/c6x/c6x.c (c6x_function_arg_advance): Likewise. (c6x_call_saved_register_used): Update call accordingly. * config/cr16/cr16.c (cr16_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/cris/cris.c (cris_function_arg_advance): Likewise. * config/csky/csky.c (csky_function_arg_advance): Likewise. (csky_setup_incoming_varargs): Update call accordingly. * config/epiphany/epiphany.c (epiphany_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/fr30/fr30.c (fr30_function_arg_advance): Likewise. * config/frv/frv.c (frv_function_arg_advance): Likewise. * config/ft32/ft32.c (ft32_function_arg_advance): Likewise. * config/gcn/gcn.c (gcn_function_arg_advance): Likewise. * config/h8300/h8300.c (h8300_function_arg_advance): Likewise. * config/i386/i386.c (ix86_function_arg_advance): Likewise. (ix86_setup_incoming_varargs): Update call accordingly. * config/ia64/ia64.c (ia64_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (ia64_setup_incoming_varargs): Update call accordingly. * config/iq2000/iq2000.c (iq2000_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (iq2000_expand_prologue): Update call accordingly. * config/lm32/lm32.c (lm32_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/m32c/m32c.c (m32c_function_arg_advance): Likewise. * config/m32r/m32r.c (m32r_function_arg_advance): Likewise. * config/m68k/m68k.c (m68k_function_arg_advance): Likewise. * config/mcore/mcore.c (mcore_function_arg_advance): Likewise. * config/microblaze/microblaze.c (microblaze_function_arg_advance): Likewise. (microblaze_expand_prologue): Update call accordingly. * config/mips/mips.c (mips_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (mips_setup_incoming_varargs): Update call accordingly. (mips_output_args_xfer): Likewise. * config/mmix/mmix.c (mmix_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/mn10300/mn10300.c (mn10300_function_arg_advance): Likewise. * config/moxie/moxie.c (moxie_function_arg_advance): Likewise. * config/msp430/msp430.c (msp430_function_arg_advance): Likewise. * config/nds32/nds32.c (nds32_function_arg_advance): Likewise. * config/nios2/nios2.c (nios2_function_arg_advance): Likewise. (nios2_setup_incoming_varargs): Update call accordingly. * config/nvptx/nvptx.c (nvptx_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/or1k/or1k.c (or1k_function_arg_advance): Likewise. * config/pa/pa.c (pa_function_arg_advance): Likewise. * config/pdp11/pdp11.c (pdp11_function_arg_advance): Likewise. * config/pru/pru.c (pru_function_arg_advance): Likewise. * config/riscv/riscv.c (riscv_function_arg_advance): Likewise. (riscv_setup_incoming_varargs): Update call accordingly. * config/rl78/rl78.c (rl78_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/rs6000/rs6000-internal.h (rs6000_function_arg_advance): Likewise. * config/rs6000/rs6000-call.c (rs6000_function_arg_advance): Likewise. (rs6000_parm_needs_stack): Update call accordingly. * config/rx/rx.c (rx_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/s390/s390.c (s390_function_arg_advance): Likewise. (s390_call_saved_register_used): Update call accordingly. * config/sh/sh.c (sh_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (sh_output_mi_thunk): Update call accordingly. * config/sparc/sparc.c (sparc_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/spu/spu.c (spu_function_arg_advance): Likewise. (spu_setup_incoming_varargs): Update call accordingly. * config/stormy16/stormy16.c (xstormy16_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/tilegx/tilegx.c (tilegx_function_arg_advance): Likewise. (tilegx_setup_incoming_varargs): Update call accordingly. * config/tilepro/tilepro.c (tilepro_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. (tilegx_setup_incoming_varargs): Update call accordingly. * config/v850/v850.c (v850_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. * config/vax/vax.c (vax_function_arg_advance): Likewise. * config/visium/visium.c (visium_function_arg_advance): Likewise. (visium_setup_incoming_varargs): Update call accordingly. * config/xtensa/xtensa.c (xtensa_function_arg_advance): Take a function_arg_info instead of a mode, type and named flag. From-SVN: r274701 --- gcc/ChangeLog | 115 ++++++++++++++++++++++++++++++++++++ gcc/calls.c | 13 ++-- gcc/config/aarch64/aarch64.c | 9 +-- gcc/config/alpha/alpha.c | 17 +++--- gcc/config/arc/arc.c | 28 +++------ gcc/config/arm/arm.c | 38 ++++++------ gcc/config/avr/avr.c | 6 +- gcc/config/bfin/bfin.c | 10 ++-- gcc/config/c6x/c6x.c | 7 +-- gcc/config/cr16/cr16.c | 18 +++--- gcc/config/cris/cris.c | 10 ++-- gcc/config/csky/csky.c | 8 +-- gcc/config/epiphany/epiphany.c | 11 ++-- gcc/config/fr30/fr30.c | 20 +++---- gcc/config/frv/frv.c | 22 +++---- gcc/config/ft32/ft32.c | 7 ++- gcc/config/gcn/gcn.c | 10 ++-- gcc/config/h8300/h8300.c | 13 ++-- gcc/config/i386/i386.c | 26 ++++---- gcc/config/ia64/ia64.c | 39 ++++++------ gcc/config/iq2000/iq2000.c | 28 ++++----- gcc/config/lm32/lm32.c | 9 ++- gcc/config/m32c/m32c.c | 8 +-- gcc/config/m32r/m32r.c | 16 +++-- gcc/config/m68k/m68k.c | 12 ++-- gcc/config/mcore/mcore.c | 11 ++-- gcc/config/microblaze/microblaze.c | 16 +++-- gcc/config/mips/mips.c | 14 ++--- gcc/config/mmix/mmix.c | 12 ++-- gcc/config/mn10300/mn10300.c | 12 ++-- gcc/config/moxie/moxie.c | 6 +- gcc/config/msp430/msp430.c | 6 +- gcc/config/nds32/nds32.c | 8 ++- gcc/config/nios2/nios2.c | 22 ++----- gcc/config/nvptx/nvptx.c | 5 +- gcc/config/or1k/or1k.c | 8 +-- gcc/config/pa/pa.c | 16 +++-- gcc/config/pdp11/pdp11.c | 14 ++--- gcc/config/pru/pru.c | 14 ++--- gcc/config/riscv/riscv.c | 9 ++- gcc/config/rl78/rl78.c | 7 +-- gcc/config/rs6000/rs6000-call.c | 10 ++-- gcc/config/rs6000/rs6000-internal.h | 5 +- gcc/config/rx/rx.c | 6 +- gcc/config/s390/s390.c | 22 +++---- gcc/config/sh/sh.c | 32 +++++----- gcc/config/sparc/sparc.c | 14 ++--- gcc/config/spu/spu.c | 17 +++--- gcc/config/stormy16/stormy16.c | 14 ++--- gcc/config/tilegx/tilegx.c | 11 ++-- gcc/config/tilepro/tilepro.c | 11 ++-- gcc/config/v850/v850.c | 19 +++--- gcc/config/vax/vax.c | 16 ++--- gcc/config/visium/visium.c | 28 ++++----- gcc/config/xtensa/xtensa.c | 15 +++-- gcc/doc/tm.texi | 5 +- gcc/dse.c | 2 +- gcc/expr.c | 3 +- gcc/function.c | 10 ++-- gcc/target.def | 5 +- gcc/targhooks.c | 5 +- gcc/targhooks.h | 2 +- gcc/var-tracking.c | 7 +-- 63 files changed, 470 insertions(+), 469 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6377619..c0be9bb00 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,120 @@ 2019-08-20 Richard Sandiford + * target.def (function_arg_advance): Take a function_arg_info instead + of a mode, type and named flag. + * doc/tm.texi: Regenerate. + * targhooks.h (default_function_arg_advance): Take a function_arg_info + instead of a mode, type and named flag. + * targhooks.c (default_function_arg_advance): Likewise. + * calls.c (initialize_argument_information): Update call to + targetm.calls.function_arg_advance. + (emit_library_call_value_1): Likewise. + * dse.c (get_call_args): Likewise. + * expr.c (block_move_libcall_safe_for_call_parm): Likewise. + * function.c (assign_parms, gimplify_parameters): Likewise. + * var-tracking.c (prepare_call_arguments): Likewise. + * config/aarch64/aarch64.c (aarch64_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (aarch64_setup_incoming_varargs): Update call accordingly. + * config/alpha/alpha.c (alpha_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (alpha_setup_incoming_varargs): Update call accordingly. + * config/arc/arc.c (arc_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (arc_setup_incoming_varargs): Update call accordingly. + * config/arm/arm.c (arm_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (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_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/bfin/bfin.c (bfin_function_arg_advance): Likewise. + * config/c6x/c6x.c (c6x_function_arg_advance): Likewise. + (c6x_call_saved_register_used): Update call accordingly. + * config/cr16/cr16.c (cr16_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/cris/cris.c (cris_function_arg_advance): Likewise. + * config/csky/csky.c (csky_function_arg_advance): Likewise. + (csky_setup_incoming_varargs): Update call accordingly. + * config/epiphany/epiphany.c (epiphany_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/fr30/fr30.c (fr30_function_arg_advance): Likewise. + * config/frv/frv.c (frv_function_arg_advance): Likewise. + * config/ft32/ft32.c (ft32_function_arg_advance): Likewise. + * config/gcn/gcn.c (gcn_function_arg_advance): Likewise. + * config/h8300/h8300.c (h8300_function_arg_advance): Likewise. + * config/i386/i386.c (ix86_function_arg_advance): Likewise. + (ix86_setup_incoming_varargs): Update call accordingly. + * config/ia64/ia64.c (ia64_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (ia64_setup_incoming_varargs): Update call accordingly. + * config/iq2000/iq2000.c (iq2000_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (iq2000_expand_prologue): Update call accordingly. + * config/lm32/lm32.c (lm32_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/m32c/m32c.c (m32c_function_arg_advance): Likewise. + * config/m32r/m32r.c (m32r_function_arg_advance): Likewise. + * config/m68k/m68k.c (m68k_function_arg_advance): Likewise. + * config/mcore/mcore.c (mcore_function_arg_advance): Likewise. + * config/microblaze/microblaze.c (microblaze_function_arg_advance): + Likewise. + (microblaze_expand_prologue): Update call accordingly. + * config/mips/mips.c (mips_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (mips_setup_incoming_varargs): Update call accordingly. + (mips_output_args_xfer): Likewise. + * config/mmix/mmix.c (mmix_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/mn10300/mn10300.c (mn10300_function_arg_advance): Likewise. + * config/moxie/moxie.c (moxie_function_arg_advance): Likewise. + * config/msp430/msp430.c (msp430_function_arg_advance): Likewise. + * config/nds32/nds32.c (nds32_function_arg_advance): Likewise. + * config/nios2/nios2.c (nios2_function_arg_advance): Likewise. + (nios2_setup_incoming_varargs): Update call accordingly. + * config/nvptx/nvptx.c (nvptx_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/or1k/or1k.c (or1k_function_arg_advance): Likewise. + * config/pa/pa.c (pa_function_arg_advance): Likewise. + * config/pdp11/pdp11.c (pdp11_function_arg_advance): Likewise. + * config/pru/pru.c (pru_function_arg_advance): Likewise. + * config/riscv/riscv.c (riscv_function_arg_advance): Likewise. + (riscv_setup_incoming_varargs): Update call accordingly. + * config/rl78/rl78.c (rl78_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/rs6000/rs6000-internal.h (rs6000_function_arg_advance): + Likewise. + * config/rs6000/rs6000-call.c (rs6000_function_arg_advance): Likewise. + (rs6000_parm_needs_stack): Update call accordingly. + * config/rx/rx.c (rx_function_arg_advance): Take a function_arg_info + instead of a mode, type and named flag. + * config/s390/s390.c (s390_function_arg_advance): Likewise. + (s390_call_saved_register_used): Update call accordingly. + * config/sh/sh.c (sh_function_arg_advance): Take a function_arg_info + instead of a mode, type and named flag. + (sh_output_mi_thunk): Update call accordingly. + * config/sparc/sparc.c (sparc_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/spu/spu.c (spu_function_arg_advance): Likewise. + (spu_setup_incoming_varargs): Update call accordingly. + * config/stormy16/stormy16.c (xstormy16_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/tilegx/tilegx.c (tilegx_function_arg_advance): Likewise. + (tilegx_setup_incoming_varargs): Update call accordingly. + * config/tilepro/tilepro.c (tilepro_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + (tilegx_setup_incoming_varargs): Update call accordingly. + * config/v850/v850.c (v850_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + * config/vax/vax.c (vax_function_arg_advance): Likewise. + * config/visium/visium.c (visium_function_arg_advance): Likewise. + (visium_setup_incoming_varargs): Update call accordingly. + * config/xtensa/xtensa.c (xtensa_function_arg_advance): Take a + function_arg_info instead of a mode, type and named flag. + +2019-08-20 Richard Sandiford + * target.def (function_arg, function_incoming_arg): Take a function_arg_info instead of a mode, tree and named flag. * doc/tm.texi: Regenerate. diff --git a/gcc/calls.c b/gcc/calls.c index 7947009..69a3184 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2192,8 +2192,13 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, /* Increment ARGS_SO_FAR, which has info about which arg-registers have been used, etc. */ - targetm.calls.function_arg_advance (args_so_far, TYPE_MODE (type), - type, argpos < n_named_args); + /* ??? Traditionally we've passed TYPE_MODE here, instead of the + promoted_mode used for function_arg above. However, the + corresponding handling of incoming arguments in function.c + does pass the promoted mode. */ + function_arg_info arg_to_skip (type, TYPE_MODE (type), + argpos < n_named_args); + targetm.calls.function_arg_advance (args_so_far, arg_to_skip); /* Store argument values for functions decorated with attribute alloc_size. */ @@ -4881,7 +4886,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, || reg_parm_stack_space > 0) args_size.constant += argvec[count].locate.size.constant; - targetm.calls.function_arg_advance (args_so_far, Pmode, (tree) 0, true); + targetm.calls.function_arg_advance (args_so_far, ptr_arg); count++; } @@ -4977,7 +4982,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, known_le (GET_MODE_SIZE (mode), UNITS_PER_WORD)); #endif - targetm.calls.function_arg_advance (args_so_far, mode, (tree) 0, true); + targetm.calls.function_arg_advance (args_so_far, arg); } for (int i = 0; i < nargs; i++) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index e8e13a2..f13a777 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -4846,14 +4846,12 @@ aarch64_init_cumulative_args (CUMULATIVE_ARGS *pcum, static void aarch64_function_arg_advance (cumulative_args_t pcum_v, - machine_mode mode, - const_tree type, - bool named) + const function_arg_info &arg) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); if (pcum->pcs_variant == ARM_PCS_AAPCS64) { - aarch64_layout_arg (pcum_v, mode, type, named); + aarch64_layout_arg (pcum_v, arg.mode, arg.type, arg.named); gcc_assert ((pcum->aapcs_reg != NULL_RTX) != (pcum->aapcs_stack_words != 0)); pcum->aapcs_arg_processed = false; @@ -14523,8 +14521,7 @@ aarch64_setup_incoming_varargs (cumulative_args_t cum_v, 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), - arg.mode, arg.type, arg.named); + aarch64_function_arg_advance (pack_cumulative_args(&local_cum), arg); /* 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 f43415a..477c24e 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5606,23 +5606,21 @@ alpha_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return gen_rtx_REG (arg.mode, num_args + basereg); } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -alpha_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +alpha_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - bool onstack = targetm.calls.must_pass_in_stack (mode, type); - int increment = onstack ? 6 : ALPHA_ARG_SIZE (mode, type); + bool onstack = targetm.calls.must_pass_in_stack (arg.mode, arg.type); + int increment = onstack ? 6 : ALPHA_ARG_SIZE (arg.mode, arg.type); #if TARGET_ABI_OSF *cum += increment; #else if (!onstack && cum->num_args < 6) - cum->atypes[cum->num_args] = alpha_arg_type (mode); + cum->atypes[cum->num_args] = alpha_arg_type (arg.mode); cum->num_args += increment; #endif } @@ -6090,8 +6088,7 @@ alpha_setup_incoming_varargs (cumulative_args_t pcum, CUMULATIVE_ARGS cum = *get_cumulative_args (pcum); /* Skip the current argument. */ - targetm.calls.function_arg_advance (pack_cumulative_args (&cum), - arg.mode, arg.type, arg.named); + targetm.calls.function_arg_advance (pack_cumulative_args (&cum), arg); #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 9eb9e90..d603406 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -642,8 +642,8 @@ static bool arc_can_follow_jump (const rtx_insn *follower, const rtx_insn *followee); static rtx frame_insn (rtx); -static void arc_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void arc_function_arg_advance (cumulative_args_t, + const function_arg_info &); static rtx arc_legitimize_address_0 (rtx, rtx, machine_mode mode); /* initialize the GCC target structure. */ @@ -2429,8 +2429,7 @@ arc_setup_incoming_varargs (cumulative_args_t args_so_far, /* We must treat `__builtin_va_alist' as an anonymous arg. */ next_cum = *get_cumulative_args (args_so_far); - arc_function_arg_advance (pack_cumulative_args (&next_cum), - arg.mode, arg.type, arg.named); + arc_function_arg_advance (pack_cumulative_args (&next_cum), arg); first_anon_arg = next_cum; if (FUNCTION_ARG_REGNO_P (first_anon_arg)) @@ -6480,17 +6479,7 @@ arc_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return ret; } -/* The function to update the summarizer variable *CUM to advance past - an argument in the argument list. The values MODE, TYPE and NAMED - describe that argument. Once this is done, the variable *CUM is - suitable for analyzing the *following* argument with - `FUNCTION_ARG', etc. - - This function need not do anything if the argument in question was - passed on the stack. The compiler knows how to track the amount of - stack space used for arguments without any special help. - - The function is used to implement macro FUNCTION_ARG_ADVANCE. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE. */ /* For the ARC: the cum set here is passed on to function_arg where we look at its value and say which reg to use. Strategy: advance the regnumber here till we run out of arg regs, then set *cum to last @@ -6500,18 +6489,15 @@ arc_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) static void arc_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode, - const_tree type, - bool named ATTRIBUTE_UNUSED) + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - int bytes = (mode == BLKmode - ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode)); + int bytes = arg.promoted_size_in_bytes (); int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; int i; if (words) - *cum = ROUND_ADVANCE_CUM (*cum, mode, type); + *cum = ROUND_ADVANCE_CUM (*cum, arg.mode, arg.type); for (i = 0; i < words; i++) *cum = ARC_NEXT_ARG_REG (*cum); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index e926578..74e7c54 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -190,8 +190,8 @@ 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, const function_arg_info &); -static void arm_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void arm_function_arg_advance (cumulative_args_t, + const function_arg_info &); static pad_direction arm_function_arg_padding (machine_mode, const_tree); static unsigned int arm_function_arg_boundary (machine_mode, const_tree); static rtx aapcs_allocate_return_reg (machine_mode, const_tree, @@ -6770,24 +6770,22 @@ arm_arg_partial_bytes (cumulative_args_t pcum_v, const function_arg_info &arg) return 0; } -/* Update the data in PCUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in PCUM to advance over argument ARG. */ static void -arm_function_arg_advance (cumulative_args_t pcum_v, machine_mode mode, - const_tree type, bool named) +arm_function_arg_advance (cumulative_args_t pcum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); 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); if (pcum->aapcs_cprc_slot >= 0) { - aapcs_cp_arg_layout[pcum->aapcs_cprc_slot].advance (pcum, mode, - type); + aapcs_cp_arg_layout[pcum->aapcs_cprc_slot].advance (pcum, arg.mode, + arg.type); pcum->aapcs_cprc_slot = -1; } @@ -6800,12 +6798,12 @@ arm_function_arg_advance (cumulative_args_t pcum_v, machine_mode mode, else { pcum->nargs += 1; - if (arm_vector_mode_supported_p (mode) + if (arm_vector_mode_supported_p (arg.mode) && pcum->named_count > pcum->nargs && TARGET_IWMMXT_ABI) pcum->iwmmxt_nregs += 1; else - pcum->nregs += ARM_NUM_REGS2 (mode, type); + pcum->nregs += ARM_NUM_REGS2 (arg.mode, arg.type); } } @@ -6984,7 +6982,6 @@ cmse_func_args_or_return_in_stack (tree fndecl, tree name, tree fntype) FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter) { rtx arg_rtx; - machine_mode arg_mode = TYPE_MODE (arg_type); prev_arg_type = arg_type; if (VOID_TYPE_P (arg_type)) @@ -6992,7 +6989,9 @@ cmse_func_args_or_return_in_stack (tree fndecl, tree name, tree fntype) function_arg_info arg (arg_type, /*named=*/true); if (!first_param) - arm_function_arg_advance (args_so_far, arg_mode, arg_type, true); + /* ??? We should advance after processing the argument and pass + the argument we're advancing past. */ + arm_function_arg_advance (args_so_far, arg); arg_rtx = arm_function_arg (args_so_far, arg); if (!arg_rtx || arm_arg_partial_bytes (args_so_far, arg)) { @@ -7378,7 +7377,10 @@ arm_function_ok_for_sibcall (tree decl, tree exp) { tree type = TREE_VALUE (t); if (!VOID_TYPE_P (type)) - arm_function_arg_advance (cum_v, TYPE_MODE (type), type, true); + { + function_arg_info arg (type, /*named=*/true); + arm_function_arg_advance (cum_v, arg); + } } function_arg_info arg (integer_type_node, /*named=*/true); @@ -17441,15 +17443,15 @@ cmse_nonsecure_call_clear_caller_saved (void) { rtx arg_rtx; uint64_t to_clear_args_mask; - machine_mode arg_mode = TYPE_MODE (arg_type); 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); + /* ??? We should advance after processing the argument and pass + the argument we're advancing past. */ + arm_function_arg_advance (args_so_far, arg); arg_rtx = arm_function_arg (args_so_far, arg); gcc_assert (REG_P (arg_rtx)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index d6a35f2..6a5271d 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -3405,11 +3405,11 @@ avr_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) in the argument list. */ static void -avr_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +avr_function_arg_advance (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); cum->nregs -= bytes; cum->regno -= bytes; diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 45fbd39..80ab777 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -1647,18 +1647,16 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, return; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -bfin_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +bfin_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int count, bytes, words; - bytes = (mode == BLKmode) ? int_size_in_bytes (type) : GET_MODE_SIZE (mode); + bytes = arg.promoted_size_in_bytes (); words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; cum->words += words; diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index 3271526..383634f 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -526,10 +526,7 @@ c6x_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) } static void -c6x_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode ATTRIBUTE_UNUSED, - const_tree type ATTRIBUTE_UNUSED, - bool named ATTRIBUTE_UNUSED) +c6x_function_arg_advance (cumulative_args_t cum_v, const function_arg_info &) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); cum->count++; @@ -1136,7 +1133,7 @@ c6x_call_saved_register_used (tree call_expr) function_arg_info arg (type, mode, /*named=*/false); parm_rtx = c6x_function_arg (cum, arg); - c6x_function_arg_advance (cum, mode, type, 0); + c6x_function_arg_advance (cum, arg); if (!parm_rtx) continue; diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c index 2518521..dc4cb91 100644 --- a/gcc/config/cr16/cr16.c +++ b/gcc/config/cr16/cr16.c @@ -660,34 +660,34 @@ cr16_init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype, /* Implements the macro FUNCTION_ARG_ADVANCE defined in cr16.h. */ static void -cr16_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +cr16_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS * cum = get_cumulative_args (cum_v); /* l holds the number of registers required. */ - int l = GET_MODE_BITSIZE (mode) / BITS_PER_WORD; + int l = GET_MODE_BITSIZE (arg.mode) / BITS_PER_WORD; /* If the parameter isn't passed on a register don't advance cum. */ if (!cum->last_parm_in_reg) return; - 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; - if ((mode == SImode) || (mode == HImode) - || (mode == QImode) || (mode == DImode)) + if ((arg.mode == SImode) || (arg.mode == HImode) + || (arg.mode == QImode) || (arg.mode == DImode)) { if (l <= 1) cum->ints += 1; else cum->ints += l; } - else if ((mode == SFmode) || (mode == DFmode)) + else if ((arg.mode == SFmode) || (arg.mode == DFmode)) cum->ints += l; - else if ((mode) == BLKmode) + else if (arg.mode == BLKmode) { - if ((l = enough_regs_for_param (cum, type, mode)) != 0) + if ((l = enough_regs_for_param (cum, arg.type, arg.mode)) != 0) cum->ints += l; } return; diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 5317e49..f238853 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -147,8 +147,8 @@ static int cris_arg_partial_bytes (cumulative_args_t, static rtx cris_function_arg (cumulative_args_t, const function_arg_info &); static rtx cris_function_incoming_arg (cumulative_args_t, const function_arg_info &); -static void cris_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void cris_function_arg_advance (cumulative_args_t, + const function_arg_info &); static rtx_insn *cris_md_asm_adjust (vec &, vec &, vec &, vec &, HARD_REG_SET &); @@ -4156,12 +4156,12 @@ cris_function_incoming_arg (cumulative_args_t ca, const function_arg_info &arg) /* Worker function for TARGET_FUNCTION_ARG_ADVANCE. */ static void -cris_function_arg_advance (cumulative_args_t ca_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +cris_function_arg_advance (cumulative_args_t ca_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v); - ca->regs += (3 + CRIS_FUNCTION_ARG_SIZE (mode, type)) / 4; + ca->regs += (3 + CRIS_FUNCTION_ARG_SIZE (arg.mode, arg.type)) / 4; } /* Worker function for TARGET_MD_ASM_ADJUST. */ diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index 13312af..309d00d 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -1819,11 +1819,11 @@ csky_num_arg_regs (machine_mode mode, const_tree type) /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -csky_function_arg_advance (cumulative_args_t pcum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +csky_function_arg_advance (cumulative_args_t pcum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); - int param_size = csky_num_arg_regs (mode, type); + int param_size = csky_num_arg_regs (arg.mode, arg.type); if (*pcum + param_size > CSKY_NPARM_REGS) *pcum = CSKY_NPARM_REGS; @@ -1941,7 +1941,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, arg.mode, arg.type, arg.named); + csky_function_arg_advance (local_cum_v, arg); 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 e1f8148..7dfb91f 100644 --- a/gcc/config/epiphany/epiphany.c +++ b/gcc/config/epiphany/epiphany.c @@ -2269,16 +2269,15 @@ epiphany_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return 0; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -epiphany_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +epiphany_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum = ROUND_ADVANCE_CUM (*cum, mode, type) + ROUND_ADVANCE_ARG (mode, type); + *cum = (ROUND_ADVANCE_CUM (*cum, arg.mode, arg.type) + + ROUND_ADVANCE_ARG (arg.mode, arg.type)); } /* Nested function support. diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index 873606a..7f1eae1 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -120,8 +120,8 @@ 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, const function_arg_info &); -static void fr30_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void fr30_function_arg_advance (cumulative_args_t, + const function_arg_info &); static bool fr30_frame_pointer_required (void); static rtx fr30_function_value (const_tree, const_tree, bool); static rtx fr30_libcall_value (machine_mode, const_rtx); @@ -811,19 +811,13 @@ fr30_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return gen_rtx_REG (arg.mode, *cum + FIRST_ARG_REGNUM); } -/* A C statement (sans semicolon) to update the summarizer variable CUM to - advance past an argument in the argument list. The values MODE, TYPE and - NAMED describe that argument. Once this is done, the variable CUM is - suitable for analyzing the *following* argument with `FUNCTION_ARG', etc. - - This macro need not do anything if the argument in question was passed on - the stack. The compiler knows how to track the amount of stack space used - for arguments without any special help. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -fr30_function_arg_advance (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named) +fr30_function_arg_advance (cumulative_args_t cum, + const function_arg_info &arg) { - *get_cumulative_args (cum) += named * fr30_num_arg_regs (mode, type); + if (arg.named) + *get_cumulative_args (cum) += fr30_num_arg_regs (arg.mode, arg.type); } /*}}}*/ diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index 08163f0..5d319c0 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -385,8 +385,8 @@ static int frv_arg_partial_bytes (cumulative_args_t, 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 void frv_function_arg_advance (cumulative_args_t, + const function_arg_info &); static unsigned int frv_function_arg_boundary (machine_mode, const_tree); static void frv_output_dwarf_dtprel (FILE *, int, rtx) @@ -3149,24 +3149,15 @@ frv_function_incoming_arg (cumulative_args_t cum, const function_arg_info &arg) } -/* A C statement (sans semicolon) to update the summarizer variable CUM to - advance past an argument in the argument list. The values MODE, TYPE and - NAMED describe that argument. Once this is done, the variable CUM is - suitable for analyzing the *following* argument with `FUNCTION_ARG', etc. - - This macro need not do anything if the argument in question was passed on - the stack. The compiler knows how to track the amount of stack space used - for arguments without any special help. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void frv_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode, - const_tree type ATTRIBUTE_UNUSED, - bool named) + const function_arg_info &arg) { 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 bytes = GET_MODE_SIZE (xmode); int words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; int arg_num = *cum; @@ -3176,7 +3167,8 @@ frv_function_arg_advance (cumulative_args_t cum_v, if (TARGET_DEBUG_ARG) fprintf (stderr, "function_adv: words = %2d, mode = %4s, named = %d, size = %3d\n", - arg_num, GET_MODE_NAME (mode), named, words * UNITS_PER_WORD); + arg_num, GET_MODE_NAME (arg.mode), arg.named, + words * UNITS_PER_WORD); } diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c index 6dc91db..e9eb4d4 100644 --- a/gcc/config/ft32/ft32.c +++ b/gcc/config/ft32/ft32.c @@ -672,13 +672,14 @@ ft32_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) : (unsigned) int_size_in_bytes (TYPE)) static void -ft32_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +ft32_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); *cum = (*cum < FT32_R6 - ? *cum + ((3 + FT32_FUNCTION_ARG_SIZE (mode, type)) / 4) : *cum); + ? *cum + ((3 + FT32_FUNCTION_ARG_SIZE (arg.mode, arg.type)) / 4) + : *cum); } /* Return non-zero if the function argument described by ARG is to be diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 9f4e9ee..c919d31 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -2313,17 +2313,17 @@ gcn_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) argument in the argument list. */ static void -gcn_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +gcn_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); if (cum->normal_function) { - if (!named) + if (!arg.named) return; - int num_regs = num_arg_regs (mode, type); + int num_regs = num_arg_regs (arg.mode, arg.type); if (num_regs > 0) while ((FIRST_PARM_REG + cum->num) % num_regs != 0) cum->num++; @@ -2335,7 +2335,7 @@ gcn_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, cum->num++; else { - cum->offset += tree_to_uhwi (TYPE_SIZE_UNIT (type)); + cum->offset += tree_to_uhwi (TYPE_SIZE_UNIT (arg.type)); cfun->machine->kernarg_segment_byte_size = cum->offset; } } diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 653d0ec..c51b32d 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1151,19 +1151,16 @@ h8300_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return result; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -h8300_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +h8300_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - cum->nbytes += (mode != BLKmode - ? (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD - : (int_size_in_bytes (type) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD); + cum->nbytes += ((arg.promoted_size_in_bytes () + UNITS_PER_WORD - 1) + & -UNITS_PER_WORD); } diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9950d2d..f036d56 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2919,15 +2919,14 @@ function_arg_advance_ms_64 (CUMULATIVE_ARGS *cum, HOST_WIDE_INT bytes, return 0; } -/* Update the data in CUM to advance over an argument of mode MODE and - data type TYPE. (TYPE is null for libcalls where that information - may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +ix86_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); + machine_mode mode = arg.mode; HOST_WIDE_INT bytes, words; int nregs; @@ -2936,14 +2935,11 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, if (!cum->caller && cfun->machine->func_type != TYPE_NORMAL) return; - 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); - if (type) - mode = type_natural_mode (type, NULL, false); + if (arg.type) + mode = type_natural_mode (arg.type, NULL, false); if (TARGET_64BIT) { @@ -2952,10 +2948,11 @@ ix86_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, if (call_abi == MS_ABI) nregs = function_arg_advance_ms_64 (cum, bytes, words); else - nregs = function_arg_advance_64 (cum, mode, type, words, named); + nregs = function_arg_advance_64 (cum, mode, arg.type, words, + arg.named); } else - nregs = function_arg_advance_32 (cum, mode, type, bytes, words); + nregs = function_arg_advance_32 (cum, mode, arg.type, bytes, words); if (!nregs) { @@ -4109,8 +4106,7 @@ ix86_setup_incoming_varargs (cumulative_args_t cum_v, 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), - arg.mode, arg.type, arg.named); + ix86_function_arg_advance (pack_cumulative_args (&next_cum), arg); 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 0de27a3..bfec69b 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -207,8 +207,8 @@ static int ia64_arg_partial_bytes (cumulative_args_t, static rtx ia64_function_arg (cumulative_args_t, const function_arg_info &); static rtx ia64_function_incoming_arg (cumulative_args_t, const function_arg_info &); -static void ia64_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void ia64_function_arg_advance (cumulative_args_t, + const function_arg_info &); static pad_direction ia64_function_arg_padding (machine_mode, const_tree); static unsigned int ia64_function_arg_boundary (machine_mode, const_tree); @@ -4596,8 +4596,7 @@ ia64_setup_incoming_varargs (cumulative_args_t cum, CUMULATIVE_ARGS next_cum = *get_cumulative_args (cum); /* Skip the current argument. */ - ia64_function_arg_advance (pack_cumulative_args (&next_cum), - arg.mode, arg.type, arg.named); + ia64_function_arg_advance (pack_cumulative_args (&next_cum), arg); if (next_cum.words < MAX_ARGUMENT_SLOTS) { @@ -4999,12 +4998,12 @@ ia64_arg_type (machine_mode mode) ia64_function_arg. */ static void -ia64_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +ia64_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - 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; /* If all arg slots are already full, then there is nothing to do. */ @@ -5014,7 +5013,7 @@ ia64_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, return; } - cum->atypes[cum->words] = ia64_arg_type (mode); + cum->atypes[cum->words] = ia64_arg_type (arg.mode); cum->words += words + offset; /* On OpenVMS argument is either in Rn or Fn. */ @@ -5026,12 +5025,12 @@ ia64_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, } /* 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)) { int fp_regs = cum->fp_regs; /* This is the original value of cum->words + offset. */ @@ -5050,8 +5049,7 @@ ia64_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, /* 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 @@ -5068,26 +5066,29 @@ ia64_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, /* Integral and aggregates go in general registers. So do TFmode FP values. If we have run out of FR registers, then other 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) cum->int_regs = cum->words; /* If there is a prototype, then FP values go in a FR register when named, and in a GR register when unnamed. */ else if (cum->prototype) { - if (! named) + if (! arg.named) cum->int_regs = cum->words; else /* ??? Complex types should not reach here. */ - cum->fp_regs += (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT ? 2 : 1); + cum->fp_regs + += (GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_FLOAT ? 2 : 1); } /* If there is no prototype, then FP values go in both FR and GR registers. */ else { /* ??? Complex types should not reach here. */ - cum->fp_regs += (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT ? 2 : 1); + cum->fp_regs + += (GET_MODE_CLASS (arg.mode) == MODE_COMPLEX_FLOAT ? 2 : 1); cum->int_regs = cum->words; } } diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index e1ea745a..80c6381 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -166,7 +166,7 @@ static int iq2000_arg_partial_bytes (cumulative_args_t, static rtx iq2000_function_arg (cumulative_args_t, const function_arg_info &); static void iq2000_function_arg_advance (cumulative_args_t, - machine_mode, const_tree, bool); + const function_arg_info &); static pad_direction iq2000_function_arg_padding (machine_mode, const_tree); static unsigned int iq2000_function_arg_boundary (machine_mode, const_tree); @@ -1153,12 +1153,11 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, } } -/* Advance the argument of type TYPE and mode MODE to the next argument - position in CUM. */ +/* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -iq2000_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +iq2000_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); @@ -1167,29 +1166,29 @@ iq2000_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, fprintf (stderr, "function_adv({gp reg found = %d, arg # = %2d, words = %2d}, %4s, ", cum->gp_reg_found, cum->arg_number, cum->arg_words, - GET_MODE_NAME (mode)); - fprintf (stderr, "%p", (const void *) type); - fprintf (stderr, ", %d )\n\n", named); + GET_MODE_NAME (arg.mode)); + fprintf (stderr, "%p", (const void *) arg.type); + fprintf (stderr, ", %d )\n\n", arg.named); } cum->arg_number++; - switch (mode) + switch (arg.mode) { case E_VOIDmode: 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); cum->gp_reg_found = 1; - cum->arg_words += ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) + cum->arg_words += ((GET_MODE_SIZE (arg.mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); break; case E_BLKmode: cum->gp_reg_found = 1; - cum->arg_words += ((int_size_in_bytes (type) + UNITS_PER_WORD - 1) + cum->arg_words += ((int_size_in_bytes (arg.type) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); break; @@ -1971,8 +1970,7 @@ iq2000_expand_prologue (void) 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_function_arg_advance (args_so_far, arg); next_arg = DECL_CHAIN (cur_arg); if (entry_parm && store_args_on_stack) diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index cd5663b..a393dff 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -75,8 +75,7 @@ static HOST_WIDE_INT lm32_compute_frame_size (int size); static void lm32_option_override (void); 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); + const function_arg_info &); static bool lm32_hard_regno_mode_ok (unsigned int, machine_mode); static bool lm32_modes_tieable_p (machine_mode, machine_mode); static HOST_WIDE_INT lm32_starting_frame_offset (void); @@ -641,10 +640,10 @@ lm32_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) } static void -lm32_function_arg_advance (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +lm32_function_arg_advance (cumulative_args_t cum, + const function_arg_info &arg) { - *get_cumulative_args (cum) += LM32_NUM_REGS2 (mode, type); + *get_cumulative_args (cum) += LM32_NUM_REGS2 (arg.mode, arg.type); } HOST_WIDE_INT diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 508eb50..ace00e0 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -79,8 +79,8 @@ static bool m32c_addr_space_legitimate_address_p (machine_mode, rtx, bool, addr_ 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, - const_tree, bool); +static void m32c_function_arg_advance (cumulative_args_t, + const function_arg_info &); static unsigned int m32c_function_arg_boundary (machine_mode, const_tree); static int m32c_pushm_popm (Push_Pop_Type); static bool m32c_strict_argument_naming (cumulative_args_t); @@ -1399,9 +1399,7 @@ m32c_init_cumulative_args (CUMULATIVE_ARGS * ca, #define TARGET_FUNCTION_ARG_ADVANCE m32c_function_arg_advance static void m32c_function_arg_advance (cumulative_args_t ca_v, - machine_mode mode ATTRIBUTE_UNUSED, - const_tree type ATTRIBUTE_UNUSED, - bool named ATTRIBUTE_UNUSED) + const function_arg_info &) { CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v); diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 88785fc..52a1e26 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -97,8 +97,8 @@ static bool m32r_pass_by_reference (cumulative_args_t, static int m32r_arg_partial_bytes (cumulative_args_t, const function_arg_info &); 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 void m32r_function_arg_advance (cumulative_args_t, + const function_arg_info &); static bool m32r_can_eliminate (const int, const int); static void m32r_conditional_register_usage (void); static void m32r_trampoline_init (rtx, tree, rtx); @@ -1217,18 +1217,16 @@ m32r_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) : NULL_RTX); } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -m32r_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +m32r_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum = (ROUND_ADVANCE_CUM (*cum, mode, type) - + ROUND_ADVANCE_ARG (mode, type)); + *cum = (ROUND_ADVANCE_CUM (*cum, arg.mode, arg.type) + + ROUND_ADVANCE_ARG (arg.mode, arg.type)); } /* Worker function for TARGET_RETURN_IN_MEMORY. */ diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index cbc6c1c..70f3e5c 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -181,8 +181,8 @@ static void m68k_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED; static void m68k_trampoline_init (rtx, tree, rtx); static poly_int64 m68k_return_pops_args (tree, tree, poly_int64); static rtx m68k_delegitimize_address (rtx); -static void m68k_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void m68k_function_arg_advance (cumulative_args_t, + const function_arg_info &); 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); @@ -1469,14 +1469,12 @@ m68k_function_arg (cumulative_args_t, const function_arg_info &) } static void -m68k_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +m68k_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum += (mode != BLKmode - ? (GET_MODE_SIZE (mode) + 3) & ~3 - : (int_size_in_bytes (type) + 3) & ~3); + *cum += (arg.promoted_size_in_bytes () + 3) & ~3; } /* Convert X to a legitimate function call memory reference and return the diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index f28219f..9feac95 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -135,8 +135,7 @@ static int mcore_arg_partial_bytes (cumulative_args_t, static rtx mcore_function_arg (cumulative_args_t, const function_arg_info &); static void mcore_function_arg_advance (cumulative_args_t, - machine_mode, - const_tree, bool); + const function_arg_info &); static unsigned int mcore_function_arg_boundary (machine_mode, const_tree); static void mcore_asm_trampoline_template (FILE *); @@ -2817,13 +2816,13 @@ mcore_function_arg (cumulative_args_t cum, const function_arg_info &arg) } static void -mcore_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +mcore_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum = (ROUND_REG (*cum, mode) - + (int)named * mcore_num_arg_regs (mode, type)); + *cum = (ROUND_REG (*cum, arg.mode) + + (int) arg.named * mcore_num_arg_regs (arg.mode, arg.type)); } static unsigned int diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index 9fd49b5..3d0f593 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -1543,29 +1543,28 @@ init_cumulative_args (CUMULATIVE_ARGS * cum, tree fntype, static void microblaze_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); cum->arg_number++; - switch (mode) + switch (arg.mode) { case E_VOIDmode: 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); cum->gp_reg_found = 1; - cum->arg_words += ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) + cum->arg_words += ((GET_MODE_SIZE (arg.mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); break; case E_BLKmode: cum->gp_reg_found = 1; - cum->arg_words += ((int_size_in_bytes (type) + UNITS_PER_WORD - 1) + cum->arg_words += ((int_size_in_bytes (arg.type) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); break; @@ -2935,8 +2934,7 @@ microblaze_expand_prologue (void) break; } - targetm.calls.function_arg_advance (args_so_far, passed_mode, - passed_type, true); + targetm.calls.function_arg_advance (args_so_far, arg); next_arg = TREE_CHAIN (cur_arg); if (next_arg == 0) diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 420a7ce..c4d08a4 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6102,13 +6102,13 @@ mips_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -mips_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +mips_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); struct mips_arg_info info; - mips_get_arg_info (&info, cum, mode, type, named); + mips_get_arg_info (&info, cum, arg.mode, arg.type, arg.named); if (!info.fpr_p) cum->gp_reg_found = true; @@ -6118,7 +6118,7 @@ mips_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, either the o32 or the o64 ABI, both of which pass at most 2 arguments in FPRs. */ if (cum->arg_number < 2 && info.fpr_p) - cum->fp_code += (mode == SFmode ? 1 : 2) << (cum->arg_number * 2); + cum->fp_code += (arg.mode == SFmode ? 1 : 2) << (cum->arg_number * 2); /* Advance the register count. This has the effect of setting num_gprs to MAX_ARGS_IN_REGISTERS if a doubleword-aligned @@ -6554,8 +6554,7 @@ mips_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. */ local_cum = *get_cumulative_args (cum); - mips_function_arg_advance (pack_cumulative_args (&local_cum), - arg.mode, arg.type, arg.named); + mips_function_arg_advance (pack_cumulative_args (&local_cum), arg); /* Found out how many registers we need to save. */ gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs; @@ -7305,7 +7304,8 @@ mips_output_args_xfer (int fp_code, char direction) else mips_output_64bit_xfer (direction, gparg, fparg); - mips_function_arg_advance (pack_cumulative_args (&cum), mode, NULL, true); + function_arg_info arg (mode, /*named=*/true); + mips_function_arg_advance (pack_cumulative_args (&cum), arg); } } diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 87d5cd2..9c4eb2d 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -149,8 +149,8 @@ static rtx mmix_struct_value_rtx (tree, int); static machine_mode mmix_promote_function_mode (const_tree, machine_mode, int *, const_tree, int); -static void mmix_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void mmix_function_arg_advance (cumulative_args_t, + const function_arg_info &); 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 &); @@ -615,13 +615,13 @@ mmix_initial_elimination_offset (int fromreg, int toreg) } static void -mmix_function_arg_advance (cumulative_args_t argsp_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +mmix_function_arg_advance (cumulative_args_t argsp_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *argsp = get_cumulative_args (argsp_v); - int arg_size = MMIX_FUNCTION_ARG_SIZE (mode, type); + int arg_size = MMIX_FUNCTION_ARG_SIZE (arg.mode, arg.type); - argsp->regs = ((targetm.calls.must_pass_in_stack (mode, type) + argsp->regs = ((targetm.calls.must_pass_in_stack (arg.mode, arg.type) || (arg_size > 8 && !TARGET_LIBFUNC && !argsp->lib)) diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index a4d242c..50020e2 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -1575,19 +1575,15 @@ mn10300_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) return result; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -mn10300_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +mn10300_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - cum->nbytes += (mode != BLKmode - ? (GET_MODE_SIZE (mode) + 3) & ~3 - : (int_size_in_bytes (type) + 3) & ~3); + cum->nbytes += (arg.promoted_size_in_bytes () + 3) & ~3; } /* Return the number of bytes of registers to use for an argument passed diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index 64c1e8e..d840463 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -438,13 +438,13 @@ moxie_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) : (unsigned) int_size_in_bytes (TYPE)) static void -moxie_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +moxie_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); *cum = (*cum < MOXIE_R6 - ? *cum + ((3 + MOXIE_FUNCTION_ARG_SIZE (mode, type)) / 4) + ? *cum + ((3 + MOXIE_FUNCTION_ARG_SIZE (arg.mode, arg.type)) / 4) : *cum); } diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index 1f8cfcd..66bb217 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -766,14 +766,12 @@ msp430_callee_copies (cumulative_args_t cap ATTRIBUTE_UNUSED, void msp430_function_arg_advance (cumulative_args_t cap, - machine_mode mode, - const_tree type, - bool named) + const function_arg_info &arg) { CUMULATIVE_ARGS *ca = get_cumulative_args (cap); int i; - msp430_evaluate_arg (cap, mode, type, named); + msp430_evaluate_arg (cap, arg.mode, arg.type, arg.named); if (ca->start_reg >= CA_FIRST_REG) for (i = 0; i < ca->reg_count; i ++) diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index 6f7b475..3fd4cc8 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -2008,12 +2008,14 @@ nds32_arg_partial_bytes (cumulative_args_t ca, const function_arg_info &arg) } static void -nds32_function_arg_advance (cumulative_args_t ca, machine_mode mode, - const_tree type, bool named) +nds32_function_arg_advance (cumulative_args_t ca, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (ca); + tree type = arg.type; + machine_mode mode = arg.mode; - if (named) + if (arg.named) { /* We need to further check TYPE and MODE so that we can determine which kind of register we shall advance. */ diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c index 853ee14..6167803 100644 --- a/gcc/config/nios2/nios2.c +++ b/gcc/config/nios2/nios2.c @@ -3399,25 +3399,15 @@ nios2_arg_partial_bytes (cumulative_args_t cum_v, const function_arg_info &arg) return 0; } -/* Update the data in CUM to advance over an argument of mode MODE - and data type TYPE; TYPE is null for libcalls where that information - may not be available. */ +/* Update the data in CUM to advance over argument ARG. */ static void -nios2_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type ATTRIBUTE_UNUSED, - bool named ATTRIBUTE_UNUSED) +nios2_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - HOST_WIDE_INT param_size; - - if (mode == BLKmode) - { - param_size = int_size_in_bytes (type); - gcc_assert (param_size >= 0); - } - else - param_size = GET_MODE_SIZE (mode); + HOST_WIDE_INT param_size = arg.promoted_size_in_bytes (); + gcc_assert (param_size >= 0); /* Convert to words (round up). */ param_size = (UNITS_PER_WORD - 1 + param_size) / UNITS_PER_WORD; @@ -3520,7 +3510,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, arg.mode, arg.type, arg.named); + nios2_function_arg_advance (local_cum_v, arg); regs_to_push = NUM_ARG_REGS - local_cum.regs_used; diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index b37f923..90171a9 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -550,10 +550,7 @@ nvptx_function_incoming_arg (cumulative_args_t cum_v, /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -nvptx_function_arg_advance (cumulative_args_t cum_v, - machine_mode ARG_UNUSED (mode), - const_tree ARG_UNUSED (type), - bool ARG_UNUSED (named)) +nvptx_function_arg_advance (cumulative_args_t cum_v, const function_arg_info &) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c index 363c3f6..34b9d6f 100644 --- a/gcc/config/or1k/or1k.c +++ b/gcc/config/or1k/or1k.c @@ -1019,15 +1019,15 @@ or1k_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) argument. Note, this is not called for arguments passed on the stack. */ static void -or1k_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree /* type */, bool named) +or1k_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { 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) + if (arg.named) *cum += nreg; } diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 3ed030b..ba14fbd 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -167,8 +167,8 @@ static rtx pa_struct_value_rtx (tree, int); static bool pa_pass_by_reference (cumulative_args_t, const function_arg_info &); static int pa_arg_partial_bytes (cumulative_args_t, const function_arg_info &); -static void pa_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void pa_function_arg_advance (cumulative_args_t, + const function_arg_info &); 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); @@ -9437,21 +9437,19 @@ pa_function_value_regno_p (const unsigned int regno) return false; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -pa_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +pa_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - int arg_size = pa_function_arg_size (mode, type); + int arg_size = pa_function_arg_size (arg.mode, arg.type); cum->nargs_prototype--; cum->words += (arg_size + ((cum->words & 01) - && type != NULL_TREE + && arg.type != NULL_TREE && arg_size > 1)); } diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 21d78cd..62a1b27 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -164,7 +164,7 @@ 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, const function_arg_info &); static void pdp11_function_arg_advance (cumulative_args_t, - machine_mode, const_tree, bool); + const function_arg_info &); static void pdp11_conditional_register_usage (void); static bool pdp11_legitimate_constant_p (machine_mode, rtx); @@ -2189,19 +2189,15 @@ pdp11_function_arg (cumulative_args_t, const function_arg_info &) /* Worker function for TARGET_FUNCTION_ARG_ADVANCE. - Update the data in CUM to advance over an argument of mode MODE and - data type TYPE. (TYPE is null for libcalls where that information - may not be available.) */ + Update the data in CUM to advance over argument ARG. */ static void -pdp11_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +pdp11_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum += (mode != BLKmode - ? GET_MODE_SIZE (mode) - : int_size_in_bytes (type)); + *cum += arg.promoted_size_in_bytes (); } /* Make sure everything's fine if we *don't* have an FPU. diff --git a/gcc/config/pru/pru.c b/gcc/config/pru/pru.c index 2b33929..579d3d4 100644 --- a/gcc/config/pru/pru.c +++ b/gcc/config/pru/pru.c @@ -2177,19 +2177,17 @@ pru_arg_partial_bytes (cumulative_args_t, const function_arg_info &) return 0; } -/* Update the data in CUM to advance over an argument of mode MODE - and data type TYPE; TYPE is null for libcalls where that information - may not be available. */ +/* Update the data in CUM to advance over argument ARG. */ static void -pru_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, - bool named) +pru_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { - 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) - pru_function_arg_regi_mark_slot (regi, cum_v, mode, type, named); + pru_function_arg_regi_mark_slot (regi, cum_v, arg.mode, + arg.type, arg.named); } /* Implement TARGET_FUNCTION_VALUE. */ diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index c9aaaff..9b16a1e 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -2757,13 +2757,13 @@ riscv_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void -riscv_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +riscv_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); struct riscv_arg_info info; - riscv_get_arg_info (&info, cum, mode, type, named, false); + riscv_get_arg_info (&info, cum, arg.mode, arg.type, arg.named, false); /* Advance the register count. This has the effect of setting num_gprs to MAX_ARGS_IN_REGISTERS if a doubleword-aligned @@ -2864,8 +2864,7 @@ riscv_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. */ local_cum = *get_cumulative_args (cum); - riscv_function_arg_advance (pack_cumulative_args (&local_cum), - arg.mode, arg.type, arg.named); + riscv_function_arg_advance (pack_cumulative_args (&local_cum), arg); /* Found out how many registers we need to save. */ gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs; diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c index e5d0001..1c5d1e1 100644 --- a/gcc/config/rl78/rl78.c +++ b/gcc/config/rl78/rl78.c @@ -1750,14 +1750,13 @@ rl78_function_arg (cumulative_args_t, const function_arg_info &) #define TARGET_FUNCTION_ARG_ADVANCE rl78_function_arg_advance static void -rl78_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, const_tree type, - bool named ATTRIBUTE_UNUSED) +rl78_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { int rounded_size; CUMULATIVE_ARGS * cum = get_cumulative_args (cum_v); - rounded_size = ((mode == BLKmode) - ? int_size_in_bytes (type) : GET_MODE_SIZE (mode)); + rounded_size = arg.promoted_size_in_bytes (); if (rounded_size & 1) rounded_size ++; (*cum) += rounded_size; diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index 2024092..548a715 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -1400,11 +1400,11 @@ rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, machine_mode mode, } void -rs6000_function_arg_advance (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named) +rs6000_function_arg_advance (cumulative_args_t cum, + const function_arg_info &arg) { - rs6000_function_arg_advance_1 (get_cumulative_args (cum), mode, type, named, - 0); + rs6000_function_arg_advance_1 (get_cumulative_args (cum), + arg.mode, arg.type, arg.named, 0); } /* A subroutine of rs6000_darwin64_record_arg. Assign the bits of the @@ -2221,7 +2221,7 @@ rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type) return true; /* Update info on where next arg arrives in registers. */ - rs6000_function_arg_advance (args_so_far, mode, type, true); + rs6000_function_arg_advance (args_so_far, arg); return false; } diff --git a/gcc/config/rs6000/rs6000-internal.h b/gcc/config/rs6000/rs6000-internal.h index f43714f..cdd9327 100644 --- a/gcc/config/rs6000/rs6000-internal.h +++ b/gcc/config/rs6000/rs6000-internal.h @@ -159,9 +159,8 @@ extern unsigned int rs6000_function_arg_boundary (machine_mode mode, extern bool rs6000_must_pass_in_stack (machine_mode mode, const_tree type); extern int rs6000_arg_partial_bytes (cumulative_args_t, const function_arg_info &); -extern void rs6000_function_arg_advance (cumulative_args_t cum, - machine_mode mode, - const_tree type, bool named); +extern void rs6000_function_arg_advance (cumulative_args_t, + const function_arg_info &); extern pad_direction rs6000_function_arg_padding (machine_mode mode, const_tree type); extern rtx rs6000_function_arg (cumulative_args_t, const function_arg_info &); diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index da73665..a1fc22b 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -1105,10 +1105,10 @@ rx_function_arg (cumulative_args_t cum, const function_arg_info &arg) } static void -rx_function_arg_advance (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +rx_function_arg_advance (cumulative_args_t cum, + const function_arg_info &arg) { - *get_cumulative_args (cum) += rx_function_arg_size (mode, type); + *get_cumulative_args (cum) += rx_function_arg_size (arg.mode, arg.type); } static unsigned int diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index e9ea76c..3ad4a18 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -11982,35 +11982,31 @@ s390_pass_by_reference (cumulative_args_t, const function_arg_info &arg) return false; } -/* Update the data in CUM to advance over an argument of mode MODE and - data type TYPE. (TYPE is null for libcalls where that information - may not be available.). The boolean NAMED specifies whether the - argument is a named argument (as opposed to an unnamed argument - matching an ellipsis). */ +/* Update the data in CUM to advance over argument ARG. */ static void -s390_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +s390_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - if (s390_function_arg_vector (mode, type)) + if (s390_function_arg_vector (arg.mode, arg.type)) { /* We are called for unnamed vector stdarg arguments which are passed on the stack. In this case this hook does not have to do anything since stack arguments are tracked by common code. */ - if (!named) + if (!arg.named) return; cum->vrs += 1; } - else if (s390_function_arg_float (mode, type)) + else if (s390_function_arg_float (arg.mode, arg.type)) { cum->fprs += 1; } - 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); cum->gprs += ((size + UNITS_PER_LONG - 1) / UNITS_PER_LONG); } else @@ -13349,7 +13345,7 @@ s390_call_saved_register_used (tree call_expr) function_arg_info arg (type, mode, /*named=*/true); parm_rtx = s390_function_arg (cum, arg); - s390_function_arg_advance (cum, mode, type, true); + s390_function_arg_advance (cum, arg); if (!parm_rtx) continue; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 43d89e2..ac3c5a5 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -299,8 +299,8 @@ static bool sh_pass_by_reference (cumulative_args_t, static bool sh_callee_copies (cumulative_args_t, machine_mode, const_tree, bool); static int sh_arg_partial_bytes (cumulative_args_t, const function_arg_info &); -static void sh_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void sh_function_arg_advance (cumulative_args_t, + const function_arg_info &); 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); @@ -8066,13 +8066,10 @@ sh_function_arg (cumulative_args_t ca_v, const function_arg_info &arg) return NULL_RTX; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be - available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -sh_function_arg_advance (cumulative_args_t ca_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +sh_function_arg_advance (cumulative_args_t ca_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *ca = get_cumulative_args (ca_v); @@ -8082,7 +8079,7 @@ sh_function_arg_advance (cumulative_args_t ca_v, machine_mode mode, if ((TARGET_HITACHI || ca->renesas_abi) && TARGET_FPU_DOUBLE) { /* Note that we've used the skipped register. */ - if (mode == SFmode && ca->free_single_fp_reg) + if (arg.mode == SFmode && ca->free_single_fp_reg) { ca->free_single_fp_reg = 0; return; @@ -8091,21 +8088,19 @@ sh_function_arg_advance (cumulative_args_t ca_v, machine_mode mode, skipped in order to align the DF value. We note this skipped register, because the next SF value will use it, and not the SF that follows the DF. */ - if (mode == DFmode + if (arg.mode == DFmode && sh_round_reg (*ca, DFmode) != sh_round_reg (*ca, SFmode)) { ca->free_single_fp_reg = (sh_round_reg (*ca, SFmode) - + BASE_ARG_REG (mode)); + + BASE_ARG_REG (arg.mode)); } } if (! ((TARGET_SH4 || TARGET_SH2A) || ca->renesas_abi) - || sh_pass_in_reg_p (*ca, mode, type)) - (ca->arg_count[(int) get_sh_arg_class (mode)] - = (sh_round_reg (*ca, mode) - + (mode == BLKmode - ? CEIL (int_size_in_bytes (type), UNITS_PER_WORD) - : CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD)))); + || sh_pass_in_reg_p (*ca, arg.mode, arg.type)) + (ca->arg_count[(int) get_sh_arg_class (arg.mode)] + = (sh_round_reg (*ca, arg.mode) + + CEIL (arg.promoted_size_in_bytes (), UNITS_PER_WORD))); } /* The Renesas calling convention doesn't quite fit into this scheme since @@ -10811,7 +10806,8 @@ sh_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, { tree ptype = build_pointer_type (TREE_TYPE (funtype)); - sh_function_arg_advance (pack_cumulative_args (&cum), Pmode, ptype, true); + function_arg_info ptr_arg (ptype, Pmode, /*named=*/true); + sh_function_arg_advance (pack_cumulative_args (&cum), ptr_arg); } function_arg_info ptr_arg (ptr_type_node, Pmode, /*named=*/true); this_rtx = sh_function_arg (pack_cumulative_args (&cum), ptr_arg); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 66cc1af..68e3dce 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -657,7 +657,7 @@ static bool sparc_mode_dependent_address_p (const_rtx, addr_space_t); static bool sparc_pass_by_reference (cumulative_args_t, const function_arg_info &); static void sparc_function_arg_advance (cumulative_args_t, - machine_mode, const_tree, bool); + const function_arg_info &); static rtx sparc_function_arg (cumulative_args_t, const function_arg_info &); static rtx sparc_function_incoming_arg (cumulative_args_t, const function_arg_info &); @@ -7590,19 +7590,19 @@ sparc_arg_partial_bytes (cumulative_args_t cum, const function_arg_info &arg) } /* Handle the TARGET_FUNCTION_ARG_ADVANCE hook. - Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - TYPE is null for libcalls where that information may not be available. */ + Update the data in CUM to advance over argument ARG. */ static void -sparc_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named) +sparc_function_arg_advance (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 regno, padding; /* We pass false for incoming here, it doesn't matter. */ - function_arg_slotno (cum, mode, type, named, false, ®no, &padding); + function_arg_slotno (cum, mode, type, arg.named, false, ®no, &padding); /* If argument requires leading padding, add it. */ cum->words += padding; diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index 0825f76..7afd43b 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -3863,18 +3863,18 @@ spu_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) } static void -spu_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +spu_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum += (type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST + *cum += (arg.type && TREE_CODE (TYPE_SIZE (arg.type)) != INTEGER_CST ? 1 - : mode == BLKmode - ? ((int_size_in_bytes (type) + 15) / 16) - : mode == VOIDmode + : arg.mode == BLKmode + ? ((int_size_in_bytes (arg.type) + 15) / 16) + : arg.mode == VOIDmode ? 1 - : spu_hard_regno_nregs (FIRST_ARG_REGNUM, mode)); + : spu_hard_regno_nregs (FIRST_ARG_REGNUM, arg.mode)); } /* Implement TARGET_FUNCTION_ARG_OFFSET. The SPU ABI wants 32/64-bit @@ -4099,8 +4099,7 @@ spu_setup_incoming_varargs (cumulative_args_t cum, /* cum currently points to the last named argument, we want to start at the next argument. */ - spu_function_arg_advance (pack_cumulative_args (&ncum), - arg.mode, arg.type, arg.named); + spu_function_arg_advance (pack_cumulative_args (&ncum), arg); offset = -STACK_POINTER_OFFSET; for (regno = ncum; regno < MAX_REGISTER_ARGS; regno++) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 490606c..7ccfbda 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -1205,9 +1205,8 @@ xstormy16_function_profiler (void) sorry ("function_profiler support"); } -/* Update CUM to advance past an argument in the argument list. The - values MODE, TYPE and NAMED describe that argument. Once this is - done, the variable CUM is suitable for analyzing the *following* +/* Update CUM to advance past argument ARG. Once this is done, + the variable CUM is suitable for analyzing the *following* argument with `TARGET_FUNCTION_ARG', etc. This function need not do anything if the argument in question was @@ -1217,8 +1216,8 @@ xstormy16_function_profiler (void) the word count. */ static void -xstormy16_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +xstormy16_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); @@ -1226,10 +1225,11 @@ xstormy16_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, and partially on the stack, the whole of it is passed on the stack. */ if (*cum < NUM_ARGUMENT_REGISTERS - && *cum + XSTORMY16_WORD_SIZE (type, mode) > NUM_ARGUMENT_REGISTERS) + && (*cum + XSTORMY16_WORD_SIZE (arg.type, arg.mode) + > NUM_ARGUMENT_REGISTERS)) *cum = NUM_ARGUMENT_REGISTERS; - *cum += XSTORMY16_WORD_SIZE (type, mode); + *cum += XSTORMY16_WORD_SIZE (arg.type, arg.mode); } static rtx diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c index e62f1fd..4f29655 100644 --- a/gcc/config/tilegx/tilegx.c +++ b/gcc/config/tilegx/tilegx.c @@ -245,19 +245,17 @@ tilegx_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void tilegx_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) + 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 (); int word_size = (byte_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; bool doubleword_aligned_p; /* 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; @@ -396,8 +394,7 @@ tilegx_setup_incoming_varargs (cumulative_args_t cum, /* The caller has advanced CUM up to, but not beyond, the last named 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), - arg.mode, arg.type, arg.named); + targetm.calls.function_arg_advance (pack_cumulative_args (&local_cum), arg); 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 dbd0b0b..2e14b2e 100644 --- a/gcc/config/tilepro/tilepro.c +++ b/gcc/config/tilepro/tilepro.c @@ -197,19 +197,17 @@ tilepro_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) /* Implement TARGET_FUNCTION_ARG_ADVANCE. */ static void tilepro_function_arg_advance (cumulative_args_t cum_v, - machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) + 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 (); int word_size = (byte_size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; bool doubleword_aligned_p; /* 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; @@ -348,8 +346,7 @@ tilepro_setup_incoming_varargs (cumulative_args_t cum, /* The caller has advanced CUM up to, but not beyond, the last named 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), - arg.mode, arg.type, arg.named); + targetm.calls.function_arg_advance (pack_cumulative_args (&local_cum), arg); first_reg = local_cum; if (local_cum < TILEPRO_NUM_ARG_REGS) diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 07a10ba..26ad4a7 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -216,27 +216,22 @@ v850_arg_partial_bytes (cumulative_args_t cum_v, const function_arg_info &arg) return 4 * UNITS_PER_WORD - cum->nbytes; } -/* Update the data in CUM to advance over an argument - of mode MODE and data type TYPE. - (TYPE is null for libcalls where that information may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -v850_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +v850_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); if (!TARGET_GCC_ABI) - cum->nbytes += (((mode != BLKmode - ? GET_MODE_SIZE (mode) - : int_size_in_bytes (type)) + UNITS_PER_WORD - 1) + cum->nbytes += ((arg.promoted_size_in_bytes () + UNITS_PER_WORD - 1) & -UNITS_PER_WORD); else - cum->nbytes += (((type && int_size_in_bytes (type) > 8 + cum->nbytes += (((arg.type && int_size_in_bytes (arg.type) > 8 ? GET_MODE_SIZE (Pmode) - : (mode != BLKmode - ? GET_MODE_SIZE (mode) - : int_size_in_bytes (type))) + UNITS_PER_WORD - 1) + : (HOST_WIDE_INT) arg.promoted_size_in_bytes ()) + + UNITS_PER_WORD - 1) & -UNITS_PER_WORD); } diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index f314948..1c220ff 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -55,8 +55,8 @@ 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, const function_arg_info &); -static void vax_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void vax_function_arg_advance (cumulative_args_t, + const function_arg_info &); static rtx vax_struct_value_rtx (tree, int); static void vax_asm_trampoline_template (FILE *); static void vax_trampoline_init (rtx, tree, rtx); @@ -2148,19 +2148,15 @@ vax_function_arg (cumulative_args_t, const function_arg_info &) return NULL_RTX; } -/* Update the data in CUM to advance over an argument of mode MODE and - data type TYPE. (TYPE is null for libcalls where that information - may not be available.) */ +/* Update the data in CUM to advance over argument ARG. */ static void -vax_function_arg_advance (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +vax_function_arg_advance (cumulative_args_t cum_v, + const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); - *cum += (mode != BLKmode - ? (GET_MODE_SIZE (mode) + 3) & ~3 - : (int_size_in_bytes (type) + 3) & ~3); + *cum += (arg.promoted_size_in_bytes () + 3) & ~3; } static HOST_WIDE_INT diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c index 95242a3..b51c23f 100644 --- a/gcc/config/visium/visium.c +++ b/gcc/config/visium/visium.c @@ -163,8 +163,8 @@ static bool visium_pass_by_reference (cumulative_args_t, 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); +static void visium_function_arg_advance (cumulative_args_t, + const function_arg_info &); static bool visium_return_in_memory (const_tree, const_tree fntype); @@ -1358,28 +1358,25 @@ visium_function_arg (cumulative_args_t pcum_v, const function_arg_info &arg) return NULL_RTX; } -/* Update the summarizer variable pointed to by PCUM_V to advance past an - argument in the argument list. The values MODE, TYPE and NAMED describe - that argument. Once this is done, the variable CUM is suitable for +/* Update the summarizer variable pointed to by PCUM_V to advance past + argument ARG. Once this is done, the variable CUM is suitable for analyzing the _following_ argument with visium_function_arg. */ static void visium_function_arg_advance (cumulative_args_t pcum_v, - machine_mode mode, - const_tree type ATTRIBUTE_UNUSED, - bool named) + const function_arg_info &arg) { - int size = (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + int size = (GET_MODE_SIZE (arg.mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD; int stack_size = 0; CUMULATIVE_ARGS *ca = get_cumulative_args (pcum_v); /* 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) ca->frcount += size; @@ -1402,7 +1399,7 @@ visium_function_arg_advance (cumulative_args_t pcum_v, } } - if (named) + if (arg.named) ca->stack_words += stack_size; } @@ -1483,8 +1480,7 @@ 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, arg.mode, - arg.type, arg.named); + TARGET_FUNCTION_ARG_ADVANCE (local_args_so_far, arg); /* Find how many registers we need to save. */ locargs = get_cumulative_args (local_args_so_far); diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index d1cdbe1..a277633 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -141,8 +141,8 @@ static tree xtensa_build_builtin_va_list (void); static bool xtensa_return_in_memory (const_tree, const_tree); static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); -static void xtensa_function_arg_advance (cumulative_args_t, machine_mode, - const_tree, bool); +static void xtensa_function_arg_advance (cumulative_args_t, + const function_arg_info &); static rtx xtensa_function_arg (cumulative_args_t, const function_arg_info &); static rtx xtensa_function_incoming_arg (cumulative_args_t, const function_arg_info &); @@ -2105,8 +2105,8 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, int incoming) /* Advance the argument to the next argument position. */ static void -xtensa_function_arg_advance (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named ATTRIBUTE_UNUSED) +xtensa_function_arg_advance (cumulative_args_t cum, + const function_arg_info &arg) { int words, max; int *arg_words; @@ -2114,12 +2114,11 @@ xtensa_function_arg_advance (cumulative_args_t cum, machine_mode mode, arg_words = &get_cumulative_args (cum)->arg_words; 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 (*arg_words < max - && (targetm.calls.must_pass_in_stack (mode, type) + && (targetm.calls.must_pass_in_stack (arg.mode, arg.type) || *arg_words + words > max)) *arg_words = max; diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 01c405a..c3e23cd 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4159,10 +4159,9 @@ argument @var{libname} exists for symmetry with @c --mew 5feb93 i switched the order of the sentences. --mew 10feb93 @end defmac -@deftypefn {Target Hook} void TARGET_FUNCTION_ARG_ADVANCE (cumulative_args_t @var{ca}, machine_mode @var{mode}, const_tree @var{type}, bool @var{named}) +@deftypefn {Target Hook} void TARGET_FUNCTION_ARG_ADVANCE (cumulative_args_t @var{ca}, const function_arg_info @var{&arg}) This hook updates the summarizer variable pointed to by @var{ca} to -advance past an argument in the argument list. The values @var{mode}, -@var{type} and @var{named} describe that argument. Once this is done, +advance past argument @var{arg} in the argument list. Once this is done, the variable @var{cum} is suitable for analyzing the @emph{following} argument with @code{TARGET_FUNCTION_ARG}, etc. diff --git a/gcc/dse.c b/gcc/dse.c index 78249da..7511f71 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -2377,7 +2377,7 @@ get_call_args (rtx call_insn, tree fn, rtx *args, int nargs) if (tmp) args[idx] = tmp; - targetm.calls.function_arg_advance (args_so_far, mode, NULL_TREE, true); + targetm.calls.function_arg_advance (args_so_far, arg); } if (arg != void_list_node || idx != nargs) return false; diff --git a/gcc/expr.c b/gcc/expr.c index 471adb6..9297928 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -1715,8 +1715,7 @@ block_move_libcall_safe_for_call_parm (void) return false; if (targetm.calls.arg_partial_bytes (args_so_far, arg_info)) return false; - targetm.calls.function_arg_advance (args_so_far, mode, - NULL_TREE, true); + targetm.calls.function_arg_advance (args_so_far, arg_info); } } return true; diff --git a/gcc/function.c b/gcc/function.c index 1319208..64a272b 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3672,8 +3672,9 @@ assign_parms (tree fndecl) assign_parms_setup_varargs (&all, &data, false); /* Update info on where next arg arrives in registers. */ - targetm.calls.function_arg_advance (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); + targetm.calls.function_arg_advance (all.args_so_far, arg); } if (targetm.calls.split_complex_arg) @@ -3860,8 +3861,9 @@ gimplify_parameters (gimple_seq *cleanup) continue; /* Update info on where next arg arrives in registers. */ - targetm.calls.function_arg_advance (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); + targetm.calls.function_arg_advance (all.args_so_far, arg); /* ??? Once upon a time variable_size stuffed parameter list SAVE_EXPRs (amongst others) onto a pending sizes list. This diff --git a/gcc/target.def b/gcc/target.def index 790c0d2..cf315c5 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4686,8 +4686,7 @@ register to be used by the caller for this argument; likewise\n\ DEFHOOK (function_arg_advance, "This hook updates the summarizer variable pointed to by @var{ca} to\n\ -advance past an argument in the argument list. The values @var{mode},\n\ -@var{type} and @var{named} describe that argument. Once this is done,\n\ +advance past argument @var{arg} in the argument list. Once this is done,\n\ the variable @var{cum} is suitable for analyzing the @emph{following}\n\ argument with @code{TARGET_FUNCTION_ARG}, etc.\n\ \n\ @@ -4695,7 +4694,7 @@ This hook need not do anything if the argument in question was passed\n\ on the stack. The compiler knows how to track the amount of stack space\n\ used for arguments without any special help.", void, - (cumulative_args_t ca, machine_mode mode, const_tree type, bool named), + (cumulative_args_t ca, const function_arg_info &arg), default_function_arg_advance) DEFHOOK diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 911a970..59954b2 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -784,10 +784,7 @@ hook_void_CUMULATIVE_ARGS_tree (cumulative_args_t ca ATTRIBUTE_UNUSED, } void -default_function_arg_advance (cumulative_args_t ca ATTRIBUTE_UNUSED, - machine_mode mode ATTRIBUTE_UNUSED, - const_tree type ATTRIBUTE_UNUSED, - bool named ATTRIBUTE_UNUSED) +default_function_arg_advance (cumulative_args_t, const function_arg_info &) { gcc_unreachable (); } diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 03187b2..1266591 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -148,7 +148,7 @@ extern void hook_void_CUMULATIVE_ARGS_tree extern const char *hook_invalid_arg_for_unprototyped_fn (const_tree, const_tree, const_tree); extern void default_function_arg_advance - (cumulative_args_t, machine_mode, const_tree, bool); + (cumulative_args_t, const function_arg_info &); 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, const function_arg_info &); diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 88059b0..8b1d447 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -6293,14 +6293,12 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) && targetm.calls.struct_value_rtx (type, 0) == 0) { 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, arg); - targetm.calls.function_arg_advance (args_so_far, mode, - struct_addr, true); + targetm.calls.function_arg_advance (args_so_far, arg); if (reg == NULL_RTX) { for (; link; link = XEXP (link, 1)) @@ -6489,8 +6487,7 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) } } } - targetm.calls.function_arg_advance (args_so_far, mode, - argtype, true); + targetm.calls.function_arg_advance (args_so_far, arg); t = TREE_CHAIN (t); } } -- cgit v1.1