becopyilp: fix size_reduction code
[libfirm] / ir / be / becopyilp2.c
index 0ac084e..14b7675 100644 (file)
@@ -59,7 +59,6 @@
 #define DEBUG_LVL 1
 
 typedef struct local_env_t {
-       double time_limit;
        int first_x_var, last_x_var;
        int n_colors;
        bitset_t *normal_colors;
@@ -488,7 +487,6 @@ static void build_path_cstr(ilp_env_t *ienv)
 
 static void ilp2_build(ilp_env_t *ienv)
 {
-       local_env_t *lenv = ienv->env;
        int lower_bound;
 
        ienv->lp = lpp_new(ienv->co->name, lpp_minimize);
@@ -500,7 +498,6 @@ static void ilp2_build(ilp_env_t *ienv)
 
        lower_bound = co_get_lower_bound(ienv->co) - co_get_inevit_copy_costs(ienv->co);
        lpp_set_bound(ienv->lp, lower_bound);
-       lpp_set_time_limit(ienv->lp, lenv->time_limit);
 }
 
 static void ilp2_apply(ilp_env_t *ienv)
@@ -515,8 +512,11 @@ static void ilp2_apply(ilp_env_t *ienv)
                lpp_sol_state_t  state = lpp_get_solution(ienv->lp, sol, lenv->first_x_var, lenv->last_x_var);
 
                if (state != lpp_optimal) {
-                       printf("WARNING %s: Solution state is not 'optimal': %d\n", ienv->co->name, (int)state);
-                       assert(state >= lpp_feasible && "The solution should at least be feasible!");
+                       printf("WARNING %s: Solution state is not 'optimal': %d\n",
+                              ienv->co->name, (int)state);
+                       if (state < lpp_feasible) {
+                               panic("Copy coalescing solution not feasible!");
+                       }
                }
 
                for (i=0; i<count; ++i) {
@@ -548,17 +548,13 @@ static void ilp2_apply(ilp_env_t *ienv)
 #endif
 }
 
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp2)
-void be_init_copyilp2(void)
-{
-       static co_algo_info copyheur = {
-               co_solve_ilp2, 1
-       };
-
-       be_register_copyopt("ilp", &copyheur);
-}
-
-int co_solve_ilp2(copy_opt_t *co)
+/**
+ * Solves the problem using mixed integer programming
+ * @returns 1 iff solution state was optimal
+ * Uses the OU and the GRAPH data structure
+ * Dependency of the OU structure can be removed
+ */
+static int co_solve_ilp2(copy_opt_t *co)
 {
        lpp_sol_state_t sol_state;
        ilp_env_t *ienv;
@@ -567,7 +563,6 @@ int co_solve_ilp2(copy_opt_t *co)
        ASSERT_OU_AVAIL(co); //See build_clique_st
        ASSERT_GS_AVAIL(co);
 
-       my.time_limit  = 0;
        my.first_x_var = -1;
        my.last_x_var  = -1;
        my.nr_2_irn    = pmap_create();
@@ -587,3 +582,13 @@ int co_solve_ilp2(copy_opt_t *co)
 
        return sol_state == lpp_optimal;
 }
+
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyilp2)
+void be_init_copyilp2(void)
+{
+       static co_algo_info copyheur = {
+               co_solve_ilp2, 1
+       };
+
+       be_register_copyopt("ilp", &copyheur);
+}