aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-11-24 20:04:04 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-11-24 19:04:04 +0000
commitdeb3dae698b52152c56ec9e271e015f7547d2468 (patch)
treecbddd6bafd673199d9301ff3e023bd7f2712bbb8 /gcc/tree.c
parentd7dc0f8037a3999144177147fb772ab26c2aad6a (diff)
downloadgcc-deb3dae698b52152c56ec9e271e015f7547d2468.zip
gcc-deb3dae698b52152c56ec9e271e015f7547d2468.tar.gz
gcc-deb3dae698b52152c56ec9e271e015f7547d2468.tar.bz2
tree.c (free_node): New function.
* tree.c (free_node): New function. (type_hash_canon): Use it. * tree.h (free_node): Declare. * lto.c (unify_scc): Use free_node. From-SVN: r230833
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 779fe93..2888657 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1103,6 +1103,27 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
return t;
}
+
+/* Free tree node. */
+
+void
+free_node (tree node)
+{
+ enum tree_code code = TREE_CODE (node);
+ if (GATHER_STATISTICS)
+ {
+ tree_code_counts[(int) TREE_CODE (node)]--;
+ tree_node_counts[(int) t_kind]--;
+ tree_node_sizes[(int) t_kind] -= tree_code_size (TREE_CODE (node));
+ }
+ if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
+ vec_free (CONSTRUCTOR_ELTS (node));
+ else if (code == BLOCK)
+ vec_free (BLOCK_NONLOCALIZED_VARS (node));
+ else if (code == TREE_BINFO)
+ vec_free (BINFO_BASE_ACCESSES (node));
+ ggc_free (node);
+}
/* Return a new node with the same contents as NODE except that its
TREE_CHAIN, if it has one, is zero and it has a fresh uid. */
@@ -7100,12 +7121,7 @@ type_hash_canon (unsigned int hashcode, tree type)
{
tree t1 = ((type_hash *) *loc)->type;
gcc_assert (TYPE_MAIN_VARIANT (t1) == t1);
- if (GATHER_STATISTICS)
- {
- tree_code_counts[(int) TREE_CODE (type)]--;
- tree_node_counts[(int) t_kind]--;
- tree_node_sizes[(int) t_kind] -= sizeof (struct tree_type_non_common);
- }
+ free_node (type);
return t1;
}
else