From: aesok Date: Mon, 30 Nov 2009 21:38:46 +0000 (+0000) Subject: * config/sh/sh.c (sh_promote_prototypes): Make static. X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=5cb06fbbebd8155782baf71fdb146fda920f9a95;p=pf3gnuchains%2Fgcc-fork.git * config/sh/sh.c (sh_promote_prototypes): Make static. (sh_function_value, sh_libcall_value, sh_function_value_regno_p): New functions. (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare. * config/sh/sh.h: (FUNCTION_VALUE_REGNO_P): Redefine, use sh_function_value_regno_p. (FUNCTION_VALUE, LIBCALL_VALUE): Remove. * config/sh/sh-protos.h (sh_function_value_regno_p): Declare. (sh_promote_prototypes) : Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154842 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 71d9b8ef78d..417e4b6a664 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2009-11-30 Anatoly Sokolov + + * config/sh/sh.c (sh_promote_prototypes): Make static. + (sh_function_value, sh_libcall_value, sh_function_value_regno_p): New + functions. + (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare. + * config/sh/sh.h: (FUNCTION_VALUE_REGNO_P): Redefine, use + sh_function_value_regno_p. + (FUNCTION_VALUE, LIBCALL_VALUE): Remove. + * config/sh/sh-protos.h (sh_function_value_regno_p): Declare. + (sh_promote_prototypes) : Remove. + 2009-11-30 Julian Brown * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Don't restrict Thumb-2 diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index 8157221c0c6..7335efcd0a1 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -163,7 +163,7 @@ extern rtx sh_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern void sh_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern int sh_pass_in_reg_p (CUMULATIVE_ARGS *, enum machine_mode, tree); extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, signed int, enum machine_mode); -extern bool sh_promote_prototypes (const_tree); +extern bool sh_function_value_regno_p (const unsigned int); extern rtx sh_dwarf_register_span (rtx); extern rtx replace_n_hard_rtx (rtx, rtx *, int , int); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 26bceea670d..5fe752eac20 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -251,6 +251,8 @@ static struct save_entry_s *sh5_schedule_saves (HARD_REG_SET *, struct save_schedule_s *, int); static rtx sh_struct_value_rtx (tree, int); +static rtx sh_function_value (const_tree, const_tree, bool); +static rtx sh_libcall_value (enum machine_mode, const_rtx); static bool sh_return_in_memory (const_tree, const_tree); static rtx sh_builtin_saveregs (void); static void sh_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); @@ -259,6 +261,7 @@ static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *); static tree sh_build_builtin_va_list (void); static void sh_va_start (tree, rtx); static tree sh_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); +static bool sh_promote_prototypes (const_tree); static enum machine_mode sh_promote_function_mode (const_tree type, enum machine_mode, int *punsignedp, @@ -451,6 +454,10 @@ static const struct attribute_spec sh_attribute_table[] = #undef TARGET_PROMOTE_FUNCTION_MODE #define TARGET_PROMOTE_FUNCTION_MODE sh_promote_function_mode +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE sh_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE sh_libcall_value #undef TARGET_STRUCT_VALUE_RTX #define TARGET_STRUCT_VALUE_RTX sh_struct_value_rtx #undef TARGET_RETURN_IN_MEMORY @@ -7947,7 +7954,7 @@ sh_promote_function_mode (const_tree type, enum machine_mode mode, return mode; } -bool +static bool sh_promote_prototypes (const_tree type) { if (TARGET_HITACHI) @@ -8306,6 +8313,54 @@ sh_struct_value_rtx (tree fndecl, int incoming ATTRIBUTE_UNUSED) return gen_rtx_REG (Pmode, 2); } +/* Worker function for TARGET_FUNCTION_VALUE. + + For the SH, this is like LIBCALL_VALUE, except that we must change the + mode like PROMOTE_MODE does. + ??? PROMOTE_MODE is ignored for non-scalar types. The set of types + tested here has to be kept in sync with the one in explow.c:promote_mode. +*/ + +static rtx +sh_function_value (const_tree valtype, + const_tree fn_decl_or_type, + bool outgoing ATTRIBUTE_UNUSED) +{ + if (fn_decl_or_type + && !DECL_P (fn_decl_or_type)) + fn_decl_or_type = NULL; + + return gen_rtx_REG ( + ((GET_MODE_CLASS (TYPE_MODE (valtype)) == MODE_INT + && GET_MODE_SIZE (TYPE_MODE (valtype)) < 4 + && (TREE_CODE (valtype) == INTEGER_TYPE + || TREE_CODE (valtype) == ENUMERAL_TYPE + || TREE_CODE (valtype) == BOOLEAN_TYPE + || TREE_CODE (valtype) == REAL_TYPE + || TREE_CODE (valtype) == OFFSET_TYPE)) + && sh_promote_prototypes (fn_decl_or_type) + ? (TARGET_SHMEDIA64 ? DImode : SImode) : TYPE_MODE (valtype)), + BASE_RETURN_VALUE_REG (TYPE_MODE (valtype))); +} + +/* Worker function for TARGET_LIBCALL_VALUE. */ + +static rtx +sh_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (mode, BASE_RETURN_VALUE_REG (mode)); +} + +/* Worker function for FUNCTION_VALUE_REGNO_P. */ + +bool +sh_function_value_regno_p (const unsigned int regno) +{ + return ((regno) == FIRST_RET_REG + || (TARGET_SH2E && (regno) == FIRST_FP_RET_REG) + || (TARGET_SHMEDIA_FPU && (regno) == FIRST_FP_RET_REG)); +} + /* Worker function for TARGET_RETURN_IN_MEMORY. */ static bool diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index c24555f9796..697138f57ce 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -1453,37 +1453,7 @@ extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER]; ? FIRST_FP_PARM_REG \ : FIRST_PARM_REG) -/* 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. - For the SH, this is like LIBCALL_VALUE, except that we must change the - mode like PROMOTE_MODE does. - ??? PROMOTE_MODE is ignored for non-scalar types. The set of types - tested here has to be kept in sync with the one in explow.c:promote_mode. */ - -#define FUNCTION_VALUE(VALTYPE, FUNC) \ - gen_rtx_REG ( \ - ((GET_MODE_CLASS (TYPE_MODE (VALTYPE)) == MODE_INT \ - && GET_MODE_SIZE (TYPE_MODE (VALTYPE)) < 4 \ - && (TREE_CODE (VALTYPE) == INTEGER_TYPE \ - || TREE_CODE (VALTYPE) == ENUMERAL_TYPE \ - || TREE_CODE (VALTYPE) == BOOLEAN_TYPE \ - || TREE_CODE (VALTYPE) == REAL_TYPE \ - || TREE_CODE (VALTYPE) == OFFSET_TYPE)) \ - && sh_promote_prototypes (FUNC) \ - ? (TARGET_SHMEDIA64 ? DImode : SImode) : TYPE_MODE (VALTYPE)), \ - BASE_RETURN_VALUE_REG (TYPE_MODE (VALTYPE))) - -/* Define how to find the value returned by a library function - assuming the value has mode MODE. */ -#define LIBCALL_VALUE(MODE) \ - gen_rtx_REG ((MODE), BASE_RETURN_VALUE_REG (MODE)); - -/* 1 if N is a possible register number for a function value. */ -#define FUNCTION_VALUE_REGNO_P(REGNO) \ - ((REGNO) == FIRST_RET_REG || (TARGET_SH2E && (REGNO) == FIRST_FP_RET_REG) \ - || (TARGET_SHMEDIA_FPU && (REGNO) == FIRST_FP_RET_REG)) +#define FUNCTION_VALUE_REGNO_P(REGNO) sh_function_value_regno_p (REGNO) /* 1 if N is a possible register number for function argument passing. */ /* ??? There are some callers that pass REGNO as int, and others that pass