From 0c3a9758c0dddf055d4b1ff2350df0db80c78b0b Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Sat, 9 Oct 2010 14:17:48 +0000 Subject: [PATCH] alpha-protos.h (function_arg): Delete. * config/alpha/alpha-protos.h (function_arg): Delete. * config/alpha/alpha.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. * config/alpha/vms.h (FUNCTION_ARG_ADVANCE): Delete. * config/alpha/alpha.c (function_arg): Rename to... (alpha_function_arg): ...this. Make static. Take a const_tree and a bool. Delete TARGET_ABI_UNICOSMK code. (alpha_function_arg_advance): New function. (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. From-SVN: r165225 --- gcc/ChangeLog | 11 ++++ gcc/config/alpha/alpha-protos.h | 1 - gcc/config/alpha/alpha.c | 105 ++++++++++---------------------- gcc/config/alpha/alpha.h | 28 --------- gcc/config/alpha/vms.h | 12 ---- 5 files changed, 43 insertions(+), 114 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad9774b3772..8a2015ce371 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2010-10-09 Nathan Froyd + + * config/alpha/alpha-protos.h (function_arg): Delete. + * config/alpha/alpha.h (FUNCTION_ARG, FUNCTION_ARG_ADVANCE): Delete. + * config/alpha/vms.h (FUNCTION_ARG_ADVANCE): Delete. + * config/alpha/alpha.c (function_arg): Rename to... + (alpha_function_arg): ...this. Make static. Take a const_tree and + a bool. Delete TARGET_ABI_UNICOSMK code. + (alpha_function_arg_advance): New function. + (TARGET_FUNCTION_ARG, TARGET_FUNCTION_ARG_ADVANCE): Define. + 2010-10-09 Nathan Froyd * config/mep/mep-protos.h (mep_function_arg): Delete. diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index 4b5e6734dc7..74771696007 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -74,7 +74,6 @@ extern void print_operand_address (FILE *, rtx); extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int); extern rtx alpha_va_arg (tree, tree); -extern rtx function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int); extern rtx function_value (const_tree, const_tree, enum machine_mode); extern void alpha_start_function (FILE *, const char *, tree); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 46627e379a2..c6415d3a1df 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5634,9 +5634,9 @@ alpha_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) On Alpha the first 6 words of args are normally in registers and the rest are pushed. */ -rtx -function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type, - int named ATTRIBUTE_UNUSED) +static rtx +alpha_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named ATTRIBUTE_UNUSED) { int basereg; int num_args; @@ -5661,87 +5661,22 @@ function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type, } /* ??? Irritatingly, the definition of CUMULATIVE_ARGS is different for - the three platforms, so we can't avoid conditional compilation. */ + the two platforms, so we can't avoid conditional compilation. */ #if TARGET_ABI_OPEN_VMS { if (mode == VOIDmode) return alpha_arg_info_reg_val (cum); - num_args = cum.num_args; + num_args = cum->num_args; if (num_args >= 6 || targetm.calls.must_pass_in_stack (mode, type)) return NULL_RTX; } -#elif TARGET_ABI_UNICOSMK - { - int size; - - /* If this is the last argument, generate the call info word (CIW). */ - /* ??? We don't include the caller's line number in the CIW because - I don't know how to determine it if debug infos are turned off. */ - if (mode == VOIDmode) - { - int i; - HOST_WIDE_INT lo; - HOST_WIDE_INT hi; - rtx ciw; - - lo = 0; - - for (i = 0; i < cum.num_reg_words && i < 5; i++) - if (cum.reg_args_type[i]) - lo |= (1 << (7 - i)); - - if (cum.num_reg_words == 6 && cum.reg_args_type[5]) - lo |= 7; - else - lo |= cum.num_reg_words; - -#if HOST_BITS_PER_WIDE_INT == 32 - hi = (cum.num_args << 20) | cum.num_arg_words; -#else - lo = lo | ((HOST_WIDE_INT) cum.num_args << 52) - | ((HOST_WIDE_INT) cum.num_arg_words << 32); - hi = 0; -#endif - ciw = immed_double_const (lo, hi, DImode); - - return gen_rtx_UNSPEC (DImode, gen_rtvec (1, ciw), - UNSPEC_UMK_LOAD_CIW); - } - - size = ALPHA_ARG_SIZE (mode, type, named); - num_args = cum.num_reg_words; - if (cum.force_stack - || cum.num_reg_words + size > 6 - || targetm.calls.must_pass_in_stack (mode, type)) - return NULL_RTX; - else if (type && TYPE_MODE (type) == BLKmode) - { - rtx reg1, reg2; - - reg1 = gen_rtx_REG (DImode, num_args + 16); - reg1 = gen_rtx_EXPR_LIST (DImode, reg1, const0_rtx); - - /* The argument fits in two registers. Note that we still need to - reserve a register for empty structures. */ - if (size == 0) - return NULL_RTX; - else if (size == 1) - return gen_rtx_PARALLEL (mode, gen_rtvec (1, reg1)); - else - { - reg2 = gen_rtx_REG (DImode, num_args + 17); - reg2 = gen_rtx_EXPR_LIST (DImode, reg2, GEN_INT (8)); - return gen_rtx_PARALLEL (mode, gen_rtvec (2, reg1, reg2)); - } - } - } #elif TARGET_ABI_OSF { - if (cum >= 6) + if (*cum >= 6) return NULL_RTX; - num_args = cum; + num_args = *cum; /* VOID is passed as a special flag for "last argument". */ if (type == void_type_node) @@ -5756,6 +5691,26 @@ function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type, return gen_rtx_REG (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.) */ + +static void +alpha_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, + const_tree type, bool named) +{ + bool onstack = targetm.calls.must_pass_in_stack (mode, type); + int increment = onstack ? 6 : ALPHA_ARG_SIZE (mode, type, named); + +#if TARGET_ABI_OSF + *cum += increment; +#else + if (!onstack && cum->num_args < 6) + cum->atypes[cum->num_args] = alpha_arg_type (mode); + cum->num_args += increment; +#endif +} + static int alpha_arg_partial_bytes (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, @@ -6183,7 +6138,7 @@ alpha_setup_incoming_varargs (CUMULATIVE_ARGS *pcum, enum machine_mode mode, CUMULATIVE_ARGS cum = *pcum; /* Skip the current argument. */ - FUNCTION_ARG_ADVANCE (cum, mode, type, 1); + targetm.calls.function_arg_advance (cum, mode, type, true); #if TARGET_ABI_UNICOSMK /* On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register @@ -11149,6 +11104,10 @@ alpha_init_libfuncs (void) #define TARGET_GIMPLIFY_VA_ARG_EXPR alpha_gimplify_va_arg #undef TARGET_ARG_PARTIAL_BYTES #define TARGET_ARG_PARTIAL_BYTES alpha_arg_partial_bytes +#undef TARGET_FUNCTION_ARG +#define TARGET_FUNCTION_ARG alpha_function_arg +#undef TARGET_FUNCTION_ARG_ADVANCE +#define TARGET_FUNCTION_ARG_ADVANCE alpha_function_arg_advance #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT alpha_trampoline_init diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index bdf31599d07..66e215a5b36 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -749,34 +749,6 @@ extern int alpha_memory_latency; : (((MODE) == BLKmode ? int_size_in_bytes (TYPE) : GET_MODE_SIZE (MODE)) \ + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD) -/* 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.) */ - -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - ((CUM) += \ - (targetm.calls.must_pass_in_stack (MODE, TYPE)) \ - ? 6 : ALPHA_ARG_SIZE (MODE, TYPE, NAMED)) - -/* Determine where to put an argument to a function. - Value is zero to push the argument on the stack, - or a hard register in which to store the argument. - - MODE is the argument's machine mode. - TYPE is the data type of the argument (as a tree). - This is null for libcalls where that information may - not be available. - CUM is a variable of type CUMULATIVE_ARGS which gives info about - the preceding args and about the function being called. - NAMED is nonzero if this argument is a named parameter - (otherwise it is an extra parameter matching an ellipsis). - - On Alpha the first 6 words of args are normally in registers - and the rest are pushed. */ - -#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - function_arg((CUM), (MODE), (TYPE), (NAMED)) - /* Make (or fake) .linkage entry for function call. IS_LOCAL is 0 if name is used in call, 1 if name is used in definition. */ diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 38b2068693e..2c151a7e816 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -175,18 +175,6 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info; (CUM).atypes[0] = (CUM).atypes[1] = (CUM).atypes[2] = I64; \ (CUM).atypes[3] = (CUM).atypes[4] = (CUM).atypes[5] = I64; -#undef FUNCTION_ARG_ADVANCE -#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ - if (targetm.calls.must_pass_in_stack (MODE, TYPE)) \ - (CUM).num_args += 6; \ - else \ - { \ - if ((CUM).num_args < 6) \ - (CUM).atypes[(CUM).num_args] = alpha_arg_type (MODE); \ - \ - (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \ - } - #define DEFAULT_PCC_STRUCT_RETURN 0 #undef ASM_WEAKEN_LABEL -- 2.30.2