diff options
Diffstat (limited to 'gcc/lcm.c')
-rw-r--r-- | gcc/lcm.c | 103 |
1 files changed, 60 insertions, 43 deletions
diff --git a/gcc/lcm.c b/gcc/lcm.c index aa63c7272f0..1129d6c65ea 100644 --- a/gcc/lcm.c +++ b/gcc/lcm.c @@ -105,7 +105,7 @@ compute_antinout_edge (sbitmap *antloc, sbitmap *transp, sbitmap *antin, /* We want a maximal solution, so make an optimistic initialization of ANTIN. */ - bitmap_vector_ones (antin, last_basic_block); + bitmap_vector_ones (antin, last_basic_block_for_fn (cfun)); /* Put every block on the worklist; this is necessary because of the optimistic initialization of ANTIN above. */ @@ -330,10 +330,10 @@ compute_laterin (struct edge_list *edge_list, sbitmap *earliest, /* Computation of insertion and deletion points requires computing LATERIN for the EXIT block. We allocated an extra entry in the LATERIN array for just this purpose. */ - bitmap_ones (laterin[last_basic_block]); + bitmap_ones (laterin[last_basic_block_for_fn (cfun)]); FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds) - bitmap_and (laterin[last_basic_block], - laterin[last_basic_block], + bitmap_and (laterin[last_basic_block_for_fn (cfun)], + laterin[last_basic_block_for_fn (cfun)], later[(size_t) e->aux]); clear_aux_for_edges (); @@ -359,7 +359,8 @@ compute_insert_delete (struct edge_list *edge_list, sbitmap *antloc, basic_block b = INDEX_EDGE_SUCC_BB (edge_list, x); if (b == EXIT_BLOCK_PTR_FOR_FN (cfun)) - bitmap_and_compl (insert[x], later[x], laterin[last_basic_block]); + bitmap_and_compl (insert[x], later[x], + laterin[last_basic_block_for_fn (cfun)]); else bitmap_and_compl (insert[x], later[x], laterin[b->index]); } @@ -389,29 +390,35 @@ pre_edge_lcm (int n_exprs, sbitmap *transp, fprintf (dump_file, "Edge List:\n"); verify_edge_list (dump_file, edge_list); print_edge_list (dump_file, edge_list); - dump_bitmap_vector (dump_file, "transp", "", transp, last_basic_block); - dump_bitmap_vector (dump_file, "antloc", "", antloc, last_basic_block); - dump_bitmap_vector (dump_file, "avloc", "", avloc, last_basic_block); - dump_bitmap_vector (dump_file, "kill", "", kill, last_basic_block); + dump_bitmap_vector (dump_file, "transp", "", transp, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "antloc", "", antloc, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "avloc", "", avloc, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "kill", "", kill, + last_basic_block_for_fn (cfun)); } #endif /* Compute global availability. */ - avin = sbitmap_vector_alloc (last_basic_block, n_exprs); - avout = sbitmap_vector_alloc (last_basic_block, n_exprs); + avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); + avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); compute_available (avloc, kill, avout, avin); sbitmap_vector_free (avin); /* Compute global anticipatability. */ - antin = sbitmap_vector_alloc (last_basic_block, n_exprs); - antout = sbitmap_vector_alloc (last_basic_block, n_exprs); + antin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); + antout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); compute_antinout_edge (antloc, transp, antin, antout); #ifdef LCM_DEBUG_INFO if (dump_file) { - dump_bitmap_vector (dump_file, "antin", "", antin, last_basic_block); - dump_bitmap_vector (dump_file, "antout", "", antout, last_basic_block); + dump_bitmap_vector (dump_file, "antin", "", antin, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "antout", "", antout, + last_basic_block_for_fn (cfun)); } #endif @@ -431,13 +438,15 @@ pre_edge_lcm (int n_exprs, sbitmap *transp, later = sbitmap_vector_alloc (num_edges, n_exprs); /* Allocate an extra element for the exit block in the laterin vector. */ - laterin = sbitmap_vector_alloc (last_basic_block + 1, n_exprs); + laterin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun) + 1, + n_exprs); compute_laterin (edge_list, earliest, antloc, later, laterin); #ifdef LCM_DEBUG_INFO if (dump_file) { - dump_bitmap_vector (dump_file, "laterin", "", laterin, last_basic_block + 1); + dump_bitmap_vector (dump_file, "laterin", "", laterin, + last_basic_block_for_fn (cfun) + 1); dump_bitmap_vector (dump_file, "later", "", later, num_edges); } #endif @@ -445,9 +454,9 @@ pre_edge_lcm (int n_exprs, sbitmap *transp, sbitmap_vector_free (earliest); *insert = sbitmap_vector_alloc (num_edges, n_exprs); - *del = sbitmap_vector_alloc (last_basic_block, n_exprs); + *del = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); bitmap_vector_clear (*insert, num_edges); - bitmap_vector_clear (*del, last_basic_block); + bitmap_vector_clear (*del, last_basic_block_for_fn (cfun)); compute_insert_delete (edge_list, antloc, later, laterin, *insert, *del); sbitmap_vector_free (laterin); @@ -458,7 +467,7 @@ pre_edge_lcm (int n_exprs, sbitmap *transp, { dump_bitmap_vector (dump_file, "pre_insert_map", "", *insert, num_edges); dump_bitmap_vector (dump_file, "pre_delete_map", "", *del, - last_basic_block); + last_basic_block_for_fn (cfun)); } #endif @@ -484,7 +493,7 @@ compute_available (sbitmap *avloc, sbitmap *kill, sbitmap *avout, XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun) - NUM_FIXED_BLOCKS); /* We want a maximal solution. */ - bitmap_vector_ones (avout, last_basic_block); + bitmap_vector_ones (avout, last_basic_block_for_fn (cfun)); /* Put every block on the worklist; this is necessary because of the optimistic initialization of AVOUT above. */ @@ -666,10 +675,10 @@ compute_nearerout (struct edge_list *edge_list, sbitmap *farthest, /* Computation of insertion and deletion points requires computing NEAREROUT for the ENTRY block. We allocated an extra entry in the NEAREROUT array for just this purpose. */ - bitmap_ones (nearerout[last_basic_block]); + bitmap_ones (nearerout[last_basic_block_for_fn (cfun)]); FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs) - bitmap_and (nearerout[last_basic_block], - nearerout[last_basic_block], + bitmap_and (nearerout[last_basic_block_for_fn (cfun)], + nearerout[last_basic_block_for_fn (cfun)], nearer[(size_t) e->aux]); clear_aux_for_edges (); @@ -694,7 +703,8 @@ compute_rev_insert_delete (struct edge_list *edge_list, sbitmap *st_avloc, { basic_block b = INDEX_EDGE_PRED_BB (edge_list, x); if (b == ENTRY_BLOCK_PTR_FOR_FN (cfun)) - bitmap_and_compl (insert[x], nearer[x], nearerout[last_basic_block]); + bitmap_and_compl (insert[x], nearer[x], + nearerout[last_basic_block_for_fn (cfun)]); else bitmap_and_compl (insert[x], nearer[x], nearerout[b->index]); } @@ -719,15 +729,15 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp, edge_list = create_edge_list (); num_edges = NUM_EDGES (edge_list); - st_antin = sbitmap_vector_alloc (last_basic_block, n_exprs); - st_antout = sbitmap_vector_alloc (last_basic_block, n_exprs); - bitmap_vector_clear (st_antin, last_basic_block); - bitmap_vector_clear (st_antout, last_basic_block); + st_antin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); + st_antout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); + bitmap_vector_clear (st_antin, last_basic_block_for_fn (cfun)); + bitmap_vector_clear (st_antout, last_basic_block_for_fn (cfun)); compute_antinout_edge (st_antloc, transp, st_antin, st_antout); /* Compute global anticipatability. */ - st_avout = sbitmap_vector_alloc (last_basic_block, n_exprs); - st_avin = sbitmap_vector_alloc (last_basic_block, n_exprs); + st_avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); + st_avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); compute_available (st_avloc, kill, st_avout, st_avin); #ifdef LCM_DEBUG_INFO @@ -736,20 +746,26 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp, fprintf (dump_file, "Edge List:\n"); verify_edge_list (dump_file, edge_list); print_edge_list (dump_file, edge_list); - dump_bitmap_vector (dump_file, "transp", "", transp, last_basic_block); - dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc, last_basic_block); - dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc, last_basic_block); - dump_bitmap_vector (dump_file, "st_antin", "", st_antin, last_basic_block); - dump_bitmap_vector (dump_file, "st_antout", "", st_antout, last_basic_block); - dump_bitmap_vector (dump_file, "st_kill", "", kill, last_basic_block); + dump_bitmap_vector (dump_file, "transp", "", transp, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_avloc", "", st_avloc, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_antloc", "", st_antloc, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_antin", "", st_antin, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_antout", "", st_antout, + last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_kill", "", kill, + last_basic_block_for_fn (cfun)); } #endif #ifdef LCM_DEBUG_INFO if (dump_file) { - dump_bitmap_vector (dump_file, "st_avout", "", st_avout, last_basic_block); - dump_bitmap_vector (dump_file, "st_avin", "", st_avin, last_basic_block); + dump_bitmap_vector (dump_file, "st_avout", "", st_avout, last_basic_block_for_fn (cfun)); + dump_bitmap_vector (dump_file, "st_avin", "", st_avin, last_basic_block_for_fn (cfun)); } #endif @@ -772,14 +788,15 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp, nearer = sbitmap_vector_alloc (num_edges, n_exprs); /* Allocate an extra element for the entry block. */ - nearerout = sbitmap_vector_alloc (last_basic_block + 1, n_exprs); + nearerout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun) + 1, + n_exprs); compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout); #ifdef LCM_DEBUG_INFO if (dump_file) { dump_bitmap_vector (dump_file, "nearerout", "", nearerout, - last_basic_block + 1); + last_basic_block_for_fn (cfun) + 1); dump_bitmap_vector (dump_file, "nearer", "", nearer, num_edges); } #endif @@ -787,7 +804,7 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp, sbitmap_vector_free (farthest); *insert = sbitmap_vector_alloc (num_edges, n_exprs); - *del = sbitmap_vector_alloc (last_basic_block, n_exprs); + *del = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), n_exprs); compute_rev_insert_delete (edge_list, st_avloc, nearer, nearerout, *insert, *del); @@ -799,7 +816,7 @@ pre_edge_rev_lcm (int n_exprs, sbitmap *transp, { dump_bitmap_vector (dump_file, "pre_insert_map", "", *insert, num_edges); dump_bitmap_vector (dump_file, "pre_delete_map", "", *del, - last_basic_block); + last_basic_block_for_fn (cfun)); } #endif return edge_list; |