Patchwork fix the vcg dump bug

login
register
mail settings
Submitter Mingjie Xing
Date Oct. 13, 2010, 1:20 p.m.
Message ID <AANLkTi=8b5egDegmXU5X_283AnwMb1VHY3iknh2TKLPn@mail.gmail.com>
Download mbox | patch
Permalink /patch/67685/
State New
Headers show

Comments

Mingjie Xing - Oct. 13, 2010, 1:20 p.m.
Hello,

I'd like to prepare a patch from Tijs Wiebe Lefering to fix the vcg
dump bug, which exists for a long time, see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41523.

The patch is bootstrapped tested on ia64-redhat-linux. Is it OK?

BTW, does this need the copyright assignment from Tijs? He is doing
the copyright assignment work now.

ChangeLog:

2010-10-13  Tijs Wiebe Lefering  <twlevo@gmail.com>

       * graph.c (inbb): New variable.
       (start_bb): Set inbb to 1 if output is inside of a building block.
       (end_bb): Check if output is inside of a building block.

Thanks,
Mingjie
Richard Henderson - Oct. 13, 2010, 4:55 p.m.
On 10/13/2010 06:20 AM, Mingjie Xing wrote:
> 2010-10-13  Tijs Wiebe Lefering  <twlevo@gmail.com>
> 
>        * graph.c (inbb): New variable.
>        (start_bb): Set inbb to 1 if output is inside of a building block.
>        (end_bb): Check if output is inside of a building block.

Ok.


r~
Mingjie Xing - Oct. 14, 2010, 1:52 a.m.
2010/10/14 Richard Henderson <rth@redhat.com>:
> On 10/13/2010 06:20 AM, Mingjie Xing wrote:
>> 2010-10-13  Tijs Wiebe Lefering  <twlevo@gmail.com>
>>
>>        * graph.c (inbb): New variable.
>>        (start_bb): Set inbb to 1 if output is inside of a building block.
>>        (end_bb): Check if output is inside of a building block.
>
> Ok.

Thanks. Committed at revision 165444.

Mingjie

Patch

Index: graph.c
===================================================================
--- graph.c	(revision 165234)
+++ graph.c	(working copy)
@@ -40,6 +40,9 @@  static const char *const graph_ext[] =
   /* vcg */      ".vcg",
 };
 
+/* The flag to indicate if output is inside of a building block.  */
+static int inbb = 0;
+
 static void start_fct (FILE *);
 static void start_bb (FILE *, int);
 static void node_data (FILE *, rtx);
@@ -77,6 +80,7 @@  start_bb (FILE *fp, int bb)
 graph: {\ntitle: \"%s.BB%d\"\nfolding: 1\ncolor: lightblue\n\
 label: \"basic block %d",
 	       current_function_name (), bb, bb);
+      inbb = 1; /* Now We are inside of a building block.  */
       break;
     case no_graph:
       break;
@@ -198,7 +202,12 @@  end_bb (FILE *fp)
   switch (graph_dump_format)
     {
     case vcg:
-      fputs ("}\n", fp);
+      /* Check if we are inside of a building block.  */
+      if (inbb != 0)
+        {
+          fputs ("}\n", fp);
+          inbb = 0; /* Now we are outside of a building block.  */
+        }
       break;
     case no_graph:
       break;