disable some expensive statevs
[libfirm] / ir / be / becopyheur4.c
index e364ad5..e9d20a3 100644 (file)
@@ -33,6 +33,8 @@
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
+#define DISABLE_STATEV
+
 #include <float.h>
 
 #include "array.h"
@@ -82,7 +84,7 @@ typedef float real_t;
 #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 {
@@ -119,7 +121,7 @@ typedef struct _co_mst_env_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 */
@@ -456,13 +458,13 @@ static int aff_chunk_absorb(co_mst_env_t *env, const ir_node *src, const ir_node
        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 {
@@ -711,7 +713,7 @@ static void build_affinity_chunks(co_mst_env_t *env) {
 
 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;
@@ -746,7 +748,7 @@ static __attribute__((unused)) void chunk_order_nodes(co_mst_env_t *env, aff_chu
                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;
 
@@ -862,12 +864,12 @@ static aff_chunk_t *fragment_chunk(co_mst_env_t *env, int col, aff_chunk_t *c, w
                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 */
@@ -1013,21 +1015,25 @@ static int recolor_nodes(co_mst_env_t *env, co_mst_irn_t *node, col_cost_t *cost
        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.");
@@ -1080,6 +1086,7 @@ static int recolor_nodes(co_mst_env_t *env, co_mst_irn_t *node, col_cost_t *cost
                }
        }
 
+       DBG((dbg, LEVEL_4, "\tAll colors failed\n"));
        return 0;
 }
 
@@ -1433,7 +1440,7 @@ int co_solve_heuristic_mst(copy_opt_t *co) {
 
        /* 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));