From 8f359205089fa4570dd9db058aed35e391ceb357 Mon Sep 17 00:00:00 2001 From: tbsaunde Date: Tue, 2 Sep 2014 22:46:00 +0000 Subject: support ggc hash_map and hash_set gcc/ChangeLog: * alloc-pool.c: Include coretypes.h. * cgraph.h, dbxout.c, dwarf2out.c, except.c, except.h, function.c, function.h, symtab.c, tree-cfg.c, tree-eh.c: Use hash_map and hash_set instead of htab. * ggc-page.c (in_gc): New variable. (ggc_free): Do nothing if a collection is taking place. (ggc_collect): Set in_gc appropriately. * ggc.h (gt_ggc_mx(const char *)): New function. (gt_pch_nx(const char *)): Likewise. (gt_ggc_mx(int)): Likewise. (gt_pch_nx(int)): Likewise. * hash-map.h (hash_map::hash_entry::ggc_mx): Likewise. (hash_map::hash_entry::pch_nx): Likewise. (hash_map::hash_entry::pch_nx_helper): Likewise. (hash_map::hash_map): Adjust. (hash_map::create_ggc): New function. (gt_ggc_mx): Likewise. (gt_pch_nx): Likewise. * hash-set.h (default_hashset_traits::ggc_mx): Likewise. (default_hashset_traits::pch_nx): Likewise. (hash_set::hash_entry::ggc_mx): Likewise. (hash_set::hash_entry::pch_nx): Likewise. (hash_set::hash_entry::pch_nx_helper): Likewise. (hash_set::hash_set): Adjust. (hash_set::create_ggc): New function. (hash_set::elements): Likewise. (gt_ggc_mx): Likewise. (gt_pch_nx): Likewise. * hash-table.h (hash_table::hash_table): Adjust. (hash_table::m_ggc): New member. (hash_table::~hash_table): Adjust. (hash_table::expand): Likewise. (hash_table::empty): Likewise. (gt_ggc_mx): New function. (hashtab_entry_note_pointers): Likewise. (gt_pch_nx): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214834 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/dbxout.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'gcc/dbxout.c') diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 946f1d15e90..d856bddc115 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2484,12 +2484,9 @@ dbxout_expand_expr (tree expr) /* Helper function for output_used_types. Queue one entry from the used types hash to be output. */ -static int -output_used_types_helper (void **slot, void *data) +bool +output_used_types_helper (tree const &type, vec *types_p) { - tree type = (tree) *slot; - vec *types_p = (vec *) data; - if ((TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == QUAL_UNION_TYPE @@ -2502,7 +2499,7 @@ output_used_types_helper (void **slot, void *data) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) types_p->quick_push (TYPE_NAME (type)); - return 1; + return true; } /* This is a qsort callback which sorts types and declarations into a @@ -2544,8 +2541,9 @@ output_used_types (void) int i; tree type; - types.create (htab_elements (cfun->used_types_hash)); - htab_traverse (cfun->used_types_hash, output_used_types_helper, &types); + types.create (cfun->used_types_hash->elements ()); + cfun->used_types_hash->traverse *, output_used_types_helper> + (&types); /* Sort by UID to prevent dependence on hash table ordering. */ types.qsort (output_types_sort); -- cgit v1.2.1