This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[MN10300] Remove FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE and LIBCALL_VALUE macros.
- From: Anatoly Sokolov <aesok at post dot ru>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 25 Oct 2009 14:59:11 +0300
- Subject: [MN10300] Remove FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE and LIBCALL_VALUE macros.
Hello.
This patch removes obsolete FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE and
LIBCALL_VALUE macros from mn10300 back end in the GCC and introduces
equivalent TARGET_FUNCTION_VALUE, TARGET_FUNCTION_OUTGOING_VALUE and
TARGET_LIBCALL_VALUE target hooks. Also this patch convert
FUNCTION_VALUE_REGNO_P macro to mn10300_function_value_regno_p function, this
should simplify hookize FUNCTION_VALUE_REGNO_P macro in the future.
Regression tested on mn10300-unknown-elf.
* config/mn10300/mn10300.c (mn10300_function_value): Make static, add
new 'outgoing' argument.
(mn10300_libcall_value, mn10300_function_value_regno_p): New
functions.
(TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
* config/mn10300/mn10300.h: (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
LIBCALL_VALUE): Remove.
(FUNCTION_VALUE_REGNO_P): Redefine, use mn10300_function_value_regno_p.
* config/mn10300/mn10300-protos.h (mh10300_function_value_regno_p):
Declare.
OK to install?
Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c (revision 153538)
+++ gcc/config/mn10300/mn10300.c (working copy)
@@ -86,6 +86,8 @@
static void mn10300_encode_section_info (tree, rtx, int);
static void mn10300_asm_trampoline_template (FILE *);
static void mn10300_trampoline_init (rtx, tree, rtx);
+static rtx mn10300_function_value (const_tree, const_tree, bool);
+static rtx mn10300_libcall_value (enum machine_mode, const_rtx);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -139,6 +141,11 @@
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT mn10300_trampoline_init
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE mn10300_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE mn10300_libcall_value
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
@@ -1624,8 +1631,10 @@
we only return the PARALLEL for outgoing values; we do not want
callers relying on this extra copy. */
-rtx
-mn10300_function_value (const_tree valtype, const_tree func, int outgoing)
+static rtx
+mn10300_function_value (const_tree valtype,
+ const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+ bool outgoing)
{
rtx rv;
enum machine_mode mode = TYPE_MODE (valtype);
@@ -1649,6 +1658,23 @@
return rv;
}
+/* Implements TARGET_LIBCALL_VALUE. */
+
+static rtx
+mn10300_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, FIRST_DATA_REGNUM);
+}
+
+/* Implements FUNCTION_VALUE_REGNO_P. */
+
+bool
+mn10300_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == FIRST_DATA_REGNUM || regno == FIRST_ADDRESS_REGNUM);
+}
+
/* Output a tst insn. */
const char *
output_tst (rtx operand, rtx insn)
Index: gcc/config/mn10300/mn10300.h
===================================================================
--- gcc/config/mn10300/mn10300.h (revision 153538)
+++ gcc/config/mn10300/mn10300.h (working copy)
@@ -564,26 +564,8 @@
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
function_arg (&CUM, MODE, TYPE, NAMED)
-/* 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. */
+#define FUNCTION_VALUE_REGNO_P(N) mn10300_function_value_regno_p (N)
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- mn10300_function_value (VALTYPE, FUNC, 0)
-#define FUNCTION_OUTGOING_VALUE(VALTYPE, FUNC) \
- mn10300_function_value (VALTYPE, FUNC, 1)
-
-/* 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, FIRST_DATA_REGNUM)
-
-/* 1 if N is a possible register number for a function value. */
-
-#define FUNCTION_VALUE_REGNO_P(N) \
- ((N) == FIRST_DATA_REGNUM || (N) == FIRST_ADDRESS_REGNUM)
-
#define DEFAULT_PCC_STRUCT_RETURN 0
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
Index: gcc/config/mn10300/mn10300-protos.h
===================================================================
--- gcc/config/mn10300/mn10300-protos.h (revision 153538)
+++ gcc/config/mn10300/mn10300-protos.h (working copy)
@@ -37,12 +37,13 @@
extern int impossible_plus_operand (rtx, enum machine_mode);
extern bool mn10300_wide_const_load_uses_clr (rtx operands[2]);
+
+extern bool mn10300_function_value_regno_p (const unsigned int);
#endif /* RTX_CODE */
#ifdef TREE_CODE
extern struct rtx_def *function_arg (CUMULATIVE_ARGS *,
enum machine_mode, tree, int);
-extern rtx mn10300_function_value (const_tree, const_tree, int);
#endif /* TREE_CODE */
extern void expand_prologue (void);
Anatoly.