Re: [PATCH 1/2] convert the rest of the users of pointer_map to hash_map

2014-08-06 Thread Richard Biener
On Wed, Aug 6, 2014 at 3:28 AM,  tsaund...@mozilla.com wrote:
 From: Trevor Saunders tsaund...@mozilla.com

 hi,

 just what it says on the tin.

 bootstrapped + regtested on x86_64-unknown-linux-gnu, also bootstrapped on
 i686-unknown-linux-gnu, ran config-list.mk, ok?  gcc/

Ok.

Time to remove pointer_map?

Thanks,
Richard.

 Trev

 * hash-map.h (default_hashmap_traits): Adjust overloads of hash
 function to not conflict.
 * alias.c, cfgexpand.c, dse.c, except.h, gimple-expr.c,
 gimple-ssa-strength-reduction.c, gimple-ssa.h, ifcvt.c,
 lto-streamer-out.c, lto-streamer.h, tree-affine.c, tree-affine.h,
 tree-predcom.c, tree-scalar-evolution.c, tree-ssa-loop-im.c,
 tree-ssa-loop-niter.c, tree-ssa.c, value-prof.c: Use hash_map instead
 of pointer_map.

 gcc/cp/

 * cp-tree.h, pt.c: Use hash_map instead of pointer_map.

 gcc/lto/

 * lto-partition.c, lto.c: Use hash_map instead of pointer_map.
 ---
  gcc/alias.c |  5 +--
  gcc/cfgexpand.c | 89 
 +
  gcc/cp/cp-tree.h|  3 +-
  gcc/cp/pt.c | 23 --
  gcc/dse.c   |  5 +--
  gcc/except.h|  1 -
  gcc/gimple-expr.c   |  5 +--
  gcc/gimple-ssa-strength-reduction.c |  2 +-
  gcc/gimple-ssa.h|  3 +-
  gcc/hash-map.h  |  7 +--
  gcc/ifcvt.c | 53 ++
  gcc/lto-streamer-out.c  |  7 +--
  gcc/lto-streamer.h  |  2 +-
  gcc/lto/lto-partition.c | 17 +++
  gcc/lto/lto.c   | 15 +++
  gcc/tree-affine.c   | 28 +---
  gcc/tree-affine.h   |  9 ++--
  gcc/tree-predcom.c  |  2 +-
  gcc/tree-scalar-evolution.c |  2 +-
  gcc/tree-ssa-loop-im.c  |  4 +-
  gcc/tree-ssa-loop-niter.c   | 36 ++-
  gcc/tree-ssa.c  |  2 +-
  gcc/value-prof.c| 42 ++---
  23 files changed, 174 insertions(+), 188 deletions(-)

 diff --git a/gcc/alias.c b/gcc/alias.c
 index 0246dd7..d8e10db 100644
 --- a/gcc/alias.c
 +++ b/gcc/alias.c
 @@ -302,10 +302,9 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem)
 ! is_global_var (base)
 cfun-gimple_df-decls_to_pointers != NULL)
  {
 -  void *namep;
 -  namep = pointer_map_contains (cfun-gimple_df-decls_to_pointers, 
 base);
 +  tree *namep = cfun-gimple_df-decls_to_pointers-get (base);
if (namep)
 -   ref-base = build_simple_mem_ref (*(tree *)namep);
 +   ref-base = build_simple_mem_ref (*namep);
  }

ref-ref_alias_set = MEM_ALIAS_SET (mem);
 diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
 index b20be10..5ac22a2 100644
 --- a/gcc/cfgexpand.c
 +++ b/gcc/cfgexpand.c
 @@ -216,7 +216,7 @@ struct stack_var
  static struct stack_var *stack_vars;
  static size_t stack_vars_alloc;
  static size_t stack_vars_num;
 -static struct pointer_map_t *decl_to_stack_part;
 +static hash_maptree, size_t *decl_to_stack_part;

  /* Conflict bitmaps go on this obstack.  This allows us to destroy
 all of them in one big sweep.  */
 @@ -300,10 +300,10 @@ add_stack_var (tree decl)
 = XRESIZEVEC (struct stack_var, stack_vars, stack_vars_alloc);
  }
if (!decl_to_stack_part)
 -decl_to_stack_part = pointer_map_create ();
 +decl_to_stack_part = new hash_maptree, size_t;

v = stack_vars[stack_vars_num];
 -  * (size_t *)pointer_map_insert (decl_to_stack_part, decl) = stack_vars_num;
 +  decl_to_stack_part-put (decl, stack_vars_num);

v-decl = decl;
v-size = tree_to_uhwi (DECL_SIZE_UNIT (SSAVAR (decl)));
 @@ -375,7 +375,7 @@ visit_op (gimple, tree op, tree, void *data)
 DECL_P (op)
 DECL_RTL_IF_SET (op) == pc_rtx)
  {
 -  size_t *v = (size_t *) pointer_map_contains (decl_to_stack_part, op);
 +  size_t *v = decl_to_stack_part-get (op);
if (v)
 bitmap_set_bit (active, *v);
  }
 @@ -395,8 +395,7 @@ visit_conflict (gimple, tree op, tree, void *data)
 DECL_P (op)
 DECL_RTL_IF_SET (op) == pc_rtx)
  {
 -  size_t *v =
 -   (size_t *) pointer_map_contains (decl_to_stack_part, op);
 +  size_t *v = decl_to_stack_part-get (op);
if (v  bitmap_set_bit (active, *v))
 {
   size_t num = *v;
 @@ -447,8 +446,7 @@ add_scope_conflicts_1 (basic_block bb, bitmap work, bool 
 for_conflict)
   if (TREE_CODE (lhs) != VAR_DECL)
 continue;
   if (DECL_RTL_IF_SET (lhs) == pc_rtx
 -  (v = (size_t *)
 - pointer_map_contains (decl_to_stack_part, lhs)))
 +  (v = decl_to_stack_part-get (lhs)))
 bitmap_clear_bit (work, *v);
 }
else if (!is_gimple_debug (stmt))
 @@ -587,6 +585,26 @@ 

[PATCH 1/2] convert the rest of the users of pointer_map to hash_map

2014-08-05 Thread tsaunders
From: Trevor Saunders tsaund...@mozilla.com

hi,

just what it says on the tin.

bootstrapped + regtested on x86_64-unknown-linux-gnu, also bootstrapped on
i686-unknown-linux-gnu, ran config-list.mk, ok?  gcc/

Trev

* hash-map.h (default_hashmap_traits): Adjust overloads of hash
function to not conflict.
* alias.c, cfgexpand.c, dse.c, except.h, gimple-expr.c,
gimple-ssa-strength-reduction.c, gimple-ssa.h, ifcvt.c,
lto-streamer-out.c, lto-streamer.h, tree-affine.c, tree-affine.h,
tree-predcom.c, tree-scalar-evolution.c, tree-ssa-loop-im.c,
tree-ssa-loop-niter.c, tree-ssa.c, value-prof.c: Use hash_map instead
of pointer_map.

gcc/cp/

* cp-tree.h, pt.c: Use hash_map instead of pointer_map.

gcc/lto/

* lto-partition.c, lto.c: Use hash_map instead of pointer_map.
---
 gcc/alias.c |  5 +--
 gcc/cfgexpand.c | 89 +
 gcc/cp/cp-tree.h|  3 +-
 gcc/cp/pt.c | 23 --
 gcc/dse.c   |  5 +--
 gcc/except.h|  1 -
 gcc/gimple-expr.c   |  5 +--
 gcc/gimple-ssa-strength-reduction.c |  2 +-
 gcc/gimple-ssa.h|  3 +-
 gcc/hash-map.h  |  7 +--
 gcc/ifcvt.c | 53 ++
 gcc/lto-streamer-out.c  |  7 +--
 gcc/lto-streamer.h  |  2 +-
 gcc/lto/lto-partition.c | 17 +++
 gcc/lto/lto.c   | 15 +++
 gcc/tree-affine.c   | 28 +---
 gcc/tree-affine.h   |  9 ++--
 gcc/tree-predcom.c  |  2 +-
 gcc/tree-scalar-evolution.c |  2 +-
 gcc/tree-ssa-loop-im.c  |  4 +-
 gcc/tree-ssa-loop-niter.c   | 36 ++-
 gcc/tree-ssa.c  |  2 +-
 gcc/value-prof.c| 42 ++---
 23 files changed, 174 insertions(+), 188 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index 0246dd7..d8e10db 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -302,10 +302,9 @@ ao_ref_from_mem (ao_ref *ref, const_rtx mem)
! is_global_var (base)
cfun-gimple_df-decls_to_pointers != NULL)
 {
-  void *namep;
-  namep = pointer_map_contains (cfun-gimple_df-decls_to_pointers, base);
+  tree *namep = cfun-gimple_df-decls_to_pointers-get (base);
   if (namep)
-   ref-base = build_simple_mem_ref (*(tree *)namep);
+   ref-base = build_simple_mem_ref (*namep);
 }
 
   ref-ref_alias_set = MEM_ALIAS_SET (mem);
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index b20be10..5ac22a2 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -216,7 +216,7 @@ struct stack_var
 static struct stack_var *stack_vars;
 static size_t stack_vars_alloc;
 static size_t stack_vars_num;
-static struct pointer_map_t *decl_to_stack_part;
+static hash_maptree, size_t *decl_to_stack_part;
 
 /* Conflict bitmaps go on this obstack.  This allows us to destroy
all of them in one big sweep.  */
@@ -300,10 +300,10 @@ add_stack_var (tree decl)
= XRESIZEVEC (struct stack_var, stack_vars, stack_vars_alloc);
 }
   if (!decl_to_stack_part)
-decl_to_stack_part = pointer_map_create ();
+decl_to_stack_part = new hash_maptree, size_t;
 
   v = stack_vars[stack_vars_num];
-  * (size_t *)pointer_map_insert (decl_to_stack_part, decl) = stack_vars_num;
+  decl_to_stack_part-put (decl, stack_vars_num);
 
   v-decl = decl;
   v-size = tree_to_uhwi (DECL_SIZE_UNIT (SSAVAR (decl)));
@@ -375,7 +375,7 @@ visit_op (gimple, tree op, tree, void *data)
DECL_P (op)
DECL_RTL_IF_SET (op) == pc_rtx)
 {
-  size_t *v = (size_t *) pointer_map_contains (decl_to_stack_part, op);
+  size_t *v = decl_to_stack_part-get (op);
   if (v)
bitmap_set_bit (active, *v);
 }
@@ -395,8 +395,7 @@ visit_conflict (gimple, tree op, tree, void *data)
DECL_P (op)
DECL_RTL_IF_SET (op) == pc_rtx)
 {
-  size_t *v =
-   (size_t *) pointer_map_contains (decl_to_stack_part, op);
+  size_t *v = decl_to_stack_part-get (op);
   if (v  bitmap_set_bit (active, *v))
{
  size_t num = *v;
@@ -447,8 +446,7 @@ add_scope_conflicts_1 (basic_block bb, bitmap work, bool 
for_conflict)
  if (TREE_CODE (lhs) != VAR_DECL)
continue;
  if (DECL_RTL_IF_SET (lhs) == pc_rtx
-  (v = (size_t *)
- pointer_map_contains (decl_to_stack_part, lhs)))
+  (v = decl_to_stack_part-get (lhs)))
bitmap_clear_bit (work, *v);
}
   else if (!is_gimple_debug (stmt))
@@ -587,6 +585,26 @@ stack_var_cmp (const void *a, const void *b)
   return 0;
 }
 
+struct part_traits : default_hashmap_traits
+{
+  templatetypename T
+static bool
+is_deleted (T e)
+{ return e.m_value == reinterpret_castvoid * (1); }
+
+