sbitmap.h (sbitmap_iterator, [...]): New.

* sbitmap.h (sbitmap_iterator, sbitmap_iter_init,
	sbitmap_iter_cond, sbitmap_iter_next): New.
	* bt-load.c, cfganal.c, combine.c, ddg.c, flow.c,
	modulo-sched.c, sbitmap.c, sched-rgn.c, tree-into-ssa.c,
	tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Update
	uses of EXECUTE_IF_SET_IN_SBITMAP to the new style.

From-SVN: r100709
This commit is contained in:
Kazu Hirata 2005-06-07 14:30:25 +00:00 committed by Kazu Hirata
parent ac1826887e
commit b6e7e9af04
14 changed files with 225 additions and 119 deletions

View File

@ -1,3 +1,12 @@
2005-06-07 Kazu Hirata <kazu@codesourcery.com>
* sbitmap.h (sbitmap_iterator, sbitmap_iter_init,
sbitmap_iter_cond, sbitmap_iter_next): New.
* bt-load.c, cfganal.c, combine.c, ddg.c, flow.c,
modulo-sched.c, sbitmap.c, sched-rgn.c, tree-into-ssa.c,
tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Update
uses of EXECUTE_IF_SET_IN_SBITMAP to the new style.
2005-06-07 Zdenek Dvorak <dvorakz@suse.cz>
* tree-ssa-address.c: New file.

View File

@ -699,7 +699,8 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
{
/* Find all the reaching defs for this use. */
sbitmap reaching_defs_of_reg = sbitmap_alloc(max_uid);
int uid;
unsigned int uid;
sbitmap_iterator sbi;
if (user->use)
sbitmap_a_and_b (
@ -720,7 +721,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
reaching_defs,
btr_defset[reg - first_btr]);
}
EXECUTE_IF_SET_IN_SBITMAP (reaching_defs_of_reg, 0, uid,
EXECUTE_IF_SET_IN_SBITMAP (reaching_defs_of_reg, 0, uid, sbi)
{
btr_def def = def_array[uid];
@ -752,7 +753,7 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
def->other_btr_uses_after_use = 1;
user->next = def->uses;
def->uses = user;
});
}
sbitmap_free (reaching_defs_of_reg);
}

View File

@ -521,13 +521,15 @@ find_edge_index (struct edge_list *edge_list, basic_block pred, basic_block succ
void
flow_nodes_print (const char *str, const sbitmap nodes, FILE *file)
{
int node;
unsigned int node;
sbitmap_iterator sbi;
if (! nodes)
return;
fprintf (file, "%s { ", str);
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {fprintf (file, "%d ", node);});
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, sbi)
fprintf (file, "%d ", node);
fputs ("}\n", file);
}

View File

@ -639,7 +639,9 @@ combine_instructions (rtx f, unsigned int nregs)
rtx prev;
#endif
int i;
unsigned int j;
rtx links, nextlinks;
sbitmap_iterator sbi;
int new_direct_jump_p = 0;
@ -884,8 +886,8 @@ combine_instructions (rtx f, unsigned int nregs)
}
clear_bb_flags ();
EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i,
BASIC_BLOCK (i)->flags |= BB_DIRTY);
EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, j, sbi)
BASIC_BLOCK (j)->flags |= BB_DIRTY;
new_direct_jump_p |= purge_all_dead_edges ();
delete_noop_moves ();

View File

@ -692,7 +692,8 @@ static ddg_scc_ptr
create_scc (ddg_ptr g, sbitmap nodes)
{
ddg_scc_ptr scc;
int u;
unsigned int u;
sbitmap_iterator sbi;
scc = (ddg_scc_ptr) xmalloc (sizeof (struct ddg_scc));
scc->backarcs = NULL;
@ -701,7 +702,7 @@ create_scc (ddg_ptr g, sbitmap nodes)
sbitmap_copy (scc->nodes, nodes);
/* Mark the backarcs that belong to this SCC. */
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr n = &g->nodes[u];
@ -713,7 +714,7 @@ create_scc (ddg_ptr g, sbitmap nodes)
if (e->distance > 0)
add_backarc_to_scc (scc, e);
}
});
}
set_recurrence_length (scc, g);
return scc;
@ -782,13 +783,14 @@ get_node_of_insn (ddg_ptr g, rtx insn)
void
find_successors (sbitmap succ, ddg_ptr g, sbitmap ops)
{
int i;
unsigned int i;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi)
{
const sbitmap node_succ = NODE_SUCCESSORS (&g->nodes[i]);
sbitmap_a_or_b (succ, succ, node_succ);
});
};
/* We want those that are not in ops. */
sbitmap_difference (succ, succ, ops);
@ -800,13 +802,14 @@ find_successors (sbitmap succ, ddg_ptr g, sbitmap ops)
void
find_predecessors (sbitmap preds, ddg_ptr g, sbitmap ops)
{
int i;
unsigned int i;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi)
{
const sbitmap node_preds = NODE_PREDECESSORS (&g->nodes[i]);
sbitmap_a_or_b (preds, preds, node_preds);
});
};
/* We want those that are not in ops. */
sbitmap_difference (preds, preds, ops);
@ -901,8 +904,11 @@ int
find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to)
{
int answer;
int change, u;
int change;
unsigned int u;
int num_nodes = g->num_nodes;
sbitmap_iterator sbi;
sbitmap workset = sbitmap_alloc (num_nodes);
sbitmap reachable_from = sbitmap_alloc (num_nodes);
sbitmap reach_to = sbitmap_alloc (num_nodes);
@ -917,7 +923,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to)
change = 0;
sbitmap_copy (workset, tmp);
sbitmap_zero (tmp);
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr u_node = &g->nodes[u];
@ -934,7 +940,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to)
change = 1;
}
}
});
}
}
sbitmap_copy (reach_to, to);
@ -946,7 +952,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to)
change = 0;
sbitmap_copy (workset, tmp);
sbitmap_zero (tmp);
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr u_node = &g->nodes[u];
@ -963,7 +969,7 @@ find_nodes_on_paths (sbitmap result, ddg_ptr g, sbitmap from, sbitmap to)
change = 1;
}
}
});
}
}
answer = sbitmap_a_and_b_cg (result, reachable_from, reach_to);
@ -1008,7 +1014,8 @@ update_dist_to_successors (ddg_node_ptr u_node, sbitmap nodes, sbitmap tmp)
int
longest_simple_path (struct ddg * g, int src, int dest, sbitmap nodes)
{
int i, u;
int i;
unsigned int u;
int change = 1;
int result;
int num_nodes = g->num_nodes;
@ -1027,15 +1034,17 @@ longest_simple_path (struct ddg * g, int src, int dest, sbitmap nodes)
while (change)
{
sbitmap_iterator sbi;
change = 0;
sbitmap_copy (workset, tmp);
sbitmap_zero (tmp);
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
change |= update_dist_to_successors (u_node, nodes, tmp);
});
}
}
result = g->nodes[dest].aux.count;
sbitmap_free (workset);

View File

@ -653,7 +653,9 @@ update_life_info (sbitmap blocks, enum update_life_extent extent,
if (blocks)
{
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi)
{
bb = BASIC_BLOCK (i);
@ -662,7 +664,7 @@ update_life_info (sbitmap blocks, enum update_life_extent extent,
if (extent == UPDATE_LIFE_LOCAL)
verify_local_live_at_start (tmp, bb);
});
};
}
else
{
@ -1032,7 +1034,7 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags)
In other words, regs that are set only as part of a COND_EXEC. */
regset *cond_local_sets;
int i;
unsigned int i;
/* Some passes used to forget clear aux field of basic block causing
sick behavior here. */
@ -1406,12 +1408,14 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags)
if (blocks_out)
{
EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i, sbi)
{
basic_block bb = BASIC_BLOCK (i);
FREE_REG_SET (local_sets[bb->index - (INVALID_BLOCK + 1)]);
FREE_REG_SET (cond_local_sets[bb->index - (INVALID_BLOCK + 1)]);
});
};
}
else
{
@ -4355,7 +4359,7 @@ int
count_or_remove_death_notes (sbitmap blocks, int kill)
{
int count = 0;
int i;
unsigned int i;
basic_block bb;
/* This used to be a loop over all the blocks with a membership test
@ -4367,10 +4371,12 @@ count_or_remove_death_notes (sbitmap blocks, int kill)
than an sbitmap. */
if (blocks)
{
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi)
{
count += count_or_remove_death_notes_bb (BASIC_BLOCK (i), kill);
});
};
}
else
{
@ -4450,7 +4456,6 @@ static void
clear_log_links (sbitmap blocks)
{
rtx insn;
int i;
if (!blocks)
{
@ -4459,15 +4464,20 @@ clear_log_links (sbitmap blocks)
free_INSN_LIST_list (&LOG_LINKS (insn));
}
else
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
{
basic_block bb = BASIC_BLOCK (i);
{
unsigned int i;
sbitmap_iterator sbi;
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb));
insn = NEXT_INSN (insn))
if (INSN_P (insn))
free_INSN_LIST_list (&LOG_LINKS (insn));
});
EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i, sbi)
{
basic_block bb = BASIC_BLOCK (i);
for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb));
insn = NEXT_INSN (insn))
if (INSN_P (insn))
free_INSN_LIST_list (&LOG_LINKS (insn));
}
}
}
/* Given a register bitmap, turn on the bits in a HARD_REG_SET that

View File

@ -499,9 +499,10 @@ generate_reg_moves (partial_schedule_ptr ps)
for (i_reg_move = 0; i_reg_move < nreg_moves; i_reg_move++)
{
int i_use;
unsigned int i_use;
rtx new_reg = gen_reg_rtx (GET_MODE (prev_reg));
rtx reg_move = gen_move_insn (new_reg, prev_reg);
sbitmap_iterator sbi;
add_insn_before (reg_move, last_reg_move);
last_reg_move = reg_move;
@ -509,7 +510,7 @@ generate_reg_moves (partial_schedule_ptr ps)
if (!SCHED_FIRST_REG_MOVE (u))
SCHED_FIRST_REG_MOVE (u) = reg_move;
EXECUTE_IF_SET_IN_SBITMAP (uses_of_defs[i_reg_move], 0, i_use,
EXECUTE_IF_SET_IN_SBITMAP (uses_of_defs[i_reg_move], 0, i_use, sbi)
{
struct undo_replace_buff_elem *rep;
@ -528,7 +529,7 @@ generate_reg_moves (partial_schedule_ptr ps)
}
replace_rtx (g->nodes[i_use].insn, old_reg, new_reg);
});
}
prev_reg = new_reg;
}
@ -1842,11 +1843,12 @@ calculate_order_params (ddg_ptr g, int mii ATTRIBUTE_UNUSED)
static int
find_max_asap (ddg_ptr g, sbitmap nodes)
{
int u;
unsigned int u;
int max_asap = -1;
int result = -1;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
@ -1855,19 +1857,20 @@ find_max_asap (ddg_ptr g, sbitmap nodes)
max_asap = ASAP (u_node);
result = u;
}
});
}
return result;
}
static int
find_max_hv_min_mob (ddg_ptr g, sbitmap nodes)
{
int u;
unsigned int u;
int max_hv = -1;
int min_mob = INT_MAX;
int result = -1;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
@ -1883,19 +1886,20 @@ find_max_hv_min_mob (ddg_ptr g, sbitmap nodes)
min_mob = MOB (u_node);
result = u;
}
});
}
return result;
}
static int
find_max_dv_min_mob (ddg_ptr g, sbitmap nodes)
{
int u;
unsigned int u;
int max_dv = -1;
int min_mob = INT_MAX;
int result = -1;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u,
EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
@ -1911,7 +1915,7 @@ find_max_dv_min_mob (ddg_ptr g, sbitmap nodes)
min_mob = MOB (u_node);
result = u;
}
});
}
return result;
}

View File

@ -691,8 +691,10 @@ int
sbitmap_first_set_bit (sbitmap bmap)
{
unsigned int n;
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, { return n; });
EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, sbi)
return n;
return -1;
}

View File

@ -55,36 +55,86 @@ typedef SBITMAP_ELT_TYPE *sbitmap_ptr;
((BITMAP)->elms [(BITNO) / SBITMAP_ELT_BITS] \
&= ~((SBITMAP_ELT_TYPE) 1 << (BITNO) % SBITMAP_ELT_BITS))
/* Loop over all elements of SBITSET, starting with MIN. */
#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, CODE) \
do { \
unsigned int word_num_ = (MIN) / (unsigned int) SBITMAP_ELT_BITS; \
unsigned int bit_num_ = (MIN) % (unsigned int) SBITMAP_ELT_BITS; \
unsigned int size_ = (SBITMAP)->size; \
SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms; \
SBITMAP_ELT_TYPE word_; \
\
if (word_num_ < size_) \
{ \
word_ = ptr_[word_num_] >> bit_num_; \
\
while (1) \
{ \
for (; word_ != 0; word_ >>= 1, bit_num_++) \
{ \
if ((word_ & 1) != 0) \
{ \
(N) = word_num_ * SBITMAP_ELT_BITS + bit_num_; \
CODE; \
} \
} \
word_num_++; \
if (word_num_ >= size_) \
break; \
bit_num_ = 0, word_ = ptr_[word_num_]; \
} \
} \
} while (0)
/* The iterator for sbitmap. */
typedef struct {
/* The pointer to the first word of the bitmap. */
SBITMAP_ELT_TYPE *ptr;
/* The size of the bitmap. */
unsigned int size;
/* The current word index. */
unsigned int word_num;
/* The current bit index. */
unsigned int bit_num;
/* The words currently visited. */
SBITMAP_ELT_TYPE word;
} sbitmap_iterator;
/* Initialize the iterator I with sbitmap BMP and the initial index
MIN. */
static inline void
sbitmap_iter_init (sbitmap_iterator *i, sbitmap bmp, unsigned int min)
{
i->word_num = min / (unsigned int) SBITMAP_ELT_BITS;
i->bit_num = min % (unsigned int) SBITMAP_ELT_BITS;
i->size = bmp->size;
i->ptr = bmp->elms;
if (i->word_num >= i->size)
i->word = 0;
else
i->word = i->ptr[i->word_num] >> i->bit_num;
}
/* Return true if we have more bits to visit, in which case *N is set
to the index of the bit to be visited. Otherwise, return
false. */
static inline bool
sbitmap_iter_cond (sbitmap_iterator *i, unsigned int *n)
{
/* Skip words that are zeros. */
for (; i->word == 0; i->word = i->ptr[i->word_num])
{
i->word_num++;
/* If we have reached the end, break. */
if (i->word_num >= i->size)
return false;
i->bit_num = i->word_num * SBITMAP_ELT_BITS;
}
/* Skip bits that are zero. */
for (; (i->word & 1) == 0; i->word >>= 1)
i->bit_num++;
*n = i->bit_num;
return true;
}
/* Advance to the next bit. */
static inline void
sbitmap_iter_next (sbitmap_iterator *i)
{
i->word >>= 1;
i->bit_num++;
}
/* Loop over all elements of SBITMAP, starting with MIN. In each
iteration, N is set to the index of the bit being visited. ITER is
an instance of sbitmap_iterator used to iterate the bitmap. */
#define EXECUTE_IF_SET_IN_SBITMAP(SBITMAP, MIN, N, ITER) \
for (sbitmap_iter_init (&(ITER), (SBITMAP), (MIN)); \
sbitmap_iter_cond (&(ITER), &(N)); \
sbitmap_iter_next (&(ITER)))
#define EXECUTE_IF_SET_IN_SBITMAP_REV(SBITMAP, N, CODE) \
do { \

View File

@ -351,7 +351,8 @@ is_cfg_nonregular (void)
static void
extract_edgelst (sbitmap set, edgelst *el)
{
int i;
unsigned int i;
sbitmap_iterator sbi;
/* edgelst table space is reused in each call to extract_edgelst. */
edgelst_last = 0;
@ -360,11 +361,11 @@ extract_edgelst (sbitmap set, edgelst *el)
el->nr_members = 0;
/* Iterate over each word in the bitset. */
EXECUTE_IF_SET_IN_SBITMAP (set, 0, i,
{
edgelst_table[edgelst_last++] = rgn_edges[i];
el->nr_members++;
});
EXECUTE_IF_SET_IN_SBITMAP (set, 0, i, sbi)
{
edgelst_table[edgelst_last++] = rgn_edges[i];
el->nr_members++;
}
}
/* Functions for the construction of regions. */

View File

@ -2033,6 +2033,7 @@ prepare_names_to_update (bitmap blocks, bool insert_phi_p)
{
unsigned i;
bitmap_iterator bi;
sbitmap_iterator sbi;
/* If a name N from NEW_SSA_NAMES is also marked to be released,
remove it from NEW_SSA_NAMES so that we don't try to visit its
@ -2046,17 +2047,17 @@ prepare_names_to_update (bitmap blocks, bool insert_phi_p)
/* First process names in NEW_SSA_NAMES. Otherwise, uses of old
names may be considered to be live-in on blocks that contain
definitions for their replacements. */
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i,
prepare_def_site_for (ssa_name (i), blocks, insert_phi_p));
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi)
prepare_def_site_for (ssa_name (i), blocks, insert_phi_p);
/* If an old name is in NAMES_TO_RELEASE, we cannot remove it from
OLD_SSA_NAMES, but we have to ignore its definition site. */
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
{
if (names_to_release == NULL || !bitmap_bit_p (names_to_release, i))
prepare_def_site_for (ssa_name (i), blocks, insert_phi_p);
prepare_use_sites_for (ssa_name (i), blocks, insert_phi_p);
});
}
}
@ -2105,12 +2106,14 @@ dump_update_ssa (FILE *file)
if (new_ssa_names && sbitmap_first_set_bit (new_ssa_names) >= 0)
{
sbitmap_iterator sbi;
fprintf (file, "\nSSA replacement table\n");
fprintf (file, "N_i -> { O_1 ... O_j } means that N_i replaces "
"O_1, ..., O_j\n\n");
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i,
dump_names_replaced_by (file, ssa_name (i)));
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi)
dump_names_replaced_by (file, ssa_name (i));
fprintf (file, "\n");
fprintf (file, "Number of virtual NEW -> OLD mappings: %7u\n",
@ -2346,10 +2349,11 @@ ssa_names_to_replace (void)
{
unsigned i;
bitmap ret;
sbitmap_iterator sbi;
ret = BITMAP_ALLOC (NULL);
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i,
bitmap_set_bit (ret, i));
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
bitmap_set_bit (ret, i);
return ret;
}
@ -2516,6 +2520,7 @@ static void
switch_virtuals_to_full_rewrite (void)
{
unsigned i;
sbitmap_iterator sbi;
if (dump_file)
{
@ -2531,13 +2536,13 @@ switch_virtuals_to_full_rewrite (void)
/* Remove all virtual names from NEW_SSA_NAMES and OLD_SSA_NAMES.
Note that it is not really necessary to remove the mappings from
REPL_TBL, that would only waste time. */
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (new_ssa_names, 0, i, sbi)
if (!is_gimple_reg (ssa_name (i)))
RESET_BIT (new_ssa_names, i));
RESET_BIT (new_ssa_names, i);
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
if (!is_gimple_reg (ssa_name (i)))
RESET_BIT (old_ssa_names, i));
RESET_BIT (old_ssa_names, i);
bitmap_ior_into (syms_to_rename, update_ssa_stats.virtual_symbols);
}
@ -2616,6 +2621,7 @@ update_ssa (unsigned update_flags)
unsigned i;
sbitmap tmp;
bool insert_phi_p;
sbitmap_iterator sbi;
if (!need_ssa_update_p ())
return;
@ -2746,6 +2752,8 @@ update_ssa (unsigned update_flags)
if (sbitmap_first_set_bit (old_ssa_names) >= 0)
{
sbitmap_iterator sbi;
/* insert_update_phi_nodes_for will call add_new_name_mapping
when inserting new PHI nodes, so the set OLD_SSA_NAMES
will grow while we are traversing it (but it will not
@ -2753,9 +2761,9 @@ update_ssa (unsigned update_flags)
for traversal. */
sbitmap tmp = sbitmap_alloc (old_ssa_names->n_bits);
sbitmap_copy (tmp, old_ssa_names);
EXECUTE_IF_SET_IN_SBITMAP (tmp, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (tmp, 0, i, sbi)
insert_updated_phi_nodes_for (ssa_name (i), dfs, blocks,
update_flags));
update_flags);
sbitmap_free (tmp);
}
@ -2776,8 +2784,8 @@ update_ssa (unsigned update_flags)
/* Reset the current definition for name and symbol before renaming
the sub-graph. */
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i,
set_current_def (ssa_name (i), NULL_TREE));
EXECUTE_IF_SET_IN_SBITMAP (old_ssa_names, 0, i, sbi)
set_current_def (ssa_name (i), NULL_TREE);
EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
set_current_def (referenced_var (i), NULL_TREE);

View File

@ -695,6 +695,7 @@ coalesce_ssa_name (var_map map, int flags)
conflict_graph graph;
basic_block bb;
coalesce_list_p cl = NULL;
sbitmap_iterator sbi;
if (num_var_partitions (map) <= 1)
return NULL;
@ -797,7 +798,7 @@ coalesce_ssa_name (var_map map, int flags)
/* Assign root variable as partition representative for each live on entry
partition. */
EXECUTE_IF_SET_IN_SBITMAP (live, 0, x,
EXECUTE_IF_SET_IN_SBITMAP (live, 0, x, sbi)
{
var = root_var (rv, root_var_find (rv, x));
ann = var_ann (var);
@ -817,7 +818,7 @@ coalesce_ssa_name (var_map map, int flags)
change_partition_var (map, var, x);
}
});
}
sbitmap_free (live);

View File

@ -1073,12 +1073,13 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (sbitmap_first_set_bit (may_aliases2) >= 0)
{
size_t k;
unsigned int k;
sbitmap_iterator sbi;
/* Add all the aliases for TAG2 into TAG1's alias set.
FIXME, update grouping heuristic counters. */
EXECUTE_IF_SET_IN_SBITMAP (may_aliases2, 0, k,
add_may_alias (tag1, referenced_var (k)));
EXECUTE_IF_SET_IN_SBITMAP (may_aliases2, 0, k, sbi)
add_may_alias (tag1, referenced_var (k));
sbitmap_a_or_b (may_aliases1, may_aliases1, may_aliases2);
}
else
@ -1133,11 +1134,12 @@ total_alias_vops_cmp (const void *p, const void *q)
static void
group_aliases_into (tree tag, sbitmap tag_aliases, struct alias_info *ai)
{
size_t i;
unsigned int i;
var_ann_t tag_ann = var_ann (tag);
size_t num_tag_refs = VARRAY_UINT (ai->num_references, tag_ann->uid);
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (tag_aliases, 0, i,
EXECUTE_IF_SET_IN_SBITMAP (tag_aliases, 0, i, sbi)
{
tree var = referenced_var (i);
var_ann_t ann = var_ann (var);
@ -1157,7 +1159,7 @@ group_aliases_into (tree tag, sbitmap tag_aliases, struct alias_info *ai)
itself won't be removed. We will merely replace them with
references to TAG. */
ai->total_alias_vops -= num_tag_refs;
});
}
/* We have reduced the number of virtual operands that TAG makes on
behalf of all the variables formerly aliased with it. However,

View File

@ -185,7 +185,8 @@ void
compact_var_map (var_map map, int flags)
{
sbitmap used;
int x, limit, count, tmp, root, root_i;
int tmp, root, root_i;
unsigned int x, limit, count;
tree var;
root_var_p rv = NULL;
@ -238,10 +239,12 @@ compact_var_map (var_map map, int flags)
/* Build a compacted partitioning. */
if (count != limit)
{
sbitmap_iterator sbi;
map->compact_to_partition = (int *)xmalloc (count * sizeof (int));
count = 0;
/* SSA renaming begins at 1, so skip 0 when compacting. */
EXECUTE_IF_SET_IN_SBITMAP (used, 1, x,
EXECUTE_IF_SET_IN_SBITMAP (used, 1, x, sbi)
{
map->partition_to_compact[x] = count;
map->compact_to_partition[count] = x;
@ -249,7 +252,7 @@ compact_var_map (var_map map, int flags)
if (TREE_CODE (var) != SSA_NAME)
change_partition_var (map, var, count);
count++;
});
}
}
else
{
@ -408,9 +411,11 @@ create_ssa_var_map (int flags)
sbitmap_a_and_b (both, used_in_real_ops, used_in_virtual_ops);
if (sbitmap_first_set_bit (both) >= 0)
{
EXECUTE_IF_SET_IN_SBITMAP (both, 0, i,
sbitmap_iterator sbi;
EXECUTE_IF_SET_IN_SBITMAP (both, 0, i, sbi)
fprintf (stderr, "Variable %s used in real and virtual operands\n",
get_name (referenced_var (i))));
get_name (referenced_var (i)));
internal_error ("SSA corruption");
}