From 9eaa7740ba3111958a29fc4d16f1ba53718ec1a4 Mon Sep 17 00:00:00 2001 From: Anatoly Sokolov Date: Tue, 29 Mar 2011 00:05:28 +0400 Subject: [PATCH] h8300.h (FUNCTION_VALUE_REGNO_P, [...]): Remove macros. * config/h8300/h8300.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE, LIBCALL_VALUE): Remove macros. * config/h8300/h8300.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE, TARGET_FUNCTION_VALUE_REGNO_P): Define. (h8300_function_value, h8300_libcall_value, h8300_function_value_regno_p): New functions. From-SVN: r171625 --- gcc/ChangeLog | 9 +++++++++ gcc/config/h8300/h8300.c | 43 +++++++++++++++++++++++++++++++++++++++- gcc/config/h8300/h8300.h | 23 --------------------- 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 50df7ad7602..1de788d77f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-03-28 Anatoly Sokolov + + * config/h8300/h8300.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE, + LIBCALL_VALUE): Remove macros. + * config/h8300/h8300.c (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE, + TARGET_FUNCTION_VALUE_REGNO_P): Define. + (h8300_function_value, h8300_libcall_value, + h8300_function_value_regno_p): New functions. + 2011-03-28 Anatoly Sokolov * config/h8300/h8300.h (ASM_OUTPUT_BSS): Remove macro. diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 774863cbea7..0e44a3ab425 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1,6 +1,6 @@ /* Subroutines for insn-output.c for Renesas H8/300. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Steve Chamberlain (sac@cygnus.com), Jim Wilson (wilson@cygnus.com), and Doug Evans (dje@cygnus.com). @@ -5860,6 +5860,38 @@ h8300_init_libfuncs (void) set_optab_libfunc (umod_optab, HImode, "__umodhi3"); } +/* Worker function for TARGET_FUNCTION_VALUE. + + On the H8 the return value is in R0/R1. */ + +static rtx +h8300_function_value (const_tree ret_type, + const_tree fn_decl_or_type ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (TYPE_MODE (ret_type), R0_REG); +} + +/* Worker function for TARGET_LIBCALL_VALUE. + + On the H8 the return value is in R0/R1. */ + +static rtx +h8300_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (mode, R0_REG); +} + +/* Worker function for TARGET_FUNCTION_VALUE_REGNO_P. + + On the H8, R0 is the only register thus used. */ + +static bool +h8300_function_value_regno_p (const unsigned int regno) +{ + return (regno == R0_REG); +} + /* Worker function for TARGET_RETURN_IN_MEMORY. */ static bool @@ -5946,6 +5978,15 @@ h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt) #undef TARGET_INIT_LIBFUNCS #define TARGET_INIT_LIBFUNCS h8300_init_libfuncs +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE h8300_function_value + +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE h8300_libcall_value + +#undef TARGET_FUNCTION_VALUE_REGNO_P +#define TARGET_FUNCTION_VALUE_REGNO_P h8300_function_value_regno_p + #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY h8300_return_in_memory diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 0c61b80ccd9..57fffda2297 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -527,29 +527,6 @@ enum reg_class { #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ ((OFFSET) = h8300_initial_elimination_offset ((FROM), (TO))) -/* Define how to find the value returned by a function. - VALTYPE is the data type of the value (as a tree). - If the precise function being called is known, FUNC is its FUNCTION_DECL; - otherwise, FUNC is 0. - - On the H8 the return value is in R0/R1. */ - -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - gen_rtx_REG (TYPE_MODE (VALTYPE), R0_REG) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ - -/* On the H8 the return value is in R0/R1. */ - -#define LIBCALL_VALUE(MODE) \ - gen_rtx_REG (MODE, R0_REG) - -/* 1 if N is a possible register number for a function value. - On the H8, R0 is the only register thus used. */ - -#define FUNCTION_VALUE_REGNO_P(N) ((N) == R0_REG) - /* Define this if PCC uses the nonreentrant convention for returning structure and union values. */ -- 2.30.2