From patchwork Wed Oct 13 13:20:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingjie Xing X-Patchwork-Id: 67685 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 99F62B70D6 for ; Thu, 14 Oct 2010 00:20:48 +1100 (EST) Received: (qmail 17953 invoked by alias); 13 Oct 2010 13:20:46 -0000 Received: (qmail 17939 invoked by uid 22791); 13 Oct 2010 13:20:44 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_VC, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Oct 2010 13:20:29 +0000 Received: by yxj4 with SMTP id 4so2088270yxj.20 for ; Wed, 13 Oct 2010 06:20:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.219.10 with SMTP id r10mr967354ybg.444.1286976025713; Wed, 13 Oct 2010 06:20:25 -0700 (PDT) Received: by 10.150.202.8 with HTTP; Wed, 13 Oct 2010 06:20:25 -0700 (PDT) Date: Wed, 13 Oct 2010 21:20:25 +0800 Message-ID: Subject: [patch] fix the vcg dump bug From: Mingjie Xing To: gcc-patches@gcc.gnu.org, twlevo@gmail.com X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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 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;