This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[CRIS] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
- From: Anatoly Sokolov <aesok at post dot ru>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 18 Oct 2009 16:15:40 +0400
- Subject: [CRIS] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
Hello.
This patch removes obsolete FUNCTION_VALUE and LIBCALL_VALUE macros from
cris back end in the GCC and introduces equivalent TARGET_FUNCTION_VALUE and
TARGET_LIBCALL_VALUE target hooks. Also this patch convert
FUNCTION_VALUE_REGNO_P macro to cris_function_value_regno_p function, this
should simplify hookize FUNCTION_VALUE_REGNO_P macro in the future.
Regression tested on cris-axis-elf.
* config/cris/cris.c (cris_function_value, cris_libcall_value,
cris_function_value_regno_p): New functions.
(cris_promote_function_mode): Update comment.
(TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
* config/cris/cris.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove.
(FUNCTION_VALUE_REGNO_P): Redefine, use cris_function_value_regno_p.
* config/cris/cris-protos.h (cris_function_value_regno_p): Declare.
OK to install?
Index: gcc/config/cris/cris.c
===================================================================
--- gcc/config/cris/cris.c (revision 152953)
+++ gcc/config/cris/cris.c (working copy)
@@ -130,6 +130,9 @@
static void cris_asm_trampoline_template (FILE *);
static void cris_trampoline_init (rtx, tree, rtx);
+static rtx cris_function_value(const_tree, const_tree, bool);
+static rtx cris_libcall_value (enum machine_mode, const_rtx);
+
/* This is the parsed result of the "-max-stack-stackframe=" option. If
it (still) is zero, then there was no such option given. */
int cris_max_stackframe = 0;
@@ -197,6 +200,11 @@
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT cris_trampoline_init
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE cris_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE cris_libcall_value
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Helper for cris_load_multiple_op and cris_ret_movem_op. */
@@ -3777,14 +3785,43 @@
int for_return)
{
/* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovered bug 981110 (even
- when modifying FUNCTION_VALUE to return the promoted mode). Maybe
- pointless as of now, but let's keep the old behavior. */
+ when modifying TERGET_FUNCTION_VALUE to return the promoted mode).
+ Maybe pointless as of now, but let's keep the old behavior. */
if (for_return == 1)
return mode;
return CRIS_PROMOTED_MODE (mode, *punsignedp, type);
}
+/* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
+ time being. */
+rtx
+cris_function_value(const_tree type,
+ const_tree func ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (TYPE_MODE (type), CRIS_FIRST_ARG_REG);
+}
+
+/* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
+ time being. */
+
+rtx
+cris_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, CRIS_FIRST_ARG_REG);
+}
+
+/* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
+ time being. */
+
+bool
+cris_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == CRIS_FIRST_ARG_REG);
+}
+
static int
cris_arg_partial_bytes (CUMULATIVE_ARGS *ca, enum machine_mode mode,
tree type, bool named ATTRIBUTE_UNUSED)
Index: gcc/config/cris/cris.h
===================================================================
--- gcc/config/cris/cris.h (revision 152953)
+++ gcc/config/cris/cris.h (working copy)
@@ -906,16 +906,9 @@
/* Node: Scalar Return */
-/* Let's assume all functions return in r[CRIS_FIRST_ARG_REG] for the
- time being. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx_REG (TYPE_MODE (VALTYPE), CRIS_FIRST_ARG_REG)
+#define FUNCTION_VALUE_REGNO_P(N) cris_function_value_regno_p (N)
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, CRIS_FIRST_ARG_REG)
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == CRIS_FIRST_ARG_REG)
-
-
/* Node: Aggregate Return */
#define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
Index: gcc/config/cris/cris-protos.h
===================================================================
--- gcc/config/cris/cris-protos.h (revision 152953)
+++ gcc/config/cris/cris-protos.h (working copy)
@@ -71,3 +71,5 @@
extern int cris_initial_elimination_offset (int, int);
extern void cris_init_expanders (void);
+
+extern bool cris_function_value_regno_p (const unsigned int);
Anatoly.