aboutsummaryrefslogtreecommitdiff
path: root/gcc/genattr-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/genattr-common.c')
-rw-r--r--gcc/genattr-common.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c
index 0563cc5..0ff8da9 100644
--- a/gcc/genattr-common.c
+++ b/gcc/genattr-common.c
@@ -37,10 +37,11 @@ write_upcase (const char *str)
}
static void
-gen_attr (rtx attr)
+gen_attr (md_rtx_info *info)
{
const char *p, *tag;
+ rtx attr = info->def;
p = XSTR (attr, 1);
if (*p != '\0')
{
@@ -62,7 +63,6 @@ gen_attr (rtx attr)
int
main (int argc, char **argv)
{
- rtx desc;
bool have_delay = false;
bool have_sched = false;
@@ -78,34 +78,33 @@ main (int argc, char **argv)
/* Read the machine description. */
- while (1)
- {
- int line_no, insn_code_number;
+ md_rtx_info info;
+ while (read_md_rtx (&info))
+ switch (GET_CODE (info.def))
+ {
+ case DEFINE_ATTR:
+ gen_attr (&info);
+ break;
- desc = read_md_rtx (&line_no, &insn_code_number);
- if (desc == NULL)
+ case DEFINE_DELAY:
+ if (!have_delay)
+ {
+ printf ("#define DELAY_SLOTS\n");
+ have_delay = true;
+ }
break;
- if (GET_CODE (desc) == DEFINE_ATTR)
- gen_attr (desc);
+ case DEFINE_INSN_RESERVATION:
+ if (!have_sched)
+ {
+ printf ("#define INSN_SCHEDULING\n");
+ have_sched = true;
+ }
+ break;
- if (GET_CODE (desc) == DEFINE_DELAY)
- {
- if (!have_delay)
- {
- printf ("#define DELAY_SLOTS\n");
- have_delay = true;
- }
- }
- else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION)
- {
- if (!have_sched)
- {
- printf ("#define INSN_SCHEDULING\n");
- have_sched = true;
- }
- }
- }
+ default:
+ break;
+ }
puts ("\n#endif /* GCC_INSN_ATTR_COMMON_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))