+2005-09-02 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR middle-end/23547
+ * tree-nested.c (struct var_map_elt): Mark with GTY.
+ (struct nesting_info): Mark with GTY. Mark var_map's param is struct
+ var_map_elt.
+ (lookup_field_for_decl): Allocate new element in GC memory.
+ (lookup_tramp_for_decl): Likewise.
+ (convert_nl_goto_reference): Likewise
+ (create_nesting_tree): Allocate info in GC memory. Likewise for
+ info->var_map.
+ (free_nesting_tree): Free with ggc_free instead of free.
+ (root): New static variable.
+ (lower_nested_functions): Remove root as local variable. And zero out
+ root at the end of the function.
+
2005-09-02 J"orn Rennecke <joern.rennecke@st.com>
PR rtl-optimization/20365
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;
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;
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;
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)
/* 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);
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. */
convert_all_function_calls (root);
finalize_nesting_tree (root);
free_nesting_tree (root);
+ root = NULL;
}
#include "gt-tree-nested.h"