diff options
author | Anatoly Sokolov <aesok@post.ru> | 2009-11-15 00:07:23 +0300 |
---|---|---|
committer | Anatoly Sokolov <aesok@gcc.gnu.org> | 2009-11-15 00:07:23 +0300 |
commit | 7ae6223791a8caa4808f893542315b685560f939 (patch) | |
tree | 8589a78f9893d693f845ff9d91b8976c1f3fd08d | |
parent | 282cac16ce49087d657bb31d0e9841423cf40151 (diff) | |
download | gcc-7ae6223791a8caa4808f893542315b685560f939.zip gcc-7ae6223791a8caa4808f893542315b685560f939.tar.gz gcc-7ae6223791a8caa4808f893542315b685560f939.tar.bz2 |
iq2000.c (iq2000_function_value): Make static, add new 'outgoing' argument.
* config/iq2000/iq2000.c (iq2000_function_value): Make static, add
new 'outgoing' argument.
(iq2000_libcall_value, iq2000_function_value_regno_p): New functions.
(TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
* config/iq2000/iq2000.h: (FUNCTION_VALUE_REGNO_P): Redefine, use
iq2000_function_value_regno_p.
(FUNCTION_VALUE, LIBCALL_VALUE): Remove.
* config/iq2000/iq2000-protos.h (iq2000_function_value_regno_p):
Declare.
From-SVN: r154184
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/iq2000/iq2000-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/iq2000/iq2000.c | 39 | ||||
-rw-r--r-- | gcc/config/iq2000/iq2000.h | 13 |
4 files changed, 51 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f127aa0..e8ed5eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2009-11-14 Anatoly Sokolov <aesok@post.ru> + + * config/iq2000/iq2000.c (iq2000_function_value): Make static, add + new 'outgoing' argument. + (iq2000_libcall_value, iq2000_function_value_regno_p): New functions. + (TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare. + * config/iq2000/iq2000.h: (FUNCTION_VALUE_REGNO_P): Redefine, use + iq2000_function_value_regno_p. + (FUNCTION_VALUE, LIBCALL_VALUE): Remove. + * config/iq2000/iq2000-protos.h (iq2000_function_value_regno_p): + Declare. + 2009-11-14 Richard Earnshaw <rearnsha@arm.com> PR target/42031 diff --git a/gcc/config/iq2000/iq2000-protos.h b/gcc/config/iq2000/iq2000-protos.h index 0e4dba7..c01b6ee 100644 --- a/gcc/config/iq2000/iq2000-protos.h +++ b/gcc/config/iq2000/iq2000-protos.h @@ -47,7 +47,7 @@ extern void gen_conditional_branch (rtx *, enum machine_mode); extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx); extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern struct rtx_def * function_arg (CUMULATIVE_ARGS *, enum machine_mode, const_tree, int); -extern rtx iq2000_function_value (const_tree, const_tree); +extern bool iq2000_function_value_regno_p (const unsigned int); #endif #endif /* ! GCC_IQ2000_PROTOS_H */ diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 2e2f29a..4359f5e 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -168,6 +168,8 @@ static bool iq2000_legitimate_address_p (enum machine_mode, rtx, bool); static bool iq2000_can_eliminate (const int, const int); static void iq2000_asm_trampoline_template (FILE *); static void iq2000_trampoline_init (rtx, tree, rtx); +static rtx iq2000_function_value (const_tree, const_tree, bool); +static rtx iq2000_libcall_value (enum machine_mode, const_rtx); #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS iq2000_init_builtins @@ -197,6 +199,10 @@ static void iq2000_trampoline_init (rtx, tree, rtx); #undef TARGET_PROMOTE_PROTOTYPES #define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE iq2000_function_value +#undef TARGET_LIBCALL_VALUE +#define TARGET_LIBCALL_VALUE iq2000_libcall_value #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY iq2000_return_in_memory #undef TARGET_PASS_BY_REFERENCE @@ -2210,18 +2216,47 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED, /* Return register to use for a function return value with VALTYPE for function FUNC. */ -rtx -iq2000_function_value (const_tree valtype, const_tree func) +static rtx +iq2000_function_value (const_tree valtype, + const_tree fn_decl_or_type, + bool outgoing ATTRIBUTE_UNUSED) { int reg = GP_RETURN; enum machine_mode mode = TYPE_MODE (valtype); int unsignedp = TYPE_UNSIGNED (valtype); + tree func = fn_decl_or_type; + + if (fn_decl_or_type + && !DECL_P (fn_decl_or_type)) + fn_decl_or_type = NULL; /* Since we promote return types, we must promote the mode here too. */ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1); return gen_rtx_REG (mode, reg); } + +/* Worker function for TARGET_LIBCALL_VALUE. */ + +static rtx +iq2000_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED) +{ + return gen_rtx_REG (((GET_MODE_CLASS (mode) != MODE_INT + || GET_MODE_SIZE (mode) >= 4) + ? mode : SImode), + GP_RETURN); +} + +/* Worker function for FUNCTION_VALUE_REGNO_P. + + On the IQ2000, R2 and R3 are the only register thus used. */ + +bool +iq2000_function_value_regno_p (const unsigned int regno) +{ + return (regno == GP_RETURN); +} + /* Return true when an argument must be passed by reference. */ diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 4dadbdb..0b207b5 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -422,20 +422,9 @@ typedef struct iq2000_args (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST)) -/* How Scalar Function Values are Returned. */ - -#define FUNCTION_VALUE(VALTYPE, FUNC) iq2000_function_value (VALTYPE, FUNC) - -#define LIBCALL_VALUE(MODE) \ - gen_rtx_REG (((GET_MODE_CLASS (MODE) != MODE_INT \ - || GET_MODE_SIZE (MODE) >= 4) \ - ? (MODE) \ - : SImode), \ - GP_RETURN) - /* On the IQ2000, R2 and R3 are the only register thus used. */ -#define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN) +#define FUNCTION_VALUE_REGNO_P(N) iq2000_function_value_regno_p (N) /* How Large Values are Returned. */ |