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] emit-rtl.c: Remove gen_rtx().


Hi,

Attached is a patch to remove gen_rtx() as the only references to it
are in comments.

Bootstrapped on i686-pc-linux-gnu (on top of my obsolete-port-removal
patch).  OK to apply?

Kazu Hirata

2004-02-03  Kazu Hirata  <kazu@cs.umass.edu>

	* emit-rtl.c (gen_rtx): Remove.
	* genattrtab.c: Don't mention gen_rtx in a comment.
	* rtl.h: Remove the prototype for gen_rtx.
	* doc/md.texi: Replace gen_rtx with gen_rtx_REG.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.374
diff -u -r1.374 emit-rtl.c
--- emit-rtl.c	3 Feb 2004 05:15:36 -0000	1.374
+++ emit-rtl.c	3 Feb 2004 23:25:17 -0000
@@ -22,18 +22,19 @@
 
 /* Middle-to-low level generation of rtx code and insns.
 
-   This file contains the functions `gen_rtx', `gen_reg_rtx'
-   and `gen_label_rtx' that are the usual ways of creating rtl
-   expressions for most purposes.
+   This file contains the functions `gen_reg_rtx' and `gen_label_rtx'
+   that are the usual ways of creating rtl expressions for most
+   purposes.
 
    It also has the functions for creating insns and linking
    them in the doubly-linked chain.
 
    The patterns of the insns are created by machine-dependent
    routines in insn-emit.c, which is generated automatically from
-   the machine description.  These routines use `gen_rtx' to make
-   the individual rtx's of the pattern; what is machine dependent
-   is the kind of rtx's they make and what arguments they use.  */
+   the machine description.  These routines use `gen_rtx_fmt_ee' and
+   others to make the individual rtx's of the pattern; what is machine
+   dependent is the kind of rtx's they make and what arguments they
+   use.  */
 
 #include "config.h"
 #include "system.h"
@@ -645,119 +646,6 @@
 			 subreg_lowpart_offset (mode, inmode));
 }
 
-/* rtx gen_rtx (code, mode, [element1, ..., elementn])
-**
-**	    This routine generates an RTX of the size specified by
-**	<code>, which is an RTX code.   The RTX structure is initialized
-**	from the arguments <element1> through <elementn>, which are
-**	interpreted according to the specific RTX type's format.   The
-**	special machine mode associated with the rtx (if any) is specified
-**	in <mode>.
-**
-**	    gen_rtx can be invoked in a way which resembles the lisp-like
-**	rtx it will generate.   For example, the following rtx structure:
-**
-**	      (plus:QI (mem:QI (reg:SI 1))
-**		       (mem:QI (plusw:SI (reg:SI 2) (reg:SI 3))))
-**
-**		...would be generated by the following C code:
-**
-**		gen_rtx_PLUS (QImode,
-**		    gen_rtx_MEM (QImode,
-**			gen_rtx_REG (SImode, 1)),
-**		    gen_rtx_MEM (QImode,
-**			gen_rtx_PLUS (SImode,
-**			    gen_rtx_REG (SImode, 2),
-**			    gen_rtx_REG (SImode, 3)))),
-*/
-
-/*VARARGS2*/
-rtx
-gen_rtx (enum rtx_code code, enum machine_mode mode, ...)
-{
-  int i;		/* Array indices...			*/
-  const char *fmt;	/* Current rtx's format...		*/
-  rtx rt_val;		/* RTX to return to caller...		*/
-  va_list p;
-
-  va_start (p, mode);
-
-  switch (code)
-    {
-    case CONST_INT:
-      rt_val = gen_rtx_CONST_INT (mode, va_arg (p, HOST_WIDE_INT));
-      break;
-
-    case CONST_DOUBLE:
-      {
-	HOST_WIDE_INT arg0 = va_arg (p, HOST_WIDE_INT);
-	HOST_WIDE_INT arg1 = va_arg (p, HOST_WIDE_INT);
-
-	rt_val = immed_double_const (arg0, arg1, mode);
-      }
-      break;
-
-    case REG:
-      rt_val = gen_rtx_REG (mode, va_arg (p, int));
-      break;
-
-    case MEM:
-      rt_val = gen_rtx_MEM (mode, va_arg (p, rtx));
-      break;
-
-    default:
-      rt_val = rtx_alloc (code);	/* Allocate the storage space.  */
-      rt_val->mode = mode;		/* Store the machine mode...  */
-
-      fmt = GET_RTX_FORMAT (code);	/* Find the right format...  */
-      for (i = 0; i < GET_RTX_LENGTH (code); i++)
-	{
-	  switch (*fmt++)
-	    {
-	    case '0':		/* Field with unknown use.  Zero it.  */
-	      X0EXP (rt_val, i) = NULL_RTX;
-	      break;
-
-	    case 'i':		/* An integer?  */
-	      XINT (rt_val, i) = va_arg (p, int);
-	      break;
-
-	    case 'w':		/* A wide integer? */
-	      XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT);
-	      break;
-
-	    case 's':		/* A string?  */
-	      XSTR (rt_val, i) = va_arg (p, char *);
-	      break;
-
-	    case 'e':		/* An expression?  */
-	    case 'u':		/* An insn?  Same except when printing.  */
-	      XEXP (rt_val, i) = va_arg (p, rtx);
-	      break;
-
-	    case 'E':		/* An RTX vector?  */
-	      XVEC (rt_val, i) = va_arg (p, rtvec);
-	      break;
-
-	    case 'b':           /* A bitmap? */
-	      XBITMAP (rt_val, i) = va_arg (p, bitmap);
-	      break;
-
-	    case 't':           /* A tree? */
-	      XTREE (rt_val, i) = va_arg (p, tree);
-	      break;
-
-	    default:
-	      abort ();
-	    }
-	}
-      break;
-    }
-
-  va_end (p);
-  return rt_val;
-}
-
 /* gen_rtvec (n, [rt1, ..., rtn])
 **
 **	    This routine creates an rtvec and stores within it the
@@ -5389,7 +5277,7 @@
 
   /* Create the unique rtx's for certain rtx codes and operand values.  */
 
-  /* Don't use gen_rtx here since gen_rtx in this case
+  /* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case
      tries to use these variables.  */
   for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
     const_int_rtx[i + MAX_SAVED_CONST_INT] =
Index: genattrtab.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genattrtab.c,v
retrieving revision 1.141
diff -u -r1.141 genattrtab.c
--- genattrtab.c	21 Jan 2004 20:39:54 -0000	1.141
+++ genattrtab.c	3 Feb 2004 23:25:19 -0000
@@ -549,7 +549,7 @@
    In some cases we cannot uniquify; then we return an ordinary
    impermanent rtx with ATTR_PERMANENT_P clear.
 
-   Args are like gen_rtx, but without the mode:
+   Args are as follows:
 
    rtx attr_rtx (code, [element1, ..., elementn])  */
 
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.453
diff -u -r1.453 rtl.h
--- rtl.h	31 Jan 2004 09:21:18 -0000	1.453
+++ rtl.h	3 Feb 2004 23:25:21 -0000
@@ -1445,7 +1445,6 @@
 extern void optimize_save_area_alloca (rtx);
 
 /* In emit-rtl.c */
-extern rtx gen_rtx (enum rtx_code, enum machine_mode, ...);
 extern rtvec gen_rtvec (int, ...);
 extern rtx copy_insn_1 (rtx);
 extern rtx copy_insn (rtx);
@@ -1874,8 +1873,7 @@
 
 /* There are some RTL codes that require special attention; the
    generation functions included above do the raw handling.  If you
-   add to this list, modify special_rtx in gengenrtl.c as well.  You
-   should also modify gen_rtx to use the special function.  */
+   add to this list, modify special_rtx in gengenrtl.c as well.  */
 
 extern rtx gen_rtx_CONST_INT (enum machine_mode, HOST_WIDE_INT);
 extern rtx gen_rtx_CONST_VECTOR (enum machine_mode, rtvec);
Index: doc/md.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/md.texi,v
retrieving revision 1.87
diff -u -r1.87 md.texi
--- doc/md.texi	3 Feb 2004 14:44:15 -0000	1.87
+++ doc/md.texi	3 Feb 2004 23:25:55 -0000
@@ -4625,7 +4625,7 @@
   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
 @{
   rtx xoperands[2];
-  xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
+  xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
 #ifdef MOTOROLA
   output_asm_insn ("move.l %1,(sp)", xoperands);
   output_asm_insn ("move.l %1,-(sp)", operands);


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