This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] xstormy16: Hookize some target macros.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: geoffk at geoffk dot org
- Date: Sun, 25 Jan 2004 14:34:45 -0500 (EST)
- Subject: [patch] xstormy16: Hookize some target macros.
Hi,
Attached is a patch to hookize some target macros.
Built cc1 of xstormy16-unknown-elf. OK to apply?
Kazu Hirata
2004-01-25 Kazu Hirata <kazu@cs.umass.edu>
* config/stormy16/stormy16-protos.h: Remove the prototype for
xstormy16_setup_incoming_varargs.
* config/stormy16/stormy16.c
(xstormy16_setup_incoming_varargs): Remove.
(xstormy16_return_in_memory): New.
(TARGET_PROMOTE_FUNCTION_ARGS): Likewise.
(TARGET_PROMOTE_FUNCTION_RETURN): Likewise.
(TARGET_PROMOTE_PROTOTYPES): Likewise.
(TARGET_STRUCT_VALUE_RTX): Likewise.
(TARGET_RETURN_IN_MEMORY): Likewise.
* config/stormy16/stormy16.h (PROMOTE_FUNCTION_ARGS): Remove.
(PROMOTE_FUNCTION_RETURN): Likewise
(PROMOTE_PROTOTYPES): Likewise
(RETURN_IN_MEMORY): Likewise
(STRUCT_VALUE): Likewise
(SETUP_INCOMING_VARARGS): Likewise
Index: stormy16-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16-protos.h,v
retrieving revision 1.15
diff -u -r1.15 stormy16-protos.h
--- stormy16-protos.h 17 Nov 2003 08:42:55 -0000 1.15
+++ stormy16-protos.h 25 Jan 2004 19:30:14 -0000
@@ -30,15 +30,11 @@
extern int xstormy16_epilogue_uses (int);
extern void xstormy16_function_profiler (void);
-#if defined (TREE_CODE)
-# if defined (HAVE_MACHINE_MODES)
+#if defined (TREE_CODE) && defined (HAVE_MACHINE_MODES)
extern CUMULATIVE_ARGS xstormy16_function_arg_advance
(CUMULATIVE_ARGS, enum machine_mode, tree, int);
extern rtx xstormy16_function_arg
(CUMULATIVE_ARGS, enum machine_mode, tree, int);
-# endif
-extern void xstormy16_setup_incoming_varargs
- (CUMULATIVE_ARGS, int, tree, int *);
#endif
#if defined (TREE_CODE) && defined (RTX_CODE)
Index: stormy16.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.c,v
retrieving revision 1.51
diff -u -r1.51 stormy16.c
--- stormy16.c 17 Nov 2003 08:42:56 -0000 1.51
+++ stormy16.c 25 Jan 2004 19:30:15 -0000
@@ -57,6 +57,7 @@
static rtx xstormy16_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static bool xstormy16_rtx_costs (rtx, int, int, int *);
static int xstormy16_address_cost (rtx);
+static bool xstormy16_return_in_memory (tree, tree);
/* Define the information needed to generate branch and scc insns. This is
stored from the compare operation. */
@@ -1233,16 +1234,6 @@
return gen_rtx_REG (mode, cum + 2);
}
-/* Do any needed setup for a variadic function. CUM has not been updated
- for the last named argument which has type TYPE and mode MODE. */
-void
-xstormy16_setup_incoming_varargs (CUMULATIVE_ARGS cum ATTRIBUTE_UNUSED,
- int int_mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED,
- int *pretend_size ATTRIBUTE_UNUSED)
-{
-}
-
/* Build the va_list type.
For this chip, va_list is a record containing a counter and a pointer.
@@ -1436,8 +1427,9 @@
relevant. (Actually, on most machines, scalar values are returned
in the same place regardless of mode).
- If `PROMOTE_FUNCTION_RETURN' is defined, you must apply the same promotion
- rules specified in `PROMOTE_MODE' if VALTYPE is a scalar type.
+ If `TARGET_PROMOTE_FUNCTION_RETURN' is defined to return true, you
+ must apply the same promotion rules specified in `PROMOTE_MODE' if
+ VALTYPE is a scalar type.
If the precise function being called is known, FUNC is a tree node
(`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it
@@ -2194,7 +2186,12 @@
return retval;
}
-
+
+static bool
+xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+ return int_size_in_bytes (type) > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS;
+}
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
@@ -2213,5 +2210,17 @@
#undef TARGET_BUILD_BUILTIN_VA_LIST_TYPE
#define TARGET_BUILD_BUILTIN_VA_LIST_TYPE xstormy16_build_builtin_va_list
+
+#undef TARGET_PROMOTE_FUNCTION_ARGS
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#undef TARGET_PROMOTE_FUNCTION_RETURN
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#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 xstormy16_return_in_memory
struct gcc_target targetm = TARGET_INITIALIZER;
Index: stormy16.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.h,v
retrieving revision 1.83
diff -u -r1.83 stormy16.h
--- stormy16.h 16 Jan 2004 21:19:07 -0000 1.83
+++ stormy16.h 25 Jan 2004 19:30:15 -0000
@@ -89,10 +89,6 @@
(MODE) = HImode; \
} while (0)
-#define PROMOTE_FUNCTION_ARGS 1
-
-#define PROMOTE_FUNCTION_RETURN 1
-
#define PARM_BOUNDARY 16
#define STACK_BOUNDARY 16
@@ -402,8 +398,6 @@
/* Passing Function Arguments on the Stack */
-#define PROMOTE_PROTOTYPES 1
-
#define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
#define RETURN_POPS_ARGS(FUNDECL, FUNTYPE, STACK_SIZE) 0
@@ -459,14 +453,6 @@
#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
-/* How Large Values are Returned */
-
-#define RETURN_IN_MEMORY(TYPE) \
- (int_size_in_bytes (TYPE) > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS)
-
-#define STRUCT_VALUE 0
-
-
/* Function Entry and Exit */
#define EPILOGUE_USES(REGNO) \
@@ -491,10 +477,6 @@
/* #define TARGET_CANNOT_INLINE_P(FN_DECL) xstormy16_cannot_inline_p (FN_DECL) */
/* Implementing the Varargs Macros. */
-
-#define SETUP_INCOMING_VARARGS(ARGS_SO_FAR, MODE, TYPE, PRETEND_ARGS_SIZE, SECOND_TIME) \
- if (! SECOND_TIME) \
- xstormy16_setup_incoming_varargs (ARGS_SO_FAR, MODE, TYPE, & PRETEND_ARGS_SIZE)
/* Implement the stdarg/varargs va_start macro. STDARG_P is nonzero if this
is stdarg.h instead of varargs.h. VALIST is the tree of the va_list