From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: jason@redhat.com, Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH][C++] Annotate more functions with MEM-STATs
Date: Fri, 17 Feb 2017 12:23:00 -0000 [thread overview]
Message-ID: <alpine.LSU.2.20.1702171240160.8538@zhemvz.fhfr.qr> (raw)
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?
Thanks,
Richard.
2017-02-17 Richard Biener <rguenther@suse.de>
* 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;
}
next reply other threads:[~2017-02-17 11:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 12:23 Richard Biener [this message]
2017-02-17 12:27 ` Richard Biener
2017-02-17 12:30 ` Jakub Jelinek
2017-02-17 12:59 ` Richard Biener
2017-02-18 4:53 ` Jason Merrill
2017-04-21 9:27 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LSU.2.20.1702171240160.8538@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).