This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix powerpc rtl checking failure
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: austern at apple dot com
- Date: Thu, 09 Sep 2004 15:39:27 +0100
- Subject: Fix powerpc rtl checking failure
This patch fixes the rtl checking failure that Matt reporteed here:
http://gcc.gnu.org/ml/gcc/2004-09/msg00383.html
The problem was that genattrtab tests the insn codes of both
define_peepholes and define_insns, and we were trying to print
the name of a define_peephole as if it were a define_insn.
Bootstrapped & regression tested on i686-pc-linux-gnu with
--enable-checking=gc,misc,rtlflag,rtl,tree. I also tested a
cross-compile to powerpc-apple-darwin, same flags, to make sure
it got past the failure point. I checked the powerpc insn-attrtab.c
file to make sure that define_peephole comments looked reasonable.
OK to install?
Richard
* 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.
Index: genattrtab.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genattrtab.c,v
retrieving revision 1.151
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.151 genattrtab.c
*** genattrtab.c 13 Aug 2004 16:43:04 -0000 1.151
--- genattrtab.c 9 Sep 2004 06:42:59 -0000
*************** static rtx eliminate_known_true (rtx, rt
*** 338,343 ****
--- 338,344 ----
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 *);
*************** write_attr_set (struct attr_desc *attr,
*** 3874,3879 ****
--- 3875,3899 ----
}
}
+ /* 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
*************** write_attr_case (struct attr_desc *attr,
*** 3881,3888 ****
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;
--- 3901,3906 ----
*************** write_attr_case (struct attr_desc *attr,
*** 3899,3913 ****
}
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));
! }
! }
else
{
write_indent (indent);
--- 3917,3923 ----
}
if (write_case_lines)
! write_insn_cases (av->first_insn, indent);
else
{
write_indent (indent);
*************** write_const_num_delay_slots (void)
*** 4365,4371 ****
{
struct attr_desc *attr = find_attr (&num_delay_slots_str, 0);
struct attr_value *av;
- struct insn_ent *ie;
if (attr)
{
--- 4375,4380 ----
*************** write_const_num_delay_slots (void)
*** 4379,4391 ****
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");
! }
}
printf (" default:\n");
--- 4388,4394 ----
length_used = 0;
walk_attr_value (av->value);
if (length_used)
! write_insn_cases (av->first_insn, 4);
}
printf (" default:\n");