Commit 68fd7765 by Anatoly Sokolov Committed by Anatoly Sokolov

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
parent b3f1cee4
2011-03-18 Anatoly Sokolov <aesok@post.ru>
* 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 <jason@redhat.com> 2011-03-18 Jason Merrill <jason@redhat.com>
PR c++/23372 PR c++/23372
......
/* Prototypes for exported functions defined in avr.c /* 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. Free Software Foundation, Inc.
Contributed by Denis Chertykov (chertykov@gmail.com) Contributed by Denis Chertykov (chertykov@gmail.com)
...@@ -23,7 +24,6 @@ ...@@ -23,7 +24,6 @@
extern int function_arg_regno_p (int r); extern int function_arg_regno_p (int r);
extern void avr_cpu_cpp_builtins (struct cpp_reader * pfile); 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 enum reg_class avr_regno_reg_class (int r);
extern void asm_globalize_label (FILE *file, const char *name); extern void asm_globalize_label (FILE *file, const char *name);
extern void avr_asm_declare_function_name (FILE *, const char *, tree); 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[]); ...@@ -85,7 +85,6 @@ extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]);
extern int extra_constraint_Q (rtx x); extern int extra_constraint_Q (rtx x);
extern int adjust_insn_length (rtx insn, int len); 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_inhi (rtx insn, rtx *operands, int *len);
extern const char *output_reload_insisf (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, extern enum reg_class secondary_input_reload_class (enum reg_class,
......
/* Subroutines for insn-output.c for ATMEL AVR micro controllers /* Subroutines for insn-output.c for ATMEL AVR micro controllers
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 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) Contributed by Denis Chertykov (chertykov@gmail.com)
This file is part of GCC. This file is part of GCC.
...@@ -75,6 +75,8 @@ static void avr_asm_function_end_prologue (FILE *); ...@@ -75,6 +75,8 @@ static void avr_asm_function_end_prologue (FILE *);
static void avr_asm_function_begin_epilogue (FILE *); static void avr_asm_function_begin_epilogue (FILE *);
static bool avr_cannot_modify_jumps_p (void); static bool avr_cannot_modify_jumps_p (void);
static rtx avr_function_value (const_tree, const_tree, bool); 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_insert_attributes (tree, tree *);
static void avr_asm_init_sections (void); static void avr_asm_init_sections (void);
static unsigned int avr_section_type_flags (tree, const char *, int); static unsigned int avr_section_type_flags (tree, const char *, int);
...@@ -166,8 +168,14 @@ static const struct default_options avr_option_optimization_table[] = ...@@ -166,8 +168,14 @@ static const struct default_options avr_option_optimization_table[] =
#define TARGET_ASM_FUNCTION_END_PROLOGUE avr_asm_function_end_prologue #define TARGET_ASM_FUNCTION_END_PROLOGUE avr_asm_function_end_prologue
#undef TARGET_ASM_FUNCTION_BEGIN_EPILOGUE #undef TARGET_ASM_FUNCTION_BEGIN_EPILOGUE
#define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE avr_asm_function_begin_epilogue #define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE avr_asm_function_begin_epilogue
#undef TARGET_FUNCTION_VALUE #undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE avr_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 #undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE avr_attribute_table #define TARGET_ATTRIBUTE_TABLE avr_attribute_table
#undef TARGET_ASM_FUNCTION_RODATA_SECTION #undef TARGET_ASM_FUNCTION_RODATA_SECTION
...@@ -5910,36 +5918,49 @@ avr_reorg (void) ...@@ -5910,36 +5918,49 @@ avr_reorg (void)
/* Returns register number for function return value.*/ /* Returns register number for function return value.*/
int static inline int
avr_ret_register (void) avr_ret_register (void)
{ {
return 24; 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 /* Create an RTX representing the place where a
library function returns a value of mode MODE. */ library function returns a value of mode MODE. */
rtx static rtx
avr_libcall_value (enum machine_mode mode) avr_libcall_value (enum machine_mode mode,
const_rtx func ATTRIBUTE_UNUSED)
{ {
int offs = GET_MODE_SIZE (mode); int offs = GET_MODE_SIZE (mode);
if (offs < 2) if (offs < 2)
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 /* Create an RTX representing the place where a
function returns a value of data type VALTYPE. */ function returns a value of data type VALTYPE. */
rtx static rtx
avr_function_value (const_tree type, avr_function_value (const_tree type, const_tree fn_decl_or_type,
const_tree func ATTRIBUTE_UNUSED,
bool outgoing ATTRIBUTE_UNUSED) bool outgoing ATTRIBUTE_UNUSED)
{ {
unsigned int offs; 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) 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); offs = int_size_in_bytes (type);
if (offs < 2) if (offs < 2)
...@@ -5949,7 +5970,7 @@ avr_function_value (const_tree type, ...@@ -5949,7 +5970,7 @@ avr_function_value (const_tree type,
else if (offs > GET_MODE_SIZE (SImode) && offs < GET_MODE_SIZE (DImode)) else if (offs > GET_MODE_SIZE (SImode) && offs < GET_MODE_SIZE (DImode))
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 int
......
...@@ -380,12 +380,6 @@ typedef struct avr_args { ...@@ -380,12 +380,6 @@ typedef struct avr_args {
extern int avr_reg_order[]; 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 DEFAULT_PCC_STRUCT_RETURN 0
#define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO) #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment