aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog33
-rw-r--r--gcc/Makefile.in77
-rw-r--r--gcc/genconstants.c5
-rw-r--r--gcc/genmddeps.c7
-rw-r--r--gcc/read-md.c56
-rw-r--r--gcc/read-md.h1
6 files changed, 132 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e697a52..ed3c96a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,38 @@
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).
* genmddeps.c: Include read-md.h.
(main): Call init_rtx_reader_args instead of init_md_reader_args.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 84f332f..bdafaa5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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
diff --git a/gcc/genconstants.c b/gcc/genconstants.c
index e5f083a..60526bb 100644
--- a/gcc/genconstants.c
+++ b/gcc/genconstants.c
@@ -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
diff --git a/gcc/genmddeps.c b/gcc/genmddeps.c
index f9fdacb..15311ee 100644
--- a/gcc/genmddeps.c
+++ b/gcc/genmddeps.c
@@ -18,11 +18,8 @@
#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;
diff --git a/gcc/read-md.c b/gcc/read-md.c
index 0071e28..af9800f 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -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. */
diff --git a/gcc/read-md.h b/gcc/read-md.h
index bb83468..ebe47cc3 100644
--- a/gcc/read-md.h
+++ b/gcc/read-md.h
@@ -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 *);