From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79063 invoked by alias); 12 Feb 2016 22:06:12 -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 79050 invoked by uid 89); 12 Feb 2016 22:06:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Chief, LinkedIn, 428, Argentina X-HELO: mail-ig0-f177.google.com Received: from mail-ig0-f177.google.com (HELO mail-ig0-f177.google.com) (209.85.213.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 12 Feb 2016 22:06:10 +0000 Received: by mail-ig0-f177.google.com with SMTP id y8so19992754igp.1 for ; Fri, 12 Feb 2016 14:06:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0jNMbyqvRgBuG5OjEBDzLnWIu7sky5Voz7U8+3uGVko=; b=Bp9FPY9t15vyqSIA5Tlgraxf5yWYv0TqE4IIu1o8DvupbC5LX5kDbsuFzEmQezrOrz cbzaWnOQA7FYK6wM9QxvaabVDwX+v3PE3YQ4oMw8XihiH7v6j1tdUhq499MQoPEkiCdn /x+UmyeqBXPiGu5maf6b/RwGWEYCfyEu80YuSB3gwIOEqi/F7eXCR3lUFrZ5AlbamAVK nPJIkLSn8pA5w4ehAJnN+91rl60Mr0rqP78pN/JRZOQ3ymtBrI9RIiKBEma1LoPxdoTc Wk8wPS/8Nqwu1Pub4tiyUPvwbg9sV6AG841j8eueDxp58mmt+1Hn65W+9jvEyIDnsyuV J6lw== X-Gm-Message-State: AG10YOStvhLLETc/zzukI51vVQTIQ7ue8cCJsDL7zJ2hNB8IT1e2aF12y5+4fJ4OfWW8ns4BGn7qq48gFb5C/fL8 MIME-Version: 1.0 X-Received: by 10.50.64.146 with SMTP id o18mr130286igs.51.1455314768123; Fri, 12 Feb 2016 14:06:08 -0800 (PST) Received: by 10.36.5.148 with HTTP; Fri, 12 Feb 2016 14:06:08 -0800 (PST) In-Reply-To: References: Date: Fri, 12 Feb 2016 22:06:00 -0000 Message-ID: Subject: Re: [PATCH] New flag for dumping information about constexpr function calls memoization (GCC 5.2.0) From: Daniel Gutson To: Andres Tiraboschi Cc: GCC Patches , Joseph Myers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00910.txt.bz2 On Fri, Jan 29, 2016 at 11:46 AM, Andres Tiraboschi wrote: > 2016-01-28 17:54 GMT-03:00 Joseph Myers : >> Any patch adding a new option needs to add documentation for it to >> invoke.texi (both substantive documentation, and inclusion in the summary >> lists of options). >> >> -- >> Joseph S. Myers >> joseph@codesourcery.com > > Hi, > > Thanks for the feedback, I've just updated the documentation. > > patch: Ping, any chance to review this? Thanks, Daniel. > > > diff --git a/gcc/common.opt b/gcc/common.opt > index 1218a71..bf0c7df 100644 > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -1168,6 +1168,10 @@ fdump-passes > Common Var(flag_dump_passes) Init(0) > Dump optimization passes > > +fdump-memoization-hits > +Common Var(flag_dump_memoization_hits) Init(0) > +Dump info about constexpr calls memoized. > + > fdump-unnumbered > Common Report Var(flag_dump_unnumbered) > Suppress output of instruction numbers, line number notes and > addresses in debugging dumps > diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c > index e250726..41ae5b3 100644 > --- a/gcc/cp/constexpr.c > +++ b/gcc/cp/constexpr.c > @@ -42,6 +42,8 @@ along with GCC; see the file COPYING3. If not see > #include "builtins.h" > #include "tree-inline.h" > #include "ubsan.h" > +#include "tree-pretty-print.h" > +#include "dumpfile.h" > > static bool verify_constant (tree, bool, bool *, bool *); > #define VERIFY_CONSTANT(X) \ > @@ -1173,6 +1175,14 @@ cx_error_context (void) > return r; > } > > +static void > +dump_memoization_hit (FILE *file, tree call, int flags) > +{ > + fprintf(file, "Memoized call:\n"); > + print_generic_decl(file, call, flags); > + fprintf(file, "\n"); > +} > + > /* Subroutine of cxx_eval_constant_expression. > Evaluate the call expression tree T in the context of OLD_CALL expres= sion > evaluation. */ > @@ -1338,7 +1348,11 @@ cxx_eval_call_expression (const constexpr_ctx > *ctx, tree t, > entry->result =3D result =3D error_mark_node; > } > else > - result =3D entry->result; > + { > + if (flag_dump_memoization_hits) > + dump_memoization_hit(stderr, t, 0); > + result =3D entry->result; > + } > } > > if (!depth_ok) > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi > index f84a199..b78bd4b 100644 > --- a/gcc/doc/invoke.texi > +++ b/gcc/doc/invoke.texi > @@ -322,6 +322,7 @@ Objective-C and Objective-C++ Dialects}. > -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol > -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol > -fdump-passes @gol > +-fdump-memoization-hits @gol > -fdump-statistics @gol > -fdump-tree-all @gol > -fdump-tree-original@r{[}-@var{n}@r{]} @gol > @@ -6771,6 +6772,10 @@ Dump after function inlining. > Dump the list of optimization passes that are turned on and off by > the current command-line options. > > +@item -fdump-memoization-hits > +@opindex fdump-memoization-hits > +Dump the list of constexpr function calls that were memoized. > + > @item -fdump-statistics-@var{option} > @opindex fdump-statistics > Enable and control dumping of pass statistics in a separate file. The --=20 Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 C=C3=B3rdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson LinkedIn: http://ar.linkedin.com/in/danielgutson