From 8ac411c731c11569c7deee92ea0a4734bb5777eb Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 29 Jan 2004 01:31:15 +0000 Subject: [PATCH] frv-protos.h: Remove the prototype for frv_expand_builtin_saveregs. * config/frv/frv-protos.h: Remove the prototype for frv_expand_builtin_saveregs. * config/frv/frv.c (TARGET_STRUCT_VALUE_RTX): Likewise. (TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise. (frv_stack_info): Use FRV_STRUCT_VALUE_REGNUM instead of STRUCT_VALUE_REGNUM. (frv_expand_builtin_saveregs): Make it static. (frv_struct_value_rtx): New. * config/frv/frv.h (EXPAND_BUILTIN_SAVEREGS): Remove. From-SVN: r76826 --- gcc/ChangeLog | 12 +++++++++++ gcc/config/frv/frv-protos.h | 3 +-- gcc/config/frv/frv.c | 32 ++++++++++++++++++++++------- gcc/config/frv/frv.h | 40 +++++++++++++++---------------------- 4 files changed, 54 insertions(+), 33 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa895420975..aad6684c79d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2004-01-28 Kazu Hirata + + * config/frv/frv-protos.h: Remove the prototype for + frv_expand_builtin_saveregs. + * config/frv/frv.c (TARGET_STRUCT_VALUE_RTX): Likewise. + (TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise. + (frv_stack_info): Use FRV_STRUCT_VALUE_REGNUM instead of + STRUCT_VALUE_REGNUM. + (frv_expand_builtin_saveregs): Make it static. + (frv_struct_value_rtx): New. + * config/frv/frv.h (EXPAND_BUILTIN_SAVEREGS): Remove. + 2004-01-29 Jan Hubicka PR c++/12850 diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h index d664bb070f6..5cea43b74d0 100644 --- a/gcc/config/frv/frv-protos.h +++ b/gcc/config/frv/frv-protos.h @@ -1,5 +1,5 @@ /* Frv prototypes. - Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. Contributed by Red Hat, Inc. This file is part of GCC. @@ -96,7 +96,6 @@ extern int frv_function_arg_keep_as_reference (CUMULATIVE_ARGS *, enum machine_mode, tree, int); -extern rtx frv_expand_builtin_saveregs (void); extern void frv_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index ae0c6bd80c6..71180945754 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004 + Free Software Foundation, Inc. Contributed by Red Hat, Inc. This file is part of GCC. @@ -262,9 +263,11 @@ static void frv_init_libfuncs (void); static bool frv_in_small_data_p (tree); static void frv_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); +static rtx frv_expand_builtin_saveregs (void); static bool frv_rtx_costs (rtx, int, int, int*); static void frv_asm_out_constructor (rtx, int); static void frv_asm_out_destructor (rtx, int); +static rtx frv_struct_value_rtx (tree, int); /* Initialize the GCC target structure. */ #undef TARGET_ASM_FUNCTION_PROLOGUE @@ -298,6 +301,12 @@ static void frv_asm_out_destructor (rtx, int); #undef TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE #define TARGET_SCHED_USE_DFA_PIPELINE_INTERFACE frv_use_dfa_pipeline_interface +#undef TARGET_STRUCT_VALUE_RTX +#define TARGET_STRUCT_VALUE_RTX frv_struct_value_rtx + +#undef TARGET_EXPAND_BUILTIN_SAVEREGS +#define TARGET_EXPAND_BUILTIN_SAVEREGS frv_expand_builtin_saveregs + struct gcc_target targetm = TARGET_INITIALIZER; /* Given a CONST, return true if the symbol_ref points to small data. */ @@ -902,8 +911,8 @@ frv_stack_info (void) info_ptr->regs[STACK_REGS_STDARG].special_p = 1; info_ptr->regs[STACK_REGS_STRUCT].name = "struct"; - info_ptr->regs[STACK_REGS_STRUCT].first = STRUCT_VALUE_REGNUM; - info_ptr->regs[STACK_REGS_STRUCT].last = STRUCT_VALUE_REGNUM; + info_ptr->regs[STACK_REGS_STRUCT].first = FRV_STRUCT_VALUE_REGNUM; + info_ptr->regs[STACK_REGS_STRUCT].last = FRV_STRUCT_VALUE_REGNUM; info_ptr->regs[STACK_REGS_STRUCT].special_p = 1; info_ptr->regs[STACK_REGS_FP].name = "fp"; @@ -998,7 +1007,7 @@ frv_stack_info (void) case STACK_REGS_STRUCT: if (cfun->returns_struct) { - info_ptr->save_p[STRUCT_VALUE_REGNUM] = REG_SAVE_1WORD; + info_ptr->save_p[FRV_STRUCT_VALUE_REGNUM] = REG_SAVE_1WORD; size_1word += UNITS_PER_WORD; } break; @@ -1136,8 +1145,8 @@ frv_stack_info (void) if (cfun->returns_struct) { - info_ptr->save_p[STRUCT_VALUE_REGNUM] = REG_SAVE_1WORD; - info_ptr->reg_offset[STRUCT_VALUE_REGNUM] = offset + UNITS_PER_WORD; + info_ptr->save_p[FRV_STRUCT_VALUE_REGNUM] = REG_SAVE_1WORD; + info_ptr->reg_offset[FRV_STRUCT_VALUE_REGNUM] = offset + UNITS_PER_WORD; info_ptr->regs[STACK_REGS_STRUCT].size_1word = UNITS_PER_WORD; } @@ -1975,7 +1984,7 @@ frv_setup_incoming_varargs (CUMULATIVE_ARGS *cum, If this macro is not defined, the compiler will output an ordinary call to the library function `__builtin_saveregs'. */ -rtx +static rtx frv_expand_builtin_saveregs (void) { int offset = UNITS_PER_WORD * FRV_NUM_ARG_REGS; @@ -9563,3 +9572,12 @@ frv_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED) assemble_align (POINTER_SIZE); assemble_integer_with_op ("\t.picptr\t", symbol); } + +/* Worker function for TARGET_STRUCT_VALUE_RTX. */ + +static rtx +frv_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, + int incoming ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (Pmode, FRV_STRUCT_VALUE_REGNUM); +} diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 9f85d57637d..198d7132a57 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -1,5 +1,6 @@ /* Target macros for the FRV port of GCC. - Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Contributed by Red Hat Inc. This file is part of GCC. @@ -1999,8 +2000,9 @@ struct machine_function GTY(()) (Actually, on most machines, scalar values are returned in the same place regardless of mode). - If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion - rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type. + If `TARGET_PROMOTE_FUNCTION_RETURN' is defined to return true, you + must apply the same promotion rules specified in `PROMOTE_MODE' if + VALTYPE is a scalar type. If the precise function being called is known, FUNC is a tree node (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it @@ -2008,8 +2010,8 @@ struct machine_function GTY(()) functions when all their calls are known. `FUNCTION_VALUE' is not used for return vales with aggregate data types, - because these are returned in another way. See `STRUCT_VALUE_REGNUM' and - related macros, below. */ + because these are returned in another way. See + `TARGET_STRUCT_VALUE_RTX' and related macros, below. */ #define FUNCTION_VALUE(VALTYPE, FUNC) \ gen_rtx (REG, TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM) @@ -2041,9 +2043,9 @@ struct machine_function GTY(()) /* How Large Values are Returned. */ -/* If the structure value address is passed in a register, then - `STRUCT_VALUE_REGNUM' should be the number of that register. */ -#define STRUCT_VALUE_REGNUM (GPR_FIRST + 3) +/* The number of the register that is used to to pass the structure + value address. */ +#define FRV_STRUCT_VALUE_REGNUM (GPR_FIRST + 3) /* Function Entry and Exit. */ @@ -2081,23 +2083,13 @@ struct machine_function GTY(()) /* Implementing the Varargs Macros. */ -/* If defined, is a C expression that produces the machine-specific code for a - call to `__builtin_saveregs'. This code will be moved to the very beginning - of the function, before any parameter access are made. The return value of - this function should be an RTX that contains the value to use as the return - of `__builtin_saveregs'. - - If this macro is not defined, the compiler will output an ordinary call to - the library function `__builtin_saveregs'. */ - -#define EXPAND_BUILTIN_SAVEREGS() frv_expand_builtin_saveregs () - /* This macro offers an alternative to using `__builtin_saveregs' and defining - the macro `EXPAND_BUILTIN_SAVEREGS'. Use it to store the anonymous register - arguments into the stack so that all the arguments appear to have been - passed consecutively on the stack. Once this is done, you can use the - standard implementation of varargs that works for machines that pass all - their arguments on the stack. + the target hook `TARGET_EXPAND_BUILTIN_SAVEREGS'. Use it to store + the anonymous register arguments into the stack so that all the + arguments appear to have been passed consecutively on the stack. + Once this is done, you can use the standard implementation of + varargs that works for machines that pass all their arguments on + the stack. The argument ARGS_SO_FAR is the `CUMULATIVE_ARGS' data structure, containing the values that obtain after processing of the named arguments. The