summaryrefslogtreecommitdiff
path: root/gcc/tree-eh.c
diff options
context:
space:
mode:
authorTrevor Saunders <tsaunders@mozilla.com>2014-09-02 22:46:00 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2014-09-02 22:46:00 +0000
commitb086d5308de0d25444243f482f2f3d1dfd3a9a62 (patch)
treecb4aa8d407cf40f28ef0fcd771f1109d53f44f3c /gcc/tree-eh.c
parent70f0f8b2b1c9bf53b9158e4264bc1e93b963c31e (diff)
downloadgcc-b086d5308de0d25444243f482f2f3d1dfd3a9a62.tar.gz
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. From-SVN: r214834
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r--gcc/tree-eh.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 6c6faf30364..9da8da28b36 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -77,23 +77,12 @@ typedef union {tree *tp; tree t; gimple g;} treemple;
static void
add_stmt_to_eh_lp_fn (struct function *ifun, gimple t, int num)
{
- struct throw_stmt_node *n;
- void **slot;
-
gcc_assert (num != 0);
- n = ggc_alloc<throw_stmt_node> ();
- n->stmt = t;
- n->lp_nr = num;
-
if (!get_eh_throw_stmt_table (ifun))
- set_eh_throw_stmt_table (ifun, htab_create_ggc (31, struct_ptr_hash,
- struct_ptr_eq,
- ggc_free));
+ set_eh_throw_stmt_table (ifun, hash_map<gimple, int>::create_ggc (31));
- slot = htab_find_slot (get_eh_throw_stmt_table (ifun), n, INSERT);
- gcc_assert (!*slot);
- *slot = n;
+ gcc_assert (!get_eh_throw_stmt_table (ifun)->put (t, num));
}
/* Add statement T in the current function (cfun) to EH landing pad NUM. */
@@ -130,22 +119,14 @@ record_stmt_eh_region (eh_region region, gimple t)
bool
remove_stmt_from_eh_lp_fn (struct function *ifun, gimple t)
{
- struct throw_stmt_node dummy;
- void **slot;
-
if (!get_eh_throw_stmt_table (ifun))
return false;
- dummy.stmt = t;
- slot = htab_find_slot (get_eh_throw_stmt_table (ifun), &dummy,
- NO_INSERT);
- if (slot)
- {
- htab_clear_slot (get_eh_throw_stmt_table (ifun), slot);
- return true;
- }
- else
+ if (!get_eh_throw_stmt_table (ifun)->get (t))
return false;
+
+ get_eh_throw_stmt_table (ifun)->remove (t);
+ return true;
}
@@ -166,14 +147,11 @@ remove_stmt_from_eh_lp (gimple t)
int
lookup_stmt_eh_lp_fn (struct function *ifun, gimple t)
{
- struct throw_stmt_node *p, n;
-
if (ifun->eh->throw_stmt_table == NULL)
return 0;
- n.stmt = t;
- p = (struct throw_stmt_node *) htab_find (ifun->eh->throw_stmt_table, &n);
- return p ? p->lp_nr : 0;
+ int *lp_nr = ifun->eh->throw_stmt_table->get (t);
+ return lp_nr ? *lp_nr : 0;
}
/* Likewise, but always use the current function. */