- fix a conceptual bug in peephole, we need a callback before and after
[libfirm] / ir / be / becopyheur4.c
index 21fc84e..48786e4 100644 (file)
 #define AFF_NEIGHBOUR_FIX_BENEFIT 128.0
 #define NEIGHBOUR_CONSTR_COSTS    64.0
 
-#ifdef NDEBUG
 
-#define DBG_AFF_CHUNK(env, level, chunk)
-#define DBG_COL_COST(env, level, cost)
-
-#else
+#ifdef DEBUG_libfirm
 
-static firm_dbg_module_t *dbg = NULL;
 #define DBG_AFF_CHUNK(env, level, chunk) do { if (firm_dbg_get_mask(dbg) & (level)) dbg_aff_chunk((env), (chunk)); } while(0)
 #define DBG_COL_COST(env, level, cost)   do { if (firm_dbg_get_mask(dbg) & (level)) dbg_col_cost((env), (cost)); } while(0)
 
+static firm_dbg_module_t *dbg = NULL;
+
+#else
+
+#define DBG_AFF_CHUNK(env, level, chunk)
+#define DBG_COL_COST(env, level, cost)
+
 #endif
 
 static int last_chunk_id = 0;
@@ -208,11 +210,6 @@ static int decider_always_yes(const co_mst_irn_t *node, int col) {
        return 1;
 }
 
-static int cmp_node_order(const void *a, const void *b)
-{
-       return 0;
-}
-
 /** compares two affinity edges by its weight */
 static int cmp_aff_edge(const void *a, const void *b) {
        const aff_edge_t *e1 = a;
@@ -386,7 +383,7 @@ static int aff_chunk_absorb(co_mst_env_t *env, ir_node *src, ir_node *tgt) {
        aff_chunk_t *c1 = get_aff_chunk(env, src);
        aff_chunk_t *c2 = get_aff_chunk(env, tgt);
 
-#ifndef NDEBUG
+#ifdef DEBUG_libfirm
                DB((dbg, LEVEL_4, "Attempt to let c1 (id %d): ", c1 ? c1->id : -1));
                if (c1) {
                        DBG_AFF_CHUNK(env, LEVEL_4, c1);
@@ -851,9 +848,7 @@ static void determine_color_costs(co_mst_env_t *env, co_mst_irn_t *node, col_cos
 
                int_neigh = node->int_neighs[i];
 
-               /* skip ignore nodes */
-               if (arch_irn_is(env->aenv, int_neigh, ignore))
-                       continue;
+    assert(!arch_irn_is(env->aenv, int_neigh, ignore));
 
                neigh   = get_co_mst_irn(env, int_neigh);
                col     = get_mst_irn_col(neigh);
@@ -985,7 +980,6 @@ static int recolor_nodes(co_mst_env_t *env, co_mst_irn_t *node, col_cost_t *cost
                        of the current node, every thing was ok and we can return safely.
                */
                if (neigh_ok) {
-                       co_mst_irn_t *n, *temp;
                        /* append the local_changed ones to global ones */
                        list_splice(&local_changed, changed_ones);
                        return 1;
@@ -1031,7 +1025,7 @@ static int change_node_color(co_mst_env_t *env, co_mst_irn_t *node, int tgt_col,
                return res;
        }
 
-#ifndef NDEBUG
+#ifdef DEBUG_libfirm
                if (firm_dbg_get_mask(dbg) & LEVEL_4) {
                        if (!is_loose(node))
                                DB((dbg, LEVEL_4, "\t\tCNC: %+F has already fixed color %d\n", node->irn, col));
@@ -1058,7 +1052,6 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
        waitq       *best_starts  = NULL;
        bitset_t    *visited;
        int         col, idx, len;
-       co_mst_irn_t *n;
        struct list_head changed_ones;
 
        DB((dbg, LEVEL_2, "fragmentizing chunk #%d", c->id));
@@ -1173,7 +1166,6 @@ static void color_aff_chunk(co_mst_env_t *env, aff_chunk_t *c) {
        for (idx = 0, len = ARR_LEN(best_chunk->n); idx < len; ++idx) {
                ir_node      *irn  = best_chunk->n[idx];
                co_mst_irn_t *node = get_co_mst_irn(env, irn);
-               co_mst_irn_t *n, *temp;
                int res;
 
                /* bring the node to the color. */