summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 10:44:14 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 10:44:14 +0000
commit5f8841a53d61c9a55417ea55a065ac8627a399e1 (patch)
treee1ee8dbd0c20ebb30d7feede4036d428ac99a76f /gcc/tree-ssa-loop-niter.c
parentd3ddcae48da8039f1dbd63046e922f5cdfbdad36 (diff)
downloadgcc-5f8841a53d61c9a55417ea55a065ac8627a399e1.tar.gz
convert the rest of the users of pointer_map to hash_map
gcc/ * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213703 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 83c1b195843..c95cde84036 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -3108,14 +3108,12 @@ bound_index (vec<widest_int> bounds, const widest_int &bound)
static void
discover_iteration_bound_by_body_walk (struct loop *loop)
{
- pointer_map_t *bb_bounds;
struct nb_iter_bound *elt;
vec<widest_int> bounds = vNULL;
vec<vec<basic_block> > queues = vNULL;
vec<basic_block> queue = vNULL;
ptrdiff_t queue_index;
ptrdiff_t latch_index = 0;
- pointer_map_t *block_priority;
/* Discover what bounds may interest us. */
for (elt = loop->bounds; elt; elt = elt->next)
@@ -3150,7 +3148,7 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
/* For every basic block record the lowest bound that is guaranteed to
terminate the loop. */
- bb_bounds = pointer_map_create ();
+ hash_map<basic_block, ptrdiff_t> bb_bounds;
for (elt = loop->bounds; elt; elt = elt->next)
{
widest_int bound = elt->bound;
@@ -3166,17 +3164,15 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
|| wi::ltu_p (bound, loop->nb_iterations_upper_bound))
{
ptrdiff_t index = bound_index (bounds, bound);
- void **entry = pointer_map_contains (bb_bounds,
- gimple_bb (elt->stmt));
+ ptrdiff_t *entry = bb_bounds.get (gimple_bb (elt->stmt));
if (!entry)
- *pointer_map_insert (bb_bounds,
- gimple_bb (elt->stmt)) = (void *)index;
+ bb_bounds.put (gimple_bb (elt->stmt), index);
else if ((ptrdiff_t)*entry > index)
- *entry = (void *)index;
+ *entry = index;
}
}
- block_priority = pointer_map_create ();
+ hash_map<basic_block, ptrdiff_t> block_priority;
/* Perform shortest path discovery loop->header ... loop->latch.
@@ -3199,7 +3195,7 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
queues.safe_grow_cleared (queue_index + 1);
queue.safe_push (loop->header);
queues[queue_index] = queue;
- *pointer_map_insert (block_priority, loop->header) = (void *)queue_index;
+ block_priority.put (loop->header, queue_index);
for (; queue_index >= 0; queue_index--)
{
@@ -3209,7 +3205,6 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
{
basic_block bb;
ptrdiff_t bound_index = queue_index;
- void **entry;
edge e;
edge_iterator ei;
@@ -3217,20 +3212,19 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
bb = queue.pop ();
/* OK, we later inserted the BB with lower priority, skip it. */
- if ((ptrdiff_t)*pointer_map_contains (block_priority, bb) > queue_index)
+ if (*block_priority.get (bb) > queue_index)
continue;
/* See if we can improve the bound. */
- entry = pointer_map_contains (bb_bounds, bb);
- if (entry && (ptrdiff_t)*entry < bound_index)
- bound_index = (ptrdiff_t)*entry;
+ ptrdiff_t *entry = bb_bounds.get (bb);
+ if (entry && *entry < bound_index)
+ bound_index = *entry;
/* Insert succesors into the queue, watch for latch edge
and record greatest index we saw. */
FOR_EACH_EDGE (e, ei, bb->succs)
{
bool insert = false;
- void **entry;
if (loop_exit_edge_p (loop, e))
continue;
@@ -3238,15 +3232,15 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
if (e == loop_latch_edge (loop)
&& latch_index < bound_index)
latch_index = bound_index;
- else if (!(entry = pointer_map_contains (block_priority, e->dest)))
+ else if (!(entry = block_priority.get (e->dest)))
{
insert = true;
- *pointer_map_insert (block_priority, e->dest) = (void *)bound_index;
+ block_priority.put (e->dest, bound_index);
}
- else if ((ptrdiff_t)*entry < bound_index)
+ else if (*entry < bound_index)
{
insert = true;
- *entry = (void *)bound_index;
+ *entry = bound_index;
}
if (insert)
@@ -3271,8 +3265,6 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
queues.release ();
bounds.release ();
- pointer_map_destroy (bb_bounds);
- pointer_map_destroy (block_priority);
}
/* See if every path cross the loop goes through a statement that is known