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] mmix: Hookize SETUP_INCOMING_VARARGS.


Hi,

Attached is a patch to hookize some target macros.

Built cc1 of mmix-elf.  OK to apply?

Kazu Hirata

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

	* config/mmix/mmix-protos.h: Remove the prototype for
	mmix_setup_incoming_varargs.
	* config/mmix/mmix.c (TARGET_PROMOTE_FUNCTION_ARGS): New.
	(TARGET_STRUCT_VALUE_RTX): Likewise.
	(TARGET_SETUP_INCOMING_VARARGS): Likewise.
	(mmix_setup_incoming_varargs): Make it static.
	(mmix_struct_value_rtx): New.
	* config/mmix/mmix.h (PROMOTE_FUNCTION_ARGS): Remove.
	Remove a commented-out definition of PROMOTE_FUNCTION_RETURN.
	(STRUCT_VALUE_REGNUM): Remove.
	(SETUP_INCOMING_VARARGS): Likewise.

Index: mmix-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix-protos.h,v
retrieving revision 1.27
diff -u -r1.27 mmix-protos.h
--- mmix-protos.h	16 Jul 2003 17:44:59 -0000	1.27
+++ mmix-protos.h	25 Jan 2004 08:21:21 -0000
@@ -60,8 +60,6 @@
 extern int mmix_data_alignment (tree, int);
 extern int mmix_constant_alignment (tree, int);
 extern int mmix_local_alignment (tree, int);
-extern void mmix_setup_incoming_varargs
-  (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
 extern void mmix_asm_output_pool_prologue (FILE *, const char *, tree, int);
 extern void mmix_asm_output_aligned_common (FILE *, const char *, int, int);
 extern void mmix_asm_output_aligned_local (FILE *, const char *, int, int);
Index: mmix.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.c,v
retrieving revision 1.55
diff -u -r1.55 mmix.c
--- mmix.c	5 Oct 2003 19:50:55 -0000	1.55
+++ mmix.c	25 Jan 2004 08:21:22 -0000
@@ -133,9 +133,12 @@
 static void mmix_reorg (void);
 static void mmix_asm_output_mi_thunk
   (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree);
+static void mmix_setup_incoming_varargs
+  (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
 static void mmix_file_start (void);
 static void mmix_file_end (void);
 static bool mmix_rtx_costs (rtx, int, int, int *);
+static rtx mmix_struct_value_rtx (tree, int);
 
 
 /* Target structure macros.  Listed by node.  See `Using and Porting GCC'
@@ -187,6 +190,21 @@
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG mmix_reorg
 
+#undef TARGET_PROMOTE_FUNCTION_ARGS
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#if 0
+/* Apparently not doing TRT if int < register-size.  FIXME: Perhaps
+   FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say.  */
+#undef TARGET_PROMOTE_FUNCTION_RETURN
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#endif
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX mmix_struct_value_rtx
+
+#undef TARGET_SETUP_INCOMING_VARARGS
+#define TARGET_SETUP_INCOMING_VARARGS mmix_setup_incoming_varargs
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Functions that are expansions for target macros.
@@ -803,9 +821,11 @@
   sorry ("function_profiler support for MMIX");
 }
 
-/* SETUP_INCOMING_VARARGS.  */
+/* Worker function for TARGET_SETUP_INCOMING_VARARGS.  For the moment,
+   let's stick to pushing argument registers on the stack.  Later, we
+   can parse all arguments in registers, to improve performance.  */
 
-void
+static void
 mmix_setup_incoming_varargs (CUMULATIVE_ARGS *args_so_farp,
 			     enum machine_mode mode,
 			     tree vartype,
@@ -2936,6 +2956,15 @@
     }
 
   fatal_insn ("MMIX Internal: This is not a constant:", x);
+}
+
+/* Worker function for TARGET_STRUCT_VALUE_RTX.  */
+
+static rtx
+mmix_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
+		       int incoming ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (Pmode, MMIX_STRUCT_VALUE_REGNUM);
 }
 
 /*
Index: mmix.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mmix/mmix.h,v
retrieving revision 1.58
diff -u -r1.58 mmix.h
--- mmix.h	6 Jul 2003 23:05:13 -0000	1.58
+++ mmix.h	25 Jan 2004 08:21:22 -0000
@@ -293,14 +293,6 @@
    }						\
  } while (0)
 
-#define PROMOTE_FUNCTION_ARGS
-
-#if 0
-/* Apparently not doing TRT if int < register-size.  FIXME: Perhaps
-   FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say.  */
-#define PROMOTE_FUNCTION_RETURN
-#endif
-
 /* I'm a little bit undecided about this one.  It might be beneficial to
    promote all operations.  */
 #define PROMOTE_FOR_CALL_ONLY
@@ -779,11 +771,6 @@
  mmix_function_value_regno_p (REGNO)
 
 
-/* Node: Aggregate Return */
-
-#define STRUCT_VALUE_REGNUM MMIX_STRUCT_VALUE_REGNUM
-
-
 /* Node: Caller Saves */
 /* (empty) */
 
@@ -805,12 +792,6 @@
  mmix_function_profiler (FILE, LABELNO)
 
 /* Node: Varargs */
-
-/* For the moment, let's stick to pushing argument registers on the stack.
-   Later, we can parse all arguments in registers, to improve
-   performance.  */
-#define SETUP_INCOMING_VARARGS(A, M, T, P, S)	\
- mmix_setup_incoming_varargs(&(A), M, T, &(P), S)
 
 /* FIXME: This and other EXPAND_BUILTIN_VA_... target macros are not
    documented, although used by several targets.  */


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