From patchwork Mon Aug 22 11:39:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 661412 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sHs7N2hyjz9t0t for ; Mon, 22 Aug 2016 21:39:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=KQU+YDAX; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=I50bZZfDXkPO0PC9 BxwHM9Rl23lDjC8dp1pXRih59w4hPShJsjJ46/8JnRSTDAiUN3cyjSuxyjlM54qi ycJ6ygjUsrzjqT4I6Cr6K/kXezX98IdCmU5l27wWbzDc2cCKCFCO2D86ovB4Aa93 Vc19FD6CUtizCC0Xfn/jejzfzpk= 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:from :date:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=CDy0A7wj5BtBVkGh74i6wj +St9w=; b=KQU+YDAXhhXEBKTJcXjNYm4rJrGrORik8FE9ZR2JwwncMe/vE3cbTb OyxFzvOlspNRDNTWTXE+mA4R5HtUiUyOjLf0nt8VEoEgpSVCykfCi1F7BSLrOgH8 pnmXn9UClO2GyHs97tx/cO/cq52JHocpte7qOwykHLNLbLLpP9P3I= Received: (qmail 97802 invoked by alias); 22 Aug 2016 11:39:50 -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 95972 invoked by uid 89); 22 Aug 2016 11:39:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=unwanted, H*Ad:D*cx X-HELO: mail-qt0-f196.google.com Received: from mail-qt0-f196.google.com (HELO mail-qt0-f196.google.com) (209.85.216.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Aug 2016 11:39:39 +0000 Received: by mail-qt0-f196.google.com with SMTP id u25so2735880qtb.3 for ; Mon, 22 Aug 2016 04:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Yriac3Do8WYvaOd9t5DvBVpaxgFat7R6+gByU0iMBDk=; b=lQmFTCwVQLjfDRHARHKBOmDBX3wW9WksJgwfW9qJt9VTAMYi8nm9NORQBp8BVgJ4ec 6W8R7ZLvXHMOQUC8Cv5nN3pVOJZgvOqUQoFQnTPW3Wz1ukKcCJj7MVc0REz0xJ4YPR6I O9f/bkCt4Yjg7xNH84v+TiFhfeMYK7NsVeaEpDD4AztltN8zCIi0LxnMhKL6QkgprYLQ 7CoJByJ3/kUF5lvo9UVeOzJAmZVpJ0cPhq4unAgstBl3hhB/kcIorkZF5OygMMGnLTYf rh7m9GXD8Cuo6piGOv1YHNodd8lO9/MXK1Kwut0kiVz8W5WUfftUDFCx3AASiOVMSsDx zjqg== X-Gm-Message-State: AEkoousyezL8jsZMB6ERDMZPz80zTMvvfRgIN9Ct1Y9QCKYo8+g40Go/CdthtMawQcLVcA== X-Received: by 10.200.46.216 with SMTP id i24mr23357098qta.79.1471865977489; Mon, 22 Aug 2016 04:39:37 -0700 (PDT) Received: from [192.168.1.130] (ool-4353abbc.dyn.optonline.net. [67.83.171.188]) by smtp.gmail.com with ESMTPSA id e7sm9387715qtb.9.2016.08.22.04.39.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Aug 2016 04:39:36 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Mon, 22 Aug 2016 07:39:36 -0400 (EDT) To: Richard Biener cc: Patrick Palka , GCC Patches Subject: Re: [PATCH] Improve readability of debug_tree() dumps for SSA_NAME and VECTOR_CST In-Reply-To: Message-ID: References: <20160819232745.23861-1-patrick@parcs.ath.cx> User-Agent: Alpine 2.20.13 (DEB 116 2015-12-14) MIME-Version: 1.0 On Mon, 22 Aug 2016, Richard Biener wrote: > On Sat, Aug 20, 2016 at 1:27 AM, Patrick Palka wrote: > > * For SSA_NAME: Print the ssa name's def stmt on its own line. > > > > Before: > > > type > type > size > > unit size > > align 32 symtab 0 alias set -1 canonical type 0x7ffff688a888 precision 32 min max context > > pointer_to_this > > > unsigned V8SI > > size > > unit size > > align 256 symtab 0 alias set 1 canonical type 0x7ffff6a09bd0 nunits 8 > > pointer_to_this > > > visited var def_stmt vect__2.15_101 = vect__1.14_99 & { 1, 1, 1, 1, 1, 1, 1, 1 }; > > > > version 101> > > > > After: > > (gdb) print debug_tree (op0) > > > type > type > size > > unit size > > align 32 symtab 0 alias set -1 canonical type 0x7ffff688a888 precision 32 min max context > > pointer_to_this > > > unsigned V8SI > > size > > unit size > > align 256 symtab 0 alias set 1 canonical type 0x7ffff6a09bd0 nunits 8 > > pointer_to_this > > > visited var > > def_stmt vect__2.15_101 = vect__1.14_99 & { 1, 1, 1, 1, 1, 1, 1, 1 }; > > > > version 101> > > > > * For VECTOR_CST: Coalesce the output of identical consecutive elt values. > > > > Before: > > > type > type > size > > unit size > > align 32 symtab 0 alias set -1 canonical type 0x7ffff688a888 precision 32 min max context > > pointer_to_this > > > unsigned V8SI > > size > > unit size > > align 256 symtab 0 alias set 1 canonical type 0x7ffff6a09bd0 nunits 8 > > pointer_to_this > > > constant > > elt0: constant 0> elt1: elt2: elt3: elt4: elt5: elt6: elt7: > > > > > After: > > (gdb) print debug_tree (op1) > > > type > type > size > > unit size > > align 32 symtab 0 alias set -1 canonical type 0x7ffff688a888 precision 32 min max context > > pointer_to_this > > > unsigned V8SI > > size > > unit size > > align 256 symtab 0 alias set 1 canonical type 0x7ffff6a09bd0 nunits 8 > > pointer_to_this > > > constant > > elt0...elt7: constant 0>> > > > > (I also tested the change on non-uniform VECTOR_CSTs.) > > > > Does this look OK to commit after bootstrap + regtesting? > > Ok - but can you please try to avoid the excessive newline after the > def_stmt: line? > I think the only way to do this currently is to inline > print_gimple_stmt and adjust it > accordingly. Or add a param to 'indent_to' whether to emit the newline. How does this look? gcc/ChangeLog: * print-tree.c (print_node) [SSA_NAME]: When printing the node's def stmt, replace the call to print_gimple_stmt() with its inlined body and adjust it to avoid printing an unwanted newline by calling pp_flush() instead of pp_newline_and_flush() and by not setting pp_needs_newline. --- gcc/print-tree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 2baf34a..d775491 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -882,7 +882,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent) print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4); indent_to (file, indent + 4); fprintf (file, "def_stmt "); - print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0); + { + pretty_printer buffer; + buffer.buffer->stream = file; + pp_gimple_stmt_1 (&buffer, SSA_NAME_DEF_STMT (node), indent + 4, 0); + pp_flush (&buffer); + } indent_to (file, indent + 4); fprintf (file, "version %u", SSA_NAME_VERSION (node));