diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-25 21:32:56 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-25 21:32:56 +0000 |
commit | 19c83f0039a29220154096bf312df1fd54bfab6e (patch) | |
tree | 8b716a26eaea9d3c08639ff1d1e19e739ed75ba9 /gcc/genattr-common.c | |
parent | 6280641a7019362ea83ee4eefa92e850beeb1eb9 (diff) | |
download | gcc-19c83f0039a29220154096bf312df1fd54bfab6e.tar.gz |
* 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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176769 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genattr-common.c')
-rw-r--r-- | gcc/genattr-common.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c index bc7e1bba993..d219fd1e613 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) |