[PATCH] VAX: Use define_constants for register numbers

Jan-Benedict Glaw jbglaw@microdata-pos.de
Tue Apr 26 19:39:00 GMT 2005


Hi!

This patch moves the definition of named registers into the vax.md file.

ChangeLog:

	* gcc/config/vax/vax.md: define_constant VAXens AP, FP, SP and PC
	registers and use them (specifically the stack pointer).
	* gcc/config/vax/vax.h: Use above defines right here.

diff -Nurp src-gcc-fresh/gcc/config/vax/vax.h src-gcc-hacked/gcc/config/vax/vax.h
--- src-gcc-fresh/gcc/config/vax/vax.h	2005-04-08 10:25:16.000000000 +0200
+++ src-gcc-hacked/gcc/config/vax/vax.h	2005-04-15 12:30:51.000000000 +0200
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler.  VAX version.
    Copyright (C) 1987, 1988, 1991, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -167,13 +167,13 @@ Boston, MA 02111-1307, USA.  */
    The values of these macros are register numbers.  */
 
 /* VAX pc is overloaded on a register.  */
-#define PC_REGNUM 15
+#define PC_REGNUM VAX_PC_REGNUM
 
 /* Register to use for pushing function arguments.  */
-#define STACK_POINTER_REGNUM 14
+#define STACK_POINTER_REGNUM VAX_SP_REGNUM
 
 /* Base register for access to local variables of the function.  */
-#define FRAME_POINTER_REGNUM 13
+#define FRAME_POINTER_REGNUM VAX_FP_REGNUM
 
 /* Value should be nonzero if functions must have frame pointers.
    Zero means the frame pointer need not be set up (and parms
@@ -182,7 +182,7 @@ Boston, MA 02111-1307, USA.  */
 #define FRAME_POINTER_REQUIRED 1
 
 /* Base register for access to arguments of the function.  */
-#define ARG_POINTER_REGNUM 12
+#define ARG_POINTER_REGNUM VAX_AP_REGNUM
 
 /* Register in which static-chain is passed to a function.  */
 #define STATIC_CHAIN_REGNUM 0
diff -Nurp src-gcc-fresh/gcc/config/vax/vax.md src-gcc-hacked/gcc/config/vax/vax.md
--- src-gcc-fresh/gcc/config/vax/vax.md	2005-04-02 11:34:01.000000000 +0200
+++ src-gcc-hacked/gcc/config/vax/vax.md	2005-04-15 12:37:53.000000000 +0200
@@ -31,9 +31,13 @@
 ;; UNSPEC_VOLATILE usage:
 
 (define_constants
-  [(VUNSPEC_BLOCKAGE 0)     ; `blockage' insn to prevent scheduling across an
-			    ;   insn in the code.
+  [(VUNSPEC_BLOCKAGE 0)	    ; `blockage' insn to prevent scheduling across an
+			    ; insn in the code.
    (VUNSPEC_SYNC_ISTREAM 1) ; sequence of insns to sync the I-stream
+   (VAX_AP_REGNUM 12)	    ; Register 12 contains the argument pointer
+   (VAX_FP_REGNUM 13)	    ; Register 13 contains the frame pointer
+   (VAX_SP_REGNUM 14)	    ; Register 14 contains the stack pointer
+   (VAX_PC_REGNUM 15)	    ; Register 15 contains the program counter
   ]
 )
 
@@ -1196,8 +1200,8 @@
 (define_expand "call_pop"
   [(parallel [(call (match_operand:QI 0 "memory_operand" "")
 		    (match_operand:SI 1 "const_int_operand" ""))
-	      (set (reg:SI 14)
-		   (plus:SI (reg:SI 14)
+	      (set (reg:SI VAX_SP_REGNUM)
+		   (plus:SI (reg:SI VAX_SP_REGNUM)
 			    (match_operand:SI 3 "immediate_operand" "")))])]
   ""
 {
@@ -1213,8 +1217,8 @@
 (define_insn "*call_pop"
   [(call (match_operand:QI 0 "memory_operand" "m")
 	 (match_operand:SI 1 "const_int_operand" "n"))
-   (set (reg:SI 14) (plus:SI (reg:SI 14)
-			     (match_operand:SI 2 "immediate_operand" "i")))]
+   (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
+					(match_operand:SI 2 "immediate_operand" "i")))]
   ""
 {
   operands[1] = GEN_INT ((INTVAL (operands[1]) - 4) / 4);
@@ -1225,8 +1229,8 @@
   [(parallel [(set (match_operand 0 "" "")
 		   (call (match_operand:QI 1 "memory_operand" "")
 			 (match_operand:SI 2 "const_int_operand" "")))
-	      (set (reg:SI 14)
-		   (plus:SI (reg:SI 14)
+	      (set (reg:SI VAX_SP_REGNUM)
+		   (plus:SI (reg:SI VAX_SP_REGNUM)
 			    (match_operand:SI 4 "immediate_operand" "")))])]
   ""
 {
@@ -1243,8 +1247,8 @@
   [(set (match_operand 0 "" "")
 	(call (match_operand:QI 1 "memory_operand" "m")
 	      (match_operand:SI 2 "const_int_operand" "n")))
-   (set (reg:SI 14) (plus:SI (reg:SI 14)
-			     (match_operand:SI 3 "immediate_operand" "i")))]
+   (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
+					(match_operand:SI 3 "immediate_operand" "i")))]
   ""
   "*
 {
-- 
AWEK microdata GmbH -- Am Wellbach 4 -- 33609 Bielefeld



More information about the Gcc-patches mailing list