fixed output of arm_emit_shift()
[libfirm] / ir / be / bechordal.c
index 1fa973b..b77323e 100644 (file)
@@ -501,7 +501,7 @@ static ir_node *handle_constraints(be_chordal_alloc_env_t *alloc_env, ir_node *i
        int *assignment;
        pmap *partners;
        int i, n_alloc;
-       long col;
+       bitset_pos_t col;
        const ir_edge_t *edge;
        ir_node *perm = NULL;
        int match_res, cost;
@@ -740,11 +740,10 @@ static void pressure(ir_node *block, void *env_ptr)
        be_lv_t *lv                       = env->birg->lv;
 
        int i, n;
+       bitset_pos_t elm;
        unsigned step = 0;
        unsigned pressure = 0;
        struct list_head *head;
-       pset *live_in  = be_lv_pset_put_in(lv, block, pset_new_ptr_default());
-       pset *live_end = be_lv_pset_put_end(lv, block, pset_new_ptr_default());
 
        DBG((dbg, LEVEL_1, "Computing pressure in block %+F\n", block));
        bitset_clear_all(live);
@@ -759,7 +758,8 @@ static void pressure(ir_node *block, void *env_ptr)
         * Make final uses of all values live out of the block.
         * They are necessary to build up real intervals.
         */
-       foreach_pset(live_end, irn) {
+       be_lv_foreach(lv, block, be_lv_state_end, i) {
+               ir_node *irn = be_lv_get_irn(lv, block, i);
                if(has_reg_class(env, irn)) {
                        DBG((dbg, LEVEL_3, "\tMaking live: %+F/%d\n", irn, get_irn_idx(irn)));
                        bitset_set(live, get_irn_idx(irn));
@@ -776,6 +776,26 @@ static void pressure(ir_node *block, void *env_ptr)
                DBG((dbg, LEVEL_1, "\tinsn: %+F, pressure: %d\n", irn, pressure));
                DBG((dbg, LEVEL_2, "\tlive: %B\n", live));
 
+#ifndef SCHEDULE_PROJS
+               if (get_irn_mode(irn) == mode_T) {
+                       const ir_edge_t *edge;
+
+                       foreach_out_edge(irn, edge) {
+                               ir_node *proj = get_edge_src_irn(edge);
+
+                               /*
+                                * If the node defines some value, which can put into a
+                                * register of the current class, make a border for it.
+                                */
+                               if(has_reg_class(env, proj)) {
+                                       int nr = get_irn_idx(proj);
+
+                                       bitset_clear(live, nr);
+                                       border_def(proj, step, 1);
+                               }
+                       }
+               }
+#endif
                /*
                 * If the node defines some value, which can put into a
                 * register of the current class, make a border for it.
@@ -811,22 +831,11 @@ static void pressure(ir_node *block, void *env_ptr)
                ++step;
        }
 
-       /*
-        * Add initial defs for all values live in.
-        */
-       foreach_pset(live_in, irn) {
-               if(has_reg_class(env, irn)) {
-
-                       /* Mark the value live in. */
-                       bitset_set(live, get_irn_idx(irn));
-
-                       /* Add the def */
+       bitset_foreach(live, elm) {
+               ir_node *irn = get_idx_irn(env->irg, elm);
+               if (be_is_live_in(lv, block, irn))
                        border_def(irn, step, 0);
-               }
        }
-
-       del_pset(live_in);
-       del_pset(live_end);
 }
 
 static void assign(ir_node *block, void *env_ptr)
@@ -950,7 +959,6 @@ static void assign_new(ir_node *block, be_chordal_alloc_env_t *alloc_env, bitset
        bitset_t *live             = bitset_irg_malloc(env->irg);
        const arch_env_t *arch_env = env->birg->main_env->arch_env;
        be_irg_t *birg             = env->birg;
-       lv_chk_t *lv               = be_get_birg_liveness_chk(birg);
 
        bitset_pos_t elm;
        ir_node *irn;
@@ -968,7 +976,7 @@ static void assign_new(ir_node *block, be_chordal_alloc_env_t *alloc_env, bitset
         */
        bitset_foreach (live_end_dom, elm) {
                ir_node *irn = get_idx_irn(env->irg, elm);
-               if (lv_chk_bl_in(lv, block, irn)) {
+               if (be_is_live_in(birg->lv, block, irn)) {
                        const arch_register_t *reg = arch_get_irn_register(arch_env, irn);
                        int col;
 
@@ -1066,6 +1074,7 @@ void be_ra_chordal_color(be_chordal_env_t *chordal_env)
 {
        be_chordal_alloc_env_t env;
        char buf[256];
+       be_lv_t *lv;
        be_irg_t *birg = chordal_env->birg;
        const arch_register_class_t *cls = chordal_env->cls;
 
@@ -1078,7 +1087,10 @@ void be_ra_chordal_color(be_chordal_env_t *chordal_env)
                return;
 
        be_assure_dom_front(birg);
-       be_assure_liveness(birg);
+       lv = be_assure_liveness(birg);
+       be_liveness_assure_sets(lv);
+       be_liveness_assure_chk(lv);
+
        assure_doms(irg);
 
        env.chordal_env   = chordal_env;