- replace costly bitset_popcount() ==/!=/> 0 by bitset_empty()
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Apr 2009 22:52:15 +0000 (22:52 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Apr 2009 22:52:15 +0000 (22:52 +0000)
[r25803]

ir/adt/bipartite.c
ir/be/bechordal.c
ir/be/becopyheur.c

index 2acb390..c12dc3c 100644 (file)
@@ -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);
index 622baba..25f00c2 100644 (file)
@@ -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;
                        }
index 58158c1..d744ef5 100644 (file)
@@ -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) */