bearch: Disallow passing Projs to get_irn_ops().
[libfirm] / ir / be / becopyilp2.c
index f3eefa3..455fa1a 100644 (file)
@@ -32,6 +32,8 @@
 #include "config.h"
 
 #include "be_t.h"
+#include "beintlive_t.h"
+#include "beirg.h"
 #include "bitset.h"
 #include "error.h"
 #include "raw_bitset.h"
@@ -83,7 +85,7 @@ static void build_coloring_cstr(ilp_env_t *ienv)
                unsigned                   curr_node_color;
                unsigned                   has_alignment_cstr;
 
-               if (sr_is_removed(ienv->sr, irn))
+               if (sr_is_removed(ienv, irn))
                        continue;
 
                has_alignment_cstr = check_alignment_constraints(irn);
@@ -158,7 +160,7 @@ static void build_interference_cstr(ilp_env_t *ienv)
                unsigned realsize = 0;
 
                for (i=0; i<size; ++i) {
-                       if (!sr_is_removed(ienv->sr, clique[i]))
+                       if (!sr_is_removed(ienv, clique[i]))
                                ++realsize;
                }
 
@@ -180,7 +182,7 @@ static void build_interference_cstr(ilp_env_t *ienv)
                                int      var_idx;
                                unsigned aligment_offset = 0;
 
-                               if (sr_is_removed(ienv->sr, irn))
+                               if (sr_is_removed(ienv, irn))
                                        continue;
 
                                // Use the first part of the large registers for all
@@ -338,6 +340,7 @@ static inline void remove_edge(set *edges, ir_node *n1, ir_node *n2, size_t *cou
 static void build_clique_star_cstr(ilp_env_t *ienv)
 {
        /* for each node with affinity edges */
+       be_lv_t *const lv = be_get_irg_liveness(ienv->co->irg);
        co_gs_foreach_aff_node(ienv->co, aff) {
                struct obstack ob;
                const ir_node *center = aff->irn;
@@ -366,7 +369,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv)
                n_edges = 0;
                for (i=0; i<n_nodes; ++i) {
                        for (o=0; o<i; ++o) {
-                               if (be_ifg_connected(ienv->co->cenv->ifg, nodes[i], nodes[o]))
+                               if (be_values_interfere(lv, nodes[i], nodes[o]))
                                        add_edge(edges, nodes[i], nodes[o], &n_edges);
                        }
                }
@@ -449,7 +452,6 @@ static void build_clique_star_cstr(ilp_env_t *ienv)
 
 static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn)
 {
-       be_ifg_t *ifg = ienv->co->cenv->ifg;
        int i, len;
        ir_node **curr_path;
        affinity_node_t *aff;
@@ -469,13 +471,14 @@ static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn)
        curr_path = ALLOCAN(ir_node*, len);
        pdeq_copyl(path, (const void **)curr_path);
 
+       be_lv_t *const lv = be_get_irg_liveness(ienv->co->irg);
        for (i=1; i<len; ++i) {
-               if (be_ifg_connected(ifg, irn, curr_path[i]))
+               if (be_values_interfere(lv, irn, curr_path[i]))
                        goto end;
        }
 
        /* check for terminating interference */
-       if (be_ifg_connected(ifg, irn, curr_path[0])) {
+       if (be_values_interfere(lv, irn, curr_path[0])) {
                /* One node is not a path. */
                /* And a path of length 2 is covered by a clique star constraint. */
                if (len > 2) {
@@ -528,7 +531,7 @@ static void ilp2_build(ilp_env_t *ienv)
 {
        int lower_bound;
 
-       ienv->lp = lpp_new(ienv->co->name, lpp_minimize);
+       ienv->lp = lpp_new("copyilp", lpp_minimize);
        build_coloring_cstr(ienv);
        build_interference_cstr(ienv);
        build_affinity_cstr(ienv);
@@ -552,8 +555,7 @@ static void ilp2_apply(ilp_env_t *ienv)
                int              i;
 
                if (state != lpp_optimal) {
-                       printf("WARNING %s: Solution state is not 'optimal': %d\n",
-                              ienv->co->name, (int)state);
+                       ir_printf("WARNING: Solution state of %F register class %s is not 'optimal': %d\n", ienv->co->irg, ienv->co->cls->name, (int)state);
                        if (state < lpp_feasible) {
                                panic("Copy coalescing solution not feasible!");
                        }