From 20159caa8c30381470ebc91461e0dbfff4347e18 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 6 Apr 2009 22:52:15 +0000 Subject: [PATCH] - replace costly bitset_popcount() ==/!=/> 0 by bitset_empty() [r25803] --- ir/adt/bipartite.c | 2 +- ir/be/bechordal.c | 4 ++-- ir/be/becopyheur.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ir/adt/bipartite.c b/ir/adt/bipartite.c index 2acb390b2..c12dc3cc7 100644 --- a/ir/adt/bipartite.c +++ b/ir/adt/bipartite.c @@ -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); diff --git a/ir/be/bechordal.c b/ir/be/bechordal.c index 622baba7f..25f00c279 100644 --- a/ir/be/bechordal.c +++ b/ir/be/bechordal.c @@ -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; } diff --git a/ir/be/becopyheur.c b/ir/be/becopyheur.c index 58158c17a..d744ef5c9 100644 --- a/ir/be/becopyheur.c +++ b/ir/be/becopyheur.c @@ -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) */ -- 2.20.1