#include "config.h"
#endif /* HAVE_CONFIG_H */
+#define DISABLE_STATEV
+
#include <float.h>
#include "array.h"
#define REAL(C) (C ## f)
static unsigned last_chunk_id = 0;
-static int recolor_limit = 4;
+static int recolor_limit = 7;
static real_t dislike_influence = REAL(0.1);
typedef struct _col_cost_t {
int k; /**< number of non-ignore registers in class */
bitset_t *ignore_regs; /**< set containing all global ignore registers */
ir_phase ph; /**< phase object holding data for nodes */
- pqueue *chunks; /**< priority queue for chunks */
+ pqueue_t *chunks; /**< priority queue for chunks */
pset *chunkset; /**< set holding all chunks */
be_ifg_t *ifg; /**< the interference graph */
const arch_env_t *aenv; /**< the arch environment */
aff_chunk_t *c2 = get_aff_chunk(env, tgt);
#ifdef DEBUG_libfirm
- DB((dbg, LEVEL_4, "Attempt to let c1 (id %u): ", c1 ? c1->id : -1));
+ DB((dbg, LEVEL_4, "Attempt to let c1 (id %u): ", c1 ? c1->id : 0));
if (c1) {
DBG_AFF_CHUNK(env, LEVEL_4, c1);
} else {
DB((dbg, LEVEL_4, "{%+F}", src));
}
- DB((dbg, LEVEL_4, "\n\tabsorb c2 (id %u): ", c2 ? c2->id : -1));
+ DB((dbg, LEVEL_4, "\n\tabsorb c2 (id %u): ", c2 ? c2->id : 0));
if (c2) {
DBG_AFF_CHUNK(env, LEVEL_4, c2);
} else {
static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chunk_t *chunk)
{
- pqueue *grow = new_pqueue();
+ pqueue_t *grow = new_pqueue();
const ir_node *max_node = NULL;
int max_weight = 0;
int i;
bitset_remv_irn(visited, max_node);
i = 0;
while (!pqueue_empty(grow)) {
- ir_node *irn = pqueue_get(grow);
+ ir_node *irn = pqueue_pop_front(grow);
affinity_node_t *an = get_affinity_info(env->co, irn);
neighb_t *neigh;
if (get_mst_irn_col(node) == col) {
decider = decider_has_color;
check_for_best = 1;
- DBG((dbg, LEVEL_4, "\tcolor %d wanted", col));
+ DBG((dbg, LEVEL_4, "\tcolor %d wanted\n", col));
}
else {
decider = decider_hasnot_color;
check_for_best = 0;
- DBG((dbg, LEVEL_4, "\tcolor %d forbidden", col));
+ DBG((dbg, LEVEL_4, "\tcolor %d forbidden\n", col));
}
/* create a new chunk starting at current node */
if (depth > *max_depth)
*max_depth = depth;
- if (depth >= recolor_limit)
- return 0;
-
DBG((dbg, LEVEL_4, "\tRecoloring %+F with color-costs", node->irn));
DBG_COL_COST(env, LEVEL_4, costs);
DB((dbg, LEVEL_4, "\n"));
+ if (depth >= recolor_limit) {
+ DBG((dbg, LEVEL_4, "\tHit recolor limit\n"));
+ return 0;
+ }
+
for (i = 0; i < env->n_regs; ++i) {
int tgt_col = costs[i].col;
int neigh_ok = 1;
int j;
/* If the costs for that color (and all successive) are infinite, bail out we won't make it anyway. */
- if (costs[i].cost == REAL(0.0))
+ if (costs[i].cost == REAL(0.0)) {
+ DBG((dbg, LEVEL_4, "\tAll further colors forbidden\n"));
return 0;
+ }
/* Set the new color of the node and mark the node as temporarily fixed. */
assert(node->tmp_col < 0 && "Node must not have been temporary fixed.");
}
}
+ DBG((dbg, LEVEL_4, "\tAll colors failed\n"));
return 0;
}
/* color chunks as long as there are some */
while (! pqueue_empty(mst_env.chunks)) {
- aff_chunk_t *chunk = pqueue_get(mst_env.chunks);
+ aff_chunk_t *chunk = pqueue_pop_front(mst_env.chunks);
color_aff_chunk(&mst_env, chunk);
DB((dbg, LEVEL_4, "<<<====== Coloring chunk (%u) done\n", chunk->id));