aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 45c9bfe..6f0b7fd 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -77,19 +77,19 @@
been written as independent functions without change. */
-struct var_map_elt
+struct var_map_elt GTY(())
{
tree old;
tree new;
};
-struct nesting_info
+struct nesting_info GTY ((chain_next ("%h.next")))
{
struct nesting_info *outer;
struct nesting_info *inner;
struct nesting_info *next;
- htab_t var_map;
+ htab_t GTY ((param_is (struct var_map_elt))) var_map;
tree context;
tree new_local_var_chain;
tree frame_type;
@@ -288,7 +288,7 @@ lookup_field_for_decl (struct nesting_info *info, tree decl,
insert_field_into_struct (get_frame_type (info), field);
- elt = xmalloc (sizeof (*elt));
+ elt = ggc_alloc (sizeof (*elt));
elt->old = decl;
elt->new = field;
*slot = elt;
@@ -474,7 +474,7 @@ lookup_tramp_for_decl (struct nesting_info *info, tree decl,
insert_field_into_struct (get_frame_type (info), field);
- elt = xmalloc (sizeof (*elt));
+ elt = ggc_alloc (sizeof (*elt));
elt->old = decl;
elt->new = field;
*slot = elt;
@@ -698,8 +698,8 @@ check_for_nested_with_variably_modified (tree fndecl, tree orig_fndecl)
static struct nesting_info *
create_nesting_tree (struct cgraph_node *cgn)
{
- struct nesting_info *info = xcalloc (1, sizeof (*info));
- info->var_map = htab_create (7, var_map_hash, var_map_eq, free);
+ struct nesting_info *info = ggc_calloc (1, sizeof (*info));
+ info->var_map = htab_create_ggc (7, var_map_hash, var_map_eq, ggc_free);
info->context = cgn->decl;
for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
@@ -1108,7 +1108,7 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
/* Enter this association into var_map so that we can insert the new
label into the IL during a second pass. */
- elt = xmalloc (sizeof (*elt));
+ elt = ggc_alloc (sizeof (*elt));
elt->old = label;
elt->new = new_label;
slot = htab_find_slot (i->var_map, elt, INSERT);
@@ -1474,19 +1474,20 @@ free_nesting_tree (struct nesting_info *root)
free_nesting_tree (root->inner);
htab_delete (root->var_map);
next = root->next;
- free (root);
+ ggc_free (root);
root = next;
}
while (root);
}
+static GTY(()) struct nesting_info *root;
+
/* Main entry point for this pass. Process FNDECL and all of its nested
subroutines and turn them into something less tightly bound. */
void
lower_nested_functions (tree fndecl)
{
- struct nesting_info *root;
struct cgraph_node *cgn;
/* If there are no nested functions, there's nothing to do. */
@@ -1502,6 +1503,7 @@ lower_nested_functions (tree fndecl)
convert_all_function_calls (root);
finalize_nesting_tree (root);
free_nesting_tree (root);
+ root = NULL;
}
#include "gt-tree-nested.h"