]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl.def (DEFINE_INSN, [...]): Change output-template slot to format 'T'.
authorZack Weinberg <zack@gcc.gnu.org>
Sat, 30 Jun 2001 17:23:53 +0000 (17:23 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Sat, 30 Jun 2001 17:23:53 +0000 (17:23 +0000)
* rtl.def (DEFINE_INSN, DEFINE_INSN_AND_SPLIT, DEFINE_PEEPHOLE):
Change output-template slot to format 'T'.
* rtl.h (XTMPL): New.
* read-rtl.c (read_escape): New function.
(read_quoted_string, read_braced_string): Use it.
(read_rtx): Set star_if_braced from the format string.
Use XTMPL where appropriate.
* genoutput.c (gen_insn, gen_peephole): Use XTMPL to get the
template string.

* rtl.c: Include errors.h for sake of rtl_check_failed* routines.
Document 'T' in rtx format strings.
* Makefile.in (rtl.o, $(HOST_PREFIX_1)rtl.o): Depend on errors.h.
* errors.c (internal_error): Add missing ": " at end of string.

* i860.md: Change triple backslashes to double backslashes at
ends of lines in output templates.

From-SVN: r43665

gcc/ChangeLog
gcc/Makefile.in
gcc/config/i860/i860.md
gcc/errors.c
gcc/genoutput.c
gcc/read-rtl.c
gcc/rtl.c
gcc/rtl.def
gcc/rtl.h

index f4fbe8aac78283a61fb46ab3f3199b4adb19cd1b..5eedd0fadfec9838050b55e8592113c76442e6ef 100644 (file)
@@ -1,3 +1,23 @@
+2001-06-30  Zack Weinberg  <zackw@stanford.edu>
+
+       * rtl.def (DEFINE_INSN, DEFINE_INSN_AND_SPLIT, DEFINE_PEEPHOLE):
+       Change output-template slot to format 'T'.
+       * rtl.h (XTMPL): New.
+       * read-rtl.c (read_escape): New function.
+       (read_quoted_string, read_braced_string): Use it.
+       (read_rtx): Set star_if_braced from the format string.
+       Use XTMPL where appropriate.
+       * genoutput.c (gen_insn, gen_peephole): Use XTMPL to get the
+       template string.
+
+       * rtl.c: Include errors.h for sake of rtl_check_failed* routines.
+       Document 'T' in rtx format strings.
+       * Makefile.in (rtl.o, $(HOST_PREFIX_1)rtl.o): Depend on errors.h.
+       * errors.c (internal_error): Add missing ": " at end of string.
+
+       * i860.md: Change triple backslashes to double backslashes at
+       ends of lines in output templates.
+
 2001-06-29  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * gcc.c (process_command): Append a DIR_SEPARATOR to a path
@@ -1015,7 +1035,7 @@ Mon Jun 18 12:50:49 2001  Jeffrey A Law  (law@cygnus.com)
        (delete_unreachable_blocks): Use find_unreachable_blocks.
        * basic-block.h (find_unreachable_blocks): Declare.
 
-        * dce.c (eliminate_dead_code): Fix formatting glitch.
+       * dce.c (eliminate_dead_code): Fix formatting glitch.
 
 2001-06-18  Jason Merrill  <jason_merrill@redhat.com>
 
index 58ac2c18f0329b9713ad2e54314ca246157c337d..e8493bacb3ef8a3095361c06de92f5e99b4a785a 100644 (file)
@@ -1345,7 +1345,7 @@ toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \
          -c $(srcdir)/toplev.c
 main.o : main.c toplev.h
 
-rtl.o : rtl.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) real.h $(GGC_H)
+rtl.o : rtl.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) real.h $(GGC_H) errors.h
        $(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 print-rtl.o : print-rtl.c $(GCONFIG_H) $(SYSTEM_H) $(RTL_H) hard-reg-set.h \
@@ -1822,7 +1822,7 @@ gengenrtl.o : gengenrtl.c $(RTL_BASE_H) $(HCONFIG_H) $(SYSTEM_H) real.h
 # and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
 # with the rules for rtl.o, etc.
 $(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(HCONFIG_H) $(SYSTEM_H) $(RTL_H) \
-  $(GGC_H)
+  $(GGC_H) errors.h
        rm -f $(HOST_PREFIX)rtl.c
        sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
index 5778964f5bee181cf0fab52f3882b86bab0291cb..beeabe6927b8acc6c1f5ce8888cd0afbb07b374d 100644 (file)
       cc_status.flags |= CC_KNOW_HI_R31;
       cc_status.flags &= ~CC_HI_R31_ADJ;
       cc_status.mdep = CONST2_RTX (SFmode); 
-      return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\\
-orh 0x4000,%?r0,%?r31\;ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
+      return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\
+orh 0x4000,%?r0,%?r31\;ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\
+fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\
+fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\
 fmul.dd %3,%1,%3\;fmul.dd %0,%3,%0\";
     }
   else
-    return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\\
-ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
-fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\\
+    return \"frcp.dd %2,%3\;fmul.dd %2,%3,%0\;fmov.dd %?f0,%4\;\\
+ixfr %?r31,%R4\;fsub.dd %4,%0,%0\;\\
+fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\
+fmul.dd %3,%0,%3\;fmul.dd %2,%3,%0\;fsub.dd %4,%0,%0\;\\
 fmul.dd %3,%1,%3\;fmul.dd %0,%3,%0\";
 }")
 
@@ -1991,9 +1991,9 @@ fmul.dd %3,%1,%3\;fmul.dd %0,%3,%0\";
       cc_status.mdep = CONST2_RTX (SFmode);
       output_asm_insn (\"orh 0x4000,%?r0,%?r31\", operands);
     }
-  return \"ixfr %?r31,%4\;frcp.ss %2,%0\;\\\
-fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;fmul.ss %0,%3,%0\;\\\
-fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;\\\
+  return \"ixfr %?r31,%4\;frcp.ss %2,%0\;\\
+fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;fmul.ss %0,%3,%0\;\\
+fmul.ss %2,%0,%3\;fsub.ss %4,%3,%3\;\\
 fmul.ss %1,%0,%4\;fmul.ss %3,%4,%0\";
 }")
 \f
index e1a3f13a8fd4c912f9b22fe22828cc6113666d37..a61bb8801dafd338f610d58c87e73bfcc74ee46f 100644 (file)
@@ -121,7 +121,7 @@ internal_error VPARAMS ((const char *format, ...))
   format = va_arg (ap, const char *);
 #endif
 
-  fprintf (stderr, "%s: Internal error", progname);
+  fprintf (stderr, "%s: Internal error", progname);
   vfprintf (stderr, format, ap);
   va_end (ap);
   fputc ('\n', stderr);
index c2cb124a536f8e19b8d4d20f1ea0f7f4465eae43..bca9a6232592a502146b81af11b5ae25ca061337 100644 (file)
@@ -808,7 +808,7 @@ gen_insn (insn, lineno)
   validate_insn_operands (d);
   validate_insn_alternatives (d);
   place_operands (d);
-  process_template (d, XSTR (insn, 3));
+  process_template (d, XTMPL (insn, 3));
 }
 \f
 /* Look at a define_peephole just read.  Assign its code number.
@@ -849,7 +849,7 @@ gen_peephole (peep, lineno)
 
   validate_insn_alternatives (d);
   place_operands (d);
-  process_template (d, XSTR (peep, 2));
+  process_template (d, XTMPL (peep, 2));
 }
 \f
 /* Process a define_expand just read.  Assign its code number,
index febab50b9687bcb36383b8d1e0d6157e7f9e3bbc..7e0da18f0f85cbb8aea2fd6ed8fc57fcdbec80a9 100644 (file)
@@ -37,6 +37,7 @@ static void read_name         PARAMS ((char *, FILE *));
 static char *read_string       PARAMS ((struct obstack *, FILE *, int));
 static char *read_quoted_string        PARAMS ((struct obstack *, FILE *));
 static char *read_braced_string        PARAMS ((struct obstack *, FILE *));
+static void read_escape                PARAMS ((struct obstack *, FILE *));
 static unsigned def_hash PARAMS ((const void *));
 static int def_name_eq_p PARAMS ((const void *, const void *));
 static void read_constants PARAMS ((FILE *infile, char *tmp_char));
@@ -211,6 +212,60 @@ read_name (str, infile)
     }
 }
 
+/* Subroutine of the string readers.  Handles backslash escapes.
+   Caller has read the backslash, but not placed it into the obstack.  */
+static void
+read_escape (ob, infile)
+     struct obstack *ob;
+     FILE *infile;
+{
+  int c = getc (infile);
+  switch (c)
+    {
+      /* Backslash-newline is replaced by nothing, as in C.  */
+    case '\n':
+      read_rtx_lineno++;
+      return;
+
+      /* \" \' \\ are replaced by the second character.  */
+    case '\\':
+    case '"':
+    case '\'':
+      break;
+
+      /* Standard C string escapes:
+        \a \b \f \n \r \t \v
+        \[0-7] \x
+        all are passed through to the output string unmolested.
+        In normal use these wind up in a string constant processed
+        by the C compiler, which will translate them appropriately.
+        We do not bother checking that \[0-7] are followed by up to
+        two octal digits, or that \x is followed by N hex digits.
+        \? \u \U are left out because they are not in traditional C.  */
+    case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v':
+    case '0': case '1': case '2': case '3': case '4': case '5': case '6':
+    case '7': case 'x':
+      obstack_1grow (ob, '\\');
+      break;
+
+      /* \; makes stuff for a C string constant containing
+        newline and tab.  */
+    case ';':
+      obstack_grow (ob, "\\n\\t", 4);
+      return;
+
+      /* pass anything else through, but issue a warning.  */
+    default:
+      fprintf (stderr, "%s:%d: warning: unrecognized escape \\%c\n",
+              read_rtx_filename, read_rtx_lineno, c);
+      obstack_1grow (ob, '\\');
+      break;
+    }
+
+  obstack_1grow (ob, c);
+}
+      
+
 /* Read a double-quoted string onto the obstack.  Caller has scanned
    the leading quote.  */
 static char *
@@ -226,27 +281,8 @@ read_quoted_string (ob, infile)
        read_rtx_lineno++;
       else if (c == '\\')
        {
-         c = getc (infile);    /* Read the string  */
-         /* \; makes stuff for a C string constant containing
-            newline and tab.  */
-         if (c == ';')
-           {
-             obstack_grow (ob, "\\n\\t", 4);
-             continue;
-           }
-         else if (c == '\n')
-           /* \-newline: delete the backslash and update our idea of
-              the line number.  */
-           read_rtx_lineno++;
-         else if (c == '\\' || c == '"')
-           ; /* \", \\ are a literal quote and backslash.  */
-         else
-           /* Backslash escapes we do not recognize are left unmolested.
-              They may be handled by the C compiler (e.g. \n, \t) */
-           {
-             ungetc (c, infile);  /* put it back */
-             c = '\\';
-           }
+         read_escape (ob, infile);
+         continue;
        }
       else if (c == '"')
        break;
@@ -281,27 +317,8 @@ read_braced_string (ob, infile)
        brace_depth--;
       else if (c == '\\')
        {
-         c = getc (infile);    /* Read the string  */
-         /* \; makes stuff for a C string constant containing
-            newline and tab.  */
-         if (c == ';')
-           {
-             obstack_grow (ob, "\\n\\t", 4);
-             continue;
-           }
-         else if (c == '\n')
-           /* \-newline: delete the backslash and update our idea of
-              the line number.  */
-           read_rtx_lineno++;
-         else if (c == '\\')
-           ; /* \\ is a literal backslash */
-         else
-           /* Backslash escapes we do not recognize are left unmolested.
-              They may be handled by the C compiler (e.g. \n, \t) */
-           {
-             ungetc (c, infile);  /* put it back */
-             c = '\\';
-           }
+         read_escape (ob, infile);
+         continue;
        }
 
       obstack_1grow (ob, c);
@@ -643,6 +660,7 @@ again:
            break;
          }
 
+      case 'T':
       case 's':
        {
          char *stringbuf;
@@ -651,10 +669,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.  */
-         int star_if_braced =
-           ((i == 3 && (GET_CODE (return_rtx) == DEFINE_INSN
-                        || GET_CODE (return_rtx) == DEFINE_INSN_AND_SPLIT))
-            || (i == 2 && GET_CODE (return_rtx) == DEFINE_PEEPHOLE));
+         int star_if_braced = (format_ptr[-1] == 'T');
            
          stringbuf = read_string (&rtl_obstack, infile, star_if_braced);
 
@@ -680,7 +695,10 @@ again:
              stringbuf = (char *) obstack_finish (&rtl_obstack);
            }
 
-         XSTR (return_rtx, i) = stringbuf;
+         if (star_if_braced)
+           XTMPL (return_rtx, i) = stringbuf;
+         else
+           XSTR (return_rtx, i) = stringbuf;
        }
        break;
 
index 0c84d752e3e7ca759b62fb74ba06ddc07e7de3c6..0e4a9b33da56ecf0e3e48175024b0edefa622576 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA.  */
 #include "rtl.h"
 #include "real.h"
 #include "ggc.h"
+#include "errors.h"
 
 \f
 /* Calculate the format for CONST_DOUBLE.  This depends on the relative
@@ -230,6 +231,8 @@ const char * const rtx_format[] = {
          prints the string
      "S" like "s", but optional:
         the containing rtx may end before this operand
+     "T" like "s", but treated specially by the RTL reader;
+         only found in machine description patterns.
      "e" a pointer to an rtl expression
          prints the expression
      "E" a pointer to a vector that points to a number of rtl expressions
index 906255d2dcd9e4b5c2239839752b6061a53b7c00..500301a334c3c435f5cce6850bd5d25b1d718762 100644 (file)
@@ -184,7 +184,7 @@ DEF_RTL_EXPR(MATCH_INSN, "match_insn", "is", 'm')
       template to use.
    4: optionally, a vector of attributes for this insn.
      */
-DEF_RTL_EXPR(DEFINE_INSN, "define_insn", "sEssV", 'x')
+DEF_RTL_EXPR(DEFINE_INSN, "define_insn", "sEsTV", 'x')
 
 /* Definition of a peephole optimization.
    1st operand: vector of insn patterns to match
@@ -192,7 +192,7 @@ DEF_RTL_EXPR(DEFINE_INSN, "define_insn", "sEssV", 'x')
    3rd operand: template or C code to produce assembler output.
    4: optionally, a vector of attributes for this insn.
      */
-DEF_RTL_EXPR(DEFINE_PEEPHOLE, "define_peephole", "EssV", 'x')
+DEF_RTL_EXPR(DEFINE_PEEPHOLE, "define_peephole", "EsTV", 'x')
 
 /* Definition of a split operation.
    1st operand: insn pattern to match
@@ -229,7 +229,7 @@ DEF_RTL_EXPR(DEFINE_SPLIT, "define_split", "EsES", 'x')
        elements of `recog_operand' for use by the vector of insn-patterns.
        (`operands' is an alias here for `recog_operand').  
    7: optionally, a vector of attributes for this insn.  */
-DEF_RTL_EXPR(DEFINE_INSN_AND_SPLIT, "define_insn_and_split", "sEsssESV", 'x')
+DEF_RTL_EXPR(DEFINE_INSN_AND_SPLIT, "define_insn_and_split", "sEsTsESV", 'x')
 
 /* Definition of an RTL peephole operation.
    Follows the same arguments as define_split.  */
index ca35d3f33bc9ef5aa7b43b4e0cb2b428c1402cbc..84de8fe3d39b84f581d7b19529da533cd2142bbc 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -320,6 +320,7 @@ extern void rtvec_check_failed_bounds PARAMS ((rtvec, int,
 #define XBITMAP(RTX, N) (RTL_CHECK1(RTX, N, 'b').rtbit)
 #define XTREE(RTX, N)   (RTL_CHECK1(RTX, N, 't').rttree)
 #define XBBDEF(RTX, N) (RTL_CHECK1(RTX, N, 'B').bb)
+#define XTMPL(RTX, N)  (RTL_CHECK1(RTX, N, 'T').rtstr)
 
 #define XVECEXP(RTX, N, M)     RTVEC_ELT (XVEC (RTX, N), M)
 #define XVECLEN(RTX, N)                GET_NUM_ELEM (XVEC (RTX, N))