diff options
Diffstat (limited to 'gcc/genattr.c')
-rw-r--r-- | gcc/genattr.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/gcc/genattr.c b/gcc/genattr.c index 97ed613..d31f0073 100644 --- a/gcc/genattr.c +++ b/gcc/genattr.c @@ -29,15 +29,14 @@ along with GCC; see the file COPYING3. If not see #include "gensupport.h" -static void gen_attr (rtx); - static vec<rtx> const_attrs, reservations; static void -gen_attr (rtx attr) +gen_attr (md_rtx_info *info) { const char *p; + rtx attr = info->def; int is_const = GET_CODE (XEXP (attr, 2)) == CONST; if (is_const) @@ -141,7 +140,6 @@ find_tune_attr (rtx exp) int main (int argc, char **argv) { - rtx desc; int have_delay = 0; int have_annul_true = 0; int have_annul_false = 0; @@ -162,20 +160,18 @@ main (int argc, char **argv) /* Read the machine description. */ - while (1) + md_rtx_info info; + while (read_md_rtx (&info)) { - int line_no, insn_code_number; - - desc = read_md_rtx (&line_no, &insn_code_number); - if (desc == NULL) - break; - - if (GET_CODE (desc) == DEFINE_ATTR - || GET_CODE (desc) == DEFINE_ENUM_ATTR) - gen_attr (desc); + rtx def = info.def; + switch (GET_CODE (def)) + { + case DEFINE_ATTR: + case DEFINE_ENUM_ATTR: + gen_attr (&info); + break; - else if (GET_CODE (desc) == DEFINE_DELAY) - { + case DEFINE_DELAY: if (! have_delay) { printf ("extern int num_delay_slots (rtx_insn *);\n"); @@ -184,28 +180,31 @@ main (int argc, char **argv) have_delay = 1; } - for (i = 0; i < XVECLEN (desc, 1); i += 3) + for (i = 0; i < XVECLEN (def, 1); i += 3) { - if (XVECEXP (desc, 1, i + 1) && ! have_annul_true) + if (XVECEXP (def, 1, i + 1) && ! have_annul_true) { printf ("#define ANNUL_IFTRUE_SLOTS\n"); printf ("extern int eligible_for_annul_true (rtx_insn *, int, rtx_insn *, int);\n"); have_annul_true = 1; } - if (XVECEXP (desc, 1, i + 2) && ! have_annul_false) + if (XVECEXP (def, 1, i + 2) && ! have_annul_false) { printf ("#define ANNUL_IFFALSE_SLOTS\n"); printf ("extern int eligible_for_annul_false (rtx_insn *, int, rtx_insn *, int);\n"); have_annul_false = 1; } } - } + break; - else if (GET_CODE (desc) == DEFINE_INSN_RESERVATION) - { + case DEFINE_INSN_RESERVATION: num_insn_reservations++; - reservations.safe_push (desc); + reservations.safe_push (def); + break; + + default: + break; } } |