summaryrefslogtreecommitdiff
path: root/gcc/lcm.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-12-09 20:44:49 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2013-12-09 20:44:49 +0000
commit8b1c6fd7166bb33319ebc1d20fd9ca83d39b0079 (patch)
tree65d2e5469314d74be01002d2512b443e3784d8c3 /gcc/lcm.c
parent0a6a6ac91c09c352acf13e491c02a6b8795d3e9a (diff)
Eliminate last_basic_block macro.
* basic-block.h (last_basic_block): Eliminate macro. * asan.c (transform_statements): Eliminate use of last_basic_block in favor of last_basic_block_for_fn, in order to make use of cfun explicit. * bb-reorder.c (copy_bb, reorder_basic_blocks): Likewise. * bt-load.c (compute_defs_uses_and_gen, compute_kill, compute_out, link_btr_uses, build_btr_def_use_webs, migrate_btr_defs): Likewise. * cfg.c (compact_blocks): Likewise. * cfganal.c (mark_dfs_back_edges, control_dependences::control_dependences, post_order_compute, pre_and_rev_post_order_compute_fn, dfs_enumerate_from, compute_idf, single_pred_before_succ_order): Likewise. * cfgbuild.c (make_edges): Likewise. * cfgexpand.c (add_scope_conflicts, gimple_expand_cfg): Likewise. * cfghooks.c (verify_flow_info): Likewise. * cfgloop.c (verify_loop_structure): Likewise. * cfgloopanal.c (just_once_each_iteration_p, mark_irreducible_loops): Likewise. * cfgloopmanip.c (fix_bb_placements, remove_path, update_dominators_in_loop): Likewise. * cfgrtl.c (create_basic_block_structure, rtl_create_basic_block, break_superblocks, rtl_flow_call_edges_add): Likewise. * config/epiphany/resolve-sw-modes.c (resolve_sw_modes): Likewise. * config/frv/frv.c (frv_optimize_membar): Likewise. * config/mips/mips.c (r10k_insert_cache_barriers): Likewise. * config/spu/spu.c (spu_machine_dependent_reorg): Likewise. * cprop.c (compute_local_properties, find_implicit_sets, bypass_conditional_jumps, one_cprop_pass): Likewise. * cse.c (cse_main): Likewise. * df-core.c (rest_of_handle_df_initialize, df_worklist_dataflow, df_analyze, df_grow_bb_info, df_compact_blocks): Likewise. * df-problems.c (df_lr_verify_solution_start, df_live_verify_solution_start, df_md_local_compute): Likewise. * dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree, calc_idoms): Likewise. * domwalk.c (dom_walker::walk): Likewise. * dse.c (dse_step0, dse_step3): Likewise. * function.c (epilogue_done): Likewise. * gcse.c (alloc_gcse_mem, compute_local_properties, prune_insertions_deletions, compute_pre_data, pre_expr_reaches_here_p, one_pre_gcse_pass, compute_code_hoist_vbeinout, should_hoist_expr_to_dom, hoist_code, one_code_hoisting_pass): Likewise. * graph.c (draw_cfg_nodes_no_loops): Likewise. * graphite-sese-to-poly.c (build_scop_bbs): Likewise. * haifa-sched.c (unlink_bb_notes): Likewise. * ipa-split.c (execute_split_functions): Likewise. * ira-build.c (create_loop_tree_nodes, remove_unnecessary_regions): Likewise. * ira-emit.c (ira_emit): Likewise. * ira.c (find_moveable_pseudos, ira): Likewise. * lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete, pre_edge_lcm, compute_available, compute_nearerout, compute_rev_insert_delete, pre_edge_rev_lcm): Likewise. * loop-unroll.c (opt_info_start_duplication, apply_opt_in_copies): Likewise. * lower-subreg.c (decompose_multiword_subregs): Likewise. * lra-lives.c (lra_create_live_ranges): Likewise. * lra.c (lra): Likewise. * mode-switching.c (optimize_mode_switching): Likewise. * recog.c (split_all_insns): Likewise. * regcprop.c (copyprop_hardreg_forward): Likewise. * regrename.c (regrename_analyze): Likewise. * reload1.c (reload): Likewise. * resource.c (init_resource_info): Likewise. * sched-rgn.c (haifa_find_rgns, extend_rgns, compute_trg_info, realloc_bb_state_array, schedule_region, extend_regions): Likewise. * sel-sched-ir.c (sel_extend_global_bb_info, extend_region_bb_info, recompute_rev_top_order, sel_init_pipelining, make_regions_from_the_rest): Likewise. * store-motion.c (remove_reachable_equiv_notes,build_store_vectors) Likewise. * tracer.c (tail_duplicate): Likewise. * trans-mem.c (tm_region_init, get_bb_regions_instrumented): Likewise. * tree-cfg.c (create_bb, cleanup_dead_labels, gimple_dump_cfg, gimple_flow_call_edges_add): Likewise. * tree-cfgcleanup.c (split_bbs_on_noreturn_calls, cleanup_tree_cfg_1): Likewise. * tree-complex.c (tree_lower_complex): Likewise. * tree-inline.c (copy_cfg_body): Likewise. * tree-into-ssa.c (mark_phi_for_rewrite, rewrite_into_ssa, prepare_def_site_for, update_ssa): Likewise. * tree-ssa-dce.c (tree_dce_init, perform_tree_ssa_dce): Likewise. * tree-ssa-dom.c (record_edge_info): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist): Likewise. * tree-ssa-loop-im.c (fill_always_executed_in_1): Likewise. * tree-ssa-loop-manip.c (copy_phi_node_args gimple_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (compute_antic): Likewise. * tree-ssa-propagate.c (ssa_prop_init): Likewise. * tree-ssa-reassoc.c (init_reassoc): Likewise. * tree-ssa-sccvn.c (init_scc_vn): Likewise. * tree-ssa-tail-merge.c (init_worklist): Likewise. * tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise. * tree-stdarg.c (reachable_at_most_once): Likewise. * tree-vrp.c (find_assert_locations): Likewise. * var-tracking.c (vt_find_locations): Likewise. From-SVN: r205826
Diffstat (limited to 'gcc/lcm.c')
-rw-r--r--gcc/lcm.c103
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;