Commit 20159caa authored by Michael Beck's avatar Michael Beck
Browse files

- replace costly bitset_popcount() ==/!=/> 0 by bitset_empty()

[r25803]
parent 69a73782
......@@ -129,7 +129,7 @@ static int apply_alternating_path(const bipartite_t *gr, int *matching,
assert(!bitset_is_set(matched_left, left));
bitset_andnot(tmp, matched_right);
if(bitset_popcnt(tmp) == 0)
if(bitset_is_empty(tmp))
continue;
right = bitset_next_set(tmp, 0);
......
......@@ -327,7 +327,7 @@ static ir_node *prepare_constr_insn(be_chordal_env_t *env, ir_node *irn)
*/
if (!op->has_constraints ||
!values_interfere(birg, insn->irn, op->carrier) ||
bitset_popcnt(tmp) == 0)
bitset_is_empty(tmp))
continue;
/*
......@@ -397,7 +397,7 @@ static void pair_up_operands(const be_chordal_alloc_env_t *alloc_env, be_insn_t
bitset_and(bs, out_op->regs);
n_total = bitset_popcnt(op->regs) + bitset_popcnt(out_op->regs);
if (bitset_popcnt(bs) > 0 && n_total < smallest_n_regs) {
if (!bitset_is_empty(bs) && n_total < smallest_n_regs) {
smallest = i;
smallest_n_regs = n_total;
}
......
......@@ -384,7 +384,7 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou) {
int i, o, safe_count, safe_costs, unsafe_count, *unsafe_costs;
bitset_t *curr, *best;
bitset_pos_t pos;
int max, next, curr_weight, best_weight = 0;
int next, curr_weight, best_weight = 0;
/* assign the nodes into two groups.
* safe: node has no interference, hence it is in every max stable set.
......@@ -438,7 +438,7 @@ static inline void qnode_max_ind_set(qnode_t *qn, const unit_t *ou) {
/* Exact Algorithm: Brute force */
curr = bitset_alloca(unsafe_count);
bitset_set_all(curr);
while ((max = bitset_popcnt(curr)) != 0) {
while (!bitset_is_empty(curr)) {
/* check if curr is a stable set */
for (i=bitset_next_set(curr, 0); i!=-1; i=bitset_next_set(curr, i+1))
for (o=bitset_next_set(curr, i); o!=-1; o=bitset_next_set(curr, o+1)) /* !!!!! difference to ou_max_ind_set_costs(): NOT (curr, i+1) */
......
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