Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
20159caa
Commit
20159caa
authored
Apr 06, 2009
by
Michael Beck
Browse files
- replace costly bitset_popcount() ==/!=/> 0 by bitset_empty()
[r25803]
parent
69a73782
Changes
3
Hide whitespace changes
Inline
Side-by-side
ir/adt/bipartite.c
View file @
20159caa
...
...
@@ -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
);
...
...
ir/be/bechordal.c
View file @
20159caa
...
...
@@ -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
;
}
...
...
ir/be/becopyheur.c
View file @
20159caa
...
...
@@ -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) */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment