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: Use macros for register numbers more.


Hi,

Attached is a patch to use macros for register numbers more.

Tested by building fido-none-elf.  Committed as obvious.

Kazu Hirata

2007-04-15  Kazu Hirata  <kazu@codesourcery.com>

	* config/m68k/linux.h (FUNCTION_VALUE_REGNO_P): Use macros for
	register numbers more.
	* config/m68k/m68k.h (STACK_POINTER_REGNUM,
	FRAME_POINTER_REGNUM, STATIC_CHAIN_REGNUM,
	M68K_STRUCT_VALUE_REGNUM, FUNCTION_VALUE, LIBCALL_VALUE,
	FUNCTION_VALUE_REGNO_P): Likewise.
	* config/m68k/m68kelf.h (M68K_STRUCT_VALUE_REGNUM,
	STATIC_CHAIN_REGNUM): Likewise.
	* config/m68k/m68kemb.h (FUNCTION_VALUE_REGNO_P): Likewise.
	* config/m68k/netbsd-elf.h (M68K_STRUCT_VALUE_REGNUM,
	STATIC_CHAIN_REGNUM, FUNCTION_VALUE_REGNO_P): Likewise.
	* config/m68k/m68k.md (FP_REG): New.

Index: gcc/config/m68k/linux.h
===================================================================
--- gcc/config/m68k/linux.h	(revision 123846)
+++ gcc/config/m68k/linux.h	(working copy)
@@ -160,7 +160,7 @@ Boston, MA 02110-1301, USA.  */
 
 #undef FUNCTION_VALUE_REGNO_P
 #define FUNCTION_VALUE_REGNO_P(N) \
-  ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
+  ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
 
 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
    more than one register.  */
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h	(revision 123848)
+++ gcc/config/m68k/m68k.h	(working copy)
@@ -425,12 +425,12 @@ Boston, MA 02110-1301, USA.  */
 /* Specify the registers used for certain standard purposes.
    The values of these macros are register numbers.  */
 
-#define STACK_POINTER_REGNUM 15
+#define STACK_POINTER_REGNUM SP_REG
 
 /* Most m68k targets use %a6 as a frame pointer.  The AmigaOS
    ABI uses %a6 for shared library calls, therefore the frame
    pointer is shifted to %a5 on this target.  */
-#define FRAME_POINTER_REGNUM 14
+#define FRAME_POINTER_REGNUM FP_REG
 
 #define FRAME_POINTER_REQUIRED 0
 
@@ -440,12 +440,12 @@ Boston, MA 02110-1301, USA.  */
  */
 #define ARG_POINTER_REGNUM 24
 
-#define STATIC_CHAIN_REGNUM 8
+#define STATIC_CHAIN_REGNUM A0_REG
 #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a0"
 
 /* Register in which address to store a structure value
    is passed to a function.  */
-#define M68K_STRUCT_VALUE_REGNUM 9
+#define M68K_STRUCT_VALUE_REGNUM A1_REG
 
 
 
@@ -593,13 +593,13 @@ extern enum reg_class regno_reg_class[];
 
 /* On the m68k the return value defaults to D0.  */
 #define FUNCTION_VALUE(VALTYPE, FUNC)  \
-  gen_rtx_REG (TYPE_MODE (VALTYPE), 0)
+  gen_rtx_REG (TYPE_MODE (VALTYPE), D0_REG)
 
 /* On the m68k the return value defaults to D0.  */
-#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, 0)
+#define LIBCALL_VALUE(MODE)  gen_rtx_REG (MODE, D0_REG)
 
 /* On the m68k, D0 is usually the only register used.  */
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
+#define FUNCTION_VALUE_REGNO_P(N) ((N) == D0_REG)
 
 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
    more than one register.
Index: gcc/config/m68k/m68k.md
===================================================================
--- gcc/config/m68k/m68k.md	(revision 123846)
+++ gcc/config/m68k/m68k.md	(working copy)
@@ -129,6 +129,7 @@ (define_constants
    (A0_REG		8)
    (A1_REG		9)
    (PIC_REG		13)
+   (FP_REG		14)
    (SP_REG		15)
    (FP0_REG		16)
   ])
Index: gcc/config/m68k/m68kelf.h
===================================================================
--- gcc/config/m68k/m68kelf.h	(revision 123846)
+++ gcc/config/m68k/m68kelf.h	(working copy)
@@ -81,13 +81,13 @@ do {								\
    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0.  */
 
 #undef M68K_STRUCT_VALUE_REGNUM
-#define M68K_STRUCT_VALUE_REGNUM 8
+#define M68K_STRUCT_VALUE_REGNUM A0_REG
 
 /* The static chain regnum defaults to a0, but we use that for
    structure return, so have to use a1 for the static chain.  */
 
 #undef STATIC_CHAIN_REGNUM
-#define STATIC_CHAIN_REGNUM 9
+#define STATIC_CHAIN_REGNUM A1_REG
 #undef M68K_STATIC_CHAIN_REG_NAME
 #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
 
Index: gcc/config/m68k/m68kemb.h
===================================================================
--- gcc/config/m68k/m68kemb.h	(revision 123846)
+++ gcc/config/m68k/m68kemb.h	(working copy)
@@ -26,7 +26,8 @@
   m68k_libcall_value (MODE)
 
 #undef FUNCTION_VALUE_REGNO_P
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (TARGET_68881 && (N) == 16))
+#define FUNCTION_VALUE_REGNO_P(N)			\
+  ((N) == D0_REG || (TARGET_68881 && (N) == FP0_REG))
 
 #undef NEEDS_UNTYPED_CALL
 #define NEEDS_UNTYPED_CALL 1
Index: gcc/config/m68k/netbsd-elf.h
===================================================================
--- gcc/config/m68k/netbsd-elf.h	(revision 123846)
+++ gcc/config/m68k/netbsd-elf.h	(working copy)
@@ -224,7 +224,7 @@ while (0)
    function.  The default in m68k.h is a1.  For m68k/SVR4 it is a0. */
 
 #undef M68K_STRUCT_VALUE_REGNUM
-#define M68K_STRUCT_VALUE_REGNUM 8
+#define M68K_STRUCT_VALUE_REGNUM A0_REG
 
 
 /* Register in which static-chain is passed to a function.  The
@@ -232,7 +232,7 @@ while (0)
    regnum.  Make it a1 instead.  */
 
 #undef STATIC_CHAIN_REGNUM
-#define STATIC_CHAIN_REGNUM 9
+#define STATIC_CHAIN_REGNUM A1_REG
 #undef M68K_STATIC_CHAIN_REG_NAME
 #define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
 
@@ -253,7 +253,7 @@ while (0)
 
 #undef FUNCTION_VALUE_REGNO_P
 #define FUNCTION_VALUE_REGNO_P(N)					\
-  ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
+  ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
 
 
 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for


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