aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-03-03 12:25:51 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2004-03-03 11:25:51 +0000
commitb9dcdee46edefdb67cbbb5aa0829fba999c2a1f0 (patch)
tree2b3885b2b287da398b70600d8381767cc76aa181 /gcc/tree.c
parent6ba7b54780fd483f81c39e0ac07537cbe40063df (diff)
downloadgcc-b9dcdee46edefdb67cbbb5aa0829fba999c2a1f0.zip
gcc-b9dcdee46edefdb67cbbb5aa0829fba999c2a1f0.tar.gz
gcc-b9dcdee46edefdb67cbbb5aa0829fba999c2a1f0.tar.bz2
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat): Rename from ...; make statistics transparent. (ggc_alloc_cleared, ggc_realloc_stat): ... these. (loc_descriptor): New structure. (hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics, add_statistics): New static function. (ggc_record_overhead, dump_statistics): New global function. * ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat, ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename from ...; accept locations (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared, ggc_realloc, ggc_alloc_typed): ... this one. from ...; accept locations * ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat, ggc_alloc_stat): Rename from ... ; pass locations * ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc): ... this one. (ggc_alloc_stat): Record overehead. * ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared, ggc_realloc, ggc_alloc_typed): Turn to macros (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat, ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare. (dump_ggc_loc_satistics, ggc_record_overehead): Declare. * langhooks.h (lhd_make_node): Declare. (LANG_HOOKS_MAKE_TYPE): Default to new function, * langhooks.c (lhd_make_node): New. * rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass locations. (rtx_alloc, swallow_copy_rtx): ... this one. * rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros. * rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare. * toplpev.c (finalize): Dump stats. * tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat, build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat): Rename from ... ; pass locators. (make_node, copy_node, make_tree_vec, build_tree_list, tree_cons, build?, build_decl): Declare. * tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat, build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat): Declare. (make_node, copy_node, make_tree_vec, build_tree_list, tree_cons, build?, build_decl): New macros. * Makefile.in (RTL_H, TREE_H): Add statistics.h dependency. * statistics.h: New file. From-SVN: r78826
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 3913b55..633dcd1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -200,7 +200,7 @@ tree_size (tree node)
Achoo! I got a code in the node. */
tree
-make_node (enum tree_code code)
+make_node_stat (enum tree_code code MEM_STAT_DECL)
{
tree t;
int type = TREE_CODE_CLASS (code);
@@ -269,7 +269,7 @@ make_node (enum tree_code code)
tree_node_sizes[(int) kind] += length;
#endif
- t = ggc_alloc_tree (length);
+ t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT);
memset (t, 0, length);
@@ -340,14 +340,14 @@ make_node (enum tree_code code)
TREE_CHAIN is zero and it has a fresh uid. */
tree
-copy_node (tree node)
+copy_node_stat (tree node MEM_STAT_DECL)
{
tree t;
enum tree_code code = TREE_CODE (node);
size_t length;
length = tree_size (node);
- t = ggc_alloc_tree (length);
+ t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT);
memcpy (t, node, length);
TREE_CHAIN (t) = 0;
@@ -554,7 +554,7 @@ build_complex (tree type, tree real, tree imag)
/* Build a newly constructed TREE_VEC node of length LEN. */
tree
-make_tree_vec (int len)
+make_tree_vec_stat (int len MEM_STAT_DECL)
{
tree t;
int length = (len - 1) * sizeof (tree) + sizeof (struct tree_vec);
@@ -564,9 +564,10 @@ make_tree_vec (int len)
tree_node_sizes[(int) vec_kind] += length;
#endif
- t = ggc_alloc_tree (length);
+ t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT);
memset (t, 0, length);
+
TREE_SET_CODE (t, TREE_VEC);
TREE_VEC_LENGTH (t) = len;
@@ -1024,9 +1025,9 @@ nreverse (tree t)
purpose and value fields are PARM and VALUE. */
tree
-build_tree_list (tree parm, tree value)
+build_tree_list_stat (tree parm, tree value MEM_STAT_DECL)
{
- tree t = make_node (TREE_LIST);
+ tree t = make_node_stat (TREE_LIST PASS_MEM_STAT);
TREE_PURPOSE (t) = parm;
TREE_VALUE (t) = value;
return t;
@@ -1037,11 +1038,12 @@ build_tree_list (tree parm, tree value)
and whose TREE_CHAIN is CHAIN. */
tree
-tree_cons (tree purpose, tree value, tree chain)
+tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL)
{
tree node;
- node = ggc_alloc_tree (sizeof (struct tree_list));
+ node = ggc_alloc_zone_stat (sizeof (struct tree_list),
+ tree_zone PASS_MEM_STAT);
memset (node, 0, sizeof (struct tree_common));
@@ -2296,7 +2298,7 @@ stabilize_reference_1 (tree e)
magic within the build macro. */
tree
-build0 (enum tree_code code, tree tt)
+build0_stat (enum tree_code code, tree tt MEM_STAT_DECL)
{
tree t;
@@ -2305,14 +2307,14 @@ build0 (enum tree_code code, tree tt)
abort ();
#endif
- t = make_node (code);
+ t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
return t;
}
tree
-build1 (enum tree_code code, tree type, tree node)
+build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
{
int length = sizeof (struct tree_exp);
#ifdef GATHER_STATISTICS
@@ -2343,7 +2345,7 @@ build1 (enum tree_code code, tree type, tree node)
abort ();
#endif /* ENABLE_CHECKING */
- t = ggc_alloc_tree (length);
+ t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT);
memset (t, 0, sizeof (struct tree_common));
@@ -2429,7 +2431,7 @@ build1 (enum tree_code code, tree type, tree node)
} while (0)
tree
-build2 (enum tree_code code, tree tt, tree arg0, tree arg1)
+build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
{
bool constant, read_only, side_effects;
tree t;
@@ -2440,7 +2442,7 @@ build2 (enum tree_code code, tree tt, tree arg0, tree arg1)
abort ();
#endif
- t = make_node (code);
+ t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
/* Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the
@@ -2487,7 +2489,8 @@ build2 (enum tree_code code, tree tt, tree arg0, tree arg1)
}
tree
-build3 (enum tree_code code, tree tt, tree arg0, tree arg1, tree arg2)
+build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
+ tree arg2 MEM_STAT_DECL)
{
bool constant, read_only, side_effects;
tree t;
@@ -2508,7 +2511,7 @@ build3 (enum tree_code code, tree tt, tree arg0, tree arg1, tree arg2)
abort ();
#endif
- t = make_node (code);
+ t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
fro = first_rtl_op (code);
@@ -2525,8 +2528,8 @@ build3 (enum tree_code code, tree tt, tree arg0, tree arg1, tree arg2)
}
tree
-build4 (enum tree_code code, tree tt, tree arg0, tree arg1,
- tree arg2, tree arg3)
+build4_stat (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;
@@ -2537,7 +2540,7 @@ build4 (enum tree_code code, tree tt, tree arg0, tree arg1,
abort ();
#endif
- t = make_node (code);
+ t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
fro = first_rtl_op (code);
@@ -2631,11 +2634,11 @@ build_nt (enum tree_code code, ...)
Other slots are initialized to 0 or null pointers. */
tree
-build_decl (enum tree_code code, tree name, tree type)
+build_decl_stat (enum tree_code code, tree name, tree type MEM_STAT_DECL)
{
tree t;
- t = make_node (code);
+ t = make_node_stat (code PASS_MEM_STAT);
/* if (type == error_mark_node)
type = integer_type_node; */