Commit c1a404bd by Richard Sandiford Committed by Richard Sandiford

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
parent b2416742
2004-09-09 Richard Sandiford <rsandifo@redhat.com>
* 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 <hp@axis.com> 2004-09-09 Hans-Peter Nilsson <hp@axis.com>
PR target/17377 PR target/17377
......
...@@ -336,6 +336,7 @@ static rtx eliminate_known_true (rtx, rtx, int, int); ...@@ -336,6 +336,7 @@ static rtx eliminate_known_true (rtx, rtx, int, int);
static void write_attr_set (struct attr_desc *, int, rtx, static void write_attr_set (struct attr_desc *, int, rtx,
const char *, const char *, rtx, const char *, const char *, rtx,
int, int); int, int);
static void write_insn_cases (struct insn_ent *, int);
static void write_attr_case (struct attr_desc *, struct attr_value *, static void write_attr_case (struct attr_desc *, struct attr_value *,
int, const char *, const char *, int, rtx); int, const char *, const char *, int, rtx);
static void write_attr_valueq (struct attr_desc *, const char *); 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, ...@@ -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. */ /* Write out the computation for one attribute value. */
static void static void
...@@ -3880,8 +3900,6 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, ...@@ -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 write_case_lines, const char *prefix, const char *suffix,
int indent, rtx known_true) int indent, rtx known_true)
{ {
struct insn_ent *ie;
if (av->num_insns == 0) if (av->num_insns == 0)
return; return;
...@@ -3898,15 +3916,7 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av, ...@@ -3898,15 +3916,7 @@ write_attr_case (struct attr_desc *attr, struct attr_value *av,
} }
if (write_case_lines) if (write_case_lines)
{ write_insn_cases (av->first_insn, indent);
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));
}
}
else else
{ {
write_indent (indent); write_indent (indent);
...@@ -4357,7 +4367,6 @@ write_const_num_delay_slots (void) ...@@ -4357,7 +4367,6 @@ write_const_num_delay_slots (void)
{ {
struct attr_desc *attr = find_attr (&num_delay_slots_str, 0); struct attr_desc *attr = find_attr (&num_delay_slots_str, 0);
struct attr_value *av; struct attr_value *av;
struct insn_ent *ie;
if (attr) if (attr)
{ {
...@@ -4371,13 +4380,7 @@ write_const_num_delay_slots (void) ...@@ -4371,13 +4380,7 @@ write_const_num_delay_slots (void)
length_used = 0; length_used = 0;
walk_attr_value (av->value); walk_attr_value (av->value);
if (length_used) if (length_used)
{ write_insn_cases (av->first_insn, 4);
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");
}
} }
printf (" default:\n"); printf (" default:\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment