Add the column to the debug information.
[libfirm] / ir / be / bespill.c
index cf2985d..fa542d9 100644 (file)
@@ -22,7 +22,6 @@
  * @brief       Spill module selection; Preparation steps
  * @author      Matthias Braun
  * @date        29.09.2005
- * @version     $Id$
  */
 #include "config.h"
 
@@ -64,6 +63,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
        unsigned *tmp        = NULL;
        unsigned *def_constr = NULL;
        int       arity      = get_irn_arity(node);
+       ir_node  *def;
 
        int i, i2;
 
@@ -75,7 +75,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
         */
        for (i = 0; i < arity; ++i) {
                ir_node                   *op  = get_irn_n(node, i);
-               const arch_register_req_t *req = arch_get_register_req(node, i);
+               const arch_register_req_t *req = arch_get_irn_register_req_in(node, i);
                const arch_register_t     *reg;
                ir_node                   *copy;
 
@@ -96,7 +96,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                if (rbitset_is_set(req->limited, reg->index))
                        continue;
 
-               copy = be_new_Copy(cls, block, op);
+               copy = be_new_Copy(block, op);
                stat_ev_int("constr_copy", 1);
                sched_add_before(node, copy);
                set_irn_n(node, i, copy);
@@ -110,7 +110,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                ir_node                   *copy;
                const arch_register_req_t *req;
 
-               req = arch_get_register_req(node, i);
+               req = arch_get_irn_register_req_in(node, i);
                if (req->cls != cls)
                        continue;
 
@@ -125,7 +125,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                        ir_node *in2;
                        const arch_register_req_t *req2;
 
-                       req2 = arch_get_register_req(node, i2);
+                       req2 = arch_get_irn_register_req_in(node, i2);
                        if (req2->cls != cls)
                                continue;
                        if (! (req2->type & arch_register_req_type_limited))
@@ -140,7 +140,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                        if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
                                continue;
 
-                       copy = be_new_Copy(cls, block, in);
+                       copy = be_new_Copy(block, in);
                        stat_ev_int("constr_copy", 1);
 
                        sched_add_before(node, copy);
@@ -152,27 +152,14 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
        }
 
        /* collect all registers occurring in out constraints. */
-       if (get_irn_mode(node) == mode_T) {
-               const ir_edge_t *edge;
-
-               foreach_out_edge(node, edge) {
-                       ir_node                   *proj = get_edge_src_irn(edge);
-                       const arch_register_req_t *req  = arch_get_register_req_out(proj);
-                       if (! (req->type & arch_register_req_type_limited))
-                               continue;
-
-                       if (def_constr == NULL) {
-                               rbitset_alloca(def_constr, cls->n_regs);
-                       }
-                       rbitset_or(def_constr, req->limited, cls->n_regs);
-               }
-       } else {
-               const arch_register_req_t *req = arch_get_register_req_out(node);
-               if (req->type & arch_register_req_type_limited) {
+       be_foreach_definition(node, cls, def,
+               if (! (req_->type & arch_register_req_type_limited))
+                       continue;
+               if (def_constr == NULL) {
                        rbitset_alloca(def_constr, cls->n_regs);
-                       rbitset_or(def_constr, req->limited, cls->n_regs);
                }
-       }
+               rbitset_or(def_constr, req_->limited, cls->n_regs);
+       );
 
        /* no output constraints => we're good */
        if (def_constr == NULL) {
@@ -195,7 +182,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                 * 2) lives through the node.
                 * 3) is constrained to a register occurring in out constraints.
                 */
-               req = arch_get_register_req(node, i);
+               req = arch_get_irn_register_req_in(node, i);
                if (req->cls != cls)
                        continue;
                if (!(req->type & arch_register_req_type_limited))
@@ -222,7 +209,7 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
                if (be_is_Copy(in))
                        continue;
 
-               copy = be_new_Copy(cls, block, in);
+               copy = be_new_Copy(block, in);
                sched_add_before(node, copy);
                set_irn_n(node, i, copy);
                DBG((dbg, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n",
@@ -248,7 +235,7 @@ void be_pre_spill_prepare_constr(ir_graph *irg,
        env.irg = irg;
        env.cls = cls;
 
-       be_assure_liveness(irg);
+       be_assure_live_sets(irg);
 
        irg_block_walk_graph(irg, pre_spill_prepare_constr_walker, NULL, &env);
 }