public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 06/19] use c++ instead of {make,grow}_tree_vec_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (2 preceding siblings ...)
  2017-07-27  8:30 ` [PATCH 14/19] replace rtx_alloc_stat with c++ tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 10/19] use c++ for tree_cons_stat tbsaunde+gcc
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (make_tree_vec_stat): Remove _stat from name.
	(grow_tree_vec_stat): Likewise.
	* tree.h (make_tree_vec_stat): Adjust prototype.
	(grow_tree_vec_stat): Likewise.
	(make_tree_vec): Remove macro.
	(grow_tree_vec): Likewise.
---
 gcc/tree.c | 4 ++--
 gcc/tree.h | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index bb9339030ef..931f987e93a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2265,7 +2265,7 @@ make_int_cst (int len, int ext_len MEM_STAT_DECL)
 /* Build a newly constructed TREE_VEC node of length LEN.  */
 
 tree
-make_tree_vec_stat (int len MEM_STAT_DECL)
+make_tree_vec (int len MEM_STAT_DECL)
 {
   tree t;
   size_t length = (len - 1) * sizeof (tree) + sizeof (struct tree_vec);
@@ -2283,7 +2283,7 @@ make_tree_vec_stat (int len MEM_STAT_DECL)
 /* Grow a TREE_VEC node to new length LEN.  */
 
 tree
-grow_tree_vec_stat (tree v, int len MEM_STAT_DECL)
+grow_tree_vec (tree v, int len MEM_STAT_DECL)
 {
   gcc_assert (TREE_CODE (v) == TREE_VEC);
 
diff --git a/gcc/tree.h b/gcc/tree.h
index 70803a02973..636dc0926e1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3916,13 +3916,11 @@ extern tree make_int_cst (int, int CXX_MEM_STAT_INFO);
 
 /* Make a TREE_VEC.  */
 
-extern tree make_tree_vec_stat (int MEM_STAT_DECL);
-#define make_tree_vec(t) make_tree_vec_stat (t MEM_STAT_INFO)
+extern tree make_tree_vec (int CXX_MEM_STAT_INFO);
 
 /* Grow a TREE_VEC.  */
 
-extern tree grow_tree_vec_stat (tree v, int MEM_STAT_DECL);
-#define grow_tree_vec(v, t) grow_tree_vec_stat (v, t MEM_STAT_INFO)
+extern tree grow_tree_vec (tree v, int CXX_MEM_STAT_INFO);
 
 /* Construct various types of nodes.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 00/19] cleanup of memory stats prototypes
@ 2017-07-27  8:30 tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 03/19] use cxx instead of make_tree_binfo_stat tbsaunde+gcc
                   ` (20 more replies)
  0 siblings, 21 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

The preC++ way of passing information about the call site of a function was to
use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
the same name with _stat appended to it.  The way this is now done with C++ is
to have arguments where the default value is __LINE__, __FILE__, and
__FUNCTION__ in the caller.  This has the significant advantage that if you
look for "^function (" you find the correct function, where in the C way of
doing things you need to realize its a macro and check the definition of the
macro to see what to look for next.  So this removes a layer of indirection,
and makes things somewhat more consistant in using the C++ way of doing things.

patches independently bootstrapped and regtested on ppc64le-linux-gnu.  I
successfully ran make all-gcc with --enable-gather-detailed-mem-stats, but
couldn't complete a bootstrap before the series was applied, because the
ddrs_table in tree-loop-distribution.c causes memory statistics gathering to crash before the series as well as after it.  ok?

thanks

Trev

p.s. the issue with ddrs_table is that it ends up trying to add to the memory
stats hash table from a global constructor when that hash table hasn't yet been
constructed.


Trevor Saunders (19):
  use c++ instead of make_node_stat
  use c++ instead of _stat for copy_node_stat
  use cxx instead of make_tree_binfo_stat
  use c++ for make_int_cst_stat
  use c++ instead of buildN_stat{,_loc}
  use c++ instead of {make,grow}_tree_vec_stat
  replace gimple_alloc_stat with c++
  use c++ instead of build_decl_stat
  use c++ instead of build_vl_exp_stat
  use c++ for tree_cons_stat
  remove unused build_var_debug_value prototype
  use C++ for {make,build}_vector_stat
  use c++ for build_tree_list{,_vec}_stat
  replace rtx_alloc_stat with c++
  replace shallow_copy_rtx_stat with c++
  simplify the bitmap alloc_stat functions with c++
  use c++ for bitmap_initialize
  use c++ for gimple_build_debug_bind{,_source}
  use c++ for fold_buildN_loc

 gcc/bitmap.c          |   8 ++--
 gcc/bitmap.h          |  17 +++-----
 gcc/cp/lex.c          |   4 +-
 gcc/emit-rtl.c        |   2 +-
 gcc/fold-const.c      |  14 +++----
 gcc/fold-const.h      |  24 +++++-------
 gcc/fortran/resolve.c |   2 +-
 gcc/gengenrtl.c       |   2 +-
 gcc/gimple.c          |   8 ++--
 gcc/gimple.h          |  11 ++----
 gcc/rtl.c             |   4 +-
 gcc/rtl.h             |   6 +--
 gcc/tree.c            |  62 ++++++++++++++---------------
 gcc/tree.h            | 106 ++++++++++++++++++--------------------------------
 14 files changed, 109 insertions(+), 161 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 03/19] use cxx instead of make_tree_binfo_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 08/19] use c++ instead of build_decl_stat tbsaunde+gcc
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (make_tre_binfo_stat): Remove _stat from name.
	* tree.h (make_tree_binfo_stat): Adjust prototype.
	(make_tree_binfo): Remove.
---
 gcc/tree.c | 2 +-
 gcc/tree.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 1bd4cfcc1d5..5532b5fc1a7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2193,7 +2193,7 @@ build_zero_cst (tree type)
 /* Build a BINFO with LEN language slots.  */
 
 tree
-make_tree_binfo_stat (unsigned base_binfos MEM_STAT_DECL)
+make_tree_binfo (unsigned base_binfos MEM_STAT_DECL)
 {
   tree t;
   size_t length = (offsetof (struct tree_binfo, base_binfos)
diff --git a/gcc/tree.h b/gcc/tree.h
index 64bc369c239..34c1ea31080 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3908,8 +3908,7 @@ extern tree copy_list (tree);
 extern tree build_case_label (tree, tree, tree);
 
 /* Make a BINFO.  */
-extern tree make_tree_binfo_stat (unsigned MEM_STAT_DECL);
-#define make_tree_binfo(t) make_tree_binfo_stat (t MEM_STAT_INFO)
+extern tree make_tree_binfo (unsigned CXX_MEM_STAT_INFO);
 
 /* Make an INTEGER_CST.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 07/19] replace gimple_alloc_stat with c++
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (4 preceding siblings ...)
  2017-07-27  8:30 ` [PATCH 10/19] use c++ for tree_cons_stat tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 04/19] use c++ for make_int_cst_stat tbsaunde+gcc
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gimple.c (gimple_build_with_ops_stat): Adjust.
	(gimple_alloc_stat): Remove _stat from name.
	* gimple.h (gimple_alloc): Remove macro.
---
 gcc/gimple.c | 4 ++--
 gcc/gimple.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/gimple.c b/gcc/gimple.c
index 479f90c54c9..13a68284879 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -117,7 +117,7 @@ gimple_size (enum gimple_code code)
    operands.  */
 
 gimple *
-gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
+gimple_alloc (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
 {
   size_t size;
   gimple *stmt;
@@ -169,7 +169,7 @@ static gimple *
 gimple_build_with_ops_stat (enum gimple_code code, unsigned subcode,
 		            unsigned num_ops MEM_STAT_DECL)
 {
-  gimple *s = gimple_alloc_stat (code, num_ops PASS_MEM_STAT);
+  gimple *s = gimple_alloc (code, num_ops PASS_MEM_STAT);
   gimple_set_subcode (s, subcode);
 
   return s;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 2d81eedab4a..d9945648215 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1417,8 +1417,7 @@ extern enum gimple_statement_structure_enum const gss_for_code_[];
    of comminucating the profile info to the builtin expanders.  */
 extern gimple *currently_expanding_gimple_stmt;
 
-#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
-gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
+gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
 greturn *gimple_build_return (tree);
 void gimple_call_reset_alias_info (gcall *);
 gcall *gimple_build_call_vec (tree, vec<tree> );
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 08/19] use c++ instead of build_decl_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 03/19] use cxx instead of make_tree_binfo_stat tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 14/19] replace rtx_alloc_stat with c++ tbsaunde+gcc
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (build_decl_stat): Remove _stat from name.
	* tree.h (build_decl): Remove macro.
---
 gcc/tree.c | 2 +-
 gcc/tree.h | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 931f987e93a..b763bc08969 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4740,7 +4740,7 @@ build_nt_call_vec (tree fn, vec<tree, va_gc> *args)
    Other slots are initialized to 0 or null pointers.  */
 
 tree
-build_decl_stat (location_t loc, enum tree_code code, tree name,
+build_decl (location_t loc, enum tree_code code, tree name,
     		 tree type MEM_STAT_DECL)
 {
   tree t;
diff --git a/gcc/tree.h b/gcc/tree.h
index 636dc0926e1..1c8fd57a465 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4031,10 +4031,9 @@ extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
 #define build_tree_list(t, q) build_tree_list_stat (t, q MEM_STAT_INFO)
 extern tree build_tree_list_vec_stat (const vec<tree, va_gc> *MEM_STAT_DECL);
 #define build_tree_list_vec(v) build_tree_list_vec_stat (v MEM_STAT_INFO)
-extern tree build_decl_stat (location_t, enum tree_code,
-			     tree, tree MEM_STAT_DECL);
+extern tree build_decl (location_t, enum tree_code,
+			tree, tree CXX_MEM_STAT_INFO);
 extern tree build_fn_decl (const char *, tree);
-#define build_decl(l,c,t,q) build_decl_stat (l, c, t, q MEM_STAT_INFO)
 extern tree build_translation_unit_decl (tree);
 extern tree build_block (tree, tree, tree, tree);
 extern tree build_empty_stmt (location_t);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 04/19] use c++ for make_int_cst_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (5 preceding siblings ...)
  2017-07-27  8:30 ` [PATCH 07/19] replace gimple_alloc_stat with c++ tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 18/19] use c++ for gimple_build_debug_bind{,_source} tbsaunde+gcc
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (make_int_cst_stat): Remove _stat from name.
	* tree.h (make_int_cst_stat): Adjust prototype.
	(make_int_cst): Remove macro.
---
 gcc/tree.c | 2 +-
 gcc/tree.h | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 5532b5fc1a7..4b92392d6d5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2235,7 +2235,7 @@ build_case_label (tree low_value, tree high_value, tree label_decl)
    The latter determines the length of the HOST_WIDE_INT vector.  */
 
 tree
-make_int_cst_stat (int len, int ext_len MEM_STAT_DECL)
+make_int_cst (int len, int ext_len MEM_STAT_DECL)
 {
   tree t;
   int length = ((ext_len - 1) * sizeof (HOST_WIDE_INT)
diff --git a/gcc/tree.h b/gcc/tree.h
index 34c1ea31080..9b580bc3965 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3912,9 +3912,7 @@ extern tree make_tree_binfo (unsigned CXX_MEM_STAT_INFO);
 
 /* Make an INTEGER_CST.  */
 
-extern tree make_int_cst_stat (int, int MEM_STAT_DECL);
-#define make_int_cst(LEN, EXT_LEN) \
-  make_int_cst_stat (LEN, EXT_LEN MEM_STAT_INFO)
+extern tree make_int_cst (int, int CXX_MEM_STAT_INFO);
 
 /* Make a TREE_VEC.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 10/19] use c++ for tree_cons_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (3 preceding siblings ...)
  2017-07-27  8:30 ` [PATCH 06/19] use c++ instead of {make,grow}_tree_vec_stat tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 07/19] replace gimple_alloc_stat with c++ tbsaunde+gcc
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (tree_cons_stat): Remove _stat from name.
	* tree.h (tree_cons): Remove macro.
---
 gcc/tree.c | 2 +-
 gcc/tree.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index fd25fd50157..e630316300f 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2898,7 +2898,7 @@ build_tree_list_vec_stat (const vec<tree, va_gc> *vec MEM_STAT_DECL)
    and whose TREE_CHAIN is CHAIN.  */
 
 tree 
-tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL)
+tree_cons (tree purpose, tree value, tree chain MEM_STAT_DECL)
 {
   tree node;
 
diff --git a/gcc/tree.h b/gcc/tree.h
index ca50de5c747..7ecfb947fe2 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4339,8 +4339,7 @@ extern tree chainon (tree, tree);
 
 /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN.  */
 
-extern tree tree_cons_stat (tree, tree, tree MEM_STAT_DECL);
-#define tree_cons(t,q,w) tree_cons_stat (t,q,w MEM_STAT_INFO)
+extern tree tree_cons (tree, tree, tree CXX_MEM_STAT_INFO);
 
 /* Return the last tree node in a chain.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 14/19] replace rtx_alloc_stat with c++
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 03/19] use cxx instead of make_tree_binfo_stat tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 08/19] use c++ instead of build_decl_stat tbsaunde+gcc
@ 2017-07-27  8:30 ` tbsaunde+gcc
  2017-07-27  8:30 ` [PATCH 06/19] use c++ instead of {make,grow}_tree_vec_stat tbsaunde+gcc
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:30 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* emit-rtl.c (gen_raw_REG): Adjust.
	* gengenrtl.c (gendef): Likewise.
	* rtl.c (rtx_alloc_stat): Remove _stat from name.
	* rtl.h (rtx_alloc): Remove macro.
---
 gcc/emit-rtl.c  | 2 +-
 gcc/gengenrtl.c | 2 +-
 gcc/rtl.c       | 2 +-
 gcc/rtl.h       | 3 +--
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2bc5d566933..6951f61703b 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -433,7 +433,7 @@ set_mode_and_regno (rtx x, machine_mode mode, unsigned int regno)
 rtx
 gen_raw_REG (machine_mode mode, unsigned int regno)
 {
-  rtx x = rtx_alloc_stat (REG MEM_STAT_INFO);
+  rtx x = rtx_alloc (REG MEM_STAT_INFO);
   set_mode_and_regno (x, mode, regno);
   REG_ATTRS (x) = NULL;
   ORIGINAL_REGNO (x) = regno;
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 19381be38d2..e23327b5cfc 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -250,7 +250,7 @@ gendef (const char *format)
      the memory and initializes it.  */
   puts ("{");
   puts ("  rtx rt;");
-  puts ("  rt = rtx_alloc_stat (code PASS_MEM_STAT);\n");
+  puts ("  rt = rtx_alloc (code PASS_MEM_STAT);\n");
 
   puts ("  PUT_MODE_RAW (rt, mode);");
 
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 1f6a77aa08e..b91172f63fa 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -223,7 +223,7 @@ rtx_alloc_stat_v (RTX_CODE code MEM_STAT_DECL, int extra)
    all the rest is initialized to zero.  */
 
 rtx
-rtx_alloc_stat (RTX_CODE code MEM_STAT_DECL)
+rtx_alloc (RTX_CODE code MEM_STAT_DECL)
 {
   return rtx_alloc_stat_v (code PASS_MEM_STAT, 0);
 }
diff --git a/gcc/rtl.h b/gcc/rtl.h
index e63dcf042cb..1f4b6413ca1 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2705,8 +2705,7 @@ extern HOST_WIDE_INT trunc_int_for_mode	(HOST_WIDE_INT, machine_mode);
 extern rtx plus_constant (machine_mode, rtx, HOST_WIDE_INT, bool = false);
 
 /* In rtl.c */
-extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL);
-#define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO)
+extern rtx rtx_alloc (RTX_CODE CXX_MEM_STAT_INFO);
 extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int);
 #define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ)
 #define const_wide_int_alloc(NWORDS)				\
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 15/19] replace shallow_copy_rtx_stat with c++
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (14 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 05/19] use c++ instead of buildN_stat{,_loc} tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 01/19] use c++ instead of make_node_stat tbsaunde+gcc
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* rtl.c (shallow_copy_rtx_stat): Remove _stat from name.
	* rtl.h (shallow_copy_rtx): Remove macro.
---
 gcc/rtl.c | 2 +-
 gcc/rtl.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/rtl.c b/gcc/rtl.c
index b91172f63fa..b0f977eca9c 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -359,7 +359,7 @@ copy_rtx (rtx orig)
 /* Create a new copy of an rtx.  Only copy just one level.  */
 
 rtx
-shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL)
+shallow_copy_rtx (const_rtx orig MEM_STAT_DECL)
 {
   const unsigned int size = rtx_size (orig);
   rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1f4b6413ca1..8a68bb152bc 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2725,8 +2725,7 @@ extern rtx copy_rtx_if_shared (rtx);
 
 /* In rtl.c */
 extern unsigned int rtx_size (const_rtx);
-extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL);
-#define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO)
+extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
 extern int rtx_equal_p (const_rtx, const_rtx);
 extern bool rtvec_all_equal_p (const_rtvec);
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 02/19] use c++ instead of _stat for copy_node_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (12 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 13/19] use c++ for build_tree_list{,_vec}_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 05/19] use c++ instead of buildN_stat{,_loc} tbsaunde+gcc
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/cp/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* lex.c (copy_decl): Adjust.
	(copy_type): Likewise.

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (copy_node_stat): Rename to copy_node.
	(build_distinct_type_copy): Adjust.
	* tree.h (copy_node_stat): Adjust prototype.
	(copy_node): Remove macro.
---
 gcc/cp/lex.c | 4 ++--
 gcc/tree.c   | 4 ++--
 gcc/tree.h   | 3 +--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 961b705a546..097fbb547d2 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -766,7 +766,7 @@ copy_decl (tree decl MEM_STAT_DECL)
 {
   tree copy;
 
-  copy = copy_node_stat (decl PASS_MEM_STAT);
+  copy = copy_node (decl PASS_MEM_STAT);
   cxx_dup_lang_specific_decl (copy);
   return copy;
 }
@@ -799,7 +799,7 @@ copy_type (tree type MEM_STAT_DECL)
 {
   tree copy;
 
-  copy = copy_node_stat (type PASS_MEM_STAT);
+  copy = copy_node (type PASS_MEM_STAT);
   copy_lang_type (copy);
   return copy;
 }
diff --git a/gcc/tree.c b/gcc/tree.c
index 49c54bbb4c7..1bd4cfcc1d5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1128,7 +1128,7 @@ free_node (tree node)
    TREE_CHAIN, if it has one, is zero and it has a fresh uid.  */
 
 tree
-copy_node_stat (tree node MEM_STAT_DECL)
+copy_node (tree node MEM_STAT_DECL)
 {
   tree t;
   enum tree_code code = TREE_CODE (node);
@@ -6684,7 +6684,7 @@ build_aligned_type (tree type, unsigned int align)
 tree
 build_distinct_type_copy (tree type MEM_STAT_DECL)
 {
-  tree t = copy_node_stat (type PASS_MEM_STAT);
+  tree t = copy_node (type PASS_MEM_STAT);
 
   TYPE_POINTER_TO (t) = 0;
   TYPE_REFERENCE_TO (t) = 0;
diff --git a/gcc/tree.h b/gcc/tree.h
index 554356c2ee1..64bc369c239 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3897,8 +3897,7 @@ extern void free_node (tree);
 
 /* Make a copy of a node, with all the same contents.  */
 
-extern tree copy_node_stat (tree MEM_STAT_DECL);
-#define copy_node(t) copy_node_stat (t MEM_STAT_INFO)
+extern tree copy_node (tree CXX_MEM_STAT_INFO);
 
 /* Make a copy of a chain of TREE_LIST nodes.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 18/19] use c++ for gimple_build_debug_bind{,_source}
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (6 preceding siblings ...)
  2017-07-27  8:30 ` [PATCH 04/19] use c++ for make_int_cst_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 19/19] use c++ for fold_buildN_loc tbsaunde+gcc
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* gimple.c (gimple_build_debug_bind_stat): Remove _stat from name.
	(gimple_build_debug_bind_source_stat): Likewise.
	* gimple.h (gimple_build_debug_bind): Remove macro.
	(gimple_build_debug_bind_source): Likewise.
---
 gcc/gimple.c | 4 ++--
 gcc/gimple.h | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/gimple.c b/gcc/gimple.c
index 13a68284879..3a32b530cce 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -796,7 +796,7 @@ gimple_build_eh_dispatch (int region)
    VAR is bound to VALUE; block and location are taken from STMT.  */
 
 gdebug *
-gimple_build_debug_bind_stat (tree var, tree value, gimple *stmt MEM_STAT_DECL)
+gimple_build_debug_bind (tree var, tree value, gimple *stmt MEM_STAT_DECL)
 {
   gdebug *p
     = as_a <gdebug *> (gimple_build_with_ops_stat (GIMPLE_DEBUG,
@@ -816,7 +816,7 @@ gimple_build_debug_bind_stat (tree var, tree value, gimple *stmt MEM_STAT_DECL)
    VAR is bound to VALUE; block and location are taken from STMT.  */
 
 gdebug *
-gimple_build_debug_source_bind_stat (tree var, tree value,
+gimple_build_debug_source_bind (tree var, tree value,
 				     gimple *stmt MEM_STAT_DECL)
 {
   gdebug *p
diff --git a/gcc/gimple.h b/gcc/gimple.h
index d9945648215..6213c49b91f 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1453,12 +1453,8 @@ gresx *gimple_build_resx (int);
 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
 gswitch *gimple_build_switch (tree, tree, vec<tree> );
 geh_dispatch *gimple_build_eh_dispatch (int);
-gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
-#define gimple_build_debug_bind(var,val,stmt)			\
-  gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
-gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
-#define gimple_build_debug_source_bind(var,val,stmt)			\
-  gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
+gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
+gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 11/19] remove unused build_var_debug_value prototype
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (9 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 09/19] use c++ instead of build_vl_exp_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 16/19] simplify the bitmap alloc_stat functions with c++ tbsaunde+gcc
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.h (build_var_debug_value): Remove prototype.
---
 gcc/tree.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gcc/tree.h b/gcc/tree.h
index 7ecfb947fe2..d765c31cda3 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3989,10 +3989,6 @@ build5_loc (location_t loc, enum tree_code code, tree type, tree arg0,
   return t;
 }
 
-extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
-#define build_var_debug_value(t1,t2) \
-  build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)
-
 /* Constructs double_int from tree CST.  */
 
 extern tree double_int_to_tree (tree, double_int);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 17/19] use c++ for bitmap_initialize
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (17 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 12/19] use C++ for {make,build}_vector_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
  2017-07-31 20:56 ` Martin Sebor
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* bitmap.c (bitmap_alloc): Adjust.
	(bitmap_gc_alloc): Likewise.
	* bitmap.h (bitmap_initialize_stat): Remove _stat from name.
---
 gcc/bitmap.c | 4 ++--
 gcc/bitmap.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index be8d0cc6247..03f6923db2f 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -284,7 +284,7 @@ bitmap_alloc (bitmap_obstack *bit_obstack MEM_STAT_DECL)
     bit_obstack->heads = (struct bitmap_head *) map->first;
   else
     map = XOBNEW (&bit_obstack->obstack, bitmap_head);
-  bitmap_initialize_stat (map, bit_obstack PASS_MEM_STAT);
+  bitmap_initialize (map, bit_obstack PASS_MEM_STAT);
 
   if (GATHER_STATISTICS)
     register_overhead (map, sizeof (bitmap_head));
@@ -300,7 +300,7 @@ bitmap_gc_alloc (ALONE_MEM_STAT_DECL)
   bitmap map;
 
   map = ggc_alloc<bitmap_head> ();
-  bitmap_initialize_stat (map, NULL PASS_MEM_STAT);
+  bitmap_initialize (map, NULL PASS_MEM_STAT);
 
   if (GATHER_STATISTICS)
     register_overhead (map, sizeof (bitmap_head));
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index ca047666dc1..348032360f2 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -335,14 +335,13 @@ extern void dump_bitmap_statistics (void);
    to allocate from, NULL for GC'd bitmap.  */
 
 static inline void
-bitmap_initialize_stat (bitmap head, bitmap_obstack *obstack MEM_STAT_DECL)
+bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO)
 {
   head->first = head->current = NULL;
   head->obstack = obstack;
   if (GATHER_STATISTICS)
     bitmap_register (head PASS_MEM_STAT);
 }
-#define bitmap_initialize(h,o) bitmap_initialize_stat (h,o MEM_STAT_INFO)
 
 /* Allocate and free bitmaps from obstack, malloc and gc'd memory.  */
 extern bitmap bitmap_alloc (bitmap_obstack *obstack CXX_MEM_STAT_INFO);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 05/19] use c++ instead of buildN_stat{,_loc}
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (13 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 02/19] use c++ instead of _stat for copy_node_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 15/19] replace shallow_copy_rtx_stat with c++ tbsaunde+gcc
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* fold-const.c (fold_build1_stat_loc): Adjust.
	(fold_build2_stat_loc): Likewise.
	(fold_build3_stat_loc): Likewise.
	* tree.c (build0_stat): Remove _stat from name.
	(build1_stat): Likewise.
	(build2_stat): Likewise.
	(build3_stat): Likewise.
	(build4_stat): Likewise.
	(build5_stat): Likewise.
	* tree.h (build1_loc): Remove macro, and rename _stat function
	to this.
	(build2_loc): Likewise.
	(build3_loc): Likewise.
	(build4_loc): Likewise.
	(build5_loc): Likewise.
---
 gcc/fold-const.c |  6 +++---
 gcc/tree.c       | 18 ++++++++---------
 gcc/tree.h       | 60 ++++++++++++++++++++++----------------------------------
 3 files changed, 35 insertions(+), 49 deletions(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ecba3ffada4..976924f34d7 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12222,7 +12222,7 @@ fold_build1_stat_loc (location_t loc,
 
   tem = fold_unary_loc (loc, code, type, op0);
   if (!tem)
-    tem = build1_stat_loc (loc, code, type, op0 PASS_MEM_STAT);
+    tem = build1_loc (loc, code, type, op0 PASS_MEM_STAT);
 
 #ifdef ENABLE_FOLD_CHECKING
   md5_init_ctx (&ctx);
@@ -12268,7 +12268,7 @@ fold_build2_stat_loc (location_t loc,
 
   tem = fold_binary_loc (loc, code, type, op0, op1);
   if (!tem)
-    tem = build2_stat_loc (loc, code, type, op0, op1 PASS_MEM_STAT);
+    tem = build2_loc (loc, code, type, op0, op1 PASS_MEM_STAT);
 
 #ifdef ENABLE_FOLD_CHECKING
   md5_init_ctx (&ctx);
@@ -12328,7 +12328,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
   gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
   tem = fold_ternary_loc (loc, code, type, op0, op1, op2);
   if (!tem)
-    tem = build3_stat_loc (loc, code, type, op0, op1, op2 PASS_MEM_STAT);
+    tem = build3_loc (loc, code, type, op0, op1, op2 PASS_MEM_STAT);
 
 #ifdef ENABLE_FOLD_CHECKING
   md5_init_ctx (&ctx);
diff --git a/gcc/tree.c b/gcc/tree.c
index 4b92392d6d5..bb9339030ef 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4365,7 +4365,7 @@ do { tree _node = (NODE); \
    enough for all extant tree codes.  */
 
 tree
-build0_stat (enum tree_code code, tree tt MEM_STAT_DECL)
+build0 (enum tree_code code, tree tt MEM_STAT_DECL)
 {
   tree t;
 
@@ -4378,7 +4378,7 @@ build0_stat (enum tree_code code, tree tt MEM_STAT_DECL)
 }
 
 tree
-build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
+build1 (enum tree_code code, tree type, tree node MEM_STAT_DECL)
 {
   int length = sizeof (struct tree_exp);
   tree t;
@@ -4454,7 +4454,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
   } while (0)
 
 tree
-build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
+build2 (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
 {
   bool constant, read_only, side_effects, div_by_zero;
   tree t;
@@ -4534,8 +4534,8 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
 
 
 tree
-build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
-	     tree arg2 MEM_STAT_DECL)
+build3 (enum tree_code code, tree tt, tree arg0, tree arg1,
+	tree arg2 MEM_STAT_DECL)
 {
   bool constant, read_only, side_effects;
   tree t;
@@ -4575,8 +4575,8 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
 }
 
 tree
-build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
-	     tree arg2, tree arg3 MEM_STAT_DECL)
+build4 (enum tree_code code, tree tt, tree arg0, tree arg1,
+	tree arg2, tree arg3 MEM_STAT_DECL)
 {
   bool constant, read_only, side_effects;
   tree t;
@@ -4602,8 +4602,8 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
 }
 
 tree
-build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
-	     tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
+build5 (enum tree_code code, tree tt, tree arg0, tree arg1,
+	tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
 {
   bool constant, read_only, side_effects;
   tree t;
diff --git a/gcc/tree.h b/gcc/tree.h
index 9b580bc3965..70803a02973 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3929,81 +3929,67 @@ extern tree grow_tree_vec_stat (tree v, int MEM_STAT_DECL);
 extern tree build_nt (enum tree_code, ...);
 extern tree build_nt_call_vec (tree, vec<tree, va_gc> *);
 
-extern tree build0_stat (enum tree_code, tree MEM_STAT_DECL);
-#define build0(c,t) build0_stat (c,t MEM_STAT_INFO)
-extern tree build1_stat (enum tree_code, tree, tree MEM_STAT_DECL);
-#define build1(c,t1,t2) build1_stat (c,t1,t2 MEM_STAT_INFO)
-extern tree build2_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL);
-#define build2(c,t1,t2,t3) build2_stat (c,t1,t2,t3 MEM_STAT_INFO)
-extern tree build3_stat (enum tree_code, tree, tree, tree, tree MEM_STAT_DECL);
-#define build3(c,t1,t2,t3,t4) build3_stat (c,t1,t2,t3,t4 MEM_STAT_INFO)
-extern tree build4_stat (enum tree_code, tree, tree, tree, tree,
-			 tree MEM_STAT_DECL);
-#define build4(c,t1,t2,t3,t4,t5) build4_stat (c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
-extern tree build5_stat (enum tree_code, tree, tree, tree, tree, tree,
-			 tree MEM_STAT_DECL);
-#define build5(c,t1,t2,t3,t4,t5,t6) build5_stat (c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
+extern tree build0 (enum tree_code, tree CXX_MEM_STAT_INFO);
+extern tree build1 (enum tree_code, tree, tree CXX_MEM_STAT_INFO);
+extern tree build2 (enum tree_code, tree, tree, tree CXX_MEM_STAT_INFO);
+extern tree build3 (enum tree_code, tree, tree, tree, tree CXX_MEM_STAT_INFO);
+extern tree build4 (enum tree_code, tree, tree, tree, tree,
+		    tree CXX_MEM_STAT_INFO);
+extern tree build5 (enum tree_code, tree, tree, tree, tree, tree,
+		    tree CXX_MEM_STAT_INFO);
 
 /* _loc versions of build[1-5].  */
 
 static inline tree
-build1_stat_loc (location_t loc, enum tree_code code, tree type,
-		 tree arg1 MEM_STAT_DECL)
+build1_loc (location_t loc, enum tree_code code, tree type,
+	    tree arg1 CXX_MEM_STAT_INFO)
 {
-  tree t = build1_stat (code, type, arg1 PASS_MEM_STAT);
+  tree t = build1 (code, type, arg1 PASS_MEM_STAT);
   if (CAN_HAVE_LOCATION_P (t))
     SET_EXPR_LOCATION (t, loc);
   return t;
 }
-#define build1_loc(l,c,t1,t2) build1_stat_loc (l,c,t1,t2 MEM_STAT_INFO)
 
 static inline tree
-build2_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
-		 tree arg1 MEM_STAT_DECL)
+build2_loc (location_t loc, enum tree_code code, tree type, tree arg0,
+	    tree arg1 CXX_MEM_STAT_INFO)
 {
-  tree t = build2_stat (code, type, arg0, arg1 PASS_MEM_STAT);
+  tree t = build2 (code, type, arg0, arg1 PASS_MEM_STAT);
   if (CAN_HAVE_LOCATION_P (t))
     SET_EXPR_LOCATION (t, loc);
   return t;
 }
-#define build2_loc(l,c,t1,t2,t3) build2_stat_loc (l,c,t1,t2,t3 MEM_STAT_INFO)
 
 static inline tree
-build3_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
-		 tree arg1, tree arg2 MEM_STAT_DECL)
+build3_loc (location_t loc, enum tree_code code, tree type, tree arg0,
+	    tree arg1, tree arg2 CXX_MEM_STAT_INFO)
 {
-  tree t = build3_stat (code, type, arg0, arg1, arg2 PASS_MEM_STAT);
+  tree t = build3 (code, type, arg0, arg1, arg2 PASS_MEM_STAT);
   if (CAN_HAVE_LOCATION_P (t))
     SET_EXPR_LOCATION (t, loc);
   return t;
 }
-#define build3_loc(l,c,t1,t2,t3,t4) \
-  build3_stat_loc (l,c,t1,t2,t3,t4 MEM_STAT_INFO)
 
 static inline tree
-build4_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
-		 tree arg1, tree arg2, tree arg3 MEM_STAT_DECL)
+build4_loc (location_t loc, enum tree_code code, tree type, tree arg0,
+	    tree arg1, tree arg2, tree arg3 CXX_MEM_STAT_INFO)
 {
-  tree t = build4_stat (code, type, arg0, arg1, arg2, arg3 PASS_MEM_STAT);
+  tree t = build4 (code, type, arg0, arg1, arg2, arg3 PASS_MEM_STAT);
   if (CAN_HAVE_LOCATION_P (t))
     SET_EXPR_LOCATION (t, loc);
   return t;
 }
-#define build4_loc(l,c,t1,t2,t3,t4,t5) \
-  build4_stat_loc (l,c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
 
 static inline tree
-build5_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
-		 tree arg1, tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
+build5_loc (location_t loc, enum tree_code code, tree type, tree arg0,
+	    tree arg1, tree arg2, tree arg3, tree arg4 CXX_MEM_STAT_INFO)
 {
-  tree t = build5_stat (code, type, arg0, arg1, arg2, arg3,
+  tree t = build5 (code, type, arg0, arg1, arg2, arg3,
 			arg4 PASS_MEM_STAT);
   if (CAN_HAVE_LOCATION_P (t))
     SET_EXPR_LOCATION (t, loc);
   return t;
 }
-#define build5_loc(l,c,t1,t2,t3,t4,t5,t6) \
-  build5_stat_loc (l,c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
 
 extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
 #define build_var_debug_value(t1,t2) \
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 01/19] use c++ instead of make_node_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (15 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 15/19] replace shallow_copy_rtx_stat with c++ tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 12/19] use C++ for {make,build}_vector_stat tbsaunde+gcc
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (make_node_stat): rename to make_node.
	(build_tree_list_stat): Adjust.
	(build0_stat): Likewise.
	(build2_stat): Likewise.
	(build3_stat): Likewise.
	(build4_stat): Likewise.
	(build5_stat): Likewise.
	(build_decl_stat): Likewise.
	* tree.h (make_node_stat): Adjust prototype.
	(make_node): remove macro.
---
 gcc/tree.c | 16 ++++++++--------
 gcc/tree.h |  3 +--
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index 48fb2ce0651..49c54bbb4c7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -997,7 +997,7 @@ allocate_decl_uid (void)
    Achoo!  I got a code in the node.  */
 
 tree
-make_node_stat (enum tree_code code MEM_STAT_DECL)
+make_node (enum tree_code code MEM_STAT_DECL)
 {
   tree t;
   enum tree_code_class type = TREE_CODE_CLASS (code);
@@ -2870,7 +2870,7 @@ nreverse (tree t)
 tree
 build_tree_list_stat (tree parm, tree value MEM_STAT_DECL)
 {
-  tree t = make_node_stat (TREE_LIST PASS_MEM_STAT);
+  tree t = make_node (TREE_LIST PASS_MEM_STAT);
   TREE_PURPOSE (t) = parm;
   TREE_VALUE (t) = value;
   return t;
@@ -4371,7 +4371,7 @@ build0_stat (enum tree_code code, tree tt MEM_STAT_DECL)
 
   gcc_assert (TREE_CODE_LENGTH (code) == 0);
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
 
   return t;
@@ -4474,7 +4474,7 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
     gcc_assert (POINTER_TYPE_P (tt) && POINTER_TYPE_P (TREE_TYPE (arg0))
 		&& ptrofftype_p (TREE_TYPE (arg1)));
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
 
   /* Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the
@@ -4543,7 +4543,7 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
   gcc_assert (TREE_CODE_LENGTH (code) == 3);
   gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
 
   read_only = 1;
@@ -4583,7 +4583,7 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
 
   gcc_assert (TREE_CODE_LENGTH (code) == 4);
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
 
   side_effects = TREE_SIDE_EFFECTS (t);
@@ -4610,7 +4610,7 @@ build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
 
   gcc_assert (TREE_CODE_LENGTH (code) == 5);
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   TREE_TYPE (t) = tt;
 
   side_effects = TREE_SIDE_EFFECTS (t);
@@ -4745,7 +4745,7 @@ build_decl_stat (location_t loc, enum tree_code code, tree name,
 {
   tree t;
 
-  t = make_node_stat (code PASS_MEM_STAT);
+  t = make_node (code PASS_MEM_STAT);
   DECL_SOURCE_LOCATION (t) = loc;
 
 /*  if (type == error_mark_node)
diff --git a/gcc/tree.h b/gcc/tree.h
index 819938c4458..554356c2ee1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3889,8 +3889,7 @@ extern int allocate_decl_uid (void);
    The TREE_CODE is the only argument.  Contents are initialized
    to zero except for a few of the common fields.  */
 
-extern tree make_node_stat (enum tree_code MEM_STAT_DECL);
-#define make_node(t) make_node_stat (t MEM_STAT_INFO)
+extern tree make_node (enum tree_code CXX_MEM_STAT_INFO);
 
 /* Free tree node.  */
 
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 19/19] use c++ for fold_buildN_loc
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (7 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 18/19] use c++ for gimple_build_debug_bind{,_source} tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 09/19] use c++ instead of build_vl_exp_stat tbsaunde+gcc
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* fold-const.c (fold_build1_stat_loc): Remove _stat from name.
	(fold_build2_stat_loc): Likewise.
	(fold_build3_stat_loc): Likewise.
	* fold-const.h (fold_build1, fold_build2, fold_build3): Adjust.
	(fold_build1_loc): Remove macro.
	(fold_build2_loc): Likewise.
	(fold_build3_loc): Likewise.
---
 gcc/fold-const.c |  8 ++++----
 gcc/fold-const.h | 24 +++++++++---------------
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 976924f34d7..d4e03b96937 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12205,8 +12205,8 @@ debug_fold_checksum (const_tree t)
    expression with code CODE of type TYPE with an operand OP0.  */
 
 tree
-fold_build1_stat_loc (location_t loc,
-		      enum tree_code code, tree type, tree op0 MEM_STAT_DECL)
+fold_build1_loc (location_t loc,
+		 enum tree_code code, tree type, tree op0 MEM_STAT_DECL)
 {
   tree tem;
 #ifdef ENABLE_FOLD_CHECKING
@@ -12242,7 +12242,7 @@ fold_build1_stat_loc (location_t loc,
    OP0 and OP1.  */
 
 tree
-fold_build2_stat_loc (location_t loc,
+fold_build2_loc (location_t loc,
 		      enum tree_code code, tree type, tree op0, tree op1
 		      MEM_STAT_DECL)
 {
@@ -12295,7 +12295,7 @@ fold_build2_stat_loc (location_t loc,
    type TYPE with operands OP0, OP1, and OP2.  */
 
 tree
-fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
+fold_build3_loc (location_t loc, enum tree_code code, tree type,
 		      tree op0, tree op1, tree op2 MEM_STAT_DECL)
 {
   tree tem;
diff --git a/gcc/fold-const.h b/gcc/fold-const.h
index 780e5c781b7..8380d420ddb 100644
--- a/gcc/fold-const.h
+++ b/gcc/fold-const.h
@@ -49,23 +49,17 @@ extern tree fold_binary_loc (location_t, enum tree_code, tree, tree, tree);
    fold_ternary_loc (UNKNOWN_LOCATION, CODE, T1, T2, T3, T4)
 extern tree fold_ternary_loc (location_t, enum tree_code, tree, tree, tree, tree);
 #define fold_build1(c,t1,t2)\
-   fold_build1_stat_loc (UNKNOWN_LOCATION, c, t1, t2 MEM_STAT_INFO)
-#define fold_build1_loc(l,c,t1,t2)\
-   fold_build1_stat_loc (l, c, t1, t2 MEM_STAT_INFO)
-extern tree fold_build1_stat_loc (location_t, enum tree_code, tree,
-				  tree MEM_STAT_DECL);
+   fold_build1_loc (UNKNOWN_LOCATION, c, t1, t2 MEM_STAT_INFO)
+extern tree fold_build1_loc (location_t, enum tree_code, tree,
+			     tree CXX_MEM_STAT_INFO);
 #define fold_build2(c,t1,t2,t3)\
-   fold_build2_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3 MEM_STAT_INFO)
-#define fold_build2_loc(l,c,t1,t2,t3)\
-   fold_build2_stat_loc (l, c, t1, t2, t3 MEM_STAT_INFO)
-extern tree fold_build2_stat_loc (location_t, enum tree_code, tree, tree,
-				  tree MEM_STAT_DECL);
+   fold_build2_loc (UNKNOWN_LOCATION, c, t1, t2, t3 MEM_STAT_INFO)
+extern tree fold_build2_loc (location_t, enum tree_code, tree, tree,
+			     tree CXX_MEM_STAT_INFO);
 #define fold_build3(c,t1,t2,t3,t4)\
-   fold_build3_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3, t4 MEM_STAT_INFO)
-#define fold_build3_loc(l,c,t1,t2,t3,t4)\
-   fold_build3_stat_loc (l, c, t1, t2, t3, t4 MEM_STAT_INFO)
-extern tree fold_build3_stat_loc (location_t, enum tree_code, tree, tree, tree,
-				  tree MEM_STAT_DECL);
+   fold_build3_loc (UNKNOWN_LOCATION, c, t1, t2, t3, t4 MEM_STAT_INFO)
+extern tree fold_build3_loc (location_t, enum tree_code, tree, tree, tree,
+				  tree CXX_MEM_STAT_INFO);
 extern tree fold_build1_initializer_loc (location_t, enum tree_code, tree, tree);
 extern tree fold_build2_initializer_loc (location_t, enum tree_code, tree, tree, tree);
 #define fold_build_call_array(T1,T2,N,T4)\
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 16/19] simplify the bitmap alloc_stat functions with c++
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (10 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 11/19] remove unused build_var_debug_value prototype tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 13/19] use c++ for build_tree_list{,_vec}_stat tbsaunde+gcc
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/fortran/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* resolve.c (find_reachable_labels): Adjust.

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* bitmap.c (bitmap_obstack_alloc_stat): Rename to bitmap_alloc.
	(bitmap_gc_alloc_stat): Rename to bitmap_gc_alloc.
	* bitmap.h (bitmap_obstack_alloc_stat): Adjust prototype.
	(bitmap_gc_alloc_stat): Likewise.
	(BITMAP_ALLOC, BITMAP_GGC_ALLOC): Adjust.
---
 gcc/bitmap.c          |  4 ++--
 gcc/bitmap.h          | 14 ++++----------
 gcc/fortran/resolve.c |  2 +-
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 7bebeecca55..be8d0cc6247 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -273,7 +273,7 @@ bitmap_obstack_release (bitmap_obstack *bit_obstack)
    it on the default bitmap obstack.  */
 
 bitmap
-bitmap_obstack_alloc_stat (bitmap_obstack *bit_obstack MEM_STAT_DECL)
+bitmap_alloc (bitmap_obstack *bit_obstack MEM_STAT_DECL)
 {
   bitmap map;
 
@@ -295,7 +295,7 @@ bitmap_obstack_alloc_stat (bitmap_obstack *bit_obstack MEM_STAT_DECL)
 /* Create a new GCd bitmap.  */
 
 bitmap
-bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL)
+bitmap_gc_alloc (ALONE_MEM_STAT_DECL)
 {
   bitmap map;
 
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index ad5398409d6..ca047666dc1 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -345,10 +345,10 @@ bitmap_initialize_stat (bitmap head, bitmap_obstack *obstack MEM_STAT_DECL)
 #define bitmap_initialize(h,o) bitmap_initialize_stat (h,o MEM_STAT_INFO)
 
 /* Allocate and free bitmaps from obstack, malloc and gc'd memory.  */
-extern bitmap bitmap_obstack_alloc_stat (bitmap_obstack *obstack MEM_STAT_DECL);
-#define bitmap_obstack_alloc(t) bitmap_obstack_alloc_stat (t MEM_STAT_INFO)
-extern bitmap bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL);
-#define bitmap_gc_alloc() bitmap_gc_alloc_stat (ALONE_MEM_STAT_INFO)
+extern bitmap bitmap_alloc (bitmap_obstack *obstack CXX_MEM_STAT_INFO);
+#define BITMAP_ALLOC bitmap_alloc
+extern bitmap bitmap_gc_alloc (ALONE_CXX_MEM_STAT_INFO);
+#define BITMAP_GGC_ALLOC bitmap_gc_alloc
 extern void bitmap_obstack_free (bitmap);
 
 /* A few compatibility/functions macros for compatibility with sbitmaps */
@@ -365,12 +365,6 @@ extern unsigned bitmap_last_set_bit (const_bitmap);
 /* Compute bitmap hash (for purposes of hashing etc.)  */
 extern hashval_t bitmap_hash (const_bitmap);
 
-/* Allocate a bitmap from a bit obstack.  */
-#define BITMAP_ALLOC(OBSTACK) bitmap_obstack_alloc (OBSTACK)
-
-/* Allocate a gc'd bitmap.  */
-#define BITMAP_GGC_ALLOC() bitmap_gc_alloc ()
-
 /* Do any cleanup needed on a bitmap when it is no longer used.  */
 #define BITMAP_FREE(BITMAP) \
        ((void) (bitmap_obstack_free ((bitmap) BITMAP), (BITMAP) = (bitmap) NULL))
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 12903a4390a..5caf76761ee 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9098,7 +9098,7 @@ find_reachable_labels (gfc_code *block)
   if (!block)
     return;
 
-  cs_base->reachable_labels = bitmap_obstack_alloc (&labels_obstack);
+  cs_base->reachable_labels = bitmap_alloc (&labels_obstack);
 
   /* Collect labels in this block.  We don't keep those corresponding
      to END {IF|SELECT}, these are checked in resolve_branch by going
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 13/19] use c++ for build_tree_list{,_vec}_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (11 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 16/19] simplify the bitmap alloc_stat functions with c++ tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 02/19] use c++ instead of _stat for copy_node_stat tbsaunde+gcc
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (build_tree_list_vec_stat): Remove _stat from name.
	(build_tree_list_stat): Likewise.
	* tree.h (build_tree_list): Remove macro.
	(build_tree_list_vec): Likewise.
---
 gcc/tree.c | 6 +++---
 gcc/tree.h | 6 ++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index a7a030e25f2..0c5acd6c8a6 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2868,7 +2868,7 @@ nreverse (tree t)
    purpose and value fields are PARM and VALUE.  */
 
 tree
-build_tree_list_stat (tree parm, tree value MEM_STAT_DECL)
+build_tree_list (tree parm, tree value MEM_STAT_DECL)
 {
   tree t = make_node (TREE_LIST PASS_MEM_STAT);
   TREE_PURPOSE (t) = parm;
@@ -2879,7 +2879,7 @@ build_tree_list_stat (tree parm, tree value MEM_STAT_DECL)
 /* Build a chain of TREE_LIST nodes from a vector.  */
 
 tree
-build_tree_list_vec_stat (const vec<tree, va_gc> *vec MEM_STAT_DECL)
+build_tree_list_vec (const vec<tree, va_gc> *vec MEM_STAT_DECL)
 {
   tree ret = NULL_TREE;
   tree *pp = &ret;
@@ -2887,7 +2887,7 @@ build_tree_list_vec_stat (const vec<tree, va_gc> *vec MEM_STAT_DECL)
   tree t;
   FOR_EACH_VEC_SAFE_ELT (vec, i, t)
     {
-      *pp = build_tree_list_stat (NULL, t PASS_MEM_STAT);
+      *pp = build_tree_list (NULL, t PASS_MEM_STAT);
       pp = &TREE_CHAIN (*pp);
     }
   return ret;
diff --git a/gcc/tree.h b/gcc/tree.h
index 637e99088a1..e9e7931b1ae 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4021,10 +4021,8 @@ extern tree build_minus_one_cst (tree);
 extern tree build_all_ones_cst (tree);
 extern tree build_zero_cst (tree);
 extern tree build_string (int, const char *);
-extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
-#define build_tree_list(t, q) build_tree_list_stat (t, q MEM_STAT_INFO)
-extern tree build_tree_list_vec_stat (const vec<tree, va_gc> *MEM_STAT_DECL);
-#define build_tree_list_vec(v) build_tree_list_vec_stat (v MEM_STAT_INFO)
+extern tree build_tree_list (tree, tree CXX_MEM_STAT_INFO);
+extern tree build_tree_list_vec (const vec<tree, va_gc> * CXX_MEM_STAT_INFO);
 extern tree build_decl (location_t, enum tree_code,
 			tree, tree CXX_MEM_STAT_INFO);
 extern tree build_fn_decl (const char *, tree);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 12/19] use C++ for {make,build}_vector_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (16 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 01/19] use c++ instead of make_node_stat tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 17/19] use c++ for bitmap_initialize tbsaunde+gcc
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (make_vector_stat): Remove _stat from name.
	(build_vector_stat): Likewise.
	* tree.h (make_vector_stat): Remove macro.
	(build_vector_stat): Likewise.
---
 gcc/tree.c | 4 ++--
 gcc/tree.h | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index e630316300f..a7a030e25f2 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1681,7 +1681,7 @@ cst_and_fits_in_hwi (const_tree x)
 /* Build a newly constructed VECTOR_CST node of length LEN.  */
 
 tree
-make_vector_stat (unsigned len MEM_STAT_DECL)
+make_vector (unsigned len MEM_STAT_DECL)
 {
   tree t;
   unsigned length = (len - 1) * sizeof (tree) + sizeof (struct tree_vector);
@@ -1700,7 +1700,7 @@ make_vector_stat (unsigned len MEM_STAT_DECL)
    are in a list pointed to by VALS.  */
 
 tree
-build_vector_stat (tree type, tree *vals MEM_STAT_DECL)
+build_vector (tree type, tree *vals MEM_STAT_DECL)
 {
   int over = 0;
   unsigned cnt = 0;
diff --git a/gcc/tree.h b/gcc/tree.h
index d765c31cda3..637e99088a1 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4002,10 +4002,8 @@ extern tree force_fit_type (tree, const wide_int_ref &, int, bool);
 extern tree build_int_cst (tree, HOST_WIDE_INT);
 extern tree build_int_cstu (tree type, unsigned HOST_WIDE_INT cst);
 extern tree build_int_cst_type (tree, HOST_WIDE_INT);
-extern tree make_vector_stat (unsigned MEM_STAT_DECL);
-#define make_vector(n) make_vector_stat (n MEM_STAT_INFO)
-extern tree build_vector_stat (tree, tree * MEM_STAT_DECL);
-#define build_vector(t,v) build_vector_stat (t, v MEM_STAT_INFO)
+extern tree make_vector (unsigned CXX_MEM_STAT_INFO);
+extern tree build_vector (tree, tree * CXX_MEM_STAT_INFO);
 extern tree build_vector_from_ctor (tree, vec<constructor_elt, va_gc> *);
 extern tree build_vector_from_val (tree, tree);
 extern void recompute_constructor_flags (tree);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* [PATCH 09/19] use c++ instead of build_vl_exp_stat
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (8 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 19/19] use c++ for fold_buildN_loc tbsaunde+gcc
@ 2017-07-27  8:31 ` tbsaunde+gcc
  2017-07-27  8:31 ` [PATCH 11/19] remove unused build_var_debug_value prototype tbsaunde+gcc
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 31+ messages in thread
From: tbsaunde+gcc @ 2017-07-27  8:31 UTC (permalink / raw)
  To: gcc-patches

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2017-07-27  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree.c (build_vl_exp_stat): Remove _stat from name.
	* tree.h (build_vl_exp): Remove macro.
---
 gcc/tree.c | 2 +-
 gcc/tree.h | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/tree.c b/gcc/tree.c
index b763bc08969..fd25fd50157 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11248,7 +11248,7 @@ build_omp_clause (location_t loc, enum omp_clause_code code)
    object is initialized to zeros.  */
 
 tree
-build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL)
+build_vl_exp (enum tree_code code, int len MEM_STAT_DECL)
 {
   tree t;
   int length = (len - 1) * sizeof (tree) + sizeof (struct tree_exp);
diff --git a/gcc/tree.h b/gcc/tree.h
index 1c8fd57a465..ca50de5c747 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4039,8 +4039,7 @@ extern tree build_block (tree, tree, tree, tree);
 extern tree build_empty_stmt (location_t);
 extern tree build_omp_clause (location_t, enum omp_clause_code);
 
-extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL);
-#define build_vl_exp(c, n) build_vl_exp_stat (c, n MEM_STAT_INFO)
+extern tree build_vl_exp (enum tree_code, int CXX_MEM_STAT_INFO);
 
 extern tree build_call_nary (tree, tree, int, ...);
 extern tree build_call_valist (tree, tree, int, va_list);
-- 
2.11.0

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (18 preceding siblings ...)
  2017-07-27  8:31 ` [PATCH 17/19] use c++ for bitmap_initialize tbsaunde+gcc
@ 2017-07-27  8:43 ` Richard Biener
  2017-07-28 16:32   ` Bernhard Reutner-Fischer
                     ` (2 more replies)
  2017-07-31 20:56 ` Martin Sebor
  20 siblings, 3 replies; 31+ messages in thread
From: Richard Biener @ 2017-07-27  8:43 UTC (permalink / raw)
  To: tbsaunde+gcc; +Cc: GCC Patches

On Thu, Jul 27, 2017 at 10:30 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> The preC++ way of passing information about the call site of a function was to
> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
> the same name with _stat appended to it.  The way this is now done with C++ is
> to have arguments where the default value is __LINE__, __FILE__, and
> __FUNCTION__ in the caller.  This has the significant advantage that if you
> look for "^function (" you find the correct function, where in the C way of
> doing things you need to realize its a macro and check the definition of the
> macro to see what to look for next.  So this removes a layer of indirection,
> and makes things somewhat more consistant in using the C++ way of doing things.
>
> patches independently bootstrapped and regtested on ppc64le-linux-gnu.  I
> successfully ran make all-gcc with --enable-gather-detailed-mem-stats, but
> couldn't complete a bootstrap before the series was applied, because the
> ddrs_table in tree-loop-distribution.c causes memory statistics gathering to crash before the series as well as after it.  ok?

Thanks!  This was on my list of things todo...

The series is ok.

Did you catch all of MEM_STAT_INFO/ALONE_MEM_STAT_INFO so we can remove the
non-C++ way from statistics.h?

Richard.

> thanks
>
> Trev
>
> p.s. the issue with ddrs_table is that it ends up trying to add to the memory
> stats hash table from a global constructor when that hash table hasn't yet been
> constructed.
>
>
> Trevor Saunders (19):
>   use c++ instead of make_node_stat
>   use c++ instead of _stat for copy_node_stat
>   use cxx instead of make_tree_binfo_stat
>   use c++ for make_int_cst_stat
>   use c++ instead of buildN_stat{,_loc}
>   use c++ instead of {make,grow}_tree_vec_stat
>   replace gimple_alloc_stat with c++
>   use c++ instead of build_decl_stat
>   use c++ instead of build_vl_exp_stat
>   use c++ for tree_cons_stat
>   remove unused build_var_debug_value prototype
>   use C++ for {make,build}_vector_stat
>   use c++ for build_tree_list{,_vec}_stat
>   replace rtx_alloc_stat with c++
>   replace shallow_copy_rtx_stat with c++
>   simplify the bitmap alloc_stat functions with c++
>   use c++ for bitmap_initialize
>   use c++ for gimple_build_debug_bind{,_source}
>   use c++ for fold_buildN_loc
>
>  gcc/bitmap.c          |   8 ++--
>  gcc/bitmap.h          |  17 +++-----
>  gcc/cp/lex.c          |   4 +-
>  gcc/emit-rtl.c        |   2 +-
>  gcc/fold-const.c      |  14 +++----
>  gcc/fold-const.h      |  24 +++++-------
>  gcc/fortran/resolve.c |   2 +-
>  gcc/gengenrtl.c       |   2 +-
>  gcc/gimple.c          |   8 ++--
>  gcc/gimple.h          |  11 ++----
>  gcc/rtl.c             |   4 +-
>  gcc/rtl.h             |   6 +--
>  gcc/tree.c            |  62 ++++++++++++++---------------
>  gcc/tree.h            | 106 ++++++++++++++++++--------------------------------
>  14 files changed, 109 insertions(+), 161 deletions(-)
>
> --
> 2.11.0
>

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
@ 2017-07-28 16:32   ` Bernhard Reutner-Fischer
  2017-07-29  1:08     ` Trevor Saunders
  2017-07-29  1:10   ` Trevor Saunders
  2017-07-31 18:33   ` Jeff Law
  2 siblings, 1 reply; 31+ messages in thread
From: Bernhard Reutner-Fischer @ 2017-07-28 16:32 UTC (permalink / raw)
  To: gcc-patches, Richard Biener, tbsaunde+gcc; +Cc: GCC Patches

On 27 July 2017 10:43:09 CEST, Richard Biener <richard.guenther@gmail.com> wrote:
>On Thu, Jul 27, 2017 at 10:30 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>
>> The preC++ way of passing information about the call site of a
>function was to
>> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a
>function with
>> the same name with _stat appended to it.  The way this is now done
>with C++ is
>> to have arguments where the default value is __LINE__, __FILE__, and
>> __FUNCTION__ in the caller.  This has the significant advantage that
>if you
>> look for "^function (" you find the correct function, where in the C
>way of
>> doing things you need to realize its a macro and check the definition
>of the
>> macro to see what to look for next.  So this removes a layer of
>indirection,
>> and makes things somewhat more consistant in using the C++ way of
>doing things.
>>
>> patches independently bootstrapped and regtested on
>ppc64le-linux-gnu.  I
>> successfully ran make all-gcc with
>--enable-gather-detailed-mem-stats, but
>> couldn't complete a bootstrap before the series was applied, because
>the
>> ddrs_table in tree-loop-distribution.c causes memory statistics
>gathering to crash before the series as well as after it.  ok?
>
>Thanks!  This was on my list of things todo...
>
>The series is ok.

Maybe s/enum tree_code/tree_code/ in the lines you touch?

Thanks,
>
>Did you catch all of MEM_STAT_INFO/ALONE_MEM_STAT_INFO so we can remove
>the
>non-C++ way from statistics.h?

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-28 16:32   ` Bernhard Reutner-Fischer
@ 2017-07-29  1:08     ` Trevor Saunders
  0 siblings, 0 replies; 31+ messages in thread
From: Trevor Saunders @ 2017-07-29  1:08 UTC (permalink / raw)
  To: Bernhard Reutner-Fischer; +Cc: gcc-patches, Richard Biener, tbsaunde+gcc

On Fri, Jul 28, 2017 at 06:31:05PM +0200, Bernhard Reutner-Fischer wrote:
> On 27 July 2017 10:43:09 CEST, Richard Biener <richard.guenther@gmail.com> wrote:
> >On Thu, Jul 27, 2017 at 10:30 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> >> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >>
> >> The preC++ way of passing information about the call site of a
> >function was to
> >> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a
> >function with
> >> the same name with _stat appended to it.  The way this is now done
> >with C++ is
> >> to have arguments where the default value is __LINE__, __FILE__, and
> >> __FUNCTION__ in the caller.  This has the significant advantage that
> >if you
> >> look for "^function (" you find the correct function, where in the C
> >way of
> >> doing things you need to realize its a macro and check the definition
> >of the
> >> macro to see what to look for next.  So this removes a layer of
> >indirection,
> >> and makes things somewhat more consistant in using the C++ way of
> >doing things.
> >>
> >> patches independently bootstrapped and regtested on
> >ppc64le-linux-gnu.  I
> >> successfully ran make all-gcc with
> >--enable-gather-detailed-mem-stats, but
> >> couldn't complete a bootstrap before the series was applied, because
> >the
> >> ddrs_table in tree-loop-distribution.c causes memory statistics
> >gathering to crash before the series as well as after it.  ok?
> >
> >Thanks!  This was on my list of things todo...
> >
> >The series is ok.
> 
> Maybe s/enum tree_code/tree_code/ in the lines you touch?

I'd rather leave that to a separate patch and just do it for all of gcc/
at once.

Trev

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
  2017-07-28 16:32   ` Bernhard Reutner-Fischer
@ 2017-07-29  1:10   ` Trevor Saunders
  2017-07-31 18:33   ` Jeff Law
  2 siblings, 0 replies; 31+ messages in thread
From: Trevor Saunders @ 2017-07-29  1:10 UTC (permalink / raw)
  To: Richard Biener; +Cc: tbsaunde+gcc, GCC Patches

On Thu, Jul 27, 2017 at 10:43:09AM +0200, Richard Biener wrote:
> On Thu, Jul 27, 2017 at 10:30 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> > The preC++ way of passing information about the call site of a function was to
> > use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
> > the same name with _stat appended to it.  The way this is now done with C++ is
> > to have arguments where the default value is __LINE__, __FILE__, and
> > __FUNCTION__ in the caller.  This has the significant advantage that if you
> > look for "^function (" you find the correct function, where in the C way of
> > doing things you need to realize its a macro and check the definition of the
> > macro to see what to look for next.  So this removes a layer of indirection,
> > and makes things somewhat more consistant in using the C++ way of doing things.
> >
> > patches independently bootstrapped and regtested on ppc64le-linux-gnu.  I
> > successfully ran make all-gcc with --enable-gather-detailed-mem-stats, but
> > couldn't complete a bootstrap before the series was applied, because the
> > ddrs_table in tree-loop-distribution.c causes memory statistics gathering to crash before the series as well as after it.  ok?
> 
> Thanks!  This was on my list of things todo...

no problem, it kept annoying me to find things.

> The series is ok.
> 
> Did you catch all of MEM_STAT_INFO/ALONE_MEM_STAT_INFO so we can remove the
> non-C++ way from statistics.h?

 Looks like ALONE_MEM_STAT_INFO is now effectively unused, but a few odd
 uses of MEM_STAT_INFO remain.  I'll try and look at finishing that off.

 Trev

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
  2017-07-28 16:32   ` Bernhard Reutner-Fischer
  2017-07-29  1:10   ` Trevor Saunders
@ 2017-07-31 18:33   ` Jeff Law
  2 siblings, 0 replies; 31+ messages in thread
From: Jeff Law @ 2017-07-31 18:33 UTC (permalink / raw)
  To: Richard Biener, tbsaunde+gcc; +Cc: GCC Patches

On 07/27/2017 02:43 AM, Richard Biener wrote:
> On Thu, Jul 27, 2017 at 10:30 AM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>
>> The preC++ way of passing information about the call site of a function was to
>> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
>> the same name with _stat appended to it.  The way this is now done with C++ is
>> to have arguments where the default value is __LINE__, __FILE__, and
>> __FUNCTION__ in the caller.  This has the significant advantage that if you
>> look for "^function (" you find the correct function, where in the C way of
>> doing things you need to realize its a macro and check the definition of the
>> macro to see what to look for next.  So this removes a layer of indirection,
>> and makes things somewhat more consistant in using the C++ way of doing things.
>>
>> patches independently bootstrapped and regtested on ppc64le-linux-gnu.  I
>> successfully ran make all-gcc with --enable-gather-detailed-mem-stats, but
>> couldn't complete a bootstrap before the series was applied, because the
>> ddrs_table in tree-loop-distribution.c causes memory statistics gathering to crash before the series as well as after it.  ok?
> 
> Thanks!  This was on my list of things todo...
> 
> The series is ok.
Just wanted to relay a thanks from me too.  I always find it annoying to
remember which functions are _stat thingies when debugging.  No more!

Jeff

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
                   ` (19 preceding siblings ...)
  2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
@ 2017-07-31 20:56 ` Martin Sebor
  2017-07-31 21:34   ` Trevor Saunders
  20 siblings, 1 reply; 31+ messages in thread
From: Martin Sebor @ 2017-07-31 20:56 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> The preC++ way of passing information about the call site of a function was to
> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
> the same name with _stat appended to it.  The way this is now done with C++ is
> to have arguments where the default value is __LINE__, __FILE__, and
> __FUNCTION__ in the caller.  This has the significant advantage that if you
> look for "^function (" you find the correct function, where in the C way of
> doing things you need to realize its a macro and check the definition of the
> macro to see what to look for next.  So this removes a layer of indirection,
> and makes things somewhat more consistant in using the C++ way of doing things.

So that's what these things are for! :)

I must be missing something either about the macros or about your
changes.  The way I read the changes it seems that it's no longer
possible to call, say,

   t = make_node (code);

and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
behind the scenes.

Instead, to achieve that, make_node has to be called like so

   t = make_node (code PASS_MEM_STAT);

Otherwise calling make_node() with just one argument will end up
calling it with the defaults.

Martin

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-31 20:56 ` Martin Sebor
@ 2017-07-31 21:34   ` Trevor Saunders
  2017-07-31 22:58     ` Martin Sebor
  0 siblings, 1 reply; 31+ messages in thread
From: Trevor Saunders @ 2017-07-31 21:34 UTC (permalink / raw)
  To: Martin Sebor; +Cc: tbsaunde+gcc, gcc-patches

On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote:
> On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
> > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > 
> > The preC++ way of passing information about the call site of a function was to
> > use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
> > the same name with _stat appended to it.  The way this is now done with C++ is
> > to have arguments where the default value is __LINE__, __FILE__, and
> > __FUNCTION__ in the caller.  This has the significant advantage that if you
> > look for "^function (" you find the correct function, where in the C way of
> > doing things you need to realize its a macro and check the definition of the
> > macro to see what to look for next.  So this removes a layer of indirection,
> > and makes things somewhat more consistant in using the C++ way of doing things.
> 
> So that's what these things are for! :)
> 
> I must be missing something either about the macros or about your
> changes.  The way I read the changes it seems that it's no longer
> possible to call, say,
> 
>   t = make_node (code);
> 
> and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
> behind the scenes.
> 
> Instead, to achieve that, make_node has to be called like so
> 
>   t = make_node (code PASS_MEM_STAT);
> 
> Otherwise calling make_node() with just one argument will end up
> calling it with the defaults.

calling it with the defaults will do the same thing the macro used to
do, so its fine unless you want to pass in a location that you got as an
argument.

I'm guessing you are missing that the functions when used as the default
argument provide the location of the call site of the function, not the
location of the prototype.  Which is not the most obvious thing.

Trev

> 
> Martin
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-31 21:34   ` Trevor Saunders
@ 2017-07-31 22:58     ` Martin Sebor
  2017-07-31 23:11       ` Trevor Saunders
  0 siblings, 1 reply; 31+ messages in thread
From: Martin Sebor @ 2017-07-31 22:58 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: tbsaunde+gcc, gcc-patches

On 07/31/2017 03:34 PM, Trevor Saunders wrote:
> On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote:
>> On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>
>>> The preC++ way of passing information about the call site of a function was to
>>> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
>>> the same name with _stat appended to it.  The way this is now done with C++ is
>>> to have arguments where the default value is __LINE__, __FILE__, and
>>> __FUNCTION__ in the caller.  This has the significant advantage that if you
>>> look for "^function (" you find the correct function, where in the C way of
>>> doing things you need to realize its a macro and check the definition of the
>>> macro to see what to look for next.  So this removes a layer of indirection,
>>> and makes things somewhat more consistant in using the C++ way of doing things.
>>
>> So that's what these things are for! :)
>>
>> I must be missing something either about the macros or about your
>> changes.  The way I read the changes it seems that it's no longer
>> possible to call, say,
>>
>>   t = make_node (code);
>>
>> and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
>> behind the scenes.
>>
>> Instead, to achieve that, make_node has to be called like so
>>
>>   t = make_node (code PASS_MEM_STAT);
>>
>> Otherwise calling make_node() with just one argument will end up
>> calling it with the defaults.
>
> calling it with the defaults will do the same thing the macro used to
> do, so its fine unless you want to pass in a location that you got as an
> argument.

Sorry, I'm still not sure I understand.  Please bear with me
if I'm just being slow.

When GATHER_STATISTICS is defined, make_node_stat is declared
like so in current GCC (without your patch):

   extern tree
   make_node_stat (enum tree_code , const char * _loc_name,
                   int _loc_line,  const char * _loc_function);

and the make_node macro like so:

   #define make_node(t) make_node_stat (t MEM_STAT_INFO)

with MEM_STAT_INFO being defined as follows:

   #define MEM_STAT_INFO , ALONE_MEM_STAT_INFO
   #define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__

So a call to

   t = make_node (code);

expands to

   t = make_node_stat (code, __FILE__, __LINE__, __FUNCTION__);

If I'm reading your patch correctly (please correct me if/where
I'm not) then it treats the same call as just an ordinary call
to the make_node function with no macro expansion taking place
at the call  site.  I.e., it will be made with the _loc_name,
_loc_line, and _loc_function arguments set to whatever their
defaults are where the function is declared.  To have the call
do the same thing as before it will have to be made with explicit
arguments, e.g., like so:

   t = make_node (code MEM_STAT_INFO);

That seems like a (significant) difference.

> I'm guessing you are missing that the functions when used as the default
> argument provide the location of the call site of the function, not the
> location of the prototype.  Which is not the most obvious thing.

I am indeed missing that.  How do/can they do that when that's
not how C++ 98 default arguments work?  (It's only possible with
GCC's __builtin_{FILE,LINE,FUNCTION} but not without these
extensions.)

Martin

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-31 22:58     ` Martin Sebor
@ 2017-07-31 23:11       ` Trevor Saunders
  2017-08-01  0:11         ` Martin Sebor
  0 siblings, 1 reply; 31+ messages in thread
From: Trevor Saunders @ 2017-07-31 23:11 UTC (permalink / raw)
  To: Martin Sebor; +Cc: tbsaunde+gcc, gcc-patches

On Mon, Jul 31, 2017 at 04:58:15PM -0600, Martin Sebor wrote:
> On 07/31/2017 03:34 PM, Trevor Saunders wrote:
> > On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote:
> > > On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
> > > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > > > 
> > > > The preC++ way of passing information about the call site of a function was to
> > > > use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
> > > > the same name with _stat appended to it.  The way this is now done with C++ is
> > > > to have arguments where the default value is __LINE__, __FILE__, and
> > > > __FUNCTION__ in the caller.  This has the significant advantage that if you
> > > > look for "^function (" you find the correct function, where in the C way of
> > > > doing things you need to realize its a macro and check the definition of the
> > > > macro to see what to look for next.  So this removes a layer of indirection,
> > > > and makes things somewhat more consistant in using the C++ way of doing things.
> > > 
> > > So that's what these things are for! :)
> > > 
> > > I must be missing something either about the macros or about your
> > > changes.  The way I read the changes it seems that it's no longer
> > > possible to call, say,
> > > 
> > >   t = make_node (code);
> > > 
> > > and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
> > > behind the scenes.
> > > 
> > > Instead, to achieve that, make_node has to be called like so
> > > 
> > >   t = make_node (code PASS_MEM_STAT);
> > > 
> > > Otherwise calling make_node() with just one argument will end up
> > > calling it with the defaults.
> > 
> > calling it with the defaults will do the same thing the macro used to
> > do, so its fine unless you want to pass in a location that you got as an
> > argument.
> 
> Sorry, I'm still not sure I understand.  Please bear with me
> if I'm just being slow.
> 
> When GATHER_STATISTICS is defined, make_node_stat is declared
> like so in current GCC (without your patch):
> 
>   extern tree
>   make_node_stat (enum tree_code , const char * _loc_name,
>                   int _loc_line,  const char * _loc_function);
> 
> and the make_node macro like so:
> 
>   #define make_node(t) make_node_stat (t MEM_STAT_INFO)
> 
> with MEM_STAT_INFO being defined as follows:
> 
>   #define MEM_STAT_INFO , ALONE_MEM_STAT_INFO
>   #define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__
> 
> So a call to
> 
>   t = make_node (code);
> 
> expands to
> 
>   t = make_node_stat (code, __FILE__, __LINE__, __FUNCTION__);
> 
> If I'm reading your patch correctly (please correct me if/where
> I'm not) then it treats the same call as just an ordinary call
> to the make_node function with no macro expansion taking place
> at the call  site.  I.e., it will be made with the _loc_name,
> _loc_line, and _loc_function arguments set to whatever their
> defaults are where the function is declared.  To have the call
> do the same thing as before it will have to be made with explicit
> arguments, e.g., like so:
> 
>   t = make_node (code MEM_STAT_INFO);
> 
> That seems like a (significant) difference.
> 
> > I'm guessing you are missing that the functions when used as the default
> > argument provide the location of the call site of the function, not the
> > location of the prototype.  Which is not the most obvious thing.
> 
> I am indeed missing that.  How do/can they do that when that's
> not how C++ 98 default arguments work?  (It's only possible with
> GCC's __builtin_{FILE,LINE,FUNCTION} but not without these
> extensions.)

They use the extensions if available, and otherwise provide the wrong
values.  However that's fine because this is just for profiling gcc
itself so demanding you use gcc 4.8 or greater, or bootstrap the
compiler you are going to profile isn't a big deal.

perhaps we should just make --enable-gather-detailed-mem-statss require
a recent gcc instead of supporting it but providing bad data for some
things?

Trev

> 
> Martin
> 

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-07-31 23:11       ` Trevor Saunders
@ 2017-08-01  0:11         ` Martin Sebor
  2017-08-01  9:05           ` Richard Biener
  0 siblings, 1 reply; 31+ messages in thread
From: Martin Sebor @ 2017-08-01  0:11 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: tbsaunde+gcc, gcc-patches

On 07/31/2017 05:11 PM, Trevor Saunders wrote:
> On Mon, Jul 31, 2017 at 04:58:15PM -0600, Martin Sebor wrote:
>> On 07/31/2017 03:34 PM, Trevor Saunders wrote:
>>> On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote:
>>>> On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>
>>>>> The preC++ way of passing information about the call site of a function was to
>>>>> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a function with
>>>>> the same name with _stat appended to it.  The way this is now done with C++ is
>>>>> to have arguments where the default value is __LINE__, __FILE__, and
>>>>> __FUNCTION__ in the caller.  This has the significant advantage that if you
>>>>> look for "^function (" you find the correct function, where in the C way of
>>>>> doing things you need to realize its a macro and check the definition of the
>>>>> macro to see what to look for next.  So this removes a layer of indirection,
>>>>> and makes things somewhat more consistant in using the C++ way of doing things.
>>>>
>>>> So that's what these things are for! :)
>>>>
>>>> I must be missing something either about the macros or about your
>>>> changes.  The way I read the changes it seems that it's no longer
>>>> possible to call, say,
>>>>
>>>>   t = make_node (code);
>>>>
>>>> and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
>>>> behind the scenes.
>>>>
>>>> Instead, to achieve that, make_node has to be called like so
>>>>
>>>>   t = make_node (code PASS_MEM_STAT);
>>>>
>>>> Otherwise calling make_node() with just one argument will end up
>>>> calling it with the defaults.
>>>
>>> calling it with the defaults will do the same thing the macro used to
>>> do, so its fine unless you want to pass in a location that you got as an
>>> argument.
>>
>> Sorry, I'm still not sure I understand.  Please bear with me
>> if I'm just being slow.
>>
>> When GATHER_STATISTICS is defined, make_node_stat is declared
>> like so in current GCC (without your patch):
>>
>>   extern tree
>>   make_node_stat (enum tree_code , const char * _loc_name,
>>                   int _loc_line,  const char * _loc_function);
>>
>> and the make_node macro like so:
>>
>>   #define make_node(t) make_node_stat (t MEM_STAT_INFO)
>>
>> with MEM_STAT_INFO being defined as follows:
>>
>>   #define MEM_STAT_INFO , ALONE_MEM_STAT_INFO
>>   #define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__
>>
>> So a call to
>>
>>   t = make_node (code);
>>
>> expands to
>>
>>   t = make_node_stat (code, __FILE__, __LINE__, __FUNCTION__);
>>
>> If I'm reading your patch correctly (please correct me if/where
>> I'm not) then it treats the same call as just an ordinary call
>> to the make_node function with no macro expansion taking place
>> at the call  site.  I.e., it will be made with the _loc_name,
>> _loc_line, and _loc_function arguments set to whatever their
>> defaults are where the function is declared.  To have the call
>> do the same thing as before it will have to be made with explicit
>> arguments, e.g., like so:
>>
>>   t = make_node (code MEM_STAT_INFO);
>>
>> That seems like a (significant) difference.
>>
>>> I'm guessing you are missing that the functions when used as the default
>>> argument provide the location of the call site of the function, not the
>>> location of the prototype.  Which is not the most obvious thing.
>>
>> I am indeed missing that.  How do/can they do that when that's
>> not how C++ 98 default arguments work?  (It's only possible with
>> GCC's __builtin_{FILE,LINE,FUNCTION} but not without these
>> extensions.)
>
> They use the extensions if available, and otherwise provide the wrong
> values.  However that's fine because this is just for profiling gcc
> itself so demanding you use gcc 4.8 or greater, or bootstrap the
> compiler you are going to profile isn't a big deal.

Ah, okay, thanks for your patience with me.  I didn't realize
some language features/extensions get enabled as GCC bootstraps.

>
> perhaps we should just make --enable-gather-detailed-mem-statss require
> a recent gcc instead of supporting it but providing bad data for some
> things?

That would make sense to me.  Either that, or documenting this
caveat as a known limitation somewhere users of the option will
notice (or both).

Martin

^ permalink raw reply	[flat|nested] 31+ messages in thread

* Re: [PATCH 00/19] cleanup of memory stats prototypes
  2017-08-01  0:11         ` Martin Sebor
@ 2017-08-01  9:05           ` Richard Biener
  0 siblings, 0 replies; 31+ messages in thread
From: Richard Biener @ 2017-08-01  9:05 UTC (permalink / raw)
  To: Martin Sebor; +Cc: Trevor Saunders, tbsaunde+gcc, GCC Patches

On Tue, Aug 1, 2017 at 2:11 AM, Martin Sebor <msebor@gmail.com> wrote:
> On 07/31/2017 05:11 PM, Trevor Saunders wrote:
>>
>> On Mon, Jul 31, 2017 at 04:58:15PM -0600, Martin Sebor wrote:
>>>
>>> On 07/31/2017 03:34 PM, Trevor Saunders wrote:
>>>>
>>>> On Mon, Jul 31, 2017 at 02:56:40PM -0600, Martin Sebor wrote:
>>>>>
>>>>> On 07/27/2017 02:30 AM, tbsaunde+gcc@tbsaunde.org wrote:
>>>>>>
>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>
>>>>>> The preC++ way of passing information about the call site of a
>>>>>> function was to
>>>>>> use a macro that passed __file__, __LINE__, and __FUNCTION__ to a
>>>>>> function with
>>>>>> the same name with _stat appended to it.  The way this is now done
>>>>>> with C++ is
>>>>>> to have arguments where the default value is __LINE__, __FILE__, and
>>>>>> __FUNCTION__ in the caller.  This has the significant advantage that
>>>>>> if you
>>>>>> look for "^function (" you find the correct function, where in the C
>>>>>> way of
>>>>>> doing things you need to realize its a macro and check the definition
>>>>>> of the
>>>>>> macro to see what to look for next.  So this removes a layer of
>>>>>> indirection,
>>>>>> and makes things somewhat more consistant in using the C++ way of
>>>>>> doing things.
>>>>>
>>>>>
>>>>> So that's what these things are for! :)
>>>>>
>>>>> I must be missing something either about the macros or about your
>>>>> changes.  The way I read the changes it seems that it's no longer
>>>>> possible to call, say,
>>>>>
>>>>>   t = make_node (code);
>>>>>
>>>>> and have __FILE__, __LINE__, and __FUNCTION__ passed as arguments
>>>>> behind the scenes.
>>>>>
>>>>> Instead, to achieve that, make_node has to be called like so
>>>>>
>>>>>   t = make_node (code PASS_MEM_STAT);
>>>>>
>>>>> Otherwise calling make_node() with just one argument will end up
>>>>> calling it with the defaults.
>>>>
>>>>
>>>> calling it with the defaults will do the same thing the macro used to
>>>> do, so its fine unless you want to pass in a location that you got as an
>>>> argument.
>>>
>>>
>>> Sorry, I'm still not sure I understand.  Please bear with me
>>> if I'm just being slow.
>>>
>>> When GATHER_STATISTICS is defined, make_node_stat is declared
>>> like so in current GCC (without your patch):
>>>
>>>   extern tree
>>>   make_node_stat (enum tree_code , const char * _loc_name,
>>>                   int _loc_line,  const char * _loc_function);
>>>
>>> and the make_node macro like so:
>>>
>>>   #define make_node(t) make_node_stat (t MEM_STAT_INFO)
>>>
>>> with MEM_STAT_INFO being defined as follows:
>>>
>>>   #define MEM_STAT_INFO , ALONE_MEM_STAT_INFO
>>>   #define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__
>>>
>>> So a call to
>>>
>>>   t = make_node (code);
>>>
>>> expands to
>>>
>>>   t = make_node_stat (code, __FILE__, __LINE__, __FUNCTION__);
>>>
>>> If I'm reading your patch correctly (please correct me if/where
>>> I'm not) then it treats the same call as just an ordinary call
>>> to the make_node function with no macro expansion taking place
>>> at the call  site.  I.e., it will be made with the _loc_name,
>>> _loc_line, and _loc_function arguments set to whatever their
>>> defaults are where the function is declared.  To have the call
>>> do the same thing as before it will have to be made with explicit
>>> arguments, e.g., like so:
>>>
>>>   t = make_node (code MEM_STAT_INFO);
>>>
>>> That seems like a (significant) difference.
>>>
>>>> I'm guessing you are missing that the functions when used as the default
>>>> argument provide the location of the call site of the function, not the
>>>> location of the prototype.  Which is not the most obvious thing.
>>>
>>>
>>> I am indeed missing that.  How do/can they do that when that's
>>> not how C++ 98 default arguments work?  (It's only possible with
>>> GCC's __builtin_{FILE,LINE,FUNCTION} but not without these
>>> extensions.)
>>
>>
>> They use the extensions if available, and otherwise provide the wrong
>> values.  However that's fine because this is just for profiling gcc
>> itself so demanding you use gcc 4.8 or greater, or bootstrap the
>> compiler you are going to profile isn't a big deal.
>
>
> Ah, okay, thanks for your patience with me.  I didn't realize
> some language features/extensions get enabled as GCC bootstraps.
>
>>
>> perhaps we should just make --enable-gather-detailed-mem-statss require
>> a recent gcc instead of supporting it but providing bad data for some
>> things?

My plan was to remove the fallback (so you'd get no data).  But yes,
a configure test for the extension would work as well of course.

Note it only affects non-bootstrapped builds or stage1 so the configure
test would be a bit tricky?

Of course I never use mem-stats for a bootstrapped compiler.

Richard.

>
> That would make sense to me.  Either that, or documenting this
> caveat as a known limitation somewhere users of the option will
> notice (or both).
>
> Martin

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2017-08-01  9:05 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-27  8:30 [PATCH 00/19] cleanup of memory stats prototypes tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 03/19] use cxx instead of make_tree_binfo_stat tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 08/19] use c++ instead of build_decl_stat tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 14/19] replace rtx_alloc_stat with c++ tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 06/19] use c++ instead of {make,grow}_tree_vec_stat tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 10/19] use c++ for tree_cons_stat tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 07/19] replace gimple_alloc_stat with c++ tbsaunde+gcc
2017-07-27  8:30 ` [PATCH 04/19] use c++ for make_int_cst_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 18/19] use c++ for gimple_build_debug_bind{,_source} tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 19/19] use c++ for fold_buildN_loc tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 09/19] use c++ instead of build_vl_exp_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 11/19] remove unused build_var_debug_value prototype tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 16/19] simplify the bitmap alloc_stat functions with c++ tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 13/19] use c++ for build_tree_list{,_vec}_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 02/19] use c++ instead of _stat for copy_node_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 05/19] use c++ instead of buildN_stat{,_loc} tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 15/19] replace shallow_copy_rtx_stat with c++ tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 01/19] use c++ instead of make_node_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 12/19] use C++ for {make,build}_vector_stat tbsaunde+gcc
2017-07-27  8:31 ` [PATCH 17/19] use c++ for bitmap_initialize tbsaunde+gcc
2017-07-27  8:43 ` [PATCH 00/19] cleanup of memory stats prototypes Richard Biener
2017-07-28 16:32   ` Bernhard Reutner-Fischer
2017-07-29  1:08     ` Trevor Saunders
2017-07-29  1:10   ` Trevor Saunders
2017-07-31 18:33   ` Jeff Law
2017-07-31 20:56 ` Martin Sebor
2017-07-31 21:34   ` Trevor Saunders
2017-07-31 22:58     ` Martin Sebor
2017-07-31 23:11       ` Trevor Saunders
2017-08-01  0:11         ` Martin Sebor
2017-08-01  9:05           ` Richard Biener

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).