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] m68k: Hookize some target macros.


Hi,

Attached is a patch to hookize some target macros.

Since I am planning to poison STRUCT_VALUE_REGNUM once I complete the
migration, I renamed STRUCT_VALUE_REGNUM to M68K_STRUCT_VALUE_REGNUM.
(But still #undef/#define mess of M68K_STRUCT_VALUE_REGNUM needs
cleaning up.)

Built cc1 of m68k-elf.  OK to apply?

Kazu Hirata

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

	* config/m68k/m68k.c (TARGET_PROMOTE_PROTOTYPES): New.
	(TARGET_STRUCT_VALUE_RTX): Likewise.
	(m68k_struct_value_rtx): Likewise.
	* config/m68k/m68k.h (STRUCT_VALUE_REGNUM): Rename to
	STRUCT_VALUE_REGNUM.
	(PROMOTE_PROTOTYPES): Remove.
	* config/m68k/m68kelf.h (STRUCT_VALUE_REGNUM): Rename to
	STRUCT_VALUE_REGNUM.
	* config/m68k/m68kv4.h (STRUCT_VALUE_REGNUM): Likewise.
	* config/m68k/netbsd-elf.h (STRUCT_VALUE_REGNUM): Likewise.

Index: m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.123
diff -u -r1.123 m68k.c
--- m68k.c	15 Jan 2004 09:37:34 -0000	1.123
+++ m68k.c	25 Jan 2004 06:39:30 -0000
@@ -107,6 +107,7 @@
 #endif
 static void m68k_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
 					  HOST_WIDE_INT, tree);
+static rtx m68k_struct_value_rtx (tree, int);
 static bool m68k_interrupt_function_p (tree func);
 static tree m68k_handle_fndecl_attribute (tree *node, tree name,
 					  tree args, int flags,
@@ -192,6 +193,12 @@
 #undef TARGET_ATTRIBUTE_TABLE
 #define TARGET_ATTRIBUTE_TABLE m68k_attribute_table
 
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX m68k_struct_value_rtx
+
 static const struct attribute_spec m68k_attribute_table[] =
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
@@ -3495,4 +3502,11 @@
     }
 
   output_asm_insn (fmt, xops);
+}
+
+static rtx
+m68k_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
+		       int incoming ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (Pmode, M68K_STRUCT_VALUE_REGNUM);
 }
Index: m68k.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.h,v
retrieving revision 1.103
diff -u -r1.103 m68k.h
--- m68k.h	13 Dec 2003 04:44:07 -0000	1.103
+++ m68k.h	25 Jan 2004 06:39:31 -0000
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler.
    Sun 68000/68020 version.
    Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -587,7 +587,7 @@
 
 /* Register in which address to store a structure value
    is passed to a function.  */
-#define STRUCT_VALUE_REGNUM 9
+#define M68K_STRUCT_VALUE_REGNUM 9
 
 /* Define the classes of registers for register constraints in the
    machine description.  Also define ranges of constants.
@@ -1368,9 +1368,6 @@
    and some other value for true.  This is the value stored for true.  */
 
 #define STORE_FLAG_VALUE (-1)
-
-/* When a prototype says `char' or `short', really pass an `int'.  */
-#define PROMOTE_PROTOTYPES 1
 
 /* Specify the machine mode that pointers have.
    After generation of rtl, the compiler makes no further distinction
Index: m68kelf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68kelf.h,v
retrieving revision 1.24
diff -u -r1.24 m68kelf.h
--- m68kelf.h	30 Nov 2003 04:20:27 -0000	1.24
+++ m68kelf.h	25 Jan 2004 06:39:31 -0000
@@ -1,7 +1,8 @@
 /* m68kelf support, derived from m68kv4.h */
 
 /* Target definitions for GNU compiler for mc680x0 running System V.4
-   Copyright (C) 1991, 1993, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 2000, 2002, 2003, 2004
+   Free Software Foundation, Inc.
 
    Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com).
 
@@ -137,8 +138,8 @@
 /* Register in which address to store a structure value is passed to a
    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0.  */
 
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 8
+#undef M68K_STRUCT_VALUE_REGNUM
+#define M68K_STRUCT_VALUE_REGNUM 8
 
 #define ASM_COMMENT_START "|"
 
Index: m68kv4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68kv4.h,v
retrieving revision 1.25
diff -u -r1.25 m68kv4.h
--- m68kv4.h	27 Sep 2003 04:48:24 -0000	1.25
+++ m68kv4.h	25 Jan 2004 06:39:31 -0000
@@ -1,5 +1,5 @@
 /* Target definitions for GNU compiler for mc680x0 running System V.4
-   Copyright (C) 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003
+   Copyright (C) 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2004
    Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@monkeys.com) and
    Fred Fish (fnf@cygnus.com).
@@ -90,8 +90,8 @@
 /* Register in which address to store a structure value is passed to a
    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0.  */
 
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 8
+#undef M68K_STRUCT_VALUE_REGNUM
+#define M68K_STRUCT_VALUE_REGNUM 8
 
 /* Register in which static-chain is passed to a function.  The
    default in m68k.h is a0, but that is already the struct value
Index: netbsd-elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/netbsd-elf.h,v
retrieving revision 1.20
diff -u -r1.20 netbsd-elf.h
--- netbsd-elf.h	13 Jan 2004 21:23:36 -0000	1.20
+++ netbsd-elf.h	25 Jan 2004 06:39:31 -0000
@@ -1,7 +1,7 @@
 /* Definitions of target machine for GNU compiler,
    for m68k (including m68010) NetBSD platforms using the
    ELF object format.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Wasabi Systems. Inc.
 
    This file is derived from <m68k/m68kv4.h>, <m68k/m68kelf.h>,
@@ -273,8 +273,8 @@
 /* Register in which address to store a structure value is passed to a
    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0. */
 
-#undef STRUCT_VALUE_REGNUM
-#define STRUCT_VALUE_REGNUM 8
+#undef M68K_STRUCT_VALUE_REGNUM
+#define M68K_STRUCT_VALUE_REGNUM 8
 
 
 /* Register in which static-chain is passed to a function.  The


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