This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] mn10300: Hookize some target macros.


Hi,

Attached is a patch to hookize some target macros.

Built cc1 of mn10300-elf.  OK to apply?

Kazu Hirata

2004-01-25  Kazu Hirata  <kazu@cs.umass.edu>

	* config/mn10300/mn10300-protos.h: Remove the prototype for
	mn10300_builtin_saveregs.
	* config/mn10300/mn10300.c (TARGET_PROMOTE_PROTOTYPES): New.
	(TARGET_STRUCT_VALUE_RTX): Likewise.
	(TARGET_RETURN_IN_MEMORY): Likewise.
	(TARGET_EXPAND_BUILTIN_SAVEREGS): Likewise.
	(mn10300_return_in_memory): Likewise.
	(mn10300_builtin_saveregs): Make it static.
	* config/mn10300/mn10300.h (PROMOTE_PROTOTYPES): Remove.
	(RETURN_IN_MEMORY): Likewise.
	(STRUCT_VALUE): Likewise.
	(EXPAND_BUILTIN_SAVEREGS): Likewise.

Index: mn10300-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300-protos.h,v
retrieving revision 1.11
diff -u -r1.11 mn10300-protos.h
--- mn10300-protos.h	5 Dec 2003 09:38:32 -0000	1.11
+++ mn10300-protos.h	25 Jan 2004 18:07:06 -0000
@@ -54,7 +54,6 @@
 extern struct rtx_def *mn10300_va_arg (tree, tree);
 #endif /* TREE_CODE */
 
-extern struct rtx_def *mn10300_builtin_saveregs (void);
 extern void expand_prologue (void);
 extern void expand_epilogue (void);
 extern int initial_offset (int, int);
Index: mn10300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.c,v
retrieving revision 1.61
diff -u -r1.61 mn10300.c
--- mn10300.c	5 Jan 2004 17:01:42 -0000	1.61
+++ mn10300.c	25 Jan 2004 18:07:07 -0000
@@ -69,6 +69,8 @@
 static int mn10300_address_cost (rtx);
 static bool mn10300_rtx_costs (rtx, int, int, int *);
 static void mn10300_file_start (void);
+static bool mn10300_return_in_memory (tree, tree);
+static rtx mn10300_builtin_saveregs (void);
 
 
 /* Initialize the GCC target structure.  */
@@ -88,6 +90,17 @@
 #undef  TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO mn10300_encode_section_info
 
+#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 mn10300_return_in_memory
+
+#undef TARGET_EXPAND_BUILTIN_SAVEREGS
+#define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs
+
 static void mn10300_encode_section_info (tree, rtx, int);
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -1405,9 +1418,16 @@
   abort ();
 }
 
+static bool
+mn10300_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;
+}
+
 /* Flush the argument registers to the stack for a stdarg function;
    return the new argument pointer.  */
-rtx
+static rtx
 mn10300_builtin_saveregs (void)
 {
   rtx offset, mem;
Index: mn10300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.77
diff -u -r1.77 mn10300.h
--- mn10300.h	14 Jan 2004 20:34:25 -0000	1.77
+++ mn10300.h	25 Jan 2004 18:07:07 -0000
@@ -517,9 +517,6 @@
 #define FRAME_POINTER_REQUIRED 0
 #define CAN_DEBUG_WITHOUT_FP
 
-/* A guess for the MN10300.  */
-#define PROMOTE_PROTOTYPES 1
-
 /* Value is the number of bytes of arguments automatically
    popped when returning from a subroutine call.
    FUNDECL is the declaration node of the function (as a tree),
@@ -621,16 +618,7 @@
 #define FUNCTION_VALUE_REGNO_P(N) \
   ((N) == FIRST_DATA_REGNUM || (N) == FIRST_ADDRESS_REGNUM)
 
-/* 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 MN10300 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
@@ -687,13 +675,6 @@
   ((COUNT == 0)                         \
    ? gen_rtx_MEM (Pmode, arg_pointer_rtx) \
    : (rtx) 0)
-
-/* Emit code for a call to builtin_saveregs.  We must emit USE insns which
-   reference the 2 integer arg registers.
-   Ordinarily they are not call used registers, but they are for
-   _builtin_saveregs, so we must make this explicit.  */
-
-#define EXPAND_BUILTIN_SAVEREGS() mn10300_builtin_saveregs ()
 
 /* Implement `va_start' for varargs and stdarg.  */
 #define EXPAND_BUILTIN_VA_START(valist, nextarg) \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]