aboutsummaryrefslogtreecommitdiff
path: root/gcc/trans-mem.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2012-12-03 16:11:21 +0000
committerAldy Hernandez <aldyh@redhat.com>2012-12-03 16:11:21 +0000
commit501cf8aa1471c053a12d1d7ede4d6f31d717b1e4 (patch)
tree58fa9f23494cb6c480e17f1f381819513c57e5fe /gcc/trans-mem.c
parent3bbf8f546e3b1cdcd59dcc516cfb6a3b47dddb3b (diff)
PR middle-end/55401
* trans-mem.c (get_tm_region_blocks): Exclude uninstrumented blocks from vector if requested. (collect_bb2reg): Pass new argument to get_tm_region_blocks. (get_bb_regions_instrumented): Add INCLUDE_UNINSTRUMENTED_P argument, and pass it to expand_regions. (execute_tm_mark): Pass new argument to get_bb_regions_instrumented. (execute_tm_edges): Same. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@194099 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/trans-mem.c')
-rw-r--r--gcc/trans-mem.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 0a428fea800..8762ad358bd 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2394,14 +2394,19 @@ expand_block_tm (struct tm_region *region, basic_block bb)
/* Return the list of basic-blocks in REGION.
STOP_AT_IRREVOCABLE_P is true if caller is uninterested in blocks
- following a TM_IRREVOCABLE call. */
+ following a TM_IRREVOCABLE call.
+
+ INCLUDE_UNINSTRUMENTED_P is TRUE if we should include the
+ uninstrumented code path blocks in the list of basic blocks
+ returned, false otherwise. */
static vec<basic_block>
get_tm_region_blocks (basic_block entry_block,
bitmap exit_blocks,
bitmap irr_blocks,
bitmap all_region_blocks,
- bool stop_at_irrevocable_p)
+ bool stop_at_irrevocable_p,
+ bool include_uninstrumented_p = true)
{
vec<basic_block> bbs = vNULL;
unsigned i;
@@ -2427,7 +2432,9 @@ get_tm_region_blocks (basic_block entry_block,
continue;
FOR_EACH_EDGE (e, ei, bb->succs)
- if (!bitmap_bit_p (visited_blocks, e->dest->index))
+ if ((include_uninstrumented_p
+ || !(e->flags & EDGE_TM_UNINSTRUMENTED))
+ && !bitmap_bit_p (visited_blocks, e->dest->index))
{
bitmap_set_bit (visited_blocks, e->dest->index);
bbs.safe_push (e->dest);
@@ -2442,11 +2449,19 @@ get_tm_region_blocks (basic_block entry_block,
return bbs;
}
+// Callback data for collect_bb2reg.
+struct bb2reg_stuff
+{
+ vec<tm_region_p> *bb2reg;
+ bool include_uninstrumented_p;
+};
+
// Callback for expand_regions, collect innermost region data for each bb.
static void *
collect_bb2reg (struct tm_region *region, void *data)
{
- vec<tm_region_p> *bb2reg = (vec<tm_region_p> *) data;
+ struct bb2reg_stuff *stuff = (struct bb2reg_stuff *)data;
+ vec<tm_region_p> *bb2reg = stuff->bb2reg;
vec<basic_block> queue;
unsigned int i;
basic_block bb;
@@ -2455,7 +2470,8 @@ collect_bb2reg (struct tm_region *region, void *data)
region->exit_blocks,
region->irr_blocks,
NULL,
- /*stop_at_irr_p=*/true);
+ /*stop_at_irr_p=*/true,
+ stuff->include_uninstrumented_p);
// We expect expand_region to perform a post-order traversal of the region
// tree. Therefore the last region seen for any bb is the innermost.
@@ -2468,7 +2484,8 @@ collect_bb2reg (struct tm_region *region, void *data)
// Returns a vector, indexed by BB->INDEX, of the innermost tm_region to
// which a basic block belongs. Note that we only consider the instrumented
-// code paths for the region; the uninstrumented code paths are ignored.
+// code paths for the region; the uninstrumented code paths are ignored if
+// INCLUDE_UNINSTRUMENTED_P is false.
//
// ??? This data is very similar to the bb_regions array that is collected
// during tm_region_init. Or, rather, this data is similar to what could
@@ -2489,14 +2506,18 @@ collect_bb2reg (struct tm_region *region, void *data)
// only known instance of this block sharing.
static vec<tm_region_p>
-get_bb_regions_instrumented (bool traverse_clones)
+get_bb_regions_instrumented (bool traverse_clones,
+ bool include_uninstrumented_p)
{
unsigned n = last_basic_block;
+ struct bb2reg_stuff stuff;
vec<tm_region_p> ret;
ret.create (n);
ret.safe_grow_cleared (n);
- expand_regions (all_tm_regions, collect_bb2reg, &ret, traverse_clones);
+ stuff.bb2reg = &ret;
+ stuff.include_uninstrumented_p = include_uninstrumented_p;
+ expand_regions (all_tm_regions, collect_bb2reg, &stuff, traverse_clones);
return ret;
}
@@ -2830,7 +2851,8 @@ execute_tm_mark (void)
tm_log_init ();
vec<tm_region_p> bb_regions
- = get_bb_regions_instrumented (/*traverse_clones=*/true);
+ = get_bb_regions_instrumented (/*traverse_clones=*/true,
+ /*include_uninstrumented_p=*/false);
struct tm_region *r;
unsigned i;
@@ -3004,7 +3026,8 @@ static unsigned int
execute_tm_edges (void)
{
vec<tm_region_p> bb_regions
- = get_bb_regions_instrumented (/*traverse_clones=*/false);
+ = get_bb_regions_instrumented (/*traverse_clones=*/false,
+ /*include_uninstrumented_p=*/true);
struct tm_region *r;
unsigned i;