diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-08-20 08:53:04 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-08-20 08:53:04 +0000 |
commit | 6783fdb7057d559aa1da8afa2c15a702c532a03e (patch) | |
tree | 3decf215bea8101c34e9e017c493ee6b8ee25ab1 /gcc/config/ia64 | |
parent | e7056ca417326a70eca05defb6a8b20b737d3417 (diff) | |
download | gcc-6783fdb7057d559aa1da8afa2c15a702c532a03e.zip gcc-6783fdb7057d559aa1da8afa2c15a702c532a03e.tar.gz gcc-6783fdb7057d559aa1da8afa2c15a702c532a03e.tar.bz2 |
Use function_arg_info for TARGET_FUNCTION_(INCOMING_)ARG
This patch makes both TARGET_FUNCTION_ARG and
TARGET_FUNCTION_INCOMING_ARG take a function_arg_info.
They have to be done together since many targets use the
same function for both.
The hooks are passed the promoted mode instead of the original type mode.
2019-08-20 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* target.def (function_arg, function_incoming_arg): Take a
function_arg_info instead of a mode, tree and named flag.
* doc/tm.texi: Regenerate.
* targhooks.h (default_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
(default_function_incoming_arg): Likewise.
* targhooks.c (default_function_arg): Likewise.
(default_function_incoming_arg): Likewise.
* calls.h (function_arg_info::end_marker_p): New function.
(function_arg_info::end_marker): Likewise.
* calls.c (prepare_call_address, initialize_argument_information)
(expand_call, emit_library_call_value_1): Update calls to
targetm.calls.function_arg and targetm.calls.function_incoming_arg.
* dse.c: Include calls.h.
(get_call_args): Update call to targetm.calls.function_arg.
* expr.c (block_move_libcall_safe_for_call_parm): Likewise.
* var-tracking.c (prepare_call_arguments): Likewise.
* function.c (assign_parm_find_entry_rtl): Update call to
targetm.calls.function_incoming_arg.
* config/aarch64/aarch64.c (aarch64_function_arg): Take a
function_arg_info instead of a mode, tree and named flag.
* config/alpha/alpha.c (alpha_function_arg): Likewise.
* config/arc/arc.c (arc_function_arg): Likewise.
* config/arm/arm.c (arm_function_arg): Likewise.
(cmse_func_args_or_return_in_stack): Update call accordingly.
(arm_function_ok_for_sibcall): Likewise.
(cmse_nonsecure_call_clear_caller_saved): Likewise.
* config/avr/avr.c (avr_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
* config/bfin/bfin.c (bfin_function_arg): Likewise.
* config/c6x/c6x.c (c6x_function_arg): Likewise.
(c6x_call_saved_register_used): Update call accordingly.
* config/cr16/cr16.c (cr16_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
* config/cris/cris.c (cris_function_arg, cris_function_incoming_arg)
(cris_function_arg_1): Likewise.
* config/csky/csky.c (csky_function_arg): Likewise.
* config/epiphany/epiphany.c (epiphany_function_arg): Likewise.
* config/fr30/fr30.c (fr30_function_arg): Likewise.
* config/frv/frv.c (frv_function_arg, frv_function_incoming_arg)
(frv_function_arg_1): Likewise.
* config/ft32/ft32.c (ft32_function_arg): Likewise.
* config/gcn/gcn.c (gcn_function_arg): Likewise.
* config/h8300/h8300.c (h8300_function_arg): Likewise.
* config/i386/i386.c (ix86_function_arg): Likewise.
* config/ia64/ia64.c (ia64_function_arg, ia64_function_incoming_arg)
(ia64_function_arg_1): Likewise.
* config/iq2000/iq2000.c (iq2000_function_arg): Likewise.
(iq2000_expand_prologue, iq2000_pass_by_reference): Update call
accordingly.
* config/lm32/lm32.c (lm32_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
* config/m32c/m32c.c (m32c_function_arg): Likewise.
* config/m32r/m32r.c (m32r_function_arg): Likewise.
* config/m68k/m68k.c (m68k_function_arg): Likewise.
* config/mcore/mcore.c (mcore_function_arg): Likewise.
* config/microblaze/microblaze.c (microblaze_function_arg): Likewise.
(microblaze_expand_prologue): Update call accordingly.
* config/mips/mips.c (mips_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
* config/mmix/mmix.c (mmix_function_incoming_arg, mmix_function_arg)
(mmix_function_arg_1): Likewise.
* config/mn10300/mn10300.c (mn10300_function_arg): Likewise.
* config/moxie/moxie.c (moxie_function_arg): Likewise.
* config/msp430/msp430.c (msp430_function_arg): Likewise.
* config/nds32/nds32.c (nds32_function_arg): Likewise.
* config/nios2/nios2.c (nios2_function_arg): Likewise.
* config/nvptx/nvptx.c (nvptx_function_arg): Likewise.
(nvptx_function_incoming_arg): Likewise.
* config/or1k/or1k.c (or1k_function_arg): Likewise.
* config/pa/pa.c (pa_function_arg): Likewise.
* config/pdp11/pdp11.c (pdp11_function_arg): Likewise.
* config/pru/pru.c (pru_function_arg): Likewise.
* config/riscv/riscv.c (riscv_function_arg): Likewise.
* config/rl78/rl78.c (rl78_function_arg): Likewise.
* config/rs6000/rs6000-internal.h (rs6000_function_arg): Likewise.
* config/rs6000/rs6000-call.c (rs6000_function_arg): Likewise.
(rs6000_parm_needs_stack): Update call accordingly.
* config/rx/rx.c (rx_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
* config/s390/s390.c (s390_function_arg): Likewise.
(s390_call_saved_register_used): Update call accordingly.
* config/sh/sh.c (sh_function_arg): Take a function_arg_info
instead of a mode, tree and named flag.
(sh_output_mi_thunk): Update call accordingly.
* config/sparc/sparc.c (sparc_function_arg_1, sparc_function_arg)
(sparc_function_incoming_arg): Take a function_arg_info instead of
a mode, tree and named flag.
* config/spu/spu.c (spu_function_arg): Likewise.
* config/stormy16/stormy16.c (xstormy16_function_arg): Likewise.
* config/tilegx/tilegx.c (tilegx_function_arg): Likewise.
* config/tilepro/tilepro.c (tilepro_function_arg): Likewise.
* config/v850/v850.c (v850_function_arg): Likewise.
* config/vax/vax.c (vax_function_arg): Likewise.
* config/visium/visium.c (visium_function_arg): Likewise.
* config/xtensa/xtensa.c (xtensa_function_arg_1, xtensa_function_arg)
(xtensa_function_incoming_arg): Likewise.
From-SVN: r274700
Diffstat (limited to 'gcc/config/ia64')
-rw-r--r-- | gcc/config/ia64/ia64.c | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 3bd2068..0de27a3 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -204,12 +204,9 @@ static void ia64_setup_incoming_varargs (cumulative_args_t, int *, int); static int ia64_arg_partial_bytes (cumulative_args_t, const function_arg_info &); -static rtx ia64_function_arg_1 (cumulative_args_t, machine_mode, - const_tree, bool, bool); -static rtx ia64_function_arg (cumulative_args_t, machine_mode, - const_tree, bool); +static rtx ia64_function_arg (cumulative_args_t, const function_arg_info &); static rtx ia64_function_incoming_arg (cumulative_args_t, - machine_mode, const_tree, bool); + const function_arg_info &); static void ia64_function_arg_advance (cumulative_args_t, machine_mode, const_tree, bool); static pad_direction ia64_function_arg_padding (machine_mode, const_tree); @@ -4748,14 +4745,14 @@ ia64_function_arg_offset (const CUMULATIVE_ARGS *cum, registers. */ static rtx -ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, - const_tree type, bool named, bool incoming) +ia64_function_arg_1 (cumulative_args_t cum_v, const function_arg_info &arg, + bool incoming) { const CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int basereg = (incoming ? GR_ARG_FIRST : AR_ARG_FIRST); - int words = ia64_function_arg_words (type, mode); - int offset = ia64_function_arg_offset (cum, type, words); + int words = ia64_function_arg_words (arg.type, arg.mode); + int offset = ia64_function_arg_offset (cum, arg.type, words); machine_mode hfa_mode = VOIDmode; /* For OPEN VMS, emit the instruction setting up the argument register here, @@ -4763,8 +4760,7 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, insns. This is not the conceptually best place to do this, but this is the easiest as we have convenient access to cumulative args info. */ - if (TARGET_ABI_OPEN_VMS && mode == VOIDmode && type == void_type_node - && named == 1) + if (TARGET_ABI_OPEN_VMS && arg.end_marker_p ()) { unsigned HOST_WIDE_INT regval = cum->words; int i; @@ -4783,19 +4779,19 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, /* On OpenVMS argument is either in Rn or Fn. */ if (TARGET_ABI_OPEN_VMS) { - if (FLOAT_MODE_P (mode)) - return gen_rtx_REG (mode, FR_ARG_FIRST + cum->words); + if (FLOAT_MODE_P (arg.mode)) + return gen_rtx_REG (arg.mode, FR_ARG_FIRST + cum->words); else - return gen_rtx_REG (mode, basereg + cum->words); + return gen_rtx_REG (arg.mode, basereg + cum->words); } /* Check for and handle homogeneous FP aggregates. */ - if (type) - hfa_mode = hfa_element_mode (type, 0); + if (arg.type) + hfa_mode = hfa_element_mode (arg.type, 0); /* Unnamed prototyped hfas are passed as usual. Named prototyped hfas and unprototyped hfas are passed specially. */ - if (hfa_mode != VOIDmode && (! cum->prototype || named)) + if (hfa_mode != VOIDmode && (! cum->prototype || arg.named)) { rtx loc[16]; int i = 0; @@ -4815,8 +4811,7 @@ ia64_function_arg_1 (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 @@ -4872,31 +4867,31 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, else if (gr_size > UNITS_PER_WORD) int_regs += gr_size / UNITS_PER_WORD; } - return gen_rtx_PARALLEL (mode, gen_rtvec_v (i, loc)); + return gen_rtx_PARALLEL (arg.mode, gen_rtvec_v (i, loc)); } /* Integral and aggregates go in general registers. If we have run out of FR registers, then FP values must also go in general registers. This can happen when we have a SFmode HFA. */ - else if (mode == TFmode || mode == TCmode - || (! FLOAT_MODE_P (mode) || cum->fp_regs == MAX_ARGUMENT_SLOTS)) + else if (arg.mode == TFmode || arg.mode == TCmode + || !FLOAT_MODE_P (arg.mode) + || cum->fp_regs == MAX_ARGUMENT_SLOTS) { - int byte_size = ((mode == BLKmode) - ? int_size_in_bytes (type) : GET_MODE_SIZE (mode)); + int byte_size = arg.promoted_size_in_bytes (); if (BYTES_BIG_ENDIAN - && (mode == BLKmode || (type && AGGREGATE_TYPE_P (type))) - && byte_size < UNITS_PER_WORD - && byte_size > 0) + && (arg.mode == BLKmode || arg.aggregate_type_p ()) + && byte_size < UNITS_PER_WORD + && byte_size > 0) { rtx gr_reg = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (DImode, (basereg + cum->words + offset)), const0_rtx); - return gen_rtx_PARALLEL (mode, gen_rtvec (1, gr_reg)); + return gen_rtx_PARALLEL (arg.mode, gen_rtvec (1, gr_reg)); } else - return gen_rtx_REG (mode, basereg + cum->words + offset); + return gen_rtx_REG (arg.mode, basereg + cum->words + offset); } @@ -4904,19 +4899,19 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, named, and in a GR register when unnamed. */ else if (cum->prototype) { - if (named) - return gen_rtx_REG (mode, FR_ARG_FIRST + cum->fp_regs); + if (arg.named) + return gen_rtx_REG (arg.mode, FR_ARG_FIRST + cum->fp_regs); /* In big-endian mode, an anonymous SFmode value must be represented as (parallel:SF [(expr_list (reg:DI n) (const_int 0))]) to force the value into the high half of the general register. */ - else if (BYTES_BIG_ENDIAN && mode == SFmode) - return gen_rtx_PARALLEL (mode, + else if (BYTES_BIG_ENDIAN && arg.mode == SFmode) + return gen_rtx_PARALLEL (arg.mode, gen_rtvec (1, gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_REG (DImode, basereg + cum->words + offset), const0_rtx))); else - return gen_rtx_REG (mode, basereg + cum->words + offset); + return gen_rtx_REG (arg.mode, basereg + cum->words + offset); } /* If there is no prototype, then FP values go in both FR and GR registers. */ @@ -4924,10 +4919,10 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, { /* See comment above. */ machine_mode inner_mode = - (BYTES_BIG_ENDIAN && mode == SFmode) ? DImode : mode; + (BYTES_BIG_ENDIAN && arg.mode == SFmode) ? DImode : arg.mode; rtx fp_reg = gen_rtx_EXPR_LIST (VOIDmode, - gen_rtx_REG (mode, (FR_ARG_FIRST + gen_rtx_REG (arg.mode, (FR_ARG_FIRST + cum->fp_regs)), const0_rtx); rtx gr_reg = gen_rtx_EXPR_LIST (VOIDmode, @@ -4936,27 +4931,25 @@ ia64_function_arg_1 (cumulative_args_t cum_v, machine_mode mode, + offset)), const0_rtx); - return gen_rtx_PARALLEL (mode, gen_rtvec (2, fp_reg, gr_reg)); + return gen_rtx_PARALLEL (arg.mode, gen_rtvec (2, fp_reg, gr_reg)); } } /* Implement TARGET_FUNCION_ARG target hook. */ static rtx -ia64_function_arg (cumulative_args_t cum, machine_mode mode, - const_tree type, bool named) +ia64_function_arg (cumulative_args_t cum, const function_arg_info &arg) { - return ia64_function_arg_1 (cum, mode, type, named, false); + return ia64_function_arg_1 (cum, arg, false); } /* Implement TARGET_FUNCION_INCOMING_ARG target hook. */ static rtx ia64_function_incoming_arg (cumulative_args_t cum, - machine_mode mode, - const_tree type, bool named) + const function_arg_info &arg) { - return ia64_function_arg_1 (cum, mode, type, named, true); + return ia64_function_arg_1 (cum, arg, true); } /* Return number of bytes, at the beginning of the argument, that must be |