From patchwork Thu Nov 10 15:36:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 81687 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp788617qge; Thu, 10 Nov 2016 07:37:14 -0800 (PST) X-Received: by 10.36.134.2 with SMTP id u2mr4785045itd.47.1478792234425; Thu, 10 Nov 2016 07:37:14 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id vy1si4612794pab.17.2016.11.10.07.37.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 07:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-440963-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-440963-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-440963-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=dMx1Zh9PpakqDkKOqbCn+vgMtFkprmgmrxD3lA00fd+UNoELpP 0VE7RUSsmq7LRBppsdbmWUKJEzE1MUvt3Z09ZY3jGMuJtIw4M1imiN/PE6myC38i T8EleNcOHC3xliKtNEGYTeRUpn7wk3xeknJBTjM/qydEtPvaIs7eXnZws= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Hp9ykR2tGOpkmo5hF3wQ3UF6O8M=; b=Hh1j20LwU5lzZDkYE6f5 Nw3z/hXYR+sNQpnemi+iMq+6UJxVQzeMW3JNAfVl/Nh2mXTyyoqN6RbN692woOVH 9YpEnCg4DJkUrHjH8OsN5jK4X1qyf44Gl0Tc3T+fHDZ4varKSFHYCFR4OZLeXBSA zewxKSUQJ6dCKJPVJKBoXk8= Received: (qmail 62096 invoked by alias); 10 Nov 2016 15:37:02 -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 62080 invoked by uid 89); 10 Nov 2016 15:37:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, SPF_PASS autolearn=ham version=3.3.2 spammy=wrongly, 2016-11-10 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Nov 2016 15:36:51 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BC045AC83 for ; Thu, 10 Nov 2016 15:36:49 +0000 (UTC) To: GCC Patches From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] Support no newline in print_gimple_stmt Message-ID: <56f3378c-e4ed-6120-4057-fdc2c2d9428d@suse.cz> Date: Thu, 10 Nov 2016 16:36:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 X-IsSubscribed: yes I've just noticed that tree-ssa-dse wrongly prints a new line to dump file. For the next stage1, I'll go through usages of print_gimple_stmt and remove extra new lines like: gcc/auto-profile.c: print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); gcc/auto-profile.c- fprintf (dump_file, "\n"); Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From ab1ed77381f78a8940ca250ee0f5ef5cd6b87e7f Mon Sep 17 00:00:00 2001 From: marxin Date: Thu, 10 Nov 2016 14:54:00 +0100 Subject: [PATCH] Support no newline in print_gimple_stmt gcc/ChangeLog: 2016-11-10 Martin Liska * gimple-pretty-print.c (print_gimple_stmt): Add new argument. * gimple-pretty-print.h (print_gimple_stmt): Declare the new argument. * tree-ssa-dse.c (dse_optimize_stmt): Use the argument to not to print a newline. --- gcc/gimple-pretty-print.c | 7 +++++-- gcc/gimple-pretty-print.h | 2 +- gcc/tree-ssa-dse.c | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index f588f5e..8538911 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -76,13 +76,16 @@ debug_gimple_stmt (gimple *gs) FLAGS as in pp_gimple_stmt_1. */ void -print_gimple_stmt (FILE *file, gimple *g, int spc, int flags) +print_gimple_stmt (FILE *file, gimple *g, int spc, int flags, + bool newline) { pretty_printer buffer; pp_needs_newline (&buffer) = true; buffer.buffer->stream = file; pp_gimple_stmt_1 (&buffer, g, spc, flags); - pp_newline_and_flush (&buffer); + if (newline) + pp_newline (&buffer); + pp_flush (&buffer); } DEBUG_FUNCTION void diff --git a/gcc/gimple-pretty-print.h b/gcc/gimple-pretty-print.h index f8eef99..6890cfb 100644 --- a/gcc/gimple-pretty-print.h +++ b/gcc/gimple-pretty-print.h @@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see extern void debug_gimple_stmt (gimple *); extern void debug_gimple_seq (gimple_seq); extern void print_gimple_seq (FILE *, gimple_seq, int, int); -extern void print_gimple_stmt (FILE *, gimple *, int, int); +extern void print_gimple_stmt (FILE *, gimple *, int, int, bool newline = true); extern void debug (gimple &ref); extern void debug (gimple *ptr); extern void print_gimple_expr (FILE *, gimple *, int, int); diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 372a0be..b1a8c5d 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -237,7 +237,8 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " Deleted dead call '"); - print_gimple_stmt (dump_file, gsi_stmt (*gsi), dump_flags, 0); + print_gimple_stmt (dump_file, gsi_stmt (*gsi), dump_flags, 0, + false); fprintf (dump_file, "'\n"); } @@ -293,7 +294,7 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi) if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " Deleted dead store '"); - print_gimple_stmt (dump_file, gsi_stmt (*gsi), dump_flags, 0); + print_gimple_stmt (dump_file, gsi_stmt (*gsi), dump_flags, 0, false); fprintf (dump_file, "'\n"); } -- 2.10.1