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]

.md macro patch (2/3)


Like part 1, this is just a repost of one of the preparatory patches
in the RFC.  And like part 1, the idea is just to make the main change
easier to review.  I sanity-tested on its own, but only did a full
bootstrap & regression test for the combined patch.

This part just simplifies the read-rtl.c format walk a little.  It was
more important in an earlier version of the macro support than it is now,
but I decided to keep it anyway because I think it's slightly cleaner,
and because the main patch adds another format walk along the same lines.

The combined patch was bootstrapped & regression tested on i686-pc-linux-gnu
and mips-sgi-irix6.5, no regressions.  OK to install?

Richard


	* read-rtl.c (read_rtx): Tidy use of format_ptr.

--- read-rtl.c.1	Sat Aug  7 17:21:00 2004
+++ read-rtl.c	Sat Aug  7 17:24:25 2004
@@ -597,8 +597,8 @@ again:
   else
     ungetc (i, infile);
 
-  for (i = 0; i < GET_RTX_LENGTH (GET_CODE (return_rtx)); i++)
-    switch (*format_ptr++)
+  for (i = 0; format_ptr[i] != 0; i++)
+    switch (format_ptr[i])
       {
 	/* 0 means a field for internal use only.
 	   Don't expect it to be present in the input.  */
@@ -667,7 +667,7 @@ again:
 	      /* 'S' fields are optional and should be NULL if no string
 		 was given.  Also allow normal 's' and 'T' strings to be
 		 omitted, treating them in the same way as empty strings.  */
-	      XSTR (return_rtx, i) = (format_ptr[-1] == 'S' ? NULL : "");
+	      XSTR (return_rtx, i) = (format_ptr[i] == 'S' ? NULL : "");
 	      break;
 	    }
 
@@ -675,7 +675,7 @@ again:
 	     DEFINE_INSN_AND_SPLIT, or DEFINE_PEEPHOLE automatically
 	     gets a star inserted as its first character, if it is
 	     written with a brace block instead of a string constant.  */
-	  star_if_braced = (format_ptr[-1] == 'T');
+	  star_if_braced = (format_ptr[i] == 'T');
 
 	  stringbuf = read_string (infile, star_if_braced);
 
@@ -740,7 +740,7 @@ again:
       default:
 	fprintf (stderr,
 		 "switch format wrong in rtl.read_rtx(). format was: %c.\n",
-		 format_ptr[-1]);
+		 format_ptr[i]);
 	fprintf (stderr, "\tfile position: %ld\n", ftell (infile));
 	abort ();
       }


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