1 /* Generate attribute information shared between driver and core
2 compilers (insn-attr-common.h) from machine description. Split out
4 Copyright (C) 1991-2013 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
30 #include "gensupport.h"
33 write_upcase (const char *str
)
36 putchar (TOUPPER(*str
));
47 printf ("enum attr_%s {", XSTR (attr
, 0));
49 while ((tag
= scan_comma_elt (&p
)) != 0)
51 write_upcase (XSTR (attr
, 0));
54 putchar (TOUPPER (*tag
++));
58 fputs ("};\n", stdout
);
63 main (int argc
, char **argv
)
66 bool have_delay
= false;
67 bool have_sched
= false;
69 progname
= "genattr-common";
71 if (!init_rtx_reader_args (argc
, argv
))
72 return (FATAL_EXIT_CODE
);
74 puts ("/* Generated automatically by the program `genattr-common'");
75 puts (" from the machine description file `md'. */\n");
76 puts ("#ifndef GCC_INSN_ATTR_COMMON_H");
77 puts ("#define GCC_INSN_ATTR_COMMON_H\n");
79 /* Read the machine description. */
83 int line_no
, insn_code_number
;
85 desc
= read_md_rtx (&line_no
, &insn_code_number
);
89 if (GET_CODE (desc
) == DEFINE_ATTR
)
92 if (GET_CODE (desc
) == DEFINE_DELAY
)
96 printf ("#define DELAY_SLOTS\n");
100 else if (GET_CODE (desc
) == DEFINE_INSN_RESERVATION
)
104 printf ("#define INSN_SCHEDULING\n");
109 puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */");
111 if (ferror (stdout
) || fflush (stdout
) || fclose (stdout
))
112 return FATAL_EXIT_CODE
;
114 return SUCCESS_EXIT_CODE
;