2012-10-31 Lawrence Crowl <crowl@google.com>
* sbitmap.h (sbitmap_iter_init): Rename bmp_iter_set_init and add
unused parameter to match bitmap iterator. Update callers.
(sbitmap_iter_cond): Rename bmp_iter_set. Update callers.
(sbitmap_iter_next): Rename bmp_iter_next and add unused parameter to
match bitmap iterator. Update callers.
(EXECUTE_IF_SET_IN_SBITMAP_REV): Remove unused.
(EXECUTE_IF_SET_IN_SBITMAP): Rename EXECUTE_IF_SET_IN_BITMAP and
adjust to be identical to the definition in bitmap.h. Conditionalize
the definition based on not having been defined. Update callers.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP): Conditionalize the definition
based on not having been defined. (To match the above.)
===================================================================
@@ -2672,12 +2672,12 @@ prepare_names_to_update (bool insert_phi
/* 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, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (new_ssa_names, 0, i, sbi)
prepare_def_site_for (ssa_name (i), 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, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (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), insert_phi_p);
@@ -2737,7 +2737,7 @@ dump_update_ssa (FILE *file)
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, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (new_ssa_names, 0, i, sbi)
dump_names_replaced_by (file, ssa_name (i));
}
@@ -3241,7 +3241,7 @@ update_ssa (unsigned update_flags)
for traversal. */
sbitmap tmp = sbitmap_alloc (SBITMAP_SIZE (old_ssa_names));
bitmap_copy (tmp, old_ssa_names);
- EXECUTE_IF_SET_IN_SBITMAP (tmp, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, sbi)
insert_updated_phi_nodes_for (ssa_name (i), dfs, blocks_to_update,
update_flags);
sbitmap_free (tmp);
@@ -3265,7 +3265,7 @@ 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, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (old_ssa_names, 0, i, sbi)
get_ssa_name_ann (ssa_name (i))->info.current_def = NULL_TREE;
FOR_EACH_VEC_ELT (tree, symbols_to_rename, i, sym)
===================================================================
@@ -656,7 +656,7 @@ bitmap_first_set_bit (const_sbitmap bmap
unsigned int n = 0;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (bmap, 0, n, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (bmap, 0, n, sbi)
return n;
return -1;
}
===================================================================
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3.
* cardinality : sbitmap_popcount
* choose_one : bitmap_first_set_bit /
bitmap_last_set_bit
- * forall : EXECUTE_IF_SET_IN_SBITMAP
+ * forall : EXECUTE_IF_SET_IN_BITMAP
* set_copy : bitmap_copy / bitmap_copy_n
* set_intersection : bitmap_and
* set_union : bitmap_ior
@@ -177,7 +177,8 @@ typedef struct {
MIN. */
static inline void
-sbitmap_iter_init (sbitmap_iterator *i, const_sbitmap bmp, unsigned int min)
+bmp_iter_set_init (sbitmap_iterator *i, const_sbitmap bmp,
+ unsigned int min, unsigned *bit_no ATTRIBUTE_UNUSED)
{
i->word_num = min / (unsigned int) SBITMAP_ELT_BITS;
i->bit_num = min;
@@ -196,7 +197,7 @@ sbitmap_iter_init (sbitmap_iterator *i,
false. */
static inline bool
-sbitmap_iter_cond (sbitmap_iterator *i, unsigned int *n)
+bmp_iter_set (sbitmap_iterator *i, unsigned int *n)
{
/* Skip words that are zeros. */
for (; i->word == 0; i->word = i->ptr[i->word_num])
@@ -222,7 +223,7 @@ sbitmap_iter_cond (sbitmap_iterator *i,
/* Advance to the next bit. */
static inline void
-sbitmap_iter_next (sbitmap_iterator *i)
+bmp_iter_next (sbitmap_iterator *i, unsigned *bit_no ATTRIBUTE_UNUSED)
{
i->word >>= 1;
i->bit_num++;
@@ -232,38 +233,13 @@ sbitmap_iter_next (sbitmap_iterator *i)
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 { \
- unsigned int word_num_; \
- unsigned int bit_num_; \
- unsigned int size_ = (SBITMAP)->size; \
- SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms; \
- \
- for (word_num_ = size_; word_num_ > 0; word_num_--) \
- { \
- SBITMAP_ELT_TYPE word_ = ptr_[word_num_ - 1]; \
- \
- if (word_ != 0) \
- for (bit_num_ = SBITMAP_ELT_BITS; bit_num_ > 0; bit_num_--) \
- { \
- SBITMAP_ELT_TYPE _mask = (SBITMAP_ELT_TYPE)1 << (bit_num_ - 1);\
- \
- if ((word_ & _mask) != 0) \
- { \
- word_ &= ~ _mask; \
- (N) = (word_num_ - 1) * SBITMAP_ELT_BITS + bit_num_ - 1;\
- CODE; \
- if (word_ == 0) \
- break; \
- } \
- } \
- } \
-} while (0)
+#ifndef EXECUTE_IF_SET_IN_BITMAP
+/* See bitmap.h for the other definition of EXECUTE_IF_SET_IN_BITMAP. */
+#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \
+ for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \
+ bmp_iter_set (&(ITER), &(BITNUM)); \
+ bmp_iter_next (&(ITER), &(BITNUM)))
+#endif
inline void sbitmap_free (sbitmap map)
{
===================================================================
@@ -682,10 +682,13 @@ bmp_iter_and_compl (bitmap_iterator *bi,
should be treated as a read-only variable as it contains loop
state. */
+#ifndef EXECUTE_IF_SET_IN_BITMAP
+/* See sbitmap.h for the other definition of EXECUTE_IF_SET_IN_BITMAP. */
#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \
for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \
bmp_iter_set (&(ITER), &(BITNUM)); \
bmp_iter_next (&(ITER), &(BITNUM)))
+#endif
/* Loop over all the bits set in BITMAP1 & BITMAP2, starting with MIN
and setting BITNUM to the bit number. ITER is a bitmap iterator.
===================================================================
@@ -801,7 +801,7 @@ print_sccs (FILE *file, ddg_all_sccs_ptr
for (i = 0; i < sccs->num_sccs; i++)
{
fprintf (file, "SCC number: %d\n", i);
- EXECUTE_IF_SET_IN_SBITMAP (sccs->sccs[i]->nodes, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (sccs->sccs[i]->nodes, 0, u, sbi)
{
fprintf (file, "insn num %d\n", u);
print_rtl_single (file, g->nodes[u].insn);
@@ -893,7 +893,7 @@ create_scc (ddg_ptr g, sbitmap nodes)
bitmap_copy (scc->nodes, nodes);
/* Mark the backarcs that belong to this SCC. */
- EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (nodes, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr n = &g->nodes[u];
@@ -977,7 +977,7 @@ find_successors (sbitmap succ, ddg_ptr g
unsigned int i = 0;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (ops, 0, i, sbi)
{
const sbitmap node_succ = NODE_SUCCESSORS (&g->nodes[i]);
bitmap_ior (succ, succ, node_succ);
@@ -996,7 +996,7 @@ find_predecessors (sbitmap preds, ddg_pt
unsigned int i = 0;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (ops, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (ops, 0, i, sbi)
{
const sbitmap node_preds = NODE_PREDECESSORS (&g->nodes[i]);
bitmap_ior (preds, preds, node_preds);
@@ -1141,7 +1141,7 @@ find_nodes_on_paths (sbitmap result, ddg
change = 0;
bitmap_copy (workset, tmp);
bitmap_clear (tmp);
- EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (workset, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr u_node = &g->nodes[u];
@@ -1170,7 +1170,7 @@ find_nodes_on_paths (sbitmap result, ddg
change = 0;
bitmap_copy (workset, tmp);
bitmap_clear (tmp);
- EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (workset, 0, u, sbi)
{
ddg_edge_ptr e;
ddg_node_ptr u_node = &g->nodes[u];
@@ -1257,7 +1257,7 @@ longest_simple_path (struct ddg * g, int
change = 0;
bitmap_copy (workset, tmp);
bitmap_clear (tmp);
- EXECUTE_IF_SET_IN_SBITMAP (workset, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (workset, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
===================================================================
@@ -615,7 +615,7 @@ schedule_reg_move (partial_schedule_ptr
/* Handle the dependencies between the move and previously-scheduled
successors. */
- EXECUTE_IF_SET_IN_SBITMAP (move->uses, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (move->uses, 0, u, sbi)
{
this_insn = ps_rtl_insn (ps, u);
this_latency = insn_latency (move->insn, this_insn);
@@ -829,7 +829,7 @@ apply_reg_moves (partial_schedule_ptr ps
unsigned int i_use;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (move->uses, 0, i_use, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (move->uses, 0, i_use, sbi)
{
replace_rtx (ps->g->nodes[i_use].insn, move->old_reg, move->new_reg);
df_insn_rescan (ps->g->nodes[i_use].insn);
@@ -2664,7 +2664,7 @@ find_max_asap (ddg_ptr g, sbitmap nodes)
int result = -1;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
@@ -2686,7 +2686,7 @@ find_max_hv_min_mob (ddg_ptr g, sbitmap
int result = -1;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
@@ -2715,7 +2715,7 @@ find_max_dv_min_mob (ddg_ptr g, sbitmap
int result = -1;
sbitmap_iterator sbi;
- EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, u, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (nodes, 0, u, sbi)
{
ddg_node_ptr u_node = &g->nodes[u];
===================================================================
@@ -789,7 +789,7 @@ remove_some_program_points_and_update_li
map = XCNEWVEC (int, lra_live_max_point);
n = -1;
prev_born_p = prev_dead_p = false;
- EXECUTE_IF_SET_IN_SBITMAP (born_or_dead, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (born_or_dead, 0, i, sbi)
{
born_p = TEST_BIT (born, i);
dead_p = TEST_BIT (dead, i);
===================================================================
@@ -3414,7 +3414,7 @@ dse_step3 (bool for_spills)
/* For any block in an infinite loop, we must initialize the out set
to all ones. This could be expensive, but almost never occurs in
practice. However, it is common in regression tests. */
- EXECUTE_IF_SET_IN_SBITMAP (unreachable_blocks, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (unreachable_blocks, 0, i, sbi)
{
if (bitmap_bit_p (all_blocks, i))
{
===================================================================
@@ -1480,7 +1480,7 @@ remove_some_program_points_and_update_li
map = (int *) ira_allocate (sizeof (int) * ira_max_point);
n = -1;
prev_born_p = prev_dead_p = false;
- EXECUTE_IF_SET_IN_SBITMAP (born_or_dead, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (born_or_dead, 0, i, sbi)
{
born_p = TEST_BIT (born, i);
dead_p = TEST_BIT (dead, i);
===================================================================
@@ -438,7 +438,7 @@ bitmap_and_into (ebitmap dst, ebitmap sr
the result, AND'ing them. */
bitmap_and (dst->wordmask, dst->wordmask, src->wordmask);
- EXECUTE_IF_SET_IN_SBITMAP (dst->wordmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (dst->wordmask, 0, i, sbi)
{
EBITMAP_ELT_TYPE tmpword = ebitmap_array_get (src, srceltindex++);
tmpword &= ebitmap_array_get (dst, dsteltindex++);
@@ -490,7 +490,7 @@ bitmap_and (ebitmap dst, ebitmap src1, e
0);
bitmap_and (dst->wordmask, src1->wordmask, src2->wordmask);
- EXECUTE_IF_SET_IN_SBITMAP (dst->wordmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (dst->wordmask, 0, i, sbi)
{
bool src1hasword, src2hasword;
@@ -598,7 +598,7 @@ bitmap_ior_into (ebitmap dst, ebitmap sr
newarraysize = src->numwords + dst->numwords;
newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize);
- EXECUTE_IF_SET_IN_SBITMAP (tempmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (tempmask, 0, i, sbi)
{
bool dsthasword, srchasword;
@@ -707,7 +707,7 @@ bitmap_ior (ebitmap dst, ebitmap src1, e
newarraysize = src1->numwords + src2->numwords;
newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize);
- EXECUTE_IF_SET_IN_SBITMAP (tempmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (tempmask, 0, i, sbi)
{
bool src1hasword, src2hasword;
EBITMAP_ELT_TYPE tmpword;
@@ -803,7 +803,7 @@ bitmap_and_compl_into (ebitmap dst, ebit
if (src->numwords == 0)
return false;
- EXECUTE_IF_SET_IN_SBITMAP (dst->wordmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (dst->wordmask, 0, i, sbi)
{
bool srchasword;
@@ -886,7 +886,7 @@ bitmap_and_compl (ebitmap dst, ebitmap s
newarraysize = src1->numwords;
newarray = XNEWVEC (EBITMAP_ELT_TYPE, newarraysize);
- EXECUTE_IF_SET_IN_SBITMAP (src1->wordmask, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (src1->wordmask, 0, i, sbi)
{
bool src2hasword;
EBITMAP_ELT_TYPE tmpword;
===================================================================
@@ -94,8 +94,9 @@ typedef struct {
static inline void
ebitmap_iter_init (ebitmap_iterator *i, ebitmap bmp, unsigned int min)
{
- sbitmap_iter_init (&i->maskiter, bmp->wordmask,
- min / EBITMAP_ELT_BITS);
+ unsigned unused;
+ bmp_iter_set_init (&i->maskiter, bmp->wordmask,
+ min / EBITMAP_ELT_BITS, &unused);
i->size = bmp->numwords;
if (i->size == 0)
{
@@ -131,14 +132,15 @@ static inline bool
ebitmap_iter_cond (ebitmap_iterator *i, unsigned int *n)
{
unsigned int ourn = 0;
+ unsigned unused;
if (i->size == 0)
return false;
if (i->word == 0)
{
- sbitmap_iter_next (&i->maskiter);
- if (!sbitmap_iter_cond (&i->maskiter, &ourn))
+ bmp_iter_next (&i->maskiter, &unused);
+ if (!bmp_iter_set (&i->maskiter, &ourn))
return false;
i->bit_num = ourn * EBITMAP_ELT_BITS;
i->word = i->ptr[i->eltnum++];
===================================================================
@@ -1930,7 +1930,7 @@ prune_insertions_deletions (int n_elems)
needs to be inserted. */
for (i = 0; i < (unsigned) n_edges; i++)
{
- EXECUTE_IF_SET_IN_SBITMAP (pre_insert_map[i], 0, j, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (pre_insert_map[i], 0, j, sbi)
insertions[j]++;
}
@@ -1938,7 +1938,7 @@ prune_insertions_deletions (int n_elems)
edges. */
for (i = 0; i < (unsigned) last_basic_block; i++)
{
- EXECUTE_IF_SET_IN_SBITMAP (pre_delete_map[i], 0, j, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (pre_delete_map[i], 0, j, sbi)
deletions[j]++;
}
@@ -1952,7 +1952,7 @@ prune_insertions_deletions (int n_elems)
SET_BIT (prune_exprs, j);
/* Now prune PRE_INSERT_MAP and PRE_DELETE_MAP based on PRUNE_EXPRS. */
- EXECUTE_IF_SET_IN_SBITMAP (prune_exprs, 0, j, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (prune_exprs, 0, j, sbi)
{
for (i = 0; i < (unsigned) n_edges; i++)
RESET_BIT (pre_insert_map[i], j);
@@ -2943,7 +2943,7 @@ should_hoist_expr_to_dom (basic_block ex
pressure for basic blocks newly added in hoisted_bbs. */
if (flag_ira_hoist_pressure && !pred)
{
- EXECUTE_IF_SET_IN_SBITMAP (visited, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (visited, 0, i, sbi)
if (!bitmap_bit_p (hoisted_bbs, i))
{
bitmap_set_bit (hoisted_bbs, i);
===================================================================
@@ -1589,7 +1589,7 @@ decompose_multiword_subregs (bool decomp
of a basic block, split those blocks now. Note that we only handle
the case where splitting a load has caused multiple possibly trapping
loads to appear. */
- EXECUTE_IF_SET_IN_SBITMAP (sub_blocks, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (sub_blocks, 0, i, sbi)
{
rtx insn, end;
edge fallthru;
===================================================================
@@ -720,7 +720,7 @@ link_btr_uses (btr_def *def_array, btr_u
reaching_defs,
btr_defset[reg - first_btr]);
}
- EXECUTE_IF_SET_IN_SBITMAP (reaching_defs_of_reg, 0, uid, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (reaching_defs_of_reg, 0, uid, sbi)
{
btr_def def = def_array[uid];
===================================================================
@@ -342,7 +342,7 @@ extract_edgelst (sbitmap set, edgelst *e
el->nr_members = 0;
/* Iterate over each word in the bitset. */
- EXECUTE_IF_SET_IN_SBITMAP (set, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (set, 0, i, sbi)
{
edgelst_table[edgelst_last++] = rgn_edges[i];
el->nr_members++;
===================================================================
@@ -1324,7 +1324,7 @@ undistribute_ops_list (enum tree_code op
ctable = htab_create (15, oecount_hash, oecount_eq, NULL);
subops = XCNEWVEC (VEC (operand_entry_t, heap) *,
VEC_length (operand_entry_t, *ops));
- EXECUTE_IF_SET_IN_SBITMAP (candidates, 0, i, sbi0)
+ EXECUTE_IF_SET_IN_BITMAP (candidates, 0, i, sbi0)
{
gimple oedef;
enum tree_code oecode;
@@ -1389,7 +1389,7 @@ undistribute_ops_list (enum tree_code op
the common operand in their inner chain. */
bitmap_clear (candidates2);
nr_candidates2 = 0;
- EXECUTE_IF_SET_IN_SBITMAP (candidates, 0, i, sbi0)
+ EXECUTE_IF_SET_IN_BITMAP (candidates, 0, i, sbi0)
{
gimple oedef;
enum tree_code oecode;
@@ -1431,7 +1431,7 @@ undistribute_ops_list (enum tree_code op
print_generic_expr (dump_file, oe1->op, 0);
}
zero_one_operation (&oe1->op, c->oecode, c->op);
- EXECUTE_IF_SET_IN_SBITMAP (candidates2, first+1, i, sbi0)
+ EXECUTE_IF_SET_IN_BITMAP (candidates2, first+1, i, sbi0)
{
gimple sum;
oe2 = VEC_index (operand_entry_t, *ops, i);
===================================================================
@@ -24803,7 +24803,7 @@ core2i7_first_cycle_multipass_backtrack
sbitmap_iterator sbi;
gcc_assert (bitmap_last_set_bit (data->ready_try_change) < n_ready);
- EXECUTE_IF_SET_IN_SBITMAP (data->ready_try_change, 0, i, sbi)
+ EXECUTE_IF_SET_IN_BITMAP (data->ready_try_change, 0, i, sbi)
{
ready_try[i] = 0;
}