projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sparc: implement float->unsigned conversions
[libfirm]
/
ir
/
be
/
becopyheur4.c
diff --git
a/ir/be/becopyheur4.c
b/ir/be/becopyheur4.c
index
3dbb8a4
..
ad5ca80
100644
(file)
--- a/
ir/be/becopyheur4.c
+++ b/
ir/be/becopyheur4.c
@@
-22,7
+22,6
@@
* @brief Simple copy minimization heuristics.
* @author Christian Wuerdig
* @date 27.04.2007
* @brief Simple copy minimization heuristics.
* @author Christian Wuerdig
* @date 27.04.2007
- * @version $Id$
*
* This is the C implementation of the mst algorithm
* originally written in Java by Sebastian Hack.
*
* This is the C implementation of the mst algorithm
* originally written in Java by Sebastian Hack.
@@
-44,15
+43,12
@@
#include "xmalloc.h"
#include "pdeq.h"
#include "irprintf.h"
#include "xmalloc.h"
#include "pdeq.h"
#include "irprintf.h"
-#include "irbitset.h"
#include "util.h"
#include "irtools.h"
#include "error.h"
#include "list.h"
#include "statev.h"
#include "util.h"
#include "irtools.h"
#include "error.h"
#include "list.h"
#include "statev.h"
-#include "irbitset.h"
-
#include "bearch.h"
#include "beifg.h"
#include "be_t.h"
#include "bearch.h"
#include "beifg.h"
#include "be_t.h"
@@
-773,13
+769,13
@@
static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
}
if (max_node) {
}
if (max_node) {
- bitset_t *visited = bitset_
irg_malloc(env->co->irg
);
+ bitset_t *visited = bitset_
malloc(get_irg_last_idx(env->co->irg)
);
for (i = ARR_LEN(chunk->n); i != 0;)
for (i = ARR_LEN(chunk->n); i != 0;)
- bitset_
add_irn(visited, chunk->n[--i]
);
+ bitset_
set(visited, get_irn_idx(chunk->n[--i])
);
pqueue_put(grow, (void *) max_node, max_weight);
pqueue_put(grow, (void *) max_node, max_weight);
- bitset_
remv_irn(visited, max_node
);
+ bitset_
clear(visited, get_irn_idx(max_node)
);
i = 0;
while (!pqueue_empty(grow)) {
ir_node *irn = (ir_node*)pqueue_pop_front(grow);
i = 0;
while (!pqueue_empty(grow)) {
ir_node *irn = (ir_node*)pqueue_pop_front(grow);
@@
-798,9
+794,9
@@
static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
co_gs_foreach_neighb(an, neigh) {
co_mst_irn_t *node = get_co_mst_irn(env, neigh->irn);
co_gs_foreach_neighb(an, neigh) {
co_mst_irn_t *node = get_co_mst_irn(env, neigh->irn);
- if (bitset_
contains_irn(visited, node->irn
)) {
+ if (bitset_
is_set(visited, get_irn_idx(node->irn)
)) {
pqueue_put(grow, (void *) neigh->irn, neigh->costs);
pqueue_put(grow, (void *) neigh->irn, neigh->costs);
- bitset_
remv_irn(visited, node->irn
);
+ bitset_
clear(visited, get_irn_idx(node->irn)
);
}
}
}
}
}
}
@@
-878,7
+874,7
@@
static void expand_chunk_from(co_mst_env_t *env, co_mst_irn_t *node, bitset_t *v
*/
static aff_chunk_t *fragment_chunk(co_mst_env_t *env, int col, aff_chunk_t *c, waitq *tmp)
{
*/
static aff_chunk_t *fragment_chunk(co_mst_env_t *env, int col, aff_chunk_t *c, waitq *tmp)
{
- bitset_t *visited = bitset_
irg_malloc(env->co->irg
);
+ bitset_t *visited = bitset_
malloc(get_irg_last_idx(env->co->irg)
);
int idx, len;
aff_chunk_t *best = NULL;
int idx, len;
aff_chunk_t *best = NULL;
@@
-1247,7
+1243,7
@@
static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
*/
for (i = 0; i < env->k; ++i) {
int col = order[i].col;
*/
for (i = 0; i < env->k; ++i) {
int col = order[i].col;
- waitq *good_starts
= new_waitq()
;
+ waitq *good_starts;
aff_chunk_t *local_best;
int n_succeeded;
aff_chunk_t *local_best;
int n_succeeded;
@@
-1258,6
+1254,7
@@
static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
DB((dbg, LEVEL_2, "\ttrying color %d\n", col));
n_succeeded = 0;
DB((dbg, LEVEL_2, "\ttrying color %d\n", col));
n_succeeded = 0;
+ good_starts = new_waitq();
/* try to bring all nodes of given chunk to the current color. */
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
/* try to bring all nodes of given chunk to the current color. */
for (idx = 0, len = ARR_LEN(c->n); idx < len; ++idx) {
@@
-1296,8
+1293,10
@@
static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
}
/* try next color when failed */
}
/* try next color when failed */
- if (n_succeeded == 0)
+ if (n_succeeded == 0) {
+ del_waitq(good_starts);
continue;
continue;
+ }
/* fragment the chunk according to the coloring */
local_best = fragment_chunk(env, col, c, tmp_chunks);
/* fragment the chunk according to the coloring */
local_best = fragment_chunk(env, col, c, tmp_chunks);
@@
-1398,7
+1397,7
@@
static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c)
}
/* fragment the remaining chunk */
}
/* fragment the remaining chunk */
- visited = bitset_
irg_malloc(env->co->irg
);
+ visited = bitset_
malloc(get_irg_last_idx(env->co->irg)
);
for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx)
bitset_set(visited, get_irn_idx(best_chunk->n[idx]));
for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx)
bitset_set(visited, get_irn_idx(best_chunk->n[idx]));