From patchwork Sun Apr 21 06:37:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinliang David Li X-Patchwork-Id: 238199 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 7D6102C014F for ; Sun, 21 Apr 2013 16:37:55 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=ibrPWzxYSYq/xOxZ68 osdmjv73LTfDXyFlkbi3pvf+Tg7VFBLrYimfXAvk3Nu2eBGkCpf/S2Fwd/YqWrbx SDQsh9NF5ISNq6BwVt8tHwGlxjVcycCuyeo0Dr7U2qhlDD4lXv7LgKOE62T7DM4L TWlDo6VpUYf47dcqST9no/RuI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=d+CDv5HQURi0QUjlCcB7QI5C H+U=; b=PosBy0k0Xm3rHjDFjGg9eid4vPHaHQwZ4EU98w8zD//0FExXn3Cl1qPi G+07Agu86G8ijJa/ElQqIYY+9rPZHVh/3cv0RCypSA8eFSNkCmBYaQXlooWFdhhH 1Q7EGdQBX5sxgsOyllVkyL0dG0BinFdZAPVKxuWounZYNAVkbUk= Received: (qmail 30627 invoked by alias); 21 Apr 2013 06:37:46 -0000 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 Received: (qmail 30615 invoked by uid 89); 21 Apr 2013 06:37:45 -0000 X-Spam-SWARE-Status: No, score=-5.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_CF autolearn=ham version=3.3.1 Received: from mail-we0-f182.google.com (HELO mail-we0-f182.google.com) (74.125.82.182) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 21 Apr 2013 06:37:44 +0000 Received: by mail-we0-f182.google.com with SMTP id m1so5020895wea.41 for ; Sat, 20 Apr 2013 23:37:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=a0ujg04xDCrdlDHdlNb0WMHa+L9o7PHpLx7vjqfZ/BU=; b=MIXV30NVUlPIspCmnXPZvjCYQMsHhTYUS2bGxRNSgtwpV+0AUXDWohVTHPsIXzrIVc xwk6wRDoYNd/RATr4ZZweetE0+jkrdpKdo8er0ie26jfEQf0DxLzPJw7qyHUVi4/E0/1 MTGhJwdtX9r1tYodb72tT14WitU1gFazMzhmsy+WzVICJDfQ0cBySp9ii6LTWp4wqjv6 QwYRyIo31NFydwSVjLQe7/1p1nV+AHulh++vFP0sVdRWE+XL1NFIWGFVdoQo4lXWYXwn VrD8fYtezTzXmLoX/E9d+UpEjXEn9CH/amX3aeFJXvxWNNF7H0cXGLFrUqK7XzWg1q4v D0mA== MIME-Version: 1.0 X-Received: by 10.180.98.198 with SMTP id ek6mr6727899wib.7.1366526262278; Sat, 20 Apr 2013 23:37:42 -0700 (PDT) Received: by 10.180.164.142 with HTTP; Sat, 20 Apr 2013 23:37:42 -0700 (PDT) In-Reply-To: References: Date: Sat, 20 Apr 2013 23:37:42 -0700 Message-ID: Subject: Re: Simple change in dot dumper -- Display profile count and branch probability From: Xinliang David Li To: Steven Bosscher Cc: GCC Patches X-Gm-Message-State: ALoCoQn5bAIe6QAkDd+UNwRIrdl928WdmDfpLR+oQbGFC5vsaqXspWRxy4JOMT3NnGy4gqAf6Qj+0dqorx6oqnEpcFccp3E6YuTMEs04fMYcNENyPA2mCituAtAFL3LQA3843jOKSCCSq4b8Fx/fNa7n5PsIrwJjbkq4HH36tke+KcEiavv4CZig30lVEi5b3+xLAQ8FOqlA Thanks. The patch is revised. David 2013-04-20 Xinliang David Li * graph.c (draw_cfg_node_succ_edges): Add branch probility as label. * cfghhooks.c (dump_bb_for_graph): Dump profile count and frquency. * Makefile.in: New dependency. $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(FUNCTION_H) $(TM_H) \ coretypes.h $(EXCEPT_H) langhooks.h $(TREE_PASS_H) $(RTL_H) \ On Sat, Apr 20, 2013 at 4:02 PM, Steven Bosscher wrote: > On Sun, Apr 21, 2013 at 12:47 AM, Xinliang David Li wrote: >> Index: graph.c >> =================================================================== >> --- graph.c (revision 198108) >> +++ graph.c (working copy) >> @@ -110,6 +110,9 @@ draw_cfg_node (pretty_printer *pp, int f >> else >> { >> pp_character (pp, '{'); >> + if (bb->count) >> + pp_printf (pp, "COUNT:" HOST_WIDEST_INT_PRINT_DEC, bb->count); >> + pp_printf (pp, " FREQ:%i |", bb->frequency); >> pp_write_text_to_stream (pp); >> dump_bb_for_graph (pp, bb); >> pp_character (pp, '}'); > > This doesn't belong here, please put it in cfghooks.c:dump_bb_for_graph. > > Otherwise, looks good me. > > Ciao! > Steven Index: cfghooks.c =================================================================== --- cfghooks.c (revision 198108) +++ cfghooks.c (working copy) @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. #include "timevar.h" #include "diagnostic-core.h" #include "cfgloop.h" +#include "pretty-print.h" /* A pointer to one of the hooks containers. */ static struct cfg_hooks *cfg_hooks; @@ -308,6 +309,10 @@ dump_bb_for_graph (pretty_printer *pp, b if (!cfg_hooks->dump_bb_for_graph) internal_error ("%s does not support dump_bb_for_graph", cfg_hooks->name); + if (bb->count) + pp_printf (pp, "COUNT:" HOST_WIDEST_INT_PRINT_DEC, bb->count); + pp_printf (pp, " FREQ:%i |", bb->frequency); + pp_write_text_to_stream (pp); cfg_hooks->dump_bb_for_graph (pp, bb); } Index: graph.c =================================================================== --- graph.c (revision 198108) +++ graph.c (working copy) @@ -155,11 +155,12 @@ draw_cfg_node_succ_edges (pretty_printer pp_printf (pp, "\tfn_%d_basic_block_%d:s -> fn_%d_basic_block_%d:n " - "[style=%s,color=%s,weight=%d,constraint=%s];\n", + "[style=%s,color=%s,weight=%d,constraint=%s, label=\"[%i%%]\"];\n", funcdef_no, e->src->index, funcdef_no, e->dest->index, style, color, weight, - (e->flags & (EDGE_FAKE | EDGE_DFS_BACK)) ? "false" : "true"); + (e->flags & (EDGE_FAKE | EDGE_DFS_BACK)) ? "false" : "true", + e->probability * 100 / REG_BR_PROB_BASE); } pp_flush (pp); } Index: Makefile.in =================================================================== --- Makefile.in (revision 198108) +++ Makefile.in (working copy) @@ -3123,7 +3123,7 @@ cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) co $(GGC_H) $(OBSTACK_H) alloc-pool.h $(HASH_TABLE_H) $(CFGLOOP_H) $(TREE_H) \ $(BASIC_BLOCK_H) cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ - $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) toplev.h $(DIAGNOSTIC_CORE_H) $(CFGLOOP_H) + $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) toplev.h $(DIAGNOSTIC_CORE_H) $(CFGLOOP_H) $(PRETTY_PRINT_H) cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \