]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Jun 2010 20:23:23 +0000 (20:23 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Jun 2010 20:23:23 +0000 (20:23 +0000)
* Makefile.in (BUILD_RTL): Move build/read-md.o to...
(BUILD_MD): ...this new variable.
(simple_generated_rtl_h, simple_generated_rtl_c): New variables
that include the old contents of simple_generated_h and
simple_generated_c.
(simple_generated_h, simple_generated_c): Include them.  Add
insn-constants.h.
(s-%): Make simple_generated_{h,c} stamps depend on $(MD_DEPS)
and simple_generated_rtl_{h,c} stamps depend on insn-conditions.md.
Remove these dependencies from the main rule and include
insn-conditions.md in the command line only if it appears
in the dependency list.
(insn-constants.h, s-constants): Delete.
(build/genconstants.o): Don't depend on $(RTL_BASE_H), $(GTM_H)
or gensupport.h.
(build/genmddeps.o): Likewise.
(genprogrtl): New variable that contains everything from genprogmd
except mddeps and constants.
(genprogmd): Redefine in terms of genprogrtl.  Make these programs
depend on $(BUILD_MD)
(genprog): New variable.  Make these programs depend on
$(BUILD_ERRORS).
* genmddeps.c: Don't include tm.h, rtl.h or gensupport.h.
(main): Use read_md_files instead of init_rtx_reader_args.
* genconstants.c: As for genmddeps.c.
* read-md.h (read_skip_construct): Declare.
* read-md.c (read_skip_construct): New function.
(handle_file): Allow a null handle_directive, skipping the
construct if so.
(parse_include): Update the comment accordingly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160578 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/Makefile.in
gcc/genconstants.c
gcc/genmddeps.c
gcc/read-md.c
gcc/read-md.h

index e697a5293874c0bbe7daf880da56107521735fac..ed3c96af190284b5763b039ae16826836784feb9 100644 (file)
@@ -1,3 +1,36 @@
+2010-06-10  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * Makefile.in (BUILD_RTL): Move build/read-md.o to...
+       (BUILD_MD): ...this new variable.
+       (simple_generated_rtl_h, simple_generated_rtl_c): New variables
+       that include the old contents of simple_generated_h and
+       simple_generated_c.
+       (simple_generated_h, simple_generated_c): Include them.  Add
+       insn-constants.h.
+       (s-%): Make simple_generated_{h,c} stamps depend on $(MD_DEPS)
+       and simple_generated_rtl_{h,c} stamps depend on insn-conditions.md.
+       Remove these dependencies from the main rule and include
+       insn-conditions.md in the command line only if it appears
+       in the dependency list.
+       (insn-constants.h, s-constants): Delete.
+       (build/genconstants.o): Don't depend on $(RTL_BASE_H), $(GTM_H)
+       or gensupport.h.
+       (build/genmddeps.o): Likewise.
+       (genprogrtl): New variable that contains everything from genprogmd
+       except mddeps and constants.
+       (genprogmd): Redefine in terms of genprogrtl.  Make these programs
+       depend on $(BUILD_MD)
+       (genprog): New variable.  Make these programs depend on
+       $(BUILD_ERRORS).
+       * genmddeps.c: Don't include tm.h, rtl.h or gensupport.h.
+       (main): Use read_md_files instead of init_rtx_reader_args.
+       * genconstants.c: As for genmddeps.c.
+       * read-md.h (read_skip_construct): Declare.
+       * read-md.c (read_skip_construct): New function.
+       (handle_file): Allow a null handle_directive, skipping the
+       construct if so.
+       (parse_include): Update the comment accordingly.
+
 2010-06-10  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * Makefile.in (build/genmddeps.o): Depend on $(READ_MD_H).
index 84f332ff5972ba6795815e0ebaf5974b389d2428..bdafaa55ca28a55bf16cab579cf305219cd7e751 100644 (file)
@@ -1037,9 +1037,10 @@ LDEXP_LIB = @LDEXP_LIB@
 # even if we are cross-building GCC.
 BUILD_LIBS = $(BUILD_LIBIBERTY)
 
-BUILD_RTL = build/read-md.o build/rtl.o build/read-rtl.o build/ggc-none.o \
+BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
            build/vec.o build/min-insn-modes.o build/gensupport.o \
            build/print-rtl.o
+BUILD_MD = build/read-md.o
 BUILD_ERRORS = build/errors.o
 
 # Specify the directories to be searched for header files.
@@ -3558,44 +3559,43 @@ insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h         \
   reload.h $(REGS_H) tm-constrs.h
 
 # For each of the files generated by running a generator program over
-# the machine description, the following pair of static pattern rules
-# runs the generator program only if the machine description has changed,
-# but touches the target file only when its contents actually change.
-# The "; @true" construct forces Make to recheck the timestamp on the
-# target file.
+# the machine description, the following static pattern rules run the
+# generator program only if the machine description has changed,
+# but touch the target file only when its contents actually change.
+# The "; @true" construct forces Make to recheck the timestamp on
+# the target file.
 
-simple_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
+simple_rtl_generated_h = insn-attr.h insn-codes.h insn-config.h insn-flags.h
 
-simple_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
-                    insn-extract.c insn-opinit.c insn-output.c \
-                    insn-peep.c insn-recog.c
+simple_rtl_generated_c = insn-attrtab.c insn-automata.c insn-emit.c \
+                         insn-extract.c insn-opinit.c insn-output.c \
+                         insn-peep.c insn-recog.c
+
+simple_generated_h     = $(simple_rtl_generated_h) insn-constants.h
+
+simple_generated_c     = $(simple_rtl_generated_c)
+
+$(simple_generated_h:insn-%.h=s-%) \
+$(simple_generated_c:insn-%.c=s-%): s-%: $(MD_DEPS)
+
+$(simple_rtl_generated_h:insn-%.h=s-%) \
+$(simple_rtl_generated_c:insn-%.c=s-%): s-%: insn-conditions.md
 
 $(simple_generated_h): insn-%.h: s-%; @true
 
-$(simple_generated_h:insn-%.h=s-%): s-%: build/gen%$(build_exeext) \
-  $(MD_DEPS) insn-conditions.md
+$(simple_generated_h:insn-%.h=s-%): s-%: build/gen%$(build_exeext)
        $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
-         insn-conditions.md > tmp-$*.h
+         $(filter insn-conditions.md,$^) > tmp-$*.h
        $(SHELL) $(srcdir)/../move-if-change tmp-$*.h insn-$*.h
        $(STAMP) s-$*
 
 $(simple_generated_c): insn-%.c: s-%; @true
-$(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) \
-  $(MD_DEPS) insn-conditions.md
+$(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext)
        $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \
-         insn-conditions.md > tmp-$*.c
+         $(filter insn-conditions.md,$^) > tmp-$*.c
        $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c
        $(STAMP) s-$*
 
-# genconstants needs to run before insn-conditions.md is available
-# (because the constants may be used in the conditions).
-insn-constants.h: s-constants; @true
-s-constants: build/genconstants$(build_exeext) $(MD_DEPS)
-       $(RUN_GEN) build/genconstants$(build_exeext) $(md_file) \
-         > tmp-constants.h
-       $(SHELL) $(srcdir)/../move-if-change tmp-constants.h insn-constants.h
-       $(STAMP) s-constants
-
 # gencheck doesn't read the machine description, and the file produced
 # doesn't use the insn-* convention.
 tree-check.h: s-check ; @true
@@ -3813,8 +3813,8 @@ build/genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H)        \
   gensupport.h
 build/genconfig.o : genconfig.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
   coretypes.h $(GTM_H) errors.h gensupport.h
-build/genconstants.o : genconstants.c $(RTL_BASE_H) $(BCONFIG_H)       \
-  $(SYSTEM_H) coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
+build/genconstants.o : genconstants.c $(BCONFIG_H) $(SYSTEM_H)         \
+  coretypes.h errors.h $(READ_MD_H)
 build/genemit.o : genemit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)     \
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
 build/genextract.o : genextract.c $(RTL_BASE_H) $(BCONFIG_H)           \
@@ -3829,7 +3829,7 @@ build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H) \
 build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) gengtype.h      \
   rtl.def insn-notes.def errors.h double-int.h $(HASHTAB_H)
 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h    \
-  $(GTM_H) $(RTL_BASE_H) errors.h $(READ_MD_H) gensupport.h
+  errors.h $(READ_MD_H)
 build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h                \
   $(HASHTAB_H) machmode.def $(extra_modes_file)
 build/genopinit.o : genopinit.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
@@ -3853,19 +3853,24 @@ build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
        $(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
            $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
 
-# All these programs use the MD reader ($(BUILD_RTL)).
-genprogmd = attr attrtab automata codes conditions config constants emit \
-           extract flags mddeps opinit output peep preds recog
-$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS)
+# All these programs use the RTL reader ($(BUILD_RTL)).
+genprogrtl = attr attrtab automata codes conditions config emit \
+            extract flags opinit output peep preds recog
+$(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
+
+# All these programs use the MD reader ($(BUILD_MD)).
+genprogmd = $(genprogrtl) mddeps constants
+$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_MD)
+
+# All generator programs need to report errors
+genprog = $(genprogmd) genrtl modes gtype
+$(genprog:%=build/gen%$(build_exeext)): $(BUILD_ERRORS)
 
 # These programs need libs over and above what they get from the above list.
 build/genautomata$(build_exeext) : BUILD_LIBS += -lm
 
 # These programs are not linked with the MD reader.
-build/gengenrtl$(build_exeext) : $(BUILD_ERRORS)
-build/genmodes$(build_exeext) : $(BUILD_ERRORS)
-build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o \
-                               $(BUILD_ERRORS)
+build/gengtype$(build_exeext) : build/gengtype-lex.o build/gengtype-parse.o
 
 # Generated source files for gengtype.
 gengtype-lex.c : gengtype-lex.l
index e5f083a36fd370c60abfb5acd4d3955fea014cd8..60526bbf7167154a9226608c0487371d78aa6682 100644 (file)
@@ -28,11 +28,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "bconfig.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
-#include "rtl.h"
 #include "errors.h"
 #include "read-md.h"
-#include "gensupport.h"
 
 /* Called via traverse_md_constants; emit a #define for
    the current constant definition.  */
@@ -52,7 +49,7 @@ main (int argc, char **argv)
 {
   progname = "genconstants";
 
-  if (!init_rtx_reader_args (argc, argv))
+  if (!read_md_files (argc, argv, NULL, NULL))
     return (FATAL_EXIT_CODE);
 
   /* Initializing the MD reader has the side effect of loading up
index f9fdacb4a9581c807c624af276b61f8183080515..15311eeaed6ccb79f1a80d205d47375e5dd9ce12 100644 (file)
 #include "bconfig.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
-#include "rtl.h"
 #include "errors.h"
 #include "read-md.h"
-#include "gensupport.h"
 
 
 struct filedep
@@ -50,8 +47,8 @@ main (int argc, char **argv)
   progname = "genmddeps";
   include_callback = add_filedep;
 
-  if (!init_rtx_reader_args (argc, argv))
-    return (FATAL_EXIT_CODE);
+  if (!read_md_files (argc, argv, NULL, NULL))
+    return FATAL_EXIT_CODE;
 
   *last = NULL;
 
index 0071e28b471f6af75366b4b8bbd5a02a4932094c..af9800f8e2df174fcf0702c326922e3f7ca315d1 100644 (file)
@@ -575,6 +575,55 @@ read_string (int star_if_braced)
   return stringbuf;
 }
 
+/* Skip the rest of a construct that started at line LINENO and that
+   is currently nested by DEPTH levels of parentheses.  */
+
+void
+read_skip_construct (int depth, int lineno)
+{
+  struct md_name name;
+  int c;
+
+  do
+    {
+      c = read_skip_spaces ();
+      if (c == EOF)
+       {
+         error_with_line (lineno, "unterminated construct");
+         exit (1);
+       }
+      switch (c)
+       {
+       case '(':
+         depth++;
+         break;
+
+       case ')':
+         depth--;
+         break;
+
+       case ':':
+       case '[':
+       case ']':
+       case '/':
+         break;
+
+       case '\"':
+       case '{':
+         unread_char (c);
+         read_string (false);
+         break;
+
+       default:
+         unread_char (c);
+         read_name (&name);
+         break;
+       }
+    }
+  while (depth > 0);
+  unread_char (c);
+}
+
 /* Given a string, return the number of comma-separated elements in it.
    Return 0 for the null string.  */
 
@@ -787,8 +836,10 @@ handle_file (directive_handler_t handle_directive)
        handle_constants ();
       else if (strcmp (directive.string, "include") == 0)
        handle_include (lineno, handle_directive);
-      else
+      else if (handle_directive)
        handle_directive (lineno, directive.string);
+      else
+       read_skip_construct (1, lineno);
 
       c = read_skip_spaces ();
       if (c != ')')
@@ -840,7 +891,8 @@ parse_include (const char *arg)
    It should return true if it recognizes the argument or false if a
    generic error should be reported.
 
-   The parser calls HANDLE_DIRECTIVE for each unknown directive.
+   If HANDLE_DIRECTIVE is nonnull, the parser calls it for each
+   unknown directive, otherwise it just skips such directives.
    See the comment above the directive_handler_t definition for
    details about the callback's interface.  */
 
index bb83468f53706bb721255cabf7ffb8311cd8ed4a..ebe47cc3737d9e6e92b9babd4e92453d7533740a 100644 (file)
@@ -92,6 +92,7 @@ extern int read_skip_spaces (void);
 extern void read_name (struct md_name *);
 extern char *read_quoted_string (void);
 extern char *read_string (int);
+extern void read_skip_construct (int, int);
 extern int n_comma_elts (const char *);
 extern const char *scan_comma_elt (const char **);
 extern void traverse_md_constants (htab_trav, void *);