This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Small bug fixes for df.c
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 21 Sep 2005 09:25:12 +0200
- Subject: [PATCH] Small bug fixes for df.c
Computing def-use chains requires reg-use chains, but df_analyze_1 does
not ensure this dependency is satisfied.
Also the printing loops for def-use and use-def chains were swapped.
Indeed web.c was asking for a dump of both, even though it only computed
use-def chains, because otherwise df.c would dump nothing interesting!
Ok for mainline?
Paolo
2005-09-21 Paolo Bonzini <bonzini@gnu.org>
* df.c (df_analyze_1): Compute DF_RU_CHAIN if DF_DU_CHAIN given.
(df_dump): Swap the loops for printing use-def and def-use chains.
* web.c (web_main): No need to print du-chains, which were not
computed anyway.
Index: df.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/df.c,v
retrieving revision 1.87
diff -u -r1.87 df.c
--- df.c 28 Jul 2005 01:47:06 -0000 1.87
+++ df.c 20 Sep 2005 16:43:09 -0000
@@ -1936,7 +1947,7 @@
aflags |= DF_RD | DF_RD_CHAIN;
if (flags & DF_DU_CHAIN)
- aflags |= DF_RU;
+ aflags |= DF_RU | DF_RU_CHAIN;
if (flags & DF_RU)
aflags |= DF_RU_CHAIN;
@@ -3510,9 +3610,9 @@
}
}
- if (flags & DF_UD_CHAIN)
+ if (flags & DF_DU_CHAIN)
{
- fprintf (file, "Use-def chains:\n");
+ fprintf (file, "Def-use chains:\n");
for (j = 0; j < df->n_defs; j++)
{
if (df->defs[j])
@@ -3551,9 +3651,9 @@
}
}
- if (flags & DF_DU_CHAIN)
+ if (flags & DF_UD_CHAIN)
{
- fprintf (file, "Def-use chains:\n");
+ fprintf (file, "Use-def chains:\n");
for (j = 0; j < df->n_uses; j++)
{
if (df->uses[j])
Index: web.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/web.c,v
retrieving revision 2.16
diff -p -u -u -r2.16 web.c
--- web.c 5 Jul 2005 16:20:31 -0000 2.16
+++ web.c 21 Sep 2005 07:23:25 -0000
@@ -250,7 +250,7 @@ web_main (void)
used = xcalloc (max, sizeof (char));
if (dump_file)
- df_dump (df, DF_UD_CHAIN | DF_DU_CHAIN, dump_file);
+ df_dump (df, DF_UD_CHAIN, dump_file);
/* Produce the web. */
for (i = 0; i < df->n_uses; i++)