diff options
author | Joern Rennecke <joern.rennecke@embecosm.com> | 2011-07-25 21:32:56 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2011-07-25 22:32:56 +0100 |
commit | c344a8663701f069dd5406d0b65c0de4c589ff69 (patch) | |
tree | 8b716a26eaea9d3c08639ff1d1e19e739ed75ba9 | |
parent | b97927a4e92fce96a44ef58468b532526e91ebfe (diff) | |
download | gcc-c344a8663701f069dd5406d0b65c0de4c589ff69.zip gcc-c344a8663701f069dd5406d0b65c0de4c589ff69.tar.gz gcc-c344a8663701f069dd5406d0b65c0de4c589ff69.tar.bz2 |
genattr.c (write_upcase, [...]): Move to ...
* genattr.c (write_upcase, gen_attr <enum definition writing>):
Move to ...
* genattr-common.c ... here.
(main): Call gen_attr.
* optc-gen.awk: Make generated program include insn-attr-common.h .
* Makefile.in (oprions.o): Depend on insn-attr-common.h
From-SVN: r176769
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/genattr-common.c | 33 | ||||
-rw-r--r-- | gcc/genattr.c | 29 | ||||
-rw-r--r-- | gcc/optc-gen.awk | 1 |
5 files changed, 47 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e16c95..421fcee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2011-07-25 Joern Rennecke <joern.rennecke@embecosm.com> + + * genattr.c (write_upcase, gen_attr <enum definition writing>): + Move to ... + * genattr-common.c ... here. + (main): Call gen_attr. + * optc-gen.awk: Make generated program include insn-attr-common.h . + * Makefile.in (oprions.o): Depend on insn-attr-common.h + 2011-07-25 Anatoly Sokolov <aesok@post.ru> * config/m32c/m32c.h (PRINT_OPERAND, PRINT_OPERAND_ADDRESS, diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e6d1717..7a5c176 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2257,7 +2257,7 @@ s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \ $(STAMP) $@ options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(OPTS_H) intl.h $(OPTIONS_C_EXTRA) + $(TM_H) $(OPTS_H) intl.h $(OPTIONS_C_EXTRA) insn-attr-common.h options-save.o: options-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \ $(TM_H) $(OPTS_H) intl.h $(OPTIONS_C_EXTRA) diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c index bc7e1bb..d219fd1 100644 --- a/gcc/genattr-common.c +++ b/gcc/genattr-common.c @@ -30,6 +30,36 @@ along with GCC; see the file COPYING3. If not see #include "read-md.h" #include "gensupport.h" +static void +write_upcase (const char *str) +{ + for (; *str; str++) + putchar (TOUPPER(*str)); +} + +static void +gen_attr (rtx attr) +{ + const char *p, *tag; + + p = XSTR (attr, 1); + if (*p != '\0') + { + printf ("enum attr_%s {", XSTR (attr, 0)); + + while ((tag = scan_comma_elt (&p)) != 0) + { + write_upcase (XSTR (attr, 0)); + putchar ('_'); + while (tag != p) + putchar (TOUPPER (*tag++)); + if (*p == ',') + fputs (", ", stdout); + } + fputs ("};\n", stdout); + } +} + int main (int argc, char **argv) { @@ -57,6 +87,9 @@ main (int argc, char **argv) if (desc == NULL) break; + if (GET_CODE (desc) == DEFINE_ATTR) + gen_attr (desc); + if (GET_CODE (desc) == DEFINE_DELAY) { if (!have_delay) diff --git a/gcc/genattr.c b/gcc/genattr.c index 5df138f..34e710d 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -30,23 +30,15 @@ along with GCC; see the file COPYING3. If not see #include "gensupport.h" -static void write_upcase (const char *); static void gen_attr (rtx); -static void -write_upcase (const char *str) -{ - for (; *str; str++) - putchar (TOUPPER(*str)); -} - static VEC (rtx, heap) *const_attrs, *reservations; static void gen_attr (rtx attr) { - const char *p, *tag; + const char *p; int is_const = GET_CODE (XEXP (attr, 2)) == CONST; if (is_const) @@ -65,23 +57,8 @@ gen_attr (rtx attr) printf ("extern int get_attr_%s (%s);\n", XSTR (attr, 0), (is_const ? "void" : "rtx")); else - { - printf ("enum attr_%s {", XSTR (attr, 0)); - - while ((tag = scan_comma_elt (&p)) != 0) - { - write_upcase (XSTR (attr, 0)); - putchar ('_'); - while (tag != p) - putchar (TOUPPER (*tag++)); - if (*p == ',') - fputs (", ", stdout); - } - fputs ("};\n", stdout); - - printf ("extern enum attr_%s get_attr_%s (%s);\n\n", - XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx")); - } + printf ("extern enum attr_%s get_attr_%s (%s);\n\n", + XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx")); } /* If `length' attribute, write additional function definitions and define diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index 519b1e93..71a03fb 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -37,6 +37,7 @@ for (i = 1; i <= n_headers; i++) print "#include " quote headers[i] quote print "#include " quote "opts.h" quote print "#include " quote "intl.h" quote +print "#include " quote "insn-attr-common.h" quote print "" if (n_extra_c_includes > 0) { |