From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 65731 invoked by alias); 31 Jul 2018 12:50:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 65715 invoked by uid 89); 31 Jul 2018 12:50:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=kit, malcolm, Malcolm, U*dmalcolm X-HELO: mail-lj1-f193.google.com Received: from mail-lj1-f193.google.com (HELO mail-lj1-f193.google.com) (209.85.208.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Jul 2018 12:50:56 +0000 Received: by mail-lj1-f193.google.com with SMTP id p6-v6so13596226ljc.5 for ; Tue, 31 Jul 2018 05:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5ybSTasxw+sN+3USMlB6SQR3odbXJp5tPg2prh9bRss=; b=LWinxNwn49iJ8Hd8wdqg2gRC2vYEFM6yRoIThKZbxjj/rVjE6/LPuIYbzsXFs6ZUUP FUtwibRLlf4SqqNpgUjfqFFNQe/FYF5NSrekyKg/Qm+A3Psi3YGjKrgljkHRJpxypjAg 6Bhb2g/OhIgMfUBws1lCw/Zs1yZt+uJtVFLFUhBe0IJShh/acZVF688aV634KZPqeWvH mUz58sAHSq+cHxWUzmxquZF9NNAOkPto3zNkyRzoPsBo0qy3+I+eA3ms6HH+lgeMKvWN LuFal+w6NJSMvp/z6bMvYivQ9Vw8mtxfksrHpq8+W6CmqRW569yJyD8LNbPg+8qLorrB 3uaA== MIME-Version: 1.0 References: <1532730752-10525-1-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1532730752-10525-1-git-send-email-dmalcolm@redhat.com> From: Richard Biener Date: Tue, 31 Jul 2018 12:50:00 -0000 Message-ID: Subject: Re: [PATCH 0/5] dump_printf support for middle-end types To: David Malcolm Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg01937.txt.bz2 On Fri, Jul 27, 2018 at 11:47 PM David Malcolm wrote: > > This patch kit converts dump_print and dump_printf_loc from using > fprintf etc internally to using a new pretty-printer > based on pp_format, which supports formatting middle-end types. > > In particular, the following codes are implemented (in addition > to the standard pretty_printer ones): > > %E: gimple *: > Equivalent to: dump_gimple_expr (MSG_*, TDF_SLIM, stmt, 0) > %G: gimple *: > Equivalent to: dump_gimple_stmt (MSG_*, TDF_SLIM, stmt, 0) > %T: tree: > Equivalent to: dump_generic_expr (MSG_*, arg, TDF_SLIM). > > Hence it becomes possible to convert e.g.: > > if (dump_enabled_p ()) > { > dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, > "not vectorized: different sized vector " > "types in statement, "); > dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, vectype); > dump_printf (MSG_MISSED_OPTIMIZATION, " and "); > dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, nunits_vectype); > dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); > } > return false; > > into a single call to dump_printf_loc: > > if (dump_enabled_p ()) > dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, > "not vectorized: different sized vector " > "types in statement, %T and %T\n", > vectype, nunits_vectype); > return false; > > Unlike regular pretty-printers, this captures metadata for the > formatted chunks as appropriate, so that when written out to a > JSON optimization record, the relevant parts of the message are > labelled by type, and by source location (so that > e.g. %G is entirely equivalent to using dump_gimple_stmt). > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. > > OK for trunk? Nice! I'm somehow missing 3/5? Will look into the other ones now. Richard. > I'm hoping to use this in a v3 of: > "[PATCH 0/5] [RFC v2] Higher-level reporting of vectorization problems" > https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00446.html > where the above might become: > return opt_result::failure_at (stmt, > "not vectorized: different sized vector " > "types in statement, %T and %T\n", > vectype, nunits_vectype); > where opt_result::failure_at would encapsulate the "false", and > capture an opt_problem * (when dumps are enabled), for the reasons > discussed in that other kit. > > David Malcolm (5): > Simplify dump_context by adding a dump_loc member function > dumpfile.c: eliminate special-casing of dump_file/alt_dump_file > C++: clean up cp_printer > c-family: clean up the data tables in c-format.c > Formatted printing for dump_* in the middle-end > > gcc/c-family/c-format.c | 159 +++-- > gcc/c-family/c-format.h | 1 + > gcc/cp/error.c | 46 +- > gcc/dump-context.h | 25 +- > gcc/dumpfile.c | 1011 ++++++++++++++++++++++------- > gcc/dumpfile.h | 54 +- > gcc/optinfo-emit-json.cc | 2 +- > gcc/optinfo.cc | 135 +--- > gcc/optinfo.h | 38 +- > gcc/testsuite/gcc.dg/format/gcc_diag-1.c | 19 +- > gcc/testsuite/gcc.dg/format/gcc_diag-10.c | 33 +- > 11 files changed, 998 insertions(+), 525 deletions(-) > > -- > 1.8.5.3 >