From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75657 invoked by alias); 17 Feb 2017 12:23:11 -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 75643 invoked by uid 89); 17 Feb 2017 12:23:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Fri, 17 Feb 2017 12:23:00 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A390CAAB2; Fri, 17 Feb 2017 12:22:57 +0000 (UTC) Date: Fri, 17 Feb 2017 12:27:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org cc: jason@redhat.com, Jakub Jelinek Subject: Re: [PATCH][C++] Annotate more functions with MEM-STATs In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2017-02/txt/msg01106.txt.bz2 On Fri, 17 Feb 2017, Richard Biener wrote: > > The following annotates two key wrappers around copy_node in the C++ FE > with MEM-STAT info (and with CXX_MEM_STAT_INFO this is surprisingly > easy, without adding _stat variants and macros as we have for the classic > way from the pre-C++ era). > > It also annotates more type building functions in tree.c (all in the > attempt to get a better idea on where all the types are built for C++ > sources). > > Bootstrapped without --enable-gather-detailed-mem-stats, bootstrapped > with --enable-gather-detailed-mem-stats and visually inspected the > improved stats on some example C++ code. > > There are still some more functions worth annotating: > > tree.c:8239 (build_range_type_1) 840: 0.0% > 666120: 3.2% > tree.c:8362 (build_array_type_1) 3024: 0.0% > 671496: 3.2% > tree.c:4841 (build_type_attribute_qual_variant) 13776: 0.1% > 67032: 0.3% > tree.c:8681 (build_method_type_directly) 41832: 0.3% > 202944: 1.0% > hash-table.h:736 (expand) 15136: 0.1% > 5826600: 27.8% > tree.c:8532 (build_function_type) 148344: 1.1% > 3538080: 16.9% > cp/lex.c:556 (retrofit_lang_decl) 78628: 0.6% > 43776: 0.2% > cp/lex.c:526 (build_lang_decl_loc) 87968: 0.6% > 260776: 1.2% 3902184: 7.5% 536840: 23.8% 15444 > > is it ok if I go forward with this (at this stage, also for C++ > specifics above?) > > Would it be welcome to scrap _stat and the macro wrappings everywhere > at this stage? And even unify CXX_MEM_STAT_INFO and MEM_STAT_INFO, also dropping support for host compilers < GCC 4.8, GCC 4.8 introduced __builtin_FILE and friends (you'd have to bootstrap with older host compilers or clang which doesn't seem to support those either and still claims to be GCC 4.2.1 ...). Richard. > Thanks, > Richard. > > 2017-02-17 Richard Biener > > * tree.h (build_qualified_type): Annotate with CXX_MEM_STAT_INFO. > (build_distinct_type_copy): Likewise. > (build_variant_type_copy): Likewise. > * tree.c (build_qualified_type): Pass down mem-stat info. > (build_distinct_type_copy): Likewise. > (build_variant_type_copy): Likewise. > > cp/ > * cp-tree.h (copy_decl): Annotate with CXX_MEM_STAT_INFO. > (copy_type): Likewise. > * lex.c (copy_decl): Pass down mem-stat info. > (copy_type): Likewise. > > Index: gcc/tree.h > =================================================================== > --- gcc/tree.h (revision 245526) > +++ gcc/tree.h (working copy) > @@ -4258,7 +4258,7 @@ extern tree get_qualified_type (tree, in > /* Like get_qualified_type, but creates the type if it does not > exist. This function never returns NULL_TREE. */ > > -extern tree build_qualified_type (tree, int); > +extern tree build_qualified_type (tree, int CXX_MEM_STAT_INFO); > > /* Create a variant of type T with alignment ALIGN. */ > > @@ -4276,8 +4276,8 @@ extern tree build_aligned_type (tree, un > > /* Make a copy of a type node. */ > > -extern tree build_distinct_type_copy (tree); > -extern tree build_variant_type_copy (tree); > +extern tree build_distinct_type_copy (tree CXX_MEM_STAT_INFO); > +extern tree build_variant_type_copy (tree CXX_MEM_STAT_INFO); > > /* Given a hashcode and a ..._TYPE node (for which the hashcode was made), > return a canonicalized ..._TYPE node, so that duplicates are not made. > Index: gcc/tree.c > =================================================================== > --- gcc/tree.c (revision 245526) > +++ gcc/tree.c (working copy) > @@ -6622,7 +6622,7 @@ get_qualified_type (tree type, int type_ > exist. This function never returns NULL_TREE. */ > > tree > -build_qualified_type (tree type, int type_quals) > +build_qualified_type (tree type, int type_quals MEM_STAT_DECL) > { > tree t; > > @@ -6632,7 +6632,7 @@ build_qualified_type (tree type, int typ > /* If not, build it. */ > if (!t) > { > - t = build_variant_type_copy (type); > + t = build_variant_type_copy (type PASS_MEM_STAT); > set_type_quals (t, type_quals); > > if (((type_quals & TYPE_QUAL_ATOMIC) == TYPE_QUAL_ATOMIC)) > @@ -6695,9 +6695,9 @@ build_aligned_type (tree type, unsigned > TYPE_CANONICAL points to itself. */ > > tree > -build_distinct_type_copy (tree type) > +build_distinct_type_copy (tree type MEM_STAT_DECL) > { > - tree t = copy_node (type); > + tree t = copy_node_stat (type PASS_MEM_STAT); > > TYPE_POINTER_TO (t) = 0; > TYPE_REFERENCE_TO (t) = 0; > @@ -6733,11 +6733,11 @@ build_distinct_type_copy (tree type) > require structural equality checks). */ > > tree > -build_variant_type_copy (tree type) > +build_variant_type_copy (tree type MEM_STAT_DECL) > { > tree t, m = TYPE_MAIN_VARIANT (type); > > - t = build_distinct_type_copy (type); > + t = build_distinct_type_copy (type PASS_MEM_STAT); > > /* Since we're building a variant, assume that it is a non-semantic > variant. This also propagates TYPE_STRUCTURAL_EQUALITY_P. */ > Index: gcc/cp/cp-tree.h > =================================================================== > --- gcc/cp/cp-tree.h (revision 245526) > +++ gcc/cp/cp-tree.h (working copy) > @@ -6080,8 +6080,8 @@ extern tree unqualified_fn_lookup_error > extern tree build_lang_decl (enum tree_code, tree, tree); > extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree); > extern void retrofit_lang_decl (tree); > -extern tree copy_decl (tree); > -extern tree copy_type (tree); > +extern tree copy_decl (tree CXX_MEM_STAT_INFO); > +extern tree copy_type (tree CXX_MEM_STAT_INFO); > extern tree cxx_make_type (enum tree_code); > extern tree make_class_type (enum tree_code); > extern bool cxx_init (void); > Index: gcc/cp/lex.c > =================================================================== > --- gcc/cp/lex.c (revision 245526) > +++ gcc/cp/lex.c (working copy) > @@ -607,11 +607,11 @@ cxx_dup_lang_specific_decl (tree node) > /* Copy DECL, including any language-specific parts. */ > > tree > -copy_decl (tree decl) > +copy_decl (tree decl MEM_STAT_DECL) > { > tree copy; > > - copy = copy_node (decl); > + copy = copy_node_stat (decl PASS_MEM_STAT); > cxx_dup_lang_specific_decl (copy); > return copy; > } > @@ -645,11 +645,11 @@ copy_lang_type (tree node) > /* Copy TYPE, including any language-specific parts. */ > > tree > -copy_type (tree type) > +copy_type (tree type MEM_STAT_DECL) > { > tree copy; > > - copy = copy_node (type); > + copy = copy_node_stat (type PASS_MEM_STAT); > copy_lang_type (copy); > return copy; > } > -- Richard Biener SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)