+2013-12-09 David Malcolm <dmalcolm@redhat.com>
+
+ * basic-block.h (FOR_ALL_BB): Eliminate macro.
+
+ * cfg.c (alloc_aux_for_blocks, clear_aux_for_blocks): Replace
+ uses of FOR_ALL_BB with FOR_ALL_BB_FN, making uses of cfun explicit.
+
+ * cfganal.c (inverted_post_order_compute): Likewise.
+ * cfgcleanup.c (try_optimize_cfg): Likewise.
+ * cfgexpand.c (add_scope_conflicts): Likewise.
+ * cfghooks.c (dump_flow_info, account_profile_record): Likewise.
+ * cfgrtl.c (relink_block_chain): Likewise.
+ * dce.c (mark_artificial_uses): Likewise.
+ * df-core.c (df_set_blocks, df_compute_cfg_image, df_dump): Likewise.
+ * df-problems.c (df_lr_verify_solution_start,
+ df_lr_verify_solution_end, df_lr_verify_transfer_functions,
+ df_live_verify_solution_start, df_live_verify_solution_end,
+ df_live_set_all_dirty, df_live_verify_transfer_functions,
+ df_md_local_comput): Likewise.
+ * df-scan.c (df_scan_free_internal, df_scan_alloc)
+ df_reorganize_refs_by_insn, df_scan_verify): Likewise.
+ * dominance.c (compute_dom_fast_query, calculate_dominance_info,
+ free_dominance_info): Likewise.
+ * dse.c (dse_step1, dse_step3, dse_step4, dse_step6): Likewise.
+ * graph.c (draw_cfg_edges): Likewise.
+ * graphite-scop-detection.c (print_graphite_scop_statistics,
+ dot_all_scops_1): Likewise.
+ * graphite.c (print_global_statistics,
+ print_graphite_scop_statistics): Likewise.
+ * ira.c (do_reload): Likewise.
+ * loop-init.c (loop_optimizer_finalize): Likewise.
+ * lto-streamer-in.c (input_function): Likewise.
+ * lto-streamer-out.c (output_function): Likewise.
+ * mcf.c (adjust_cfg_counts): Likewise.
+ * predict.c (estimate_loops): Likewise.
+ * sched-rgn.c (haifa_find_rgns): Likewise.
+ * tree-cfg.c (split_critical_edges): Likewise.
+ * tree-dfa.c (renumber_gimple_stmt_uids): Likewise.
+ * tree-loop-distribution.c (tree_loop_distribution): Likewise.
+ * tree-ssa-pre.c (compute_antic, insert, init_pre): Likewise.
+ * tree-ssa-propagate.c (ssa_prop_init): Likewise.
+ * var-tracking.c (vt_initialize, vt_finalize): Likewise.
+ * vtable-verify.c (vtable_verify_main): Likewise.
+ * web.c (web_main): Likewise.
+
2013-12-09 David Malcolm <dmalcolm@redhat.com>
* basic-block.h (FOR_EACH_BB_REVERSE): Eliminate macro.
/* Cycles through _all_ basic blocks, even the fake ones (entry and
exit block). */
-#define FOR_ALL_BB(BB) \
- for (BB = ENTRY_BLOCK_PTR_FOR_FN (cfun); BB; BB = BB->next_bb)
-
#define FOR_ALL_BB_FN(BB, FN) \
for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb)
{
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
alloc_aux_for_block (bb, size);
}
}
{
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->aux = NULL;
}
bitmap_clear (visited);
/* Put all blocks that have no successor into the initial work list. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
if (EDGE_COUNT (bb->succs) == 0)
{
/* Push the initial edge on to the stack. */
while (changed);
}
- FOR_ALL_BB (b)
+ FOR_ALL_BB_FN (b, cfun)
b->flags &= ~(BB_FORWARDER_BLOCK | BB_NONTHREADABLE_BLOCK);
return changed_overall;
We then do a mostly classical bitmap liveness algorithm. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->aux = BITMAP_ALLOC (&stack_var_bitmap_obstack);
rpo = XNEWVEC (int, last_basic_block_for_fn (cfun));
free (rpo);
BITMAP_FREE (work);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
BITMAP_FREE (bb->aux);
}
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks_for_fn (cfun),
n_edges_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
dump_bb (file, bb, 0, flags);
putc ('\n', file);
int sum;
gcov_type lsum;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& profile_status_for_fn (cfun) != PROFILE_ABSENT)
EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb = prev_bb;
/* Then, clean up the aux fields. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb->aux = NULL;
if (!stay_in_cfglayout_mode)
struct df_link *defs;
df_ref *use_rec;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
for (use_rec = df_get_artificial_uses (bb->index);
*use_rec; use_rec++)
{
basic_block bb;
bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_set_bit (&blocks_to_reset, bb->index);
}
int i;
int * map;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
size += EDGE_COUNT (bb->succs);
}
map = XNEWVEC (int, size);
map[0] = size;
i = 1;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
basic_block bb;
df_dump_start (file);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
df_print_bb_index (bb, file);
df_dump_top (bb, file);
problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_initialize (&problem_data->in[bb->index], &problem_data->lr_bitmaps);
bitmap_initialize (&problem_data->out[bb->index], &problem_data->lr_bitmaps);
in df_lr_finalize for details. */
df_lr->solutions_dirty = false;
else
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LR_IN (bb)))
|| (!bitmap_equal_p (&problem_data->out[bb->index], DF_LR_OUT (bb))))
/* Cannot delete them immediately because you may want to dump them
if the comparison fails. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_clear (&problem_data->in[bb->index]);
bitmap_clear (&problem_data->out[bb->index]);
bitmap_initialize (&saved_use, &bitmap_default_obstack);
bitmap_initialize (&all_blocks, &bitmap_default_obstack);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
struct df_lr_bb_info *bb_info = df_lr_get_bb_info (bb->index);
bitmap_set_bit (&all_blocks, bb->index);
problem_data->in = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
problem_data->out = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_initialize (&problem_data->in[bb->index], &problem_data->live_bitmaps);
bitmap_initialize (&problem_data->out[bb->index], &problem_data->live_bitmaps);
if (!problem_data->out)
return;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if ((!bitmap_equal_p (&problem_data->in[bb->index], DF_LIVE_IN (bb)))
|| (!bitmap_equal_p (&problem_data->out[bb->index], DF_LIVE_OUT (bb))))
/* Cannot delete them immediately because you may want to dump them
if the comparison fails. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_clear (&problem_data->in[bb->index]);
bitmap_clear (&problem_data->out[bb->index]);
df_live_set_all_dirty (void)
{
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_set_bit (df_live->out_of_date_transfer_functions,
bb->index);
}
df_grow_insn_info ();
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
struct df_live_bb_info *bb_info = df_live_get_bb_info (bb->index);
bitmap_set_bit (&all_blocks, bb->index);
bitmap_clear (&seen_in_insn);
frontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (cfun));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_initialize (&frontiers[bb->index], &bitmap_default_obstack);
compute_dominance_frontiers (frontiers);
}
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_clear (&frontiers[bb->index]);
free (frontiers);
}
}
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
df_grow_insn_info ();
df_grow_bb_info (df_scan);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
unsigned int bb_index = bb->index;
struct df_scan_bb_info *bb_info = df_scan_get_bb_info (bb_index);
}
else
{
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
offset = df_reorganize_refs_by_insn_bb (bb, offset, ref_info,
include_defs, include_uses,
include_eq_uses);
clear a mark that has not been set as this means that the ref in
the block or insn was not in the reg chain. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
df_bb_verify (bb);
/* (4) See if all reg chains are traversed a second time. This time
DF_REF_ORDER_BY_REG_WITH_NOTES,
/* Organize the refs in insn order. The insns are ordered within a
- block, and the blocks are ordered by FOR_ALL_BB. */
+ block, and the blocks are ordered by FOR_ALL_BB_FN. */
DF_REF_ORDER_BY_INSN,
/* For uses, the refs within eq notes may be added for
if (dom_computed[dir_index] == DOM_OK)
return;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (!bb->dom[dir_index]->father)
assign_dfs_numbers (bb->dom[dir_index], &num);
{
gcc_assert (!n_bbs_in_dom_tree[dir_index]);
- FOR_ALL_BB (b)
+ FOR_ALL_BB_FN (b, cfun)
{
b->dom[dir_index] = et_new_tree (b);
}
if (!dom_info_available_p (dir))
return;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
et_free_tree_force (bb->dom[dir_index]);
bb->dom[dir_index] = NULL;
bitmap_set_bit (all_blocks, ENTRY_BLOCK);
bitmap_set_bit (all_blocks, EXIT_BLOCK);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
insn_info_t ptr;
bb_info_t bb_info = (bb_info_t) pool_alloc (bb_info_pool);
bitmap_ones (unreachable_blocks);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
if (bb_info->gen)
basic_block bb;
fprintf (dump_file, "\n\n*** Global dataflow info after analysis.\n");
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
{
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb_info_t bb_info = bb_table[bb->index];
insn_info_t insn_info = bb_info->last_insn;
{
basic_block bb;
mark_dfs_back_edges ();
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
draw_cfg_node_succ_edges (pp, fun->funcdef_no, bb);
/* Add an invisible edge from ENTRY to EXIT, to improve the graph layout. */
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
fprintf (file, "digraph all {\n");
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
int part_of_scop = false;
fprintf (file, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator psi;
loop_p loop = bb->loop_father;
loop_optimizer_finalize ();
free_dominance_info (CDI_DOMINATORS);
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->loop_father = NULL;
current_loops = NULL;
loop_optimizer_finalize ();
free_dominance_info (CDI_DOMINATORS);
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bb->loop_father = NULL;
current_loops = NULL;
ggc_free (current_loops);
current_loops = NULL;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bb->loop_father = NULL;
}
/* Fix up the call statements that are mentioned in the callgraph
edges. */
set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
}
}
stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple));
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator bsi = gsi_start_phis (bb);
while (!gsi_end_p (bsi))
virtual PHIs get re-computed on-the-fly which would make numbers
inconsistent. */
set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
}
/* To avoid keeping duplicate gimple IDs in the statements, renumber
virtual phis now. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
sum_edge_counts (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds);
/* Compute edge probabilities. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
if (bb->count)
{
estimate_loops_at_level (current_loops->tree_root->inner);
/* Now propagate the frequencies through all the blocks. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
bitmap_set_bit (tovisit, bb->index);
}
}
/* Reset ->aux field used by EDGE_PASSED. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
edge_iterator ei;
edge e;
expensive. So we want to enable recording of edge to CASE_LABEL_EXPR
mappings around the calls to split_edge. */
start_recording_case_labels ();
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
FOR_EACH_EDGE (e, ei, bb->succs)
{
basic_block bb;
set_gimple_stmt_max_uid (cfun, 0);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator bsi;
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
basic_block bb;
control_dependences *cd = NULL;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator gsi;
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
has_abnormal_preds = sbitmap_alloc (last_basic_block_for_fn (cfun));
bitmap_clear (has_abnormal_preds);
- FOR_ALL_BB (block)
+ FOR_ALL_BB_FN (block, cfun)
{
edge_iterator ei;
edge e;
basic_block bb;
int num_iterations = 0;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
NEW_SETS (bb) = bitmap_set_new ();
while (new_stuff)
/* Clear the NEW sets before the next iteration. We have already
fully propagated its contents. */
if (new_stuff)
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
bitmap_set_free (NEW_SETS (bb));
}
statistics_histogram_event (cfun, "insert iterations", num_iterations);
sizeof (struct bitmap_set), 30);
pre_expr_pool = create_alloc_pool ("pre_expr nodes",
sizeof (struct pre_expr_d), 30);
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
EXP_GEN (bb) = bitmap_set_new ();
PHI_GEN (bb) = bitmap_set_new ();
/* Initially assume that every edge in the CFG is not executable.
(including the edges coming out of the entry block). */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
gimple_stmt_iterator si;
changed_variables.create (10);
/* Init the IN and OUT sets. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
VTI (bb)->visited = false;
VTI (bb)->flooded = false;
VTI (bb)->mos.release ();
}
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
{
dataflow_set_destroy (&VTI (bb)->in);
dataflow_set_destroy (&VTI (bb)->out);
unsigned int ret = 1;
basic_block bb;
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
verify_bb_vtables (bb);
return ret;
df_set_flags (DF_DEFER_INSN_RESCAN);
/* Assign ids to the uses. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
use_entry = XCNEWVEC (struct web_entry, uses_num);
/* Produce the web. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);
/* Update the instruction stream, allocating new registers for split pseudos
in progress. */
- FOR_ALL_BB (bb)
+ FOR_ALL_BB_FN (bb, cfun)
FOR_BB_INSNS (bb, insn)
{
unsigned int uid = INSN_UID (insn);