From eeea81f9dd88c8eae9172f134a1c8c95bac5c604 Mon Sep 17 00:00:00 2001 From: aesok Date: Sat, 31 Oct 2009 22:35:53 +0000 Subject: [PATCH] * config/frv/frv.c (frv_function_value, frv_libcall_value, frv_function_value_regno_p): New functions. (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare. * config/frv/frv.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove. (FUNCTION_VALUE_REGNO_P): Redefine, use frv_function_value_regno_p. * config/frv/frv-protos.h (frv_function_value_regno_p): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153783 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/frv/frv-protos.h | 1 + gcc/config/frv/frv.c | 38 ++++++++++++++++++++++++++++++++++++++ gcc/config/frv/frv.h | 43 +------------------------------------------ 4 files changed, 49 insertions(+), 42 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d63c0a..94a1ccb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,14 @@ 2009-10-31 Anatoly Sokolov + * config/frv/frv.c (frv_function_value, frv_libcall_value, + frv_function_value_regno_p): New functions. + (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare. + * config/frv/frv.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove. + (FUNCTION_VALUE_REGNO_P): Redefine, use frv_function_value_regno_p. + * config/frv/frv-protos.h (frv_function_value_regno_p): Declare. + +2009-10-31 Anatoly Sokolov + * config/mn10300/mn10300.c (mn10300_function_value): Make static, add new 'outgoing' argument. (mn10300_libcall_value, mn10300_function_value_regno_p): New diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h index 2bfdc65..3c9950d 100644 --- a/gcc/config/frv/frv-protos.h +++ b/gcc/config/frv/frv-protos.h @@ -62,6 +62,7 @@ extern rtx frv_function_arg (CUMULATIVE_ARGS *, extern void frv_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); +extern bool frv_function_value_regno_p (const unsigned int); #endif /* TREE_CODE */ extern int frv_expand_block_move (rtx *); diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index d8901e9..a757472 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -273,6 +273,10 @@ static void frv_print_operand_memory_reference_reg static void frv_print_operand_memory_reference (FILE *, rtx, int); static int frv_print_operand_jump_hint (rtx); static const char *comparison_string (enum rtx_code, rtx); +static rtx frv_function_value (const_tree, const_tree, + bool); +static rtx frv_libcall_value (enum machine_mode, + const_rtx); static FRV_INLINE int frv_regno_ok_for_base_p (int, int); static rtx single_set_pattern (rtx); static int frv_function_contains_far_jump (void); @@ -483,6 +487,11 @@ static void frv_trampoline_init (rtx, tree, rtx); #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT frv_trampoline_init +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE frv_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE frv_libcall_value + struct gcc_target targetm = TARGET_INITIALIZER; #define FRV_SYMBOL_REF_TLS_P(RTX) \ @@ -3291,6 +3300,35 @@ frv_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode, } +/* Implements TARGET_FUNCTION_VALUE. */ + +static rtx +frv_function_value (const_tree valtype, + const_tree fn_decl_or_type ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (TYPE_MODE (valtype), RETURN_VALUE_REGNUM); +} + + +/* Implements TARGET_LIBCALL_VALUE. */ + +static rtx +frv_libcall_value (enum machine_mode mode, + const_rtx fun ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (mode, RETURN_VALUE_REGNUM); +} + + +/* Implements FUNCTION_VALUE_REGNO_P. */ + +bool +frv_function_value_regno_p (const unsigned int regno) +{ + return (regno == RETURN_VALUE_REGNUM); +} + /* Return true if a register is ok to use as a base or index register. */ static FRV_INLINE int diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index 53966de..d48aa1e 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -1746,48 +1746,7 @@ typedef struct frv_stack { function call. */ #define RETURN_VALUE_REGNUM (GPR_FIRST + 8) -/* A C expression to create an RTX representing the place where a function - returns a value of data type VALTYPE. VALTYPE is a tree node representing a - data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to - represent that type. On many machines, only the mode is relevant. - (Actually, on most machines, scalar values are returned in the same place - regardless of mode). - - 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 - possible to use a different value-returning convention for specific - 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 - `TARGET_STRUCT_VALUE_RTX' and related macros, below. */ -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM) - -/* A C expression to create an RTX representing the place where a library - function returns a value of mode MODE. - - Note that "library function" in this context means a compiler support - routine, used to perform arithmetic, whose name is known specially by the - compiler and was not mentioned in the C code being compiled. - - The definition of `LIBRARY_VALUE' need not be concerned aggregate data - types, because none of the library functions returns such types. */ -#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM) - -/* A C expression that is nonzero if REGNO is the number of a hard register in - which the values of called function may come back. - - A register whose use for returning values is limited to serving as the - second of a pair (for a value of type `double', say) need not be recognized - by this macro. So for most machines, this definition suffices: - - #define FUNCTION_VALUE_REGNO_P(N) ((N) == RETURN) - - If the machine has register windows, so that the caller and the called - function use different registers for the return value, this macro should - recognize only the caller's register numbers. */ -#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM) +#define FUNCTION_VALUE_REGNO_P(REGNO) frv_function_value_regno_p (REGNO) /* How Large Values are Returned. */ -- 2.7.4