From f93c21801e66897707427dc4b3ae7fc6042462c3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 11 Oct 2003 09:54:17 -0700 Subject: [PATCH] alpha.c (alpha_return_in_memory): Rename from return_in_memory, make static, change signature to match target hook. * config/alpha/alpha.c (alpha_return_in_memory): Rename from return_in_memory, make static, change signature to match target hook. (alpha_setup_incoming_varargs): Make static, change signature to match target hook, add code for vms and unicos. (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES, TARGET_STRUCT_VALUE_RTX, TARGET_RETURN_IN_MEMORY, TARGET_SETUP_INCOMING_VARARGS, TARGET_STRICT_ARGUMENT_NAMING, TARGET_PRETEND_OUTGOING_VARARGS_NAMED): New. * config/alpha/alpha-protos.h: Update. * config/alpha/alpha.h (PROMOTE_FUNCTION_ARGS, PROMOTE_FUNCTION_RETURN, RETURN_IN_MEMORY, SETUP_INCOMING_VARARGS): Remove. * config/alpha/unicosmk.h (SETUP_INCOMING_VARARGS): Remove. * config/alpha/vms.h (SETUP_INCOMING_VARARGS): Remove. From-SVN: r72338 --- gcc/ChangeLog | 18 +++++++ gcc/config/alpha/alpha-protos.h | 3 -- gcc/config/alpha/alpha.c | 96 +++++++++++++++++++++++++-------- gcc/config/alpha/alpha.h | 23 -------- gcc/config/alpha/unicosmk.h | 24 --------- gcc/config/alpha/vms.h | 36 ------------- 6 files changed, 91 insertions(+), 109 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35ee023aeff..825eafa3073 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2003-10-11 Richard Henderson + + * config/alpha/alpha.c (alpha_return_in_memory): Rename from + return_in_memory, make static, change signature to match target hook. + (alpha_setup_incoming_varargs): Make static, change signature to + match target hook, add code for vms and unicos. + (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN, + TARGET_PROMOTE_PROTOTYPES, TARGET_STRUCT_VALUE_RTX, + TARGET_RETURN_IN_MEMORY, TARGET_SETUP_INCOMING_VARARGS, + TARGET_STRICT_ARGUMENT_NAMING, + TARGET_PRETEND_OUTGOING_VARARGS_NAMED): New. + * config/alpha/alpha-protos.h: Update. + * config/alpha/alpha.h (PROMOTE_FUNCTION_ARGS, + PROMOTE_FUNCTION_RETURN, RETURN_IN_MEMORY, + SETUP_INCOMING_VARARGS): Remove. + * config/alpha/unicosmk.h (SETUP_INCOMING_VARARGS): Remove. + * config/alpha/vms.h (SETUP_INCOMING_VARARGS): Remove. + 2003-10-11 Ian Lance Taylor * config/arm/arm.c (arm_regno_class): Handle IWMMXT_GR_REGS. diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index 20813609fb3..0e2cf4843df 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -130,13 +130,10 @@ extern void print_operand_address (FILE *, rtx); extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int); extern tree alpha_build_va_list (void); -extern void alpha_setup_incoming_varargs (CUMULATIVE_ARGS, enum machine_mode, - tree, int *, int); extern void alpha_va_start (tree, rtx); extern rtx alpha_va_arg (tree, tree); extern rtx function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int); extern rtx function_value (tree, tree, enum machine_mode); -extern bool return_in_memory (tree, enum machine_mode); extern void alpha_start_function (FILE *, const char *, tree); extern void alpha_end_function (FILE *, const char *, tree); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 2da9f2bc79b..66b6f748d1f 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -5983,9 +5983,10 @@ function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode, tree type, /* Return true if TYPE must be returned in memory, instead of in registers. */ -bool -return_in_memory (tree type, enum machine_mode mode) +static bool +alpha_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED) { + enum machine_mode mode = VOIDmode; int size; if (type) @@ -6043,7 +6044,7 @@ function_value (tree valtype, tree func ATTRIBUTE_UNUSED, enum mode_class class; #ifdef ENABLE_CHECKING - if (return_in_memory (valtype, mode)) + if (alpha_return_in_memory (valtype, func)) abort (); #endif @@ -6118,27 +6119,59 @@ alpha_build_va_list (void) } /* Perform any needed actions needed for a function that is receiving a - variable number of arguments. + variable number of arguments. */ - On the Alpha, we allocate space for all 12 arg registers, but only - push those that are remaining. However, if NO registers need to be - saved, don't allocate any space. This is not only because we won't - need the space, but because AP includes the current_pretend_args_size - and we don't want to mess up any ap-relative addresses already made. - - If we are not to use the floating-point registers, save the integer - registers where we would put the floating-point registers. This is - not the most efficient way to implement varargs with just one register - class, but it isn't worth doing anything more efficient in this rare - case. */ - -#if TARGET_ABI_OSF -void -alpha_setup_incoming_varargs(CUMULATIVE_ARGS cum, - enum machine_mode mode ATTRIBUTE_UNUSED, - tree type ATTRIBUTE_UNUSED, - int *pretend_size, int no_rtl) +static void +alpha_setup_incoming_varargs (CUMULATIVE_ARGS *pcum, + enum machine_mode mode ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + int *pretend_size, int no_rtl) { +#if TARGET_ABI_UNICOSMK + /* On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register + arguments on the stack. Unfortunately, it doesn't always store the first + one (i.e. the one that arrives in $16 or $f16). This is not a problem + with stdargs as we always have at least one named argument there. */ + int num_reg_words = pcum->num_reg_words; + if (num_reg_words < 6) + { + if (!no_rtl) + { + emit_insn (gen_umk_mismatch_args (GEN_INT (num_reg_words + 1))); + emit_insn (gen_arg_home_umk ()); + } + *pretend_size = 0; + } +#elif TARGET_ABI_OPEN_VMS + /* For VMS, we allocate space for all 6 arg registers plus a count. + + However, if NO registers need to be saved, don't allocate any space. + This is not only because we won't need the space, but because AP + includes the current_pretend_args_size and we don't want to mess up + any ap-relative addresses already made. */ + if (pcum->num_args < 6) + { + if (!no_rtl) + { + emit_move_insn (gen_rtx_REG (DImode, 1), virtual_incoming_args_rtx); + emit_insn (gen_arg_home ()); + } + *pretend_size = 7 * UNITS_PER_WORD; + } +#else + /* On OSF/1 and friends, we allocate space for all 12 arg registers, but + only push those that are remaining. However, if NO registers need to + be saved, don't allocate any space. This is not only because we won't + need the space, but because AP includes the current_pretend_args_size + and we don't want to mess up any ap-relative addresses already made. + + If we are not to use the floating-point registers, save the integer + registers where we would put the floating-point registers. This is + not the most efficient way to implement varargs with just one register + class, but it isn't worth doing anything more efficient in this rare + case. */ + CUMULATIVE_ARGS cum = *pcum; + if (cum >= 6) return; @@ -6161,8 +6194,8 @@ alpha_setup_incoming_varargs(CUMULATIVE_ARGS cum, 6 - cum); } *pretend_size = 12 * UNITS_PER_WORD; -} #endif +} void alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED) @@ -10146,6 +10179,23 @@ alpha_init_libfuncs (void) #undef TARGET_MACHINE_DEPENDENT_REORG #define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg +#undef TARGET_PROMOTE_FUNCTION_ARGS +#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true +#undef TARGET_PROMOTE_FUNCTION_RETURN +#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true +#undef TARGET_PROMOTE_PROTOTYPES +#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false +#undef TARGET_STRUCT_VALUE_RTX +#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null +#undef TARGET_RETURN_IN_MEMORY +#define TARGET_RETURN_IN_MEMORY alpha_return_in_memory +#undef TARGET_SETUP_INCOMING_VARARGS +#define TARGET_SETUP_INCOMING_VARARGS alpha_setup_incoming_varargs +#undef TARGET_STRICT_ARGUMENT_NAMING +#define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true +#undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED +#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED hook_bool_CUMULATIVE_ARGS_true + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 5faadfbdbf0..4b873775a3e 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -461,15 +461,6 @@ extern const char *alpha_tls_size_string; /* For -mtls-size= */ (MODE) = DImode; \ } -/* Define this if function arguments should also be promoted using the above - procedure. */ - -#define PROMOTE_FUNCTION_ARGS - -/* Likewise, if the function return value is promoted. */ - -#define PROMOTE_FUNCTION_RETURN - /* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. @@ -1003,15 +994,6 @@ extern int alpha_memory_latency; #define LIBCALL_VALUE(MODE) \ function_value (NULL, NULL, MODE) -/* The definition of this macro implies that there are cases where - a scalar value cannot be returned in registers. - - For the Alpha, any structure or union type is returned in memory, as - are integers whose size is larger than 64 bits. */ - -#define RETURN_IN_MEMORY(TYPE) \ - return_in_memory (TYPE, VOIDmode) - /* 1 if N is a possible register number for a function value as seen by the caller. */ @@ -1096,11 +1078,6 @@ extern int alpha_memory_latency; ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ ? 6 - (CUM) : 0) -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. */ -#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ - alpha_setup_incoming_varargs(CUM,MODE,TYPE,&(PRETEND_SIZE),NO_RTL) - /* Try to output insns to set TARGET equal to the constant C if it can be done in less than N insns. Do all computations in MODE. Returns the place where the output has been placed if it can be done and the insns have been diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h index a4789b0483c..c7f2bfe4aa7 100644 --- a/gcc/config/alpha/unicosmk.h +++ b/gcc/config/alpha/unicosmk.h @@ -223,30 +223,6 @@ do { \ #undef FUNCTION_ARG_PARTIAL_NREGS /* #define FUNCTION_ARG_PARTIAL_NREGS(CUM,MODE,TYPE,NAMED) 0 */ -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. - - On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register - arguments on the stack. Unfortunately, it doesn't always store the first - one (i.e. the one that arrives in $16 or $f16). This is not a problem - with stdargs as we always have at least one named argument there. */ - -#undef SETUP_INCOMING_VARARGS -#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ -{ if ((CUM).num_reg_words < 6) \ - { \ - if (! (NO_RTL)) \ - { \ - int start = (CUM).num_reg_words + 1; \ - \ - emit_insn (gen_umk_mismatch_args (GEN_INT (start))); \ - emit_insn (gen_arg_home_umk ()); \ - } \ - \ - PRETEND_SIZE = 0; \ - } \ -} - /* This ensures that $15 increments/decrements in leaf functions won't get eliminated. */ diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 3bb9b590af3..8b065e7b9b0 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -202,42 +202,6 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info; + ALPHA_ARG_SIZE (MODE, TYPE, NAMED) \ ? 6 - (CUM).num_args : 0) -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. - - CUM is as for INIT_CUMULATIVE_ARGS. - - MODE and TYPE are the mode and type of the current parameter. - - PRETEND_SIZE is a variable that should be set to the amount of stack - that must be pushed by the prolog to pretend that our caller pushed - it. - - Normally, this macro will push all remaining incoming registers on the - stack and set PRETEND_SIZE to the length of the registers pushed. - - For VMS, we allocate space for all 6 arg registers plus a count. - - However, if NO registers need to be saved, don't allocate any space. - This is not only because we won't need the space, but because AP includes - the current_pretend_args_size and we don't want to mess up any - ap-relative addresses already made. */ - -#undef SETUP_INCOMING_VARARGS -#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ -{ if ((CUM).num_args < 6) \ - { \ - if (! (NO_RTL)) \ - { \ - emit_move_insn (gen_rtx_REG (DImode, 1), \ - virtual_incoming_args_rtx); \ - emit_insn (gen_arg_home ()); \ - } \ - \ - PRETEND_SIZE = 7 * UNITS_PER_WORD; \ - } \ -} - /* ABI has stack checking, but it's broken. */ #undef STACK_CHECK_BUILTIN #define STACK_CHECK_BUILTIN 0