Commit 6342e53f by Aldy Hernandez Committed by Aldy Hernandez

trans-mem.c: New typedef for tm_region_p.

        * trans-mem.c: New typedef for tm_region_p.
        Define vector types for tm_region_p.
        (tm_region_init): Replace region_worklist to a vector called
        bb_regions.

From-SVN: r185000
parent 877097df
2012-03-06 Aldy Hernandez <aldyh@redhat.com>
* trans-mem.c: New typedef for tm_region_p.
Define vector types for tm_region_p.
(tm_region_init): Replace region_worklist to a vector called
bb_regions.
2012-03-06 Richard Guenther <rguenther@suse.de> 2012-03-06 Richard Guenther <rguenther@suse.de>
* fold-const.c (build_fold_addr_expr_with_type_loc): Fold * fold-const.c (build_fold_addr_expr_with_type_loc): Fold
......
...@@ -1757,6 +1757,10 @@ struct tm_region ...@@ -1757,6 +1757,10 @@ struct tm_region
bitmap irr_blocks; bitmap irr_blocks;
}; };
typedef struct tm_region *tm_region_p;
DEF_VEC_P (tm_region_p);
DEF_VEC_ALLOC_P (tm_region_p, heap);
/* True if there are pending edge statements to be committed for the /* True if there are pending edge statements to be committed for the
current function being scanned in the tmmark pass. */ current function being scanned in the tmmark pass. */
bool pending_edge_inserts_p; bool pending_edge_inserts_p;
...@@ -1858,7 +1862,7 @@ tm_region_init (struct tm_region *region) ...@@ -1858,7 +1862,7 @@ tm_region_init (struct tm_region *region)
VEC(basic_block, heap) *queue = NULL; VEC(basic_block, heap) *queue = NULL;
bitmap visited_blocks = BITMAP_ALLOC (NULL); bitmap visited_blocks = BITMAP_ALLOC (NULL);
struct tm_region *old_region; struct tm_region *old_region;
struct tm_region **region_worklist; VEC(tm_region_p, heap) *bb_regions = NULL;
all_tm_regions = region; all_tm_regions = region;
bb = single_succ (ENTRY_BLOCK_PTR); bb = single_succ (ENTRY_BLOCK_PTR);
...@@ -1866,17 +1870,15 @@ tm_region_init (struct tm_region *region) ...@@ -1866,17 +1870,15 @@ tm_region_init (struct tm_region *region)
/* We could store this information in bb->aux, but we may get called /* We could store this information in bb->aux, but we may get called
through get_all_tm_blocks() from another pass that may be already through get_all_tm_blocks() from another pass that may be already
using bb->aux. */ using bb->aux. */
region_worklist = VEC_safe_grow_cleared (tm_region_p, heap, bb_regions, last_basic_block);
(struct tm_region **) xcalloc (sizeof (struct tm_region *),
last_basic_block + NUM_FIXED_BLOCKS);
VEC_safe_push (basic_block, heap, queue, bb); VEC_safe_push (basic_block, heap, queue, bb);
region_worklist[bb->index] = region; VEC_replace (tm_region_p, bb_regions, bb->index, region);
do do
{ {
bb = VEC_pop (basic_block, queue); bb = VEC_pop (basic_block, queue);
region = region_worklist[bb->index]; region = VEC_index (tm_region_p, bb_regions, bb->index);
region_worklist[bb->index] = NULL; VEC_replace (tm_region_p, bb_regions, bb->index, NULL);
/* Record exit and irrevocable blocks. */ /* Record exit and irrevocable blocks. */
region = tm_region_init_1 (region, bb); region = tm_region_init_1 (region, bb);
...@@ -1898,15 +1900,15 @@ tm_region_init (struct tm_region *region) ...@@ -1898,15 +1900,15 @@ tm_region_init (struct tm_region *region)
the entry block of the new region is associated with this region. the entry block of the new region is associated with this region.
Other successors are still part of the old region. */ Other successors are still part of the old region. */
if (old_region != region && e->dest != region->entry_block) if (old_region != region && e->dest != region->entry_block)
region_worklist[e->dest->index] = old_region; VEC_replace (tm_region_p, bb_regions, e->dest->index, old_region);
else else
region_worklist[e->dest->index] = region; VEC_replace (tm_region_p, bb_regions, e->dest->index, region);
} }
} }
while (!VEC_empty (basic_block, queue)); while (!VEC_empty (basic_block, queue));
VEC_free (basic_block, heap, queue); VEC_free (basic_block, heap, queue);
BITMAP_FREE (visited_blocks); BITMAP_FREE (visited_blocks);
free (region_worklist); VEC_free (tm_region_p, heap, bb_regions);
} }
/* The "gate" function for all transactional memory expansion and optimization /* The "gate" function for all transactional memory expansion and optimization
......
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