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]

AM33: Use macros instead of register number constants


Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@cygnus.com>

	* config/mn10300/mn10300.h (FIRST_DATA_REG, LAST_DATA_REG,
	FIRST_ADDRESS_REG, LAST_ADDRESS_REG, FIRST_EXTENDED_REG,
	LAST_EXTENDED_REG): New macros.
	(REGNO_SP_P): Redefine in terms of STACK_POINTER_REGNUM.
	(REGNO_DATA_P, REGNO_ADDRESS_P, REGNO_EXTENDED_P,
	REGNO_AM33_P): Redefine in terms of the new macros.
	(CONDITIONAL_REGISTER_USAGE, REGNO_REG_CLASS): Likewise.
	(FUNCTION_VALUE, LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P,
	STRUCT_VALUE): Likewise.

Index: gcc/config/mn10300/mn10300.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/mn10300/mn10300.h,v
retrieving revision 1.73
diff -u -r1.73 mn10300.h
--- gcc/config/mn10300/mn10300.h	2000/04/27 12:01:37	1.73
+++ gcc/config/mn10300/mn10300.h	2000/04/27 22:27:10
@@ -169,6 +169,7 @@
 {						\
   if (!TARGET_AM33)				\
     {						\
-      for (i = 10; i < 18; i++) 		\
+      for (i = FIRST_EXTENDED_REG; 		\
+	   i < LAST_EXTENDED_REG; i++) 		\
 	fixed_regs[i] = call_used_regs[i] = 1; 	\
     }						\
@@ -272,8 +273,8 @@
    or could index an array.  */
 
 #define REGNO_REG_CLASS(REGNO) \
-  ((REGNO) < 4 ? DATA_REGS : \
-   (REGNO) < 9 ? ADDRESS_REGS : \
-   (REGNO) == 9 ? SP_REGS : \
-   (REGNO) < 18 ? EXTENDED_REGS : \
+  ((REGNO) <= LAST_DATA_REG ? DATA_REGS : \
+   (REGNO) <= LAST_ADDRESS_REG ? ADDRESS_REGS : \
+   (REGNO) == STACK_POINTER_REGNUM ? SP_REGS : \
+   (REGNO) <= LAST_EXTENDED_REG ? EXTENDED_REGS : \
    NO_REGS)
@@ -323,10 +324,21 @@
        && reg_renumber[(regno)] >= (min) && reg_renumber[(regno)] <= (max)))
 #endif
 
-#define REGNO_DATA_P(regno) REGNO_IN_RANGE_P ((regno), 0, 3)
-#define REGNO_ADDRESS_P(regno) REGNO_IN_RANGE_P ((regno), 4, 8)
-#define REGNO_SP_P(regno) REGNO_IN_RANGE_P ((regno), 9, 9)
-#define REGNO_EXTENDED_P(regno) REGNO_IN_RANGE_P ((regno), 10, 17)
+#define FIRST_DATA_REG 0
+#define LAST_DATA_REG 3
+#define FIRST_ADDRESS_REG 4
+#define LAST_ADDRESS_REG 8
+#define FIRST_EXTENDED_REG 10
+#define LAST_EXTENDED_REG 17
+
+#define REGNO_DATA_P(regno) \
+  REGNO_IN_RANGE_P ((regno), FIRST_DATA_REG, LAST_DATA_REG)
+#define REGNO_ADDRESS_P(regno) \
+  REGNO_IN_RANGE_P ((regno), FIRST_ADDRESS_REG, LAST_ADDRESS_REG)
+#define REGNO_SP_P(regno) \
+  REGNO_IN_RANGE_P ((regno), STACK_POINTER_REGNUM, STACK_POINTER_REGNUM)
+#define REGNO_EXTENDED_P(regno) \
+  REGNO_IN_RANGE_P ((regno), FIRST_EXTENDED_REG, LAST_EXTENDED_REG)
 #define REGNO_AM33_P(regno) \
   (REGNO_DATA_P ((regno)) || REGNO_ADDRESS_P ((regno)) \
    || REGNO_EXTENDED_P ((regno)))
@@ -554,16 +566,18 @@
    otherwise, FUNC is 0.   */
 
 #define FUNCTION_VALUE(VALTYPE, FUNC) \
-  gen_rtx_REG (TYPE_MODE (VALTYPE), POINTER_TYPE_P (VALTYPE) ? 4 : 0)
+  gen_rtx_REG (TYPE_MODE (VALTYPE), POINTER_TYPE_P (VALTYPE) \
+	       ? FIRST_ADDRESS_REG : FIRST_DATA_REG)
 
 /* Define how to find the value returned by a library function
    assuming the value has mode MODE.  */
 
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, 0)
+#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, FIRST_DATA_REG)
 
 /* 1 if N is a possible register number for a function value.  */
 
-#define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N) == 4)
+#define FUNCTION_VALUE_REGNO_P(N) \
+  ((N) == FIRST_DATA_REG || (N) == FIRST_ADDRESS_REG)
 
 /* Return values > 8 bytes in length in memory.  */
 #define DEFAULT_PCC_STRUCT_RETURN 0
@@ -574,7 +588,7 @@
    is passed to a function.  On the MN10300 it's passed as
    the first parameter.  */
 
-#define STRUCT_VALUE 0
+#define STRUCT_VALUE FIRST_DATA_REG
 
 /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
    the stack pointer does not matter.  The value is tested only in

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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