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: 693274 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 3tF6c65cfdz9syB for ; Fri, 11 Nov 2016 02:37:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gGc4/BEy"; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=H39n7fiVsEBaMBrWs4tXK779i1aTicNNh3E8fHW+VgPu9DM/34 mugwNDego2QvhMPlY71Qt70Am2peoyi02LT9ZWsGGJwF6pJ9Wc+rEbI1QlREdrVR nCZ3IEx8srDWppRaej0IpnYs+Kbwpn0jl0tjJhkafnpd6VFMZV+aK90aM= 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=gGc4/BEys3Z3/kwR4jkO YhdWPebU55L1DiYEqDuNiHZjYTQZmqaoZHHxqiuc4ojLaa/v4ZeWKWjegQyfS/l+ FhwY5djJpQHxV2vbtPIOFAYsSHVhf+G+xQmUrE5aSD040q1jBLJen0YWGcRqQebj t7ThOK6IGmWNHI7z0X9hh3E= 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