[patch] m68hc11: Hookize some target macros.

Kazu Hirata kazu@cs.umass.edu
Sun Jan 25 06:48:00 GMT 2004


Hi,

Attached is a patch to hookize some target macros.

Built cc1 of m68hc11-elf.  OK to apply?

Kazu Hirata

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

	* config/m68hc11/m68hc11.c (TARGET_STRUCT_VALUE_RTX): New.
	(TARGET_RETURN_IN_MEMORY): Likewise.
	(m68hc11_struct_value_rtx): Likewise.
	(m68hc11_return_in_memory): Likewise.
	* config/m68hc11/m68hc11.h: Remove a commented-out definition
	of PROMOTE_PROTOTYPES.
	(RETURN_IN_MEMORY): Remove.
	(STRUCT_VALUE_REGNUM): Likewise.

Index: m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.91
diff -u -r1.91 m68hc11.c
--- m68hc11.c	27 Oct 2003 12:26:19 -0000	1.91
+++ m68hc11.c	25 Jan 2004 05:59:28 -0000
@@ -87,6 +87,8 @@
 static int autoinc_mode (rtx);
 static int m68hc11_make_autoinc_notes (rtx *, void *);
 static void m68hc11_init_libfuncs (void);
+static rtx m68hc11_struct_value_rtx (tree, int);
+static bool m68hc11_return_in_memory (tree, tree);
 
 /* Must be set to 1 to produce debug messages.  */
 int debug_m6811 = 0;
@@ -254,6 +256,11 @@
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS m68hc11_init_libfuncs
 
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX m68hc11_struct_value_rtx
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY m68hc11_return_in_memory
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 int
@@ -5518,6 +5525,25 @@
 {
   default_dtor_section_asm_out_destructor (symbol, priority);
   fprintf (asm_out_file, "\t.globl\t__do_global_dtors\n");
+}
+
+static rtx
+m68hc11_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
+			  int incoming ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (Pmode, HARD_D_REGNUM);
+}
+
+/* Return true if type TYPE should be returned in memory.
+   Blocks and data types largers than 4 bytes cannot be returned
+   in the register (D + X = 4).  */
+
+static bool
+m68hc11_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+  return ((TYPE_MODE (type) == BLKmode)
+	  ? (int_size_in_bytes (type) > 4)
+	  : (GET_MODE_SIZE (TYPE_MODE (type)) > 4));
 }
 
 #include "gt-m68hc11.h"
Index: m68hc11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.h,v
retrieving revision 1.81
diff -u -r1.81 m68hc11.h
--- m68hc11.h	13 Dec 2003 04:44:07 -0000	1.81
+++ m68hc11.h	25 Jan 2004 05:59:29 -0000
@@ -1004,9 +1004,6 @@
 
 /* Passing Function Arguments on the Stack.  */
 
-/* When a prototype says `char' or `short', really pass an `int'.  */
-/* #define PROMOTE_PROTOTYPES */
-
 /* If we generate an insn to push BYTES bytes, this says how many the
    stack pointer really advances by. No rounding or alignment needed
    for MC6811.  */
@@ -1020,15 +1017,6 @@
    The standard MC6811 call, with arg count word, includes popping the
    args as part of the call template.  */
 #define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE)	0
-
-/* Nonzero if type TYPE should be returned in memory.
-   Blocks and data types largers than 4 bytes cannot be returned
-   in the register (D + X = 4).  */
-#define RETURN_IN_MEMORY(TYPE)				\
-    ((TYPE_MODE (TYPE) == BLKmode)			\
-     ? (int_size_in_bytes (TYPE) > 4)			\
-     : (GET_MODE_SIZE (TYPE_MODE (TYPE)) > 4))
-
 
 /* Passing Arguments in Registers.  */
 
@@ -1147,10 +1135,6 @@
 /* 1 if N is a possible register number for a function value.  */
 #define FUNCTION_VALUE_REGNO_P(N) \
      ((N) == HARD_D_REGNUM || (N) == HARD_X_REGNUM)
-
-/* Register in which address to store a structure value is passed to a
-   function.  */
-#define STRUCT_VALUE_REGNUM	HARD_D_REGNUM
 
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
    the stack pointer does not matter.  The value is tested only in functions



More information about the Gcc-patches mailing list