Commit 50979347 by Trevor Saunders Committed by Trevor Saunders

convert trans-mem to hash_table

gcc/

	* cfgexpand.c, gimple-ssa.h, trans-mem.c: Replace htab with
	hash_table.

From-SVN: r217872
parent 907dadbd
2014-11-20 Trevor Saunders <tsaunders@mozilla.com> 2014-11-20 Trevor Saunders <tsaunders@mozilla.com>
* cfgexpand.c, gimple-ssa.h, trans-mem.c: Replace htab with
hash_table.
2014-11-20 Trevor Saunders <tsaunders@mozilla.com>
* ipa-utils.c, lto-section-in.c, lto-streamer.h, * ipa-utils.c, lto-section-in.c, lto-streamer.h,
tree-scalar-evolution.c: Replace htab with hash_table. tree-scalar-evolution.c: Replace htab with hash_table.
...@@ -2234,16 +2234,16 @@ static void ...@@ -2234,16 +2234,16 @@ static void
mark_transaction_restart_calls (gimple stmt) mark_transaction_restart_calls (gimple stmt)
{ {
struct tm_restart_node dummy; struct tm_restart_node dummy;
void **slot; tm_restart_node **slot;
if (!cfun->gimple_df->tm_restart) if (!cfun->gimple_df->tm_restart)
return; return;
dummy.stmt = stmt; dummy.stmt = stmt;
slot = htab_find_slot (cfun->gimple_df->tm_restart, &dummy, NO_INSERT); slot = cfun->gimple_df->tm_restart->find_slot (&dummy, NO_INSERT);
if (slot) if (slot)
{ {
struct tm_restart_node *n = (struct tm_restart_node *) *slot; struct tm_restart_node *n = *slot;
tree list = n->label_or_list; tree list = n->label_or_list;
rtx_insn *insn; rtx_insn *insn;
...@@ -6062,10 +6062,7 @@ pass_expand::execute (function *fun) ...@@ -6062,10 +6062,7 @@ pass_expand::execute (function *fun)
/* After expanding, the tm_restart map is no longer needed. */ /* After expanding, the tm_restart map is no longer needed. */
if (fun->gimple_df->tm_restart) if (fun->gimple_df->tm_restart)
{ fun->gimple_df->tm_restart = NULL;
htab_delete (fun->gimple_df->tm_restart);
fun->gimple_df->tm_restart = NULL;
}
/* Tag the blocks with a depth number so that change_scope can find /* Tag the blocks with a depth number so that change_scope can find
the common parent easily. */ the common parent easily. */
......
...@@ -28,11 +28,24 @@ along with GCC; see the file COPYING3. If not see ...@@ -28,11 +28,24 @@ along with GCC; see the file COPYING3. If not see
/* This structure is used to map a gimple statement to a label, /* This structure is used to map a gimple statement to a label,
or list of labels to represent transaction restart. */ or list of labels to represent transaction restart. */
struct GTY(()) tm_restart_node { struct GTY((for_user)) tm_restart_node {
gimple stmt; gimple stmt;
tree label_or_list; tree label_or_list;
}; };
/* Hasher for tm_restart_node. */
struct tm_restart_hasher : ggc_hasher<tm_restart_node *>
{
static hashval_t hash (tm_restart_node *n) { return htab_hash_pointer (n); }
static bool
equal (tm_restart_node *a, tm_restart_node *b)
{
return a == b;
}
};
struct ssa_name_hasher : ggc_hasher<tree> struct ssa_name_hasher : ggc_hasher<tree>
{ {
/* Hash a tree in a uid_decl_map. */ /* Hash a tree in a uid_decl_map. */
...@@ -101,7 +114,7 @@ struct GTY(()) gimple_df { ...@@ -101,7 +114,7 @@ struct GTY(()) gimple_df {
/* Map gimple stmt to tree label (or list of labels) for transaction /* Map gimple stmt to tree label (or list of labels) for transaction
restart and abort. */ restart and abort. */
htab_t GTY ((param_is (struct tm_restart_node))) tm_restart; hash_table<tm_restart_hasher> *tm_restart;
}; };
......
...@@ -3109,15 +3109,16 @@ split_bb_make_tm_edge (gimple stmt, basic_block dest_bb, ...@@ -3109,15 +3109,16 @@ split_bb_make_tm_edge (gimple stmt, basic_block dest_bb,
// Record the need for the edge for the benefit of the rtl passes. // Record the need for the edge for the benefit of the rtl passes.
if (cfun->gimple_df->tm_restart == NULL) if (cfun->gimple_df->tm_restart == NULL)
cfun->gimple_df->tm_restart = htab_create_ggc (31, struct_ptr_hash, cfun->gimple_df->tm_restart
struct_ptr_eq, ggc_free); = hash_table<tm_restart_hasher>::create_ggc (31);
struct tm_restart_node dummy; struct tm_restart_node dummy;
dummy.stmt = stmt; dummy.stmt = stmt;
dummy.label_or_list = gimple_block_label (dest_bb); dummy.label_or_list = gimple_block_label (dest_bb);
void **slot = htab_find_slot (cfun->gimple_df->tm_restart, &dummy, INSERT); tm_restart_node **slot = cfun->gimple_df->tm_restart->find_slot (&dummy,
struct tm_restart_node *n = (struct tm_restart_node *) *slot; INSERT);
struct tm_restart_node *n = *slot;
if (n == NULL) if (n == NULL)
{ {
n = ggc_alloc<tm_restart_node> (); n = ggc_alloc<tm_restart_node> ();
...@@ -3196,7 +3197,7 @@ expand_block_edges (struct tm_region *const region, basic_block bb) ...@@ -3196,7 +3197,7 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
if (cfun->gimple_df->tm_restart == NULL) if (cfun->gimple_df->tm_restart == NULL)
cfun->gimple_df->tm_restart cfun->gimple_df->tm_restart
= htab_create_ggc (31, struct_ptr_hash, struct_ptr_eq, ggc_free); = hash_table<tm_restart_hasher>::create_ggc (31);
// All TM builtins have an abnormal edge to the outer-most transaction. // All TM builtins have an abnormal edge to the outer-most transaction.
// We never restart inner transactions. // We never restart inner transactions.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment