remove ins_permuted from CMovcc and Setcc constructors (again)
[libfirm] / ir / be / becopyheur2.c
index 801f673..bad56eb 100644 (file)
@@ -48,7 +48,7 @@
 
 #include "bemodule.h"
 #include "beabi.h"
-#include "benode_t.h"
+#include "benode.h"
 #include "becopyopt.h"
 #include "becopyopt_t.h"
 #include "bechordal_t.h"
@@ -84,18 +84,6 @@ static const lc_opt_table_entry_t options[] = {
        LC_OPT_LAST
 };
 
-void be_init_copyheur2(void)
-{
-       lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
-       lc_opt_entry_t *ra_grp = lc_opt_get_grp(be_grp, "ra");
-       lc_opt_entry_t *chordal_grp = lc_opt_get_grp(ra_grp, "chordal");
-       lc_opt_entry_t *co2_grp = lc_opt_get_grp(chordal_grp, "co2");
-
-       lc_opt_add_table(co2_grp, options);
-}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur2);
-
 /*
   ____  _             _
  / ___|| |_ __ _ _ __| |_
@@ -986,18 +974,13 @@ static void process_cloud(co2_cloud_t *cloud)
                int n_childs = ci->mst_n_childs;
                int j;
 
-               ci->col_costs       = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->col_costs[0]));
-               ci->tmp_coloring    = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->tmp_coloring[0]));
-               ci->fronts          = obstack_alloc(&cloud->obst, n_regs * n_childs * sizeof(ci->fronts[0]));
-               ci->color_badness   = obstack_alloc(&cloud->obst, n_regs * sizeof(ci->fronts[0]));
-               memset(ci->color_badness, 0, n_regs * sizeof(ci->color_badness[0]));
-               memset(ci->col_costs,     0, n_regs * sizeof(ci->col_costs[0]));
-               memset(ci->tmp_coloring,  0, n_regs * sizeof(ci->tmp_coloring[0]));
-               memset(ci->fronts,        0, n_regs * n_childs * sizeof(ci->fronts[0]));
+               ci->col_costs       = OALLOCNZ(&cloud->obst, int,             n_regs);
+               ci->tmp_coloring    = OALLOCNZ(&cloud->obst, col_cost_pair_t, n_regs);
+               ci->fronts          = OALLOCNZ(&cloud->obst, int,             n_regs * n_childs);
+               ci->color_badness   = OALLOCNZ(&cloud->obst, int,             n_regs);
 
                for(j = 0; j < env->n_regs; j++)
                        ci->col_costs[j] = INT_MAX;
-
        }
 
        determine_color_badness(cloud->mst_root, 0);
@@ -1241,7 +1224,6 @@ static be_ifg_dump_dot_cb_t ifg_dot_cb = {
        ifg_dump_at_end
 };
 
-
 int co_solve_heuristic_new(copy_opt_t *co)
 {
        char  buf[256];
@@ -1282,3 +1264,20 @@ int co_solve_heuristic_new(copy_opt_t *co)
        phase_free(&env.ph);
        return 0;
 }
+
+void be_init_copyheur2(void)
+{
+       lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
+       lc_opt_entry_t *ra_grp = lc_opt_get_grp(be_grp, "ra");
+       lc_opt_entry_t *chordal_grp = lc_opt_get_grp(ra_grp, "chordal");
+       lc_opt_entry_t *co2_grp = lc_opt_get_grp(chordal_grp, "co2");
+
+       static co_algo_info copyheur = {
+               co_solve_heuristic_new, 0
+       };
+
+       lc_opt_add_table(co2_grp, options);
+       be_register_copyopt("heur2", &copyheur);
+}
+
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur2);