split graph state into properties and constraints
[libfirm] / ir / be / bespillbelady.c
index 6a19d88..7424d3d 100644 (file)
@@ -22,7 +22,6 @@
  * @brief       Beladys spillalgorithm.
  * @author      Daniel Grund, Matthias Braun
  * @date        20.09.2005
- * @version     $Id$
  */
 #include "config.h"
 
@@ -39,6 +38,8 @@
 #include "ircons_t.h"
 #include "irprintf.h"
 #include "irnodeset.h"
+#include "irtools.h"
+#include "util.h"
 
 #include "beutil.h"
 #include "bearch.h"
@@ -293,7 +294,7 @@ static unsigned get_distance(ir_node *from, const ir_node *def, int skip_from_us
                return USES_INFINITY;
 
        /* We have to keep nonspillable nodes in the workingset */
-       if (arch_irn_get_flags(skip_Proj_const(def)) & arch_irn_flags_dont_spill)
+       if (arch_get_irn_flags(skip_Proj_const(def)) & arch_irn_flags_dont_spill)
                return 0;
 
        /* give some bonus to rematerialisable nodes */
@@ -479,7 +480,7 @@ static loc_t to_take_or_not_to_take(ir_node* first, ir_node *node,
        }
 
        /* We have to keep nonspillable nodes in the workingset */
-       if (arch_irn_get_flags(skip_Proj_const(node)) & arch_irn_flags_dont_spill) {
+       if (arch_get_irn_flags(skip_Proj_const(node)) & arch_irn_flags_dont_spill) {
                loc.time = 0;
                DB((dbg, DBG_START, "    %+F taken (dontspill node)\n", node, loc.time));
                return loc;
@@ -617,7 +618,7 @@ static void decide_start_workset(const ir_node *block)
        }
 
        pressure            = be_get_loop_pressure(loop_ana, cls, loop);
-       assert(ARR_LEN(delayed) <= (signed)pressure);
+       assert(ARR_LEN(delayed) <= pressure);
        free_slots          = n_regs - ARR_LEN(starters);
        free_pressure_slots = n_regs - (pressure - ARR_LEN(delayed));
        free_slots          = MIN(free_slots, free_pressure_slots);
@@ -628,7 +629,8 @@ static void decide_start_workset(const ir_node *block)
        DB((dbg, DBG_START, "Loop pressure %d, taking %d delayed vals\n",
            pressure, free_slots));
        if (free_slots > 0) {
-               int i;
+               size_t i;
+
                qsort(delayed, ARR_LEN(delayed), sizeof(delayed[0]), loc_compare);
 
                for (i = 0; i < ARR_LEN(delayed) && free_slots > 0; ++i) {
@@ -765,7 +767,7 @@ static void process_block(ir_node *block)
                /* no predecessor -> empty set */
                workset_clear(ws);
        } else if (arity == 1) {
-               /* one predecessor, copy it's end workset */
+               /* one predecessor, copy its end workset */
                ir_node      *pred_block = get_Block_cfgpred_block(block, 0);
                block_info_t *pred_info  = get_block_info(pred_block);
 
@@ -944,13 +946,10 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls)
 {
        int i;
 
-       be_liveness_assure_sets(be_assure_liveness(irg));
+       be_assure_live_sets(irg);
 
        stat_ev_tim_push();
-       /* construct control flow loop tree */
-       if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
-               construct_cf_backedges(irg);
-       }
+       assure_loopinfo(irg);
        stat_ev_tim_pop("belady_time_backedges");
 
        stat_ev_tim_push();
@@ -998,7 +997,7 @@ static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls)
        obstack_free(&obst, NULL);
 }
 
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady);
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spillbelady)
 void be_init_spillbelady(void)
 {
        static be_spiller_t belady_spiller = {