+2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
+ * tree.c (struct free_lang_data_d): Add constructor and change
+ types of members to ones that automatically manage resources.
+ (fld_worklist_push): Adjust.
+ (find_decls_types): Likewise.
+ (find_decls_types_in_eh_region): Likewise.
+ (free_lang_data_in_cgraph): Stop manually creating and
+ destroying members of free_lang_data_d.
+
2016-07-13 Uros Bizjak <ubizjak@gmail.com>
PR rtl-optimization/68961
struct free_lang_data_d
{
+ free_lang_data_d () : decls (100), types (100) {}
+
/* Worklist to avoid excessive recursion. */
- vec<tree> worklist;
+ auto_vec<tree> worklist;
/* Set of traversed objects. Used to avoid duplicate visits. */
- hash_set<tree> *pset;
+ hash_set<tree> pset;
/* Array of symbols to process with free_lang_data_in_decl. */
- vec<tree> decls;
+ auto_vec<tree> decls;
/* Array of types to process with free_lang_data_in_type. */
- vec<tree> types;
+ auto_vec<tree> types;
};
static inline void
fld_worklist_push (tree t, struct free_lang_data_d *fld)
{
- if (t && !is_lang_specific (t) && !fld->pset->contains (t))
+ if (t && !is_lang_specific (t) && !fld->pset.contains (t))
fld->worklist.safe_push ((t));
}
{
while (1)
{
- if (!fld->pset->contains (t))
- walk_tree (&t, find_decls_types_r, fld, fld->pset);
+ if (!fld->pset.contains (t))
+ walk_tree (&t, find_decls_types_r, fld, &fld->pset);
if (fld->worklist.is_empty ())
break;
t = fld->worklist.pop ();
for (c = r->u.eh_try.first_catch; c ; c = c->next_catch)
{
c->type_list = get_eh_types_for_runtime (c->type_list);
- walk_tree (&c->type_list, find_decls_types_r, fld, fld->pset);
+ walk_tree (&c->type_list, find_decls_types_r, fld, &fld->pset);
}
}
break;
case ERT_ALLOWED_EXCEPTIONS:
r->u.allowed.type_list
= get_eh_types_for_runtime (r->u.allowed.type_list);
- walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, fld->pset);
+ walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, &fld->pset);
break;
case ERT_MUST_NOT_THROW:
walk_tree (&r->u.must_not_throw.failure_decl,
- find_decls_types_r, fld, fld->pset);
+ find_decls_types_r, fld, &fld->pset);
break;
}
}
unsigned i;
alias_pair *p;
- /* Initialize sets and arrays to store referenced decls and types. */
- fld.pset = new hash_set<tree>;
- fld.worklist.create (0);
- fld.decls.create (100);
- fld.types.create (100);
-
/* Find decls and types in the body of every function in the callgraph. */
FOR_EACH_FUNCTION (n)
find_decls_types_in_node (n, &fld);
FOR_EACH_VEC_ELT (fld.types, i, t)
verify_type (t);
}
-
- delete fld.pset;
- fld.worklist.release ();
- fld.decls.release ();
- fld.types.release ();
}