From patchwork Sat Apr 20 22:47:45 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: 238189 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 D108A2C0157 for ; Sun, 21 Apr 2013 08:47:56 +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:date:message-id:subject:from:to:content-type; q= dns; s=default; b=FDO0/4YFhWCjrftdAU/rN7WI3i1mY7id5B+bo2yiLxPw/0 KnhSVnsEgcjX5F7zDpED5Tn7E7lLm/3nszcPMvGi5rCKOOhScLDF6CueRfxptuvG Z5Ogkq86b/DTviBB/FokzOYh/HSD5gj8xkWdx0nhnb0a7BoUXtzpJNHTXIWLU= 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:date:message-id:subject:from:to:content-type; s= default; bh=D8fnnH1fLfZ3A3Iz2eoaVWx0L6c=; b=JpZVluF192P9dMQ02VTQ BaGX9EWrFXY/rEdnjlIiVAyOjYy2vhmtGewTE32BpksiprQ1zUENExiIW94WAM4R vME+4hP6EHQ7Hp3nmtP811lrU8aCrbMv++ylz3UjsbAejLrfG9u5vfQGXEdkqjr3 Ggc3SIHZCr+Yic90qy+JvoM= Received: (qmail 1902 invoked by alias); 20 Apr 2013 22:47:49 -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 1893 invoked by uid 89); 20 Apr 2013 22:47:48 -0000 X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_CF autolearn=ham version=3.3.1 Received: from mail-we0-f173.google.com (HELO mail-we0-f173.google.com) (74.125.82.173) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 20 Apr 2013 22:47:47 +0000 Received: by mail-we0-f173.google.com with SMTP id t57so4859932wey.18 for ; Sat, 20 Apr 2013 15:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=bePcSI0F1/FaoOe6sVmz20bPLHTlnQahirhsf/J2d50=; b=W4/TODEnOH4TjF1Lg0ree8rkbef6LxScZn5zRLe4GEWykERSRnC0RPlXqXuriILgIM YeIFtkS13EQtBvoUBCSgDDqT+AYvi4d1zz7dLoqmvcW1+0qtGB5+NUg+sEbSUznZk5jY fxEp8BIlG6OpCUQzw/AouvDgd7BPY5XLpbqD5x+X6hEAp7EF8aAj1ebmuOmR6t17dyLT AwYnu2GU5K9qcMlasE+ij1noBGFKp7oAu1myUBlhlXIdmIXnQHKKSskcNqmDudE5wR9F O9+veh2RaVl8CYh/9YK4WSX7BejLUGWKXuI3cWRIUr4q8i1KRbnMsUJwrHjBNV3hg9pB urUQ== MIME-Version: 1.0 X-Received: by 10.194.142.236 with SMTP id rz12mr38362249wjb.12.1366498065635; Sat, 20 Apr 2013 15:47:45 -0700 (PDT) Received: by 10.180.164.142 with HTTP; Sat, 20 Apr 2013 15:47:45 -0700 (PDT) Date: Sat, 20 Apr 2013 15:47:45 -0700 Message-ID: Subject: Simple change in dot dumper -- Display profile count and branch probability From: Xinliang David Li To: GCC Patches X-Gm-Message-State: ALoCoQnmzKijDKaRSqyxBnFAofGU4nLaLJCWSUhLnMqvdNls6yow8uBcUkK9CQyJUwjWtZfgKw93iHUr/tS5jPTLxFygWpNaLB1zqrO0zdNt38mqQjnZWlkA80X25diiNGoPqUoo+E0uGxBbNV9UwZQIQdWQNpp54oANEj1jmvyin8VB02Ng5NasmN8tQ1BHiqf1wnjQc1cu Hi, the graph dump file currently does not show any profile information. The following simple patch fixed that. Ok for trunk? thanks, David 2013-04-20 Xinliang David Li * graph.c (draw_cfg_node): Add count and frequency info. (draw_cfg_node_succ_edges): Add branch probility as label. } 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, '}'); @@ -155,11 +158,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);