This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] v850: Hookize some target macros.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: nickc at redhat dot com
- Date: Sun, 25 Jan 2004 14:52:17 -0500 (EST)
- Subject: [patch] v850: Hookize some target macros.
Hi,
Attached is a patch to hookize some target macros.
Built cc1 of v850-unknown-elf. OK to apply?
Kazu Hirata
2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
* config/v850/v850.c (TARGET_PROMOTE_PROTOTYPES): New.
(TARGET_STRUCT_VALUE_RTX): Likewise.
(TARGET_RETURN_IN_MEMORY): Likewise.
(TARGET_SETUP_INCOMING_VARARGS): Likewise.
(v850_return_in_memory): Likewise.
(v850_setup_incoming_varargs): Likewise.
* config/v850/v850.h (PROMOTE_PROTOTYPES): Remove.
(SETUP_INCOMING_VARARGS): Likewise.
(RETURN_IN_MEMORY): Likewise.
(STRUCT_VALUE): Likewise.
Index: v850.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.c,v
retrieving revision 1.83
diff -u -r1.83 v850.c
--- v850.c 31 Dec 2003 17:22:33 -0000 1.83
+++ v850.c 25 Jan 2004 19:48:11 -0000
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for NEC V850 series
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Contributed by Jeff Law (law@cygnus.com).
@@ -64,6 +64,9 @@
static void v850_select_section (tree, int, unsigned HOST_WIDE_INT);
static void v850_encode_data_area (tree, rtx);
static void v850_encode_section_info (tree, rtx, int);
+static bool v850_return_in_memory (tree, tree);
+static void v850_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
+ tree, int *, int);
/* Information about the various small memory areas. */
struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
@@ -116,6 +119,17 @@
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG v850_reorg
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY v850_return_in_memory
+
+#undef TARGET_SETUP_INCOMING_VARARGS
+#define TARGET_SETUP_INCOMING_VARARGS v850_setup_incoming_varargs
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Sometimes certain combinations of command options do not make
@@ -3396,4 +3410,21 @@
}
else
readonly_data_section ();
+}
+
+static bool
+v850_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+ /* Return values > 8 bytes in length in memory. */
+ return int_size_in_bytes (type) > 8 || TYPE_MODE (type) == BLKmode;
+}
+
+static void
+v850_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ tree type ATTRIBUTE_UNUSED,
+ int *pretend_arg_size ATTRIBUTE_UNUSED,
+ int second_time ATTRIBUTE_UNUSED)
+{
+ ca->anonymous_args = (!TARGET_GHS ? 1 : 0);
}
Index: v850.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.h,v
retrieving revision 1.92
diff -u -r1.92 v850.h
--- v850.h 31 Dec 2003 17:22:33 -0000 1.92
+++ v850.h 25 Jan 2004 19:48:12 -0000
@@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler. NEC V850 series
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Contributed by Jeff Law (law@cygnus.com).
@@ -124,7 +124,7 @@
as GHS. We don't have enough documentation on their conventions
to be compatible.
- * Tests of SETUP_INCOMING_VARARGS need to be made runtime checks
+ * Tests of TARGET_SETUP_INCOMING_VARARGS need to be made runtime checks
since it depends on TARGET_GHS. */
#define TARGET_GHS (target_flags & MASK_GHS)
@@ -707,9 +707,6 @@
abort (); \
}
-/* A guess for the V850. */
-#define PROMOTE_PROTOTYPES 1
-
/* Keep the stack pointer constant throughout the function. */
#define ACCUMULATE_OUTGOING_ARGS 1
@@ -776,10 +773,6 @@
space allocated by the caller. */
#define OUTGOING_REG_PARM_STACK_SPACE
-/* Do any setup necessary for varargs/stdargs functions. */
-#define SETUP_INCOMING_VARARGS(CUM, MODE, TYPE, PAS, SECOND) \
- (CUM).anonymous_args = (!TARGET_GHS ? 1 : 0);
-
/* Implement `va_arg'. */
#define EXPAND_BUILTIN_VA_ARG(valist, type) \
v850_va_arg (valist, type)
@@ -812,16 +805,7 @@
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 10)
-/* Return values > 8 bytes in length in memory. */
#define DEFAULT_PCC_STRUCT_RETURN 0
-#define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes (TYPE) > 8 || TYPE_MODE (TYPE) == BLKmode)
-
-/* Register in which address to store a structure value
- is passed to a function. On the V850 it's passed as
- the first parameter. */
-
-#define STRUCT_VALUE 0
/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
the stack pointer does not matter. The value is tested only in