Message ID | 1284759533-1647-1-git-send-email-sebpop@gmail.com |
---|---|
State | New |
Headers | show |
On Fri, Sep 17, 2010 at 11:38 PM, Sebastian Pop <sebpop@gmail.com> wrote: > Regstrapped on amd64-linux. Committed to trunk. You should be able to do this kind of stuff with some gdb python magic. That'd be also more flexible ... Richard. > 2010-09-17 Sebastian Pop <sebastian.pop@amd.com> > > Revert commit: 2009-12-16 Ben Elliston <bje@au.ibm.com> > * tree-data-ref.c (dot_rdg_1): Added back. > (dot_rdg): Same. Added "#if 0" around system call. > --- > gcc/ChangeLog | 6 ++++ > gcc/tree-data-ref.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 76 insertions(+), 0 deletions(-) > > diff --git a/gcc/ChangeLog b/gcc/ChangeLog > index dcfc7e6..ff81b02 100644 > --- a/gcc/ChangeLog > +++ b/gcc/ChangeLog > @@ -1,3 +1,9 @@ > +2010-09-17 Sebastian Pop <sebastian.pop@amd.com> > + > + Revert commit: 2009-12-16 Ben Elliston <bje@au.ibm.com> > + * tree-data-ref.c (dot_rdg_1): Added back. > + (dot_rdg): Same. Added "#if 0" around system call. > + > 2010-09-17 H.J. Lu <hongjiu.lu@intel.com> > Richard Henderson <rth@redhat.com> > > diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c > index e1d2dfc..06b36e9 100644 > --- a/gcc/tree-data-ref.c > +++ b/gcc/tree-data-ref.c > @@ -4709,6 +4709,76 @@ debug_rdg (struct graph *rdg) > dump_rdg (stderr, rdg); > } > > +static void > +dot_rdg_1 (FILE *file, struct graph *rdg) > +{ > + int i; > + > + fprintf (file, "digraph RDG {\n"); > + > + for (i = 0; i < rdg->n_vertices; i++) > + { > + struct vertex *v = &(rdg->vertices[i]); > + struct graph_edge *e; > + > + /* Highlight reads from memory. */ > + if (RDG_MEM_READS_STMT (rdg, i)) > + fprintf (file, "%d [style=filled, fillcolor=green]\n", i); > + > + /* Highlight stores to memory. */ > + if (RDG_MEM_WRITE_STMT (rdg, i)) > + fprintf (file, "%d [style=filled, fillcolor=red]\n", i); > + > + if (v->succ) > + for (e = v->succ; e; e = e->succ_next) > + switch (RDGE_TYPE (e)) > + { > + case input_dd: > + fprintf (file, "%d -> %d [label=input] \n", i, e->dest); > + break; > + > + case output_dd: > + fprintf (file, "%d -> %d [label=output] \n", i, e->dest); > + break; > + > + case flow_dd: > + /* These are the most common dependences: don't print these. */ > + fprintf (file, "%d -> %d \n", i, e->dest); > + break; > + > + case anti_dd: > + fprintf (file, "%d -> %d [label=anti] \n", i, e->dest); > + break; > + > + default: > + gcc_unreachable (); > + } > + } > + > + fprintf (file, "}\n\n"); > +} > + > +/* Display the Reduced Dependence Graph using dotty. */ > +extern void dot_rdg (struct graph *); > + > +DEBUG_FUNCTION void > +dot_rdg (struct graph *rdg) > +{ > + /* When debugging, enable the following code. This cannot be used > + in production compilers because it calls "system". */ > +#if 0 > + FILE *file = fopen ("/tmp/rdg.dot", "w"); > + gcc_assert (file != NULL); > + > + dot_rdg_1 (file, rdg); > + fclose (file); > + > + system ("dotty /tmp/rdg.dot &"); > +#else > + dot_rdg_1 (stderr, rdg); > +#endif > +} > + > /* This structure is used for recording the mapping statement index in > the RDG. */ > > -- > 1.7.0.4 > >
On Fri, Sep 17, 2010 at 16:47, Richard Guenther <richard.guenther@gmail.com> wrote: > On Fri, Sep 17, 2010 at 11:38 PM, Sebastian Pop <sebpop@gmail.com> wrote: >> Regstrapped on amd64-linux. Committed to trunk. > > You should be able to do this kind of stuff with some gdb python magic. That'd > be also more flexible ... I will try to set up something like this. I will remove the dot_* functions and I will figure out how to add these functions as macros to gdbinit.in. Thanks for the suggestion, Sebastian
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dcfc7e6..ff81b02 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-09-17 Sebastian Pop <sebastian.pop@amd.com> + + Revert commit: 2009-12-16 Ben Elliston <bje@au.ibm.com> + * tree-data-ref.c (dot_rdg_1): Added back. + (dot_rdg): Same. Added "#if 0" around system call. + 2010-09-17 H.J. Lu <hongjiu.lu@intel.com> Richard Henderson <rth@redhat.com> diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index e1d2dfc..06b36e9 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4709,6 +4709,76 @@ debug_rdg (struct graph *rdg) dump_rdg (stderr, rdg); } +static void +dot_rdg_1 (FILE *file, struct graph *rdg) +{ + int i; + + fprintf (file, "digraph RDG {\n"); + + for (i = 0; i < rdg->n_vertices; i++) + { + struct vertex *v = &(rdg->vertices[i]); + struct graph_edge *e; + + /* Highlight reads from memory. */ + if (RDG_MEM_READS_STMT (rdg, i)) + fprintf (file, "%d [style=filled, fillcolor=green]\n", i); + + /* Highlight stores to memory. */ + if (RDG_MEM_WRITE_STMT (rdg, i)) + fprintf (file, "%d [style=filled, fillcolor=red]\n", i); + + if (v->succ) + for (e = v->succ; e; e = e->succ_next) + switch (RDGE_TYPE (e)) + { + case input_dd: + fprintf (file, "%d -> %d [label=input] \n", i, e->dest); + break; + + case output_dd: + fprintf (file, "%d -> %d [label=output] \n", i, e->dest); + break; + + case flow_dd: + /* These are the most common dependences: don't print these. */ + fprintf (file, "%d -> %d \n", i, e->dest); + break; + + case anti_dd: + fprintf (file, "%d -> %d [label=anti] \n", i, e->dest); + break; + + default: + gcc_unreachable (); + } + } + + fprintf (file, "}\n\n"); +} + +/* Display the Reduced Dependence Graph using dotty. */ +extern void dot_rdg (struct graph *); + +DEBUG_FUNCTION void +dot_rdg (struct graph *rdg) +{ + /* When debugging, enable the following code. This cannot be used + in production compilers because it calls "system". */ +#if 0 + FILE *file = fopen ("/tmp/rdg.dot", "w"); + gcc_assert (file != NULL); + + dot_rdg_1 (file, rdg); + fclose (file); + + system ("dotty /tmp/rdg.dot &"); +#else + dot_rdg_1 (stderr, rdg); +#endif +} + /* This structure is used for recording the mapping statement index in the RDG. */