From: Anatoly Sokolov Date: Fri, 18 Mar 2011 15:27:10 +0000 (+0300) Subject: avr.h (RET_REGISTER, [...]): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=68fd7765e4b8719538b920e4e868910a4c15db22;p=gcc.git avr.h (RET_REGISTER, [...]): Remove. * config/avr/avr.h (RET_REGISTER, LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove. * config/avr/avr-protos.h (avr_ret_register, avr_libcall_value): Remove. * config/avr/avr.c (avr_ret_register): Make static inline. (avr_function_value_regno_p): New function. (avr_libcall_value): Make static. Add 'func' argument. (avr_function_value): Make static. Rename 'func' argument to 'fn_decl_or_type', forward it to avr_libcall_value. Call avr_ret_register function instead of RET_REGISTER macro. (TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define. From-SVN: r171149 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 712eefe8f05..4b33a39ba82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2011-03-18 Anatoly Sokolov + + * config/avr/avr.h (RET_REGISTER, LIBCALL_VALUE, + FUNCTION_VALUE_REGNO_P): Remove. + * config/avr/avr-protos.h (avr_ret_register, avr_libcall_value): + Remove. + * config/avr/avr.c (avr_ret_register): Make static inline. + (avr_function_value_regno_p): New function. + (avr_libcall_value): Make static. Add 'func' argument. + (avr_function_value): Make static. Rename 'func' argument to + 'fn_decl_or_type', forward it to avr_libcall_value. Call + avr_ret_register function instead of RET_REGISTER macro. + (TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define. + 2011-03-18 Jason Merrill PR c++/23372 diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 45693597b29..67e915a569e 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -1,6 +1,7 @@ /* Prototypes for exported functions defined in avr.c - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. Contributed by Denis Chertykov (chertykov@gmail.com) @@ -23,7 +24,6 @@ extern int function_arg_regno_p (int r); extern void avr_cpu_cpp_builtins (struct cpp_reader * pfile); -extern int avr_ret_register (void); extern enum reg_class avr_regno_reg_class (int r); extern void asm_globalize_label (FILE *file, const char *name); extern void avr_asm_declare_function_name (FILE *, const char *, tree); @@ -85,7 +85,6 @@ extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]); extern int extra_constraint_Q (rtx x); extern int adjust_insn_length (rtx insn, int len); -extern rtx avr_libcall_value (enum machine_mode mode); extern const char *output_reload_inhi (rtx insn, rtx *operands, int *len); extern const char *output_reload_insisf (rtx insn, rtx *operands, int *len); extern enum reg_class secondary_input_reload_class (enum reg_class, diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 92cc7b65ba5..6709c365ce9 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for ATMEL AVR micro controllers Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. + 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Denis Chertykov (chertykov@gmail.com) This file is part of GCC. @@ -75,6 +75,8 @@ static void avr_asm_function_end_prologue (FILE *); static void avr_asm_function_begin_epilogue (FILE *); static bool avr_cannot_modify_jumps_p (void); static rtx avr_function_value (const_tree, const_tree, bool); +static rtx avr_libcall_value (enum machine_mode, const_rtx); +static bool avr_function_value_regno_p (const unsigned int); static void avr_insert_attributes (tree, tree *); static void avr_asm_init_sections (void); static unsigned int avr_section_type_flags (tree, const char *, int); @@ -166,8 +168,14 @@ static const struct default_options avr_option_optimization_table[] = #define TARGET_ASM_FUNCTION_END_PROLOGUE avr_asm_function_end_prologue #undef TARGET_ASM_FUNCTION_BEGIN_EPILOGUE #define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE avr_asm_function_begin_epilogue + #undef TARGET_FUNCTION_VALUE #define TARGET_FUNCTION_VALUE avr_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE avr_libcall_value +#undef TARGET_FUNCTION_VALUE_REGNO_P +#define TARGET_FUNCTION_VALUE_REGNO_P avr_function_value_regno_p + #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE avr_attribute_table #undef TARGET_ASM_FUNCTION_RODATA_SECTION @@ -5910,36 +5918,49 @@ avr_reorg (void) /* Returns register number for function return value.*/ -int +static inline int avr_ret_register (void) { return 24; } +/* Worker function for TARGET_FUNCTION_VALUE_REGNO_P. */ + +static bool +avr_function_value_regno_p (const unsigned int regno) +{ + return (regno == avr_ret_register ()); +} + /* Create an RTX representing the place where a library function returns a value of mode MODE. */ -rtx -avr_libcall_value (enum machine_mode mode) +static rtx +avr_libcall_value (enum machine_mode mode, + const_rtx func ATTRIBUTE_UNUSED) { int offs = GET_MODE_SIZE (mode); if (offs < 2) offs = 2; - return gen_rtx_REG (mode, RET_REGISTER + 2 - offs); + return gen_rtx_REG (mode, avr_ret_register () + 2 - offs); } /* Create an RTX representing the place where a function returns a value of data type VALTYPE. */ -rtx -avr_function_value (const_tree type, - const_tree func ATTRIBUTE_UNUSED, +static rtx +avr_function_value (const_tree type, const_tree fn_decl_or_type, bool outgoing ATTRIBUTE_UNUSED) { unsigned int offs; - + const_rtx func = fn_decl_or_type; + + if (fn_decl_or_type + && !DECL_P (fn_decl_or_type)) + fn_decl_or_type = NULL; + if (TYPE_MODE (type) != BLKmode) - return avr_libcall_value (TYPE_MODE (type)); + return avr_libcall_value (TYPE_MODE (type), func); offs = int_size_in_bytes (type); if (offs < 2) @@ -5949,7 +5970,7 @@ avr_function_value (const_tree type, else if (offs > GET_MODE_SIZE (SImode) && offs < GET_MODE_SIZE (DImode)) offs = GET_MODE_SIZE (DImode); - return gen_rtx_REG (BLKmode, RET_REGISTER + 2 - offs); + return gen_rtx_REG (BLKmode, avr_ret_register () + 2 - offs); } int diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index b52cf170cbc..146ab6793de 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -380,12 +380,6 @@ typedef struct avr_args { extern int avr_reg_order[]; -#define RET_REGISTER avr_ret_register () - -#define LIBCALL_VALUE(MODE) avr_libcall_value (MODE) - -#define FUNCTION_VALUE_REGNO_P(N) ((int) (N) == RET_REGISTER) - #define DEFAULT_PCC_STRUCT_RETURN 0 #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)