From c1a404bd99198779b2115d99ab84535a5b7fd9fb Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 9 Sep 2004 20:39:28 +0000 Subject: [PATCH] genattrtab.c (write_insn_cases): New function, split out from write_attr_case. * genattrtab.c (write_insn_cases): New function, split out from write_attr_case. Correctly handle define_peepholes when printing the instruction name. (write_attr_case, write_const_num_delay_slots): Use write_insn_cases. From-SVN: r87252 --- gcc/ChangeLog | 7 +++++++ gcc/genattrtab.c | 41 ++++++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d1f90fd476..ba72d1c2766 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-09-09 Richard Sandiford + + * genattrtab.c (write_insn_cases): New function, split out from + write_attr_case. Correctly handle define_peepholes when printing + the instruction name. + (write_attr_case, write_const_num_delay_slots): Use write_insn_cases. + 2004-09-09 Hans-Peter Nilsson PR target/17377 diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c index dc8ff6ebcb3..44a073f2b53 100644 --- a/gcc/genattrtab.c +++ b/gcc/genattrtab.c @@ -336,6 +336,7 @@ static rtx eliminate_known_true (rtx, rtx, int, int); static void write_attr_set (struct attr_desc *, int, rtx, const char *, const char *, rtx, int, int); +static void write_insn_cases (struct insn_ent *, int); static void write_attr_case (struct attr_desc *, struct attr_value *, int, const char *, const char *, int, rtx); static void write_attr_valueq (struct attr_desc *, const char *); @@ -3873,6 +3874,25 @@ write_attr_set (struct attr_desc *attr, int indent, rtx value, } } +/* Write a series of case statements for every instruction in list IE. + INDENT is the amount of indentation to write before each case. */ + +static void +write_insn_cases (struct insn_ent *ie, int indent) +{ + for (; ie != 0; ie = ie->next) + if (ie->def->insn_code != -1) + { + write_indent (indent); + if (GET_CODE (ie->def->def) == DEFINE_PEEPHOLE) + printf ("case %d: /* define_peephole, line %d */\n", + ie->def->insn_code, ie->def->lineno); + else + printf ("case %d: /* %s */\n", + ie->def->insn_code, XSTR (ie->def->def, 0)); + } +} + /* Write out the computation for one attribute value. */ static void @@ -3880,8 +3900,6 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, int write_case_lines, const char *prefix, const char *suffix, int indent, rtx known_true) { - struct insn_ent *ie; - if (av->num_insns == 0) return; @@ -3898,15 +3916,7 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, } if (write_case_lines) - { - for (ie = av->first_insn; ie; ie = ie->next) - if (ie->def->insn_code != -1) - { - write_indent (indent); - printf ("case %d: /* %s */\n", - ie->def->insn_code, XSTR (ie->def->def, 0)); - } - } + write_insn_cases (av->first_insn, indent); else { write_indent (indent); @@ -4357,7 +4367,6 @@ write_const_num_delay_slots (void) { struct attr_desc *attr = find_attr (&num_delay_slots_str, 0); struct attr_value *av; - struct insn_ent *ie; if (attr) { @@ -4371,13 +4380,7 @@ write_const_num_delay_slots (void) length_used = 0; walk_attr_value (av->value); if (length_used) - { - for (ie = av->first_insn; ie; ie = ie->next) - if (ie->def->insn_code != -1) - printf (" case %d: /* %s */\n", - ie->def->insn_code, XSTR (ie->def->def, 0)); - printf (" return 0;\n"); - } + write_insn_cases (av->first_insn, 4); } printf (" default:\n"); -- 2.30.2