1 /* Generate attribute information shared between driver and core
2 compilers (insn-attr-common.h) from machine description. Split out
4 Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000, 2003, 2004, 2007, 2008,
5 2010, 2011 Free Software Foundation, Inc.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
26 #include "coretypes.h"
31 #include "gensupport.h"
34 write_upcase (const char *str
)
37 putchar (TOUPPER(*str
));
48 printf ("enum attr_%s {", XSTR (attr
, 0));
50 while ((tag
= scan_comma_elt (&p
)) != 0)
52 write_upcase (XSTR (attr
, 0));
55 putchar (TOUPPER (*tag
++));
59 fputs ("};\n", stdout
);
64 main (int argc
, char **argv
)
67 bool have_delay
= false;
68 bool have_sched
= false;
70 progname
= "genattr-common";
72 if (!init_rtx_reader_args (argc
, argv
))
73 return (FATAL_EXIT_CODE
);
75 puts ("/* Generated automatically by the program `genattr-common'");
76 puts (" from the machine description file `md'. */\n");
77 puts ("#ifndef GCC_INSN_ATTR_COMMON_H");
78 puts ("#define GCC_INSN_ATTR_COMMON_H\n");
80 /* Read the machine description. */
84 int line_no
, insn_code_number
;
86 desc
= read_md_rtx (&line_no
, &insn_code_number
);
90 if (GET_CODE (desc
) == DEFINE_ATTR
)
93 if (GET_CODE (desc
) == DEFINE_DELAY
)
97 printf ("#define DELAY_SLOTS\n");
101 else if (GET_CODE (desc
) == DEFINE_INSN_RESERVATION
)
105 printf ("#define INSN_SCHEDULING\n");
110 puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */");
112 if (ferror (stdout
) || fflush (stdout
) || fclose (stdout
))
113 return FATAL_EXIT_CODE
;
115 return SUCCESS_EXIT_CODE
;