Commit d55bc081 by Zdenek Dvorak Committed by Zdenek Dvorak

basic-block.h (last_basic_block): Defined as synonym for n_basic_blocks.

	* basic-block.h (last_basic_block): Defined as synonym for
	n_basic_blocks.
	* cfganal.c (mark_dfs_back_edges, flow_reverse_top_sort_order_compute,
	flow_depth_first_order_compute, flow_preorder_transversal_compute,
	flow_dfs_compute_reverse_init): Replaced relevant occurences of
	n_basic_blocks with last_basic_block.
	* cfgbuild.c (make_edges): Likewise.
	* cfgloop.c (flow_loop_scan, flow_loops_find): Likewise.
	* cfgrtl.c (verify_flow_info, purge_all_dead_edges): Likewise.
	* combine.c (combine_instructions): Likewise.
	* df.c (df_alloc, df_analyse_1, df_analyse, iterative_dataflow_sbitmap,
	iterative_dataflow_bitmap): Likewise.
	* dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree,
	calc_idoms, idoms_to_doms): Likewise.
	* flow.c (update_life_info_in_dirty_blocks, free_basic_block_vars):
	Likewise.
	* gcse.c (gcse_main, alloc_gcse_mem, compute_local_properties,
	compute_hash_table, expr_reaches_here_p, one_classic_gcse_pass,
	one_cprop_pass, compute_pre_data, pre_expr_reaches_here_p,
	one_pre_gcse_pass, compute_transpout, delete_null_pointer_checks_1,
	delete_null_pointer_checks, compute_code_hoist_vbeinout,
	hoist_expr_reaches_here_p, hoist_code, one_code_hoisting_pass,
	compute_store_table, build_store_vectors): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ifcvt.c (if_convert): 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, optimize_mode_switching):
	Likewise.
	* predict.c (estimate_probability, process_note_prediction,
	note_prediction_to_br_prob): Likewise.
	* profile.c (GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): Likewise.
	* recog.c (split_all_insns, peephole2_optimize): Likewise.
	* regrename.c (copyprop_hardreg_forward): Likewise.
	* resource.c (init_resource_info): Likewise.
	* sched-rgn.c (build_control_flow, find_rgns, compute_trg_info,
	init_regions, schedule_insns): Likewise.
	* ssa-ccp.c (ssa_const_prop): Likewise.
	* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
	* ssa.c (compute_dominance_frontiers,
	compute_iterated_dominance_frontiers, convert_to_ssa): Likewise.

	* df.c (df_refs_unlink): Fix FOR_EACH_BB usage (in #if 0'ed code)
	* gcse.c (alloc_rd_mem, alloc_avail_expr_mem): Use n_blocks for vector
	sizes consistently.

From-SVN: r53924
parent 71d2c5bd
2002-05-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* basic-block.h (last_basic_block): Defined as synonym for
n_basic_blocks.
* cfganal.c (mark_dfs_back_edges, flow_reverse_top_sort_order_compute,
flow_depth_first_order_compute, flow_preorder_transversal_compute,
flow_dfs_compute_reverse_init): Replaced relevant occurences of
n_basic_blocks with last_basic_block.
* cfgbuild.c (make_edges): Likewise.
* cfgloop.c (flow_loop_scan, flow_loops_find): Likewise.
* cfgrtl.c (verify_flow_info, purge_all_dead_edges): Likewise.
* combine.c (combine_instructions): Likewise.
* df.c (df_alloc, df_analyse_1, df_analyse, iterative_dataflow_sbitmap,
iterative_dataflow_bitmap): Likewise.
* dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree,
calc_idoms, idoms_to_doms): Likewise.
* flow.c (update_life_info_in_dirty_blocks, free_basic_block_vars):
Likewise.
* gcse.c (gcse_main, alloc_gcse_mem, compute_local_properties,
compute_hash_table, expr_reaches_here_p, one_classic_gcse_pass,
one_cprop_pass, compute_pre_data, pre_expr_reaches_here_p,
one_pre_gcse_pass, compute_transpout, delete_null_pointer_checks_1,
delete_null_pointer_checks, compute_code_hoist_vbeinout,
hoist_expr_reaches_here_p, hoist_code, one_code_hoisting_pass,
compute_store_table, build_store_vectors): Likewise.
* haifa-sched.c (sched_init): Likewise.
* ifcvt.c (if_convert): 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, optimize_mode_switching):
Likewise.
* predict.c (estimate_probability, process_note_prediction,
note_prediction_to_br_prob): Likewise.
* profile.c (GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): Likewise.
* recog.c (split_all_insns, peephole2_optimize): Likewise.
* regrename.c (copyprop_hardreg_forward): Likewise.
* resource.c (init_resource_info): Likewise.
* sched-rgn.c (build_control_flow, find_rgns, compute_trg_info,
init_regions, schedule_insns): Likewise.
* ssa-ccp.c (ssa_const_prop): Likewise.
* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
* ssa.c (compute_dominance_frontiers,
compute_iterated_dominance_frontiers, convert_to_ssa): Likewise.
* df.c (df_refs_unlink): Fix FOR_EACH_BB usage (in #if 0'ed code)
* gcse.c (alloc_rd_mem, alloc_avail_expr_mem): Use n_blocks for vector
sizes consistently.
Mon May 27 14:28:12 CEST 2002 Jan Hubicka <jh@suse.cz> Mon May 27 14:28:12 CEST 2002 Jan Hubicka <jh@suse.cz>
* basic-block.h (can_hoist_p, hoist_insn_after, hoist_insn_to_edge): * basic-block.h (can_hoist_p, hoist_insn_after, hoist_insn_to_edge):
......
...@@ -233,6 +233,10 @@ typedef struct basic_block_def { ...@@ -233,6 +233,10 @@ typedef struct basic_block_def {
extern int n_basic_blocks; extern int n_basic_blocks;
/* First free basic block number. */
#define last_basic_block n_basic_blocks
/* Number of edges in the current function. */ /* Number of edges in the current function. */
extern int n_edges; extern int n_edges;
......
...@@ -120,15 +120,15 @@ mark_dfs_back_edges () ...@@ -120,15 +120,15 @@ mark_dfs_back_edges ()
bool found = false; bool found = false;
/* Allocate the preorder and postorder number arrays. */ /* Allocate the preorder and postorder number arrays. */
pre = (int *) xcalloc (n_basic_blocks, sizeof (int)); pre = (int *) xcalloc (last_basic_block, sizeof (int));
post = (int *) xcalloc (n_basic_blocks, sizeof (int)); post = (int *) xcalloc (last_basic_block, sizeof (int));
/* Allocate stack for back-tracking up CFG. */ /* Allocate stack for back-tracking up CFG. */
stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge)); stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
sp = 0; sp = 0;
/* Allocate bitmap to track nodes that have been visited. */ /* Allocate bitmap to track nodes that have been visited. */
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
/* None of the nodes in the CFG have been visited yet. */ /* None of the nodes in the CFG have been visited yet. */
sbitmap_zero (visited); sbitmap_zero (visited);
...@@ -741,7 +741,7 @@ flow_reverse_top_sort_order_compute (rts_order) ...@@ -741,7 +741,7 @@ flow_reverse_top_sort_order_compute (rts_order)
sp = 0; sp = 0;
/* Allocate bitmap to track nodes that have been visited. */ /* Allocate bitmap to track nodes that have been visited. */
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
/* None of the nodes in the CFG have been visited yet. */ /* None of the nodes in the CFG have been visited yet. */
sbitmap_zero (visited); sbitmap_zero (visited);
...@@ -812,7 +812,7 @@ flow_depth_first_order_compute (dfs_order, rc_order) ...@@ -812,7 +812,7 @@ flow_depth_first_order_compute (dfs_order, rc_order)
sp = 0; sp = 0;
/* Allocate bitmap to track nodes that have been visited. */ /* Allocate bitmap to track nodes that have been visited. */
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
/* None of the nodes in the CFG have been visited yet. */ /* None of the nodes in the CFG have been visited yet. */
sbitmap_zero (visited); sbitmap_zero (visited);
...@@ -918,7 +918,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -918,7 +918,7 @@ flow_preorder_transversal_compute (pot_order)
sp = 0; sp = 0;
/* Allocate the tree. */ /* Allocate the tree. */
dfst = (struct dfst_node *) xcalloc (n_basic_blocks, dfst = (struct dfst_node *) xcalloc (last_basic_block,
sizeof (struct dfst_node)); sizeof (struct dfst_node));
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -935,7 +935,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -935,7 +935,7 @@ flow_preorder_transversal_compute (pot_order)
} }
/* Allocate bitmap to track nodes that have been visited. */ /* Allocate bitmap to track nodes that have been visited. */
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
/* None of the nodes in the CFG have been visited yet. */ /* None of the nodes in the CFG have been visited yet. */
sbitmap_zero (visited); sbitmap_zero (visited);
...@@ -1002,7 +1002,7 @@ flow_preorder_transversal_compute (pot_order) ...@@ -1002,7 +1002,7 @@ flow_preorder_transversal_compute (pot_order)
/* Free the tree. */ /* Free the tree. */
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < last_basic_block; i++)
if (dfst[i].node) if (dfst[i].node)
free (dfst[i].node); free (dfst[i].node);
...@@ -1049,7 +1049,7 @@ flow_dfs_compute_reverse_init (data) ...@@ -1049,7 +1049,7 @@ flow_dfs_compute_reverse_init (data)
data->sp = 0; data->sp = 0;
/* Allocate bitmap to track nodes that have been visited. */ /* Allocate bitmap to track nodes that have been visited. */
data->visited_blocks = sbitmap_alloc (n_basic_blocks - (INVALID_BLOCK + 1)); data->visited_blocks = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
/* None of the nodes in the CFG have been visited yet. */ /* None of the nodes in the CFG have been visited yet. */
sbitmap_zero (data->visited_blocks); sbitmap_zero (data->visited_blocks);
......
...@@ -295,8 +295,8 @@ make_edges (label_value_list, min, max, update_p) ...@@ -295,8 +295,8 @@ make_edges (label_value_list, min, max, update_p)
amount of time searching the edge lists for duplicates. */ amount of time searching the edge lists for duplicates. */
if (forced_labels || label_value_list) if (forced_labels || label_value_list)
{ {
edge_cache = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); edge_cache = sbitmap_vector_alloc (last_basic_block, last_basic_block);
sbitmap_vector_zero (edge_cache, n_basic_blocks); sbitmap_vector_zero (edge_cache, last_basic_block);
if (update_p) if (update_p)
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb) FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
......
...@@ -600,7 +600,7 @@ flow_loop_scan (loops, loop, flags) ...@@ -600,7 +600,7 @@ flow_loop_scan (loops, loop, flags)
/* Determine which loop nodes dominate all the exits /* Determine which loop nodes dominate all the exits
of the loop. */ of the loop. */
loop->exits_doms = sbitmap_alloc (n_basic_blocks); loop->exits_doms = sbitmap_alloc (last_basic_block);
sbitmap_copy (loop->exits_doms, loop->nodes); sbitmap_copy (loop->exits_doms, loop->nodes);
for (j = 0; j < loop->num_exits; j++) for (j = 0; j < loop->num_exits; j++)
sbitmap_a_and_b (loop->exits_doms, loop->exits_doms, sbitmap_a_and_b (loop->exits_doms, loop->exits_doms,
...@@ -663,7 +663,7 @@ flow_loops_find (loops, flags) ...@@ -663,7 +663,7 @@ flow_loops_find (loops, flags)
rc_order = NULL; rc_order = NULL;
/* Compute the dominators. */ /* Compute the dominators. */
dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); dom = sbitmap_vector_alloc (last_basic_block, last_basic_block);
calculate_dominance_info (NULL, dom, CDI_DOMINATORS); calculate_dominance_info (NULL, dom, CDI_DOMINATORS);
/* Count the number of loop edges (back edges). This should be the /* Count the number of loop edges (back edges). This should be the
...@@ -705,10 +705,10 @@ flow_loops_find (loops, flags) ...@@ -705,10 +705,10 @@ flow_loops_find (loops, flags)
loops->array loops->array
= (struct loop *) xcalloc (num_loops, sizeof (struct loop)); = (struct loop *) xcalloc (num_loops, sizeof (struct loop));
headers = sbitmap_alloc (n_basic_blocks); headers = sbitmap_alloc (last_basic_block);
sbitmap_zero (headers); sbitmap_zero (headers);
loops->shared_headers = sbitmap_alloc (n_basic_blocks); loops->shared_headers = sbitmap_alloc (last_basic_block);
sbitmap_zero (loops->shared_headers); sbitmap_zero (loops->shared_headers);
/* Find and record information about all the natural loops /* Find and record information about all the natural loops
...@@ -760,7 +760,7 @@ flow_loops_find (loops, flags) ...@@ -760,7 +760,7 @@ flow_loops_find (loops, flags)
SET_BIT (headers, loop->header->index); SET_BIT (headers, loop->header->index);
/* Find nodes contained within the loop. */ /* Find nodes contained within the loop. */
loop->nodes = sbitmap_alloc (n_basic_blocks); loop->nodes = sbitmap_alloc (last_basic_block);
loop->num_nodes loop->num_nodes
= flow_loop_nodes_find (loop->header, loop->latch, loop->nodes); = flow_loop_nodes_find (loop->header, loop->latch, loop->nodes);
......
...@@ -1712,9 +1712,9 @@ verify_flow_info () ...@@ -1712,9 +1712,9 @@ verify_flow_info ()
basic_block bb, last_bb_seen; basic_block bb, last_bb_seen;
bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
last_visited = (basic_block *) xcalloc (n_basic_blocks + 2, last_visited = (basic_block *) xcalloc (last_basic_block + 2,
sizeof (basic_block)); sizeof (basic_block));
edge_checksum = (size_t *) xcalloc (n_basic_blocks + 2, sizeof (size_t)); edge_checksum = (size_t *) xcalloc (last_basic_block + 2, sizeof (size_t));
/* Check bb chain & numbers. */ /* Check bb chain & numbers. */
last_bb_seen = ENTRY_BLOCK_PTR; last_bb_seen = ENTRY_BLOCK_PTR;
...@@ -2317,7 +2317,7 @@ purge_all_dead_edges (update_life_p) ...@@ -2317,7 +2317,7 @@ purge_all_dead_edges (update_life_p)
if (update_life_p) if (update_life_p)
{ {
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (blocks); sbitmap_zero (blocks);
} }
......
...@@ -578,7 +578,7 @@ combine_instructions (f, nregs) ...@@ -578,7 +578,7 @@ combine_instructions (f, nregs)
setup_incoming_promotions (); setup_incoming_promotions ();
refresh_blocks = sbitmap_alloc (n_basic_blocks); refresh_blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (refresh_blocks); sbitmap_zero (refresh_blocks);
need_refresh = 0; need_refresh = 0;
......
...@@ -547,7 +547,7 @@ df_alloc (df, n_regs) ...@@ -547,7 +547,7 @@ df_alloc (df, n_regs)
df->uses = xmalloc (df->use_size * sizeof (*df->uses)); df->uses = xmalloc (df->use_size * sizeof (*df->uses));
df->n_regs = n_regs; df->n_regs = n_regs;
df->n_bbs = n_basic_blocks; df->n_bbs = last_basic_block;
/* Allocate temporary working array used during local dataflow analysis. */ /* Allocate temporary working array used during local dataflow analysis. */
df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *)); df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *));
...@@ -561,7 +561,7 @@ df_alloc (df, n_regs) ...@@ -561,7 +561,7 @@ df_alloc (df, n_regs)
df->flags = 0; df->flags = 0;
df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info)); df->bbs = xcalloc (last_basic_block, sizeof (struct bb_info));
df->all_blocks = BITMAP_XMALLOC (); df->all_blocks = BITMAP_XMALLOC ();
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -2006,9 +2006,9 @@ df_analyse_1 (df, blocks, flags, update) ...@@ -2006,9 +2006,9 @@ df_analyse_1 (df, blocks, flags, update)
df->dfs_order = xmalloc (sizeof(int) * n_basic_blocks); df->dfs_order = xmalloc (sizeof(int) * n_basic_blocks);
df->rc_order = xmalloc (sizeof(int) * n_basic_blocks); df->rc_order = xmalloc (sizeof(int) * n_basic_blocks);
df->rts_order = xmalloc (sizeof(int) * n_basic_blocks); df->rts_order = xmalloc (sizeof(int) * n_basic_blocks);
df->inverse_dfs_map = xmalloc (sizeof(int) * n_basic_blocks); df->inverse_dfs_map = xmalloc (sizeof(int) * last_basic_block);
df->inverse_rc_map = xmalloc (sizeof(int) * n_basic_blocks); df->inverse_rc_map = xmalloc (sizeof(int) * last_basic_block);
df->inverse_rts_map = xmalloc (sizeof(int) * n_basic_blocks); df->inverse_rts_map = xmalloc (sizeof(int) * last_basic_block);
flow_depth_first_order_compute (df->dfs_order, df->rc_order); flow_depth_first_order_compute (df->dfs_order, df->rc_order);
flow_reverse_top_sort_order_compute (df->rts_order); flow_reverse_top_sort_order_compute (df->rts_order);
...@@ -2023,10 +2023,10 @@ df_analyse_1 (df, blocks, flags, update) ...@@ -2023,10 +2023,10 @@ df_analyse_1 (df, blocks, flags, update)
/* Compute the sets of gens and kills for the defs of each bb. */ /* Compute the sets of gens and kills for the defs of each bb. */
df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks); df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
{ {
bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
in[bb->index] = DF_BB_INFO (df, bb)->rd_in; in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
...@@ -2059,10 +2059,10 @@ df_analyse_1 (df, blocks, flags, update) ...@@ -2059,10 +2059,10 @@ df_analyse_1 (df, blocks, flags, update)
uses in each bb. */ uses in each bb. */
df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks); df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
{ {
bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
in[bb->index] = DF_BB_INFO (df, bb)->ru_in; in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
...@@ -2098,10 +2098,10 @@ df_analyse_1 (df, blocks, flags, update) ...@@ -2098,10 +2098,10 @@ df_analyse_1 (df, blocks, flags, update)
/* Compute the sets of defs and uses of live variables. */ /* Compute the sets of defs and uses of live variables. */
df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks); df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
{ {
bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *use = xmalloc (sizeof (bitmap) * last_basic_block);
bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *def = xmalloc (sizeof (bitmap) * last_basic_block);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
in[bb->index] = DF_BB_INFO (df, bb)->lr_in; in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
...@@ -2292,7 +2292,7 @@ df_analyse (df, blocks, flags) ...@@ -2292,7 +2292,7 @@ df_analyse (df, blocks, flags)
/* We could deal with additional basic blocks being created by /* We could deal with additional basic blocks being created by
rescanning everything again. */ rescanning everything again. */
if (df->n_bbs && df->n_bbs != (unsigned int)n_basic_blocks) if (df->n_bbs && df->n_bbs != (unsigned int) last_basic_block)
abort (); abort ();
update = df_modified_p (df, blocks); update = df_modified_p (df, blocks);
...@@ -2402,10 +2402,8 @@ df_refs_unlink (df, blocks) ...@@ -2402,10 +2402,8 @@ df_refs_unlink (df, blocks)
} }
else else
{ {
FOR_EACH_BB (bb, FOR_EACH_BB (bb)
{
df_bb_refs_unlink (df, bb); df_bb_refs_unlink (df, bb);
});
} }
} }
#endif #endif
...@@ -3846,8 +3844,8 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks, ...@@ -3846,8 +3844,8 @@ iterative_dataflow_sbitmap (in, out, gen, kill, blocks,
fibheap_t worklist; fibheap_t worklist;
basic_block bb; basic_block bb;
sbitmap visited, pending; sbitmap visited, pending;
pending = sbitmap_alloc (n_basic_blocks); pending = sbitmap_alloc (last_basic_block);
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
sbitmap_zero (pending); sbitmap_zero (pending);
sbitmap_zero (visited); sbitmap_zero (visited);
worklist = fibheap_new (); worklist = fibheap_new ();
...@@ -3905,8 +3903,8 @@ iterative_dataflow_bitmap (in, out, gen, kill, blocks, ...@@ -3905,8 +3903,8 @@ iterative_dataflow_bitmap (in, out, gen, kill, blocks,
fibheap_t worklist; fibheap_t worklist;
basic_block bb; basic_block bb;
sbitmap visited, pending; sbitmap visited, pending;
pending = sbitmap_alloc (n_basic_blocks); pending = sbitmap_alloc (last_basic_block);
visited = sbitmap_alloc (n_basic_blocks); visited = sbitmap_alloc (last_basic_block);
sbitmap_zero (pending); sbitmap_zero (pending);
sbitmap_zero (visited); sbitmap_zero (visited);
worklist = fibheap_new (); worklist = fibheap_new ();
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
number of the corresponding basic block. Please note, that we include the number of the corresponding basic block. Please note, that we include the
artificial ENTRY_BLOCK (or EXIT_BLOCK in the post-dom case) in our lists to artificial ENTRY_BLOCK (or EXIT_BLOCK in the post-dom case) in our lists to
support multiple entry points. As it has no real basic block index we use support multiple entry points. As it has no real basic block index we use
'n_basic_blocks' for that. Its dfs number is of course 1. */ 'last_basic_block' for that. Its dfs number is of course 1. */
/* Type of Basic Block aka. TBB */ /* Type of Basic Block aka. TBB */
typedef unsigned int TBB; typedef unsigned int TBB;
...@@ -155,7 +155,7 @@ init_dom_info (di) ...@@ -155,7 +155,7 @@ init_dom_info (di)
init_ar (di->set_size, unsigned int, num, 1); init_ar (di->set_size, unsigned int, num, 1);
init_ar (di->set_child, TBB, num, 0); init_ar (di->set_child, TBB, num, 0);
init_ar (di->dfs_order, TBB, (unsigned int) n_basic_blocks + 1, 0); init_ar (di->dfs_order, TBB, (unsigned int) last_basic_block + 1, 0);
init_ar (di->dfs_to_bb, basic_block, num, 0); init_ar (di->dfs_to_bb, basic_block, num, 0);
di->dfsnum = 1; di->dfsnum = 1;
...@@ -271,7 +271,7 @@ calc_dfs_tree_nonrec (di, bb, reverse) ...@@ -271,7 +271,7 @@ calc_dfs_tree_nonrec (di, bb, reverse)
if (bb != en_block) if (bb != en_block)
my_i = di->dfs_order[bb->index]; my_i = di->dfs_order[bb->index];
else else
my_i = di->dfs_order[n_basic_blocks]; my_i = di->dfs_order[last_basic_block];
child_i = di->dfs_order[bn->index] = di->dfsnum++; child_i = di->dfs_order[bn->index] = di->dfsnum++;
di->dfs_to_bb[child_i] = bn; di->dfs_to_bb[child_i] = bn;
di->dfs_parent[child_i] = my_i; di->dfs_parent[child_i] = my_i;
...@@ -314,7 +314,7 @@ calc_dfs_tree (di, reverse) ...@@ -314,7 +314,7 @@ calc_dfs_tree (di, reverse)
{ {
/* The first block is the ENTRY_BLOCK (or EXIT_BLOCK if REVERSE). */ /* The first block is the ENTRY_BLOCK (or EXIT_BLOCK if REVERSE). */
basic_block begin = reverse ? EXIT_BLOCK_PTR : ENTRY_BLOCK_PTR; basic_block begin = reverse ? EXIT_BLOCK_PTR : ENTRY_BLOCK_PTR;
di->dfs_order[n_basic_blocks] = di->dfsnum; di->dfs_order[last_basic_block] = di->dfsnum;
di->dfs_to_bb[di->dfsnum] = begin; di->dfs_to_bb[di->dfsnum] = begin;
di->dfsnum++; di->dfsnum++;
...@@ -493,7 +493,7 @@ calc_idoms (di, reverse) ...@@ -493,7 +493,7 @@ calc_idoms (di, reverse)
e_next = e->pred_next; e_next = e->pred_next;
} }
if (b == en_block) if (b == en_block)
k1 = di->dfs_order[n_basic_blocks]; k1 = di->dfs_order[last_basic_block];
else else
k1 = di->dfs_order[b->index]; k1 = di->dfs_order[b->index];
...@@ -541,10 +541,10 @@ idoms_to_doms (di, dominators) ...@@ -541,10 +541,10 @@ idoms_to_doms (di, dominators)
{ {
TBB i, e_index; TBB i, e_index;
int bb, bb_idom; int bb, bb_idom;
sbitmap_vector_zero (dominators, n_basic_blocks); sbitmap_vector_zero (dominators, last_basic_block);
/* We have to be careful, to not include the ENTRY_BLOCK or EXIT_BLOCK /* We have to be careful, to not include the ENTRY_BLOCK or EXIT_BLOCK
in the list of (post)-doms, so remember that in e_index. */ in the list of (post)-doms, so remember that in e_index. */
e_index = di->dfs_order[n_basic_blocks]; e_index = di->dfs_order[last_basic_block];
for (i = 1; i <= di->nodes; i++) for (i = 1; i <= di->nodes; i++)
{ {
...@@ -576,8 +576,8 @@ idoms_to_doms (di, dominators) ...@@ -576,8 +576,8 @@ idoms_to_doms (di, dominators)
} }
/* The main entry point into this module. IDOM is an integer array with room /* The main entry point into this module. IDOM is an integer array with room
for n_basic_blocks integers, DOMS is a preallocated sbitmap array having for last_basic_block integers, DOMS is a preallocated sbitmap array having
room for n_basic_blocks^2 bits, and POST is true if the caller wants to room for last_basic_block^2 bits, and POST is true if the caller wants to
know post-dominators. know post-dominators.
On return IDOM[i] will be the BB->index of the immediate (post) dominator On return IDOM[i] will be the BB->index of the immediate (post) dominator
......
...@@ -761,7 +761,7 @@ update_life_info_in_dirty_blocks (extent, prop_flags) ...@@ -761,7 +761,7 @@ update_life_info_in_dirty_blocks (extent, prop_flags)
enum update_life_extent extent; enum update_life_extent extent;
int prop_flags; int prop_flags;
{ {
sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks); sbitmap update_life_blocks = sbitmap_alloc (last_basic_block);
int n = 0; int n = 0;
basic_block bb; basic_block bb;
int retval = 0; int retval = 0;
...@@ -797,6 +797,7 @@ free_basic_block_vars (keep_head_end_p) ...@@ -797,6 +797,7 @@ free_basic_block_vars (keep_head_end_p)
VARRAY_FREE (basic_block_info); VARRAY_FREE (basic_block_info);
} }
n_basic_blocks = 0; n_basic_blocks = 0;
last_basic_block = 0;
ENTRY_BLOCK_PTR->aux = NULL; ENTRY_BLOCK_PTR->aux = NULL;
ENTRY_BLOCK_PTR->global_live_at_end = NULL; ENTRY_BLOCK_PTR->global_live_at_end = NULL;
......
...@@ -2384,7 +2384,7 @@ sched_init (dump_file) ...@@ -2384,7 +2384,7 @@ sched_init (dump_file)
{ {
rtx line; rtx line;
line_note_head = (rtx *) xcalloc (n_basic_blocks, sizeof (rtx)); line_note_head = (rtx *) xcalloc (last_basic_block, sizeof (rtx));
/* Save-line-note-head: /* Save-line-note-head:
Determine the line-number at the start of each basic block. Determine the line-number at the start of each basic block.
......
...@@ -2700,7 +2700,7 @@ if_convert (x_life_data_ok) ...@@ -2700,7 +2700,7 @@ if_convert (x_life_data_ok)
post_dominators = NULL; post_dominators = NULL;
if (HAVE_conditional_execution || life_data_ok) if (HAVE_conditional_execution || life_data_ok)
{ {
post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS); calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
} }
if (life_data_ok) if (life_data_ok)
......
...@@ -412,8 +412,8 @@ estimate_probability (loops_info) ...@@ -412,8 +412,8 @@ estimate_probability (loops_info)
basic_block bb; basic_block bb;
int i; int i;
dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
calculate_dominance_info (NULL, dominators, CDI_DOMINATORS); calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS); calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
...@@ -756,7 +756,7 @@ process_note_prediction (bb, heads, dominators, post_dominators, pred, flags) ...@@ -756,7 +756,7 @@ process_note_prediction (bb, heads, dominators, post_dominators, pred, flags)
/* Now find the edge that leads to our branch and aply the prediction. */ /* Now find the edge that leads to our branch and aply the prediction. */
if (y == n_basic_blocks) if (y == last_basic_block)
return; return;
for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next) for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next)
if (e->dest->index >= 0 if (e->dest->index >= 0
...@@ -841,15 +841,15 @@ note_prediction_to_br_prob () ...@@ -841,15 +841,15 @@ note_prediction_to_br_prob ()
add_noreturn_fake_exit_edges (); add_noreturn_fake_exit_edges ();
connect_infinite_loops_to_exit (); connect_infinite_loops_to_exit ();
dominators = xmalloc (sizeof (int) * n_basic_blocks); dominators = xmalloc (sizeof (int) * last_basic_block);
memset (dominators, -1, sizeof (int) * n_basic_blocks); memset (dominators, -1, sizeof (int) * last_basic_block);
post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS); calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
calculate_dominance_info (dominators, NULL, CDI_DOMINATORS); calculate_dominance_info (dominators, NULL, CDI_DOMINATORS);
heads = xmalloc (sizeof (int) * n_basic_blocks); heads = xmalloc (sizeof (int) * last_basic_block);
memset (heads, -1, sizeof (int) * n_basic_blocks); memset (heads, -1, sizeof (int) * last_basic_block);
heads[ENTRY_BLOCK_PTR->next_bb->index] = n_basic_blocks; heads[ENTRY_BLOCK_PTR->next_bb->index] = last_basic_block;
/* Process all prediction notes. */ /* Process all prediction notes. */
......
...@@ -73,11 +73,11 @@ struct bb_info ...@@ -73,11 +73,11 @@ struct bb_info
/* Keep all basic block indexes nonnegative in the gcov output. Index 0 /* Keep all basic block indexes nonnegative in the gcov output. Index 0
is used for entry block, last block exit block. */ is used for entry block, last block exit block. */
#define GCOV_INDEX_TO_BB(i) ((i) == 0 ? ENTRY_BLOCK_PTR \ #define GCOV_INDEX_TO_BB(i) ((i) == 0 ? ENTRY_BLOCK_PTR \
: (((i) == n_basic_blocks + 1) \ : (((i) == last_basic_block + 1) \
? EXIT_BLOCK_PTR : BASIC_BLOCK ((i)-1))) ? EXIT_BLOCK_PTR : BASIC_BLOCK ((i)-1)))
#define BB_TO_GCOV_INDEX(bb) ((bb) == ENTRY_BLOCK_PTR ? 0 \ #define BB_TO_GCOV_INDEX(bb) ((bb) == ENTRY_BLOCK_PTR ? 0 \
: ((bb) == EXIT_BLOCK_PTR \ : ((bb) == EXIT_BLOCK_PTR \
? n_basic_blocks + 1 : (bb)->index + 1)) ? last_basic_block + 1 : (bb)->index + 1))
/* Instantiate the profile info structure. */ /* Instantiate the profile info structure. */
......
...@@ -2729,7 +2729,7 @@ split_all_insns (upd_life) ...@@ -2729,7 +2729,7 @@ split_all_insns (upd_life)
int changed; int changed;
basic_block bb; basic_block bb;
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (blocks); sbitmap_zero (blocks);
changed = 0; changed = 0;
...@@ -3013,7 +3013,7 @@ peephole2_optimize (dump_file) ...@@ -3013,7 +3013,7 @@ peephole2_optimize (dump_file)
live = INITIALIZE_REG_SET (rs_heads[i]); live = INITIALIZE_REG_SET (rs_heads[i]);
#ifdef HAVE_conditional_execution #ifdef HAVE_conditional_execution
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (blocks); sbitmap_zero (blocks);
changed = false; changed = false;
#else #else
......
...@@ -1729,7 +1729,7 @@ copyprop_hardreg_forward () ...@@ -1729,7 +1729,7 @@ copyprop_hardreg_forward ()
need_refresh = false; need_refresh = false;
all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks); all_vd = xmalloc (sizeof (struct value_data) * last_basic_block);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
......
...@@ -1240,7 +1240,7 @@ init_resource_info (epilogue_insn) ...@@ -1240,7 +1240,7 @@ init_resource_info (epilogue_insn)
/* Allocate and initialize the tables used by mark_target_live_regs. */ /* Allocate and initialize the tables used by mark_target_live_regs. */
target_hash_table = (struct target_info **) target_hash_table = (struct target_info **)
xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *));
bb_ticks = (int *) xcalloc (n_basic_blocks, sizeof (int)); bb_ticks = (int *) xcalloc (last_basic_block, sizeof (int));
} }
/* Free up the resources allcated to mark_target_live_regs (). This /* Free up the resources allcated to mark_target_live_regs (). This
......
...@@ -403,8 +403,8 @@ build_control_flow (edge_list) ...@@ -403,8 +403,8 @@ build_control_flow (edge_list)
} }
/* ??? We can kill these soon. */ /* ??? We can kill these soon. */
in_edges = (int *) xcalloc (n_basic_blocks, sizeof (int)); in_edges = (int *) xcalloc (last_basic_block, sizeof (int));
out_edges = (int *) xcalloc (n_basic_blocks, sizeof (int)); out_edges = (int *) xcalloc (last_basic_block, sizeof (int));
edge_table = (haifa_edge *) xcalloc (num_edges, sizeof (haifa_edge)); edge_table = (haifa_edge *) xcalloc (num_edges, sizeof (haifa_edge));
nr_edges = 0; nr_edges = 0;
...@@ -661,23 +661,23 @@ find_rgns (edge_list, dom) ...@@ -661,23 +661,23 @@ find_rgns (edge_list, dom)
STACK, SP and DFS_NR are only used during the first traversal. */ STACK, SP and DFS_NR are only used during the first traversal. */
/* Allocate and initialize variables for the first traversal. */ /* Allocate and initialize variables for the first traversal. */
max_hdr = (int *) xmalloc (n_basic_blocks * sizeof (int)); max_hdr = (int *) xmalloc (last_basic_block * sizeof (int));
dfs_nr = (int *) xcalloc (n_basic_blocks, sizeof (int)); dfs_nr = (int *) xcalloc (last_basic_block, sizeof (int));
stack = (int *) xmalloc (nr_edges * sizeof (int)); stack = (int *) xmalloc (nr_edges * sizeof (int));
inner = sbitmap_alloc (n_basic_blocks); inner = sbitmap_alloc (last_basic_block);
sbitmap_ones (inner); sbitmap_ones (inner);
header = sbitmap_alloc (n_basic_blocks); header = sbitmap_alloc (last_basic_block);
sbitmap_zero (header); sbitmap_zero (header);
passed = sbitmap_alloc (nr_edges); passed = sbitmap_alloc (nr_edges);
sbitmap_zero (passed); sbitmap_zero (passed);
in_queue = sbitmap_alloc (n_basic_blocks); in_queue = sbitmap_alloc (last_basic_block);
sbitmap_zero (in_queue); sbitmap_zero (in_queue);
in_stack = sbitmap_alloc (n_basic_blocks); in_stack = sbitmap_alloc (last_basic_block);
sbitmap_zero (in_stack); sbitmap_zero (in_stack);
for (i = 0; i < n_basic_blocks; i++) for (i = 0; i < n_basic_blocks; i++)
...@@ -1197,8 +1197,8 @@ compute_trg_info (trg) ...@@ -1197,8 +1197,8 @@ compute_trg_info (trg)
add the TO block to the update block list. This list can end add the TO block to the update block list. This list can end
up with a lot of duplicates. We need to weed them out to avoid up with a lot of duplicates. We need to weed them out to avoid
overrunning the end of the bblst_table. */ overrunning the end of the bblst_table. */
update_blocks = (char *) alloca (n_basic_blocks); update_blocks = (char *) alloca (last_basic_block);
memset (update_blocks, 0, n_basic_blocks); memset (update_blocks, 0, last_basic_block);
update_idx = 0; update_idx = 0;
for (j = 0; j < el.nr_members; j++) for (j = 0; j < el.nr_members; j++)
...@@ -2890,8 +2890,8 @@ init_regions () ...@@ -2890,8 +2890,8 @@ init_regions ()
nr_regions = 0; nr_regions = 0;
rgn_table = (region *) xmalloc ((n_basic_blocks) * sizeof (region)); rgn_table = (region *) xmalloc ((n_basic_blocks) * sizeof (region));
rgn_bb_table = (int *) xmalloc ((n_basic_blocks) * sizeof (int)); rgn_bb_table = (int *) xmalloc ((n_basic_blocks) * sizeof (int));
block_to_bb = (int *) xmalloc ((n_basic_blocks) * sizeof (int)); block_to_bb = (int *) xmalloc ((last_basic_block) * sizeof (int));
containing_rgn = (int *) xmalloc ((n_basic_blocks) * sizeof (int)); containing_rgn = (int *) xmalloc ((last_basic_block) * sizeof (int));
/* Compute regions for scheduling. */ /* Compute regions for scheduling. */
if (reload_completed if (reload_completed
...@@ -2912,7 +2912,7 @@ init_regions () ...@@ -2912,7 +2912,7 @@ init_regions ()
sbitmap *dom; sbitmap *dom;
struct edge_list *edge_list; struct edge_list *edge_list;
dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); dom = sbitmap_vector_alloc (last_basic_block, last_basic_block);
/* The scheduler runs after flow; therefore, we can't blindly call /* The scheduler runs after flow; therefore, we can't blindly call
back into find_basic_blocks since doing so could invalidate the back into find_basic_blocks since doing so could invalidate the
...@@ -2953,7 +2953,7 @@ init_regions () ...@@ -2953,7 +2953,7 @@ init_regions ()
if (CHECK_DEAD_NOTES) if (CHECK_DEAD_NOTES)
{ {
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (last_basic_block);
deaths_in_region = (int *) xmalloc (sizeof (int) * nr_regions); deaths_in_region = (int *) xmalloc (sizeof (int) * nr_regions);
/* Remove all death notes from the subroutine. */ /* Remove all death notes from the subroutine. */
for (rgn = 0; rgn < nr_regions; rgn++) for (rgn = 0; rgn < nr_regions; rgn++)
...@@ -3021,12 +3021,12 @@ schedule_insns (dump_file) ...@@ -3021,12 +3021,12 @@ schedule_insns (dump_file)
compute_bb_for_insn (get_max_uid ()); compute_bb_for_insn (get_max_uid ());
any_large_regions = 0; any_large_regions = 0;
large_region_blocks = sbitmap_alloc (n_basic_blocks); large_region_blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (large_region_blocks); sbitmap_zero (large_region_blocks);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
SET_BIT (large_region_blocks, bb->index); SET_BIT (large_region_blocks, bb->index);
blocks = sbitmap_alloc (n_basic_blocks); blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (blocks); sbitmap_zero (blocks);
/* Update life information. For regions consisting of multiple blocks /* Update life information. For regions consisting of multiple blocks
......
...@@ -1016,7 +1016,7 @@ ssa_const_prop () ...@@ -1016,7 +1016,7 @@ ssa_const_prop ()
ssa_edges = sbitmap_alloc (VARRAY_SIZE (ssa_definition)); ssa_edges = sbitmap_alloc (VARRAY_SIZE (ssa_definition));
sbitmap_zero (ssa_edges); sbitmap_zero (ssa_edges);
executable_blocks = sbitmap_alloc (n_basic_blocks); executable_blocks = sbitmap_alloc (last_basic_block);
sbitmap_zero (executable_blocks); sbitmap_zero (executable_blocks);
executable_edges = sbitmap_alloc (NUM_EDGES (edges)); executable_edges = sbitmap_alloc (NUM_EDGES (edges));
......
...@@ -506,7 +506,7 @@ ssa_eliminate_dead_code () ...@@ -506,7 +506,7 @@ ssa_eliminate_dead_code ()
mark_all_insn_unnecessary (); mark_all_insn_unnecessary ();
VARRAY_RTX_INIT (unprocessed_instructions, 64, VARRAY_RTX_INIT (unprocessed_instructions, 64,
"unprocessed instructions"); "unprocessed instructions");
cdbte = control_dependent_block_to_edge_map_create (n_basic_blocks); cdbte = control_dependent_block_to_edge_map_create (last_basic_block);
/* Prepare for use of BLOCK_NUM (). */ /* Prepare for use of BLOCK_NUM (). */
connect_infinite_loops_to_exit (); connect_infinite_loops_to_exit ();
...@@ -514,12 +514,12 @@ ssa_eliminate_dead_code () ...@@ -514,12 +514,12 @@ ssa_eliminate_dead_code ()
compute_bb_for_insn (max_insn_uid); compute_bb_for_insn (max_insn_uid);
/* Compute control dependence. */ /* Compute control dependence. */
pdom = (int *) xmalloc (n_basic_blocks * sizeof (int)); pdom = (int *) xmalloc (last_basic_block * sizeof (int));
for (i = 0; i < n_basic_blocks; ++i) for (i = 0; i < last_basic_block; ++i)
pdom[i] = INVALID_BLOCK; pdom[i] = INVALID_BLOCK;
calculate_dominance_info (pdom, NULL, CDI_POST_DOMINATORS); calculate_dominance_info (pdom, NULL, CDI_POST_DOMINATORS);
/* Assume there is a path from each node to the exit block. */ /* Assume there is a path from each node to the exit block. */
for (i = 0; i < n_basic_blocks; ++i) for (i = 0; i < last_basic_block; ++i)
if (pdom[i] == INVALID_BLOCK) if (pdom[i] == INVALID_BLOCK)
pdom[i] = EXIT_BLOCK; pdom[i] = EXIT_BLOCK;
el = create_edge_list (); el = create_edge_list ();
......
...@@ -559,7 +559,7 @@ compute_dominance_frontiers (frontiers, idom) ...@@ -559,7 +559,7 @@ compute_dominance_frontiers (frontiers, idom)
sbitmap *frontiers; sbitmap *frontiers;
int *idom; int *idom;
{ {
sbitmap done = sbitmap_alloc (n_basic_blocks); sbitmap done = sbitmap_alloc (last_basic_block);
sbitmap_zero (done); sbitmap_zero (done);
compute_dominance_frontiers_1 (frontiers, idom, 0, done); compute_dominance_frontiers_1 (frontiers, idom, 0, done);
...@@ -585,7 +585,7 @@ compute_iterated_dominance_frontiers (idfs, frontiers, evals, nregs) ...@@ -585,7 +585,7 @@ compute_iterated_dominance_frontiers (idfs, frontiers, evals, nregs)
sbitmap worklist; sbitmap worklist;
int reg, passes = 0; int reg, passes = 0;
worklist = sbitmap_alloc (n_basic_blocks); worklist = sbitmap_alloc (last_basic_block);
for (reg = 0; reg < nregs; ++reg) for (reg = 0; reg < nregs; ++reg)
{ {
...@@ -1150,8 +1150,8 @@ convert_to_ssa () ...@@ -1150,8 +1150,8 @@ convert_to_ssa ()
dead code. We'll let the SSA optimizers do that. */ dead code. We'll let the SSA optimizers do that. */
life_analysis (get_insns (), NULL, 0); life_analysis (get_insns (), NULL, 0);
idom = (int *) alloca (n_basic_blocks * sizeof (int)); idom = (int *) alloca (last_basic_block * sizeof (int));
memset ((void *) idom, -1, (size_t) n_basic_blocks * sizeof (int)); memset ((void *) idom, -1, (size_t) last_basic_block * sizeof (int));
calculate_dominance_info (idom, NULL, CDI_DOMINATORS); calculate_dominance_info (idom, NULL, CDI_DOMINATORS);
if (rtl_dump_file) if (rtl_dump_file)
...@@ -1164,13 +1164,13 @@ convert_to_ssa () ...@@ -1164,13 +1164,13 @@ convert_to_ssa ()
/* Compute dominance frontiers. */ /* Compute dominance frontiers. */
dfs = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); dfs = sbitmap_vector_alloc (last_basic_block, last_basic_block);
compute_dominance_frontiers (dfs, idom); compute_dominance_frontiers (dfs, idom);
if (rtl_dump_file) if (rtl_dump_file)
{ {
dump_sbitmap_vector (rtl_dump_file, ";; Dominance Frontiers:", dump_sbitmap_vector (rtl_dump_file, ";; Dominance Frontiers:",
"; Basic Block", dfs, n_basic_blocks); "; Basic Block", dfs, last_basic_block);
fflush (rtl_dump_file); fflush (rtl_dump_file);
} }
...@@ -1178,12 +1178,12 @@ convert_to_ssa () ...@@ -1178,12 +1178,12 @@ convert_to_ssa ()
ssa_max_reg_num = max_reg_num (); ssa_max_reg_num = max_reg_num ();
nregs = ssa_max_reg_num; nregs = ssa_max_reg_num;
evals = sbitmap_vector_alloc (nregs, n_basic_blocks); evals = sbitmap_vector_alloc (nregs, last_basic_block);
find_evaluations (evals, nregs); find_evaluations (evals, nregs);
/* Compute the iterated dominance frontier for each register. */ /* Compute the iterated dominance frontier for each register. */
idfs = sbitmap_vector_alloc (nregs, n_basic_blocks); idfs = sbitmap_vector_alloc (nregs, last_basic_block);
compute_iterated_dominance_frontiers (idfs, dfs, evals, nregs); compute_iterated_dominance_frontiers (idfs, dfs, evals, nregs);
if (rtl_dump_file) if (rtl_dump_file)
......
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