- renamed access offset functions
[libfirm] / ir / be / becopyheur2.c
index a237188..3b9b3bc 100644 (file)
 #define DUMP_CLOUD  4
 #define DUMP_ALL    2 * DUMP_CLOUD - 1
 
-static int    dump_flags      = 0;
-static int    subtree_iter    = 4;
-static int    max_depth       = 20;
-static double constr_factor   = 0.9;
+static unsigned dump_flags      = 0;
+static int      subtree_iter    = 4;
+static int      max_depth       = 20;
+static double   constr_factor   = 0.9;
 
 /* Options using libcore */
 #ifdef WITH_LIBCORE
@@ -62,10 +62,10 @@ static lc_opt_enum_mask_var_t dump_var = {
 };
 
 static const lc_opt_table_entry_t options[] = {
-       LC_OPT_ENT_ENUM_MASK("dump", "dump ifg before, after or after each cloud",             &dump_var),
-       LC_OPT_ENT_INT      ("iter", "iterations for subtree nodes (standard: 3)",             &subtree_iter),
+       LC_OPT_ENT_ENUM_MASK("dump", "dump ifg cloud",                                         &dump_var),
+       LC_OPT_ENT_INT      ("iter", "iterations for subtree nodes",                           &subtree_iter),
        LC_OPT_ENT_DBL      ("cf",   "factor of constraint importance (between 0.0 and 1.0)",  &constr_factor),
-       LC_OPT_ENT_INT      ("max",  "maximum recursion depth (default 20)",                   &max_depth),
+       LC_OPT_ENT_INT      ("max",  "maximum recursion depth",                                &max_depth),
        { NULL }
 };
 
@@ -200,8 +200,8 @@ static void *co2_irn_init(phase_t *ph, ir_node *irn, void *data)
 
 static int cmp_clouds_gt(const void *a, const void *b)
 {
-       const co2_cloud_t **p = a;
-       const co2_cloud_t **q = b;
+       const co2_cloud_t * const *p = a;
+       const co2_cloud_t * const *q = b;
        double c = CLOUD_WEIGHT(*p);
        double d = CLOUD_WEIGHT(*q);
        return QSORT_CMP(d, c);
@@ -953,7 +953,7 @@ static void process_cloud(co2_cloud_t *cloud)
 
        DBG((env->dbg, LEVEL_3, "mst:\n"));
        for(i = 0; i < cloud->n_memb; ++i) {
-               co2_cloud_irn_t *ci = cloud->seq[i];
+               DEBUG_ONLY(co2_cloud_irn_t *ci = cloud->seq[i]);
                DBG((env->dbg, LEVEL_3, "\t%+F -> %+F\n", ci->inh.irn, ci->mst_parent->inh.irn));
        }
 
@@ -1027,7 +1027,7 @@ static void process(co2_t *env)
                co2_cloud_irn_t *ci = get_co2_cloud_irn(env, a->irn);
 
                if(!ci->cloud) {
-                       co2_cloud_t *cloud = new_cloud(env, a);
+                       new_cloud(env, a);
                        n_clouds++;
                }
        }
@@ -1053,7 +1053,8 @@ static void process(co2_t *env)
                        FILE *f;
 
                        ir_snprintf(buf, sizeof(buf), "ifg_%F_%s_cloud_%d.dot", env->co->irg, env->co->cls->name, i);
-                       if(f = fopen(buf, "wt")) {
+                       f = fopen(buf, "wt");
+                       if(f != NULL) {
                                be_ifg_dump_dot(env->co->cenv->ifg, env->co->irg, f, &ifg_dot_cb, env);
                                fclose(f);
                        }
@@ -1167,7 +1168,7 @@ static void ifg_dump_node_attr(FILE *f, void *self, ir_node *irn)
                        peri = 2;
 
                if(cci->cloud && cci->cloud->mst_root)
-                       snprintf(buf, sizeof(buf), "%+F", cci->cloud->mst_root->inh.irn);
+                       ir_snprintf(buf, sizeof(buf), "%+F", cci->cloud->mst_root->inh.irn);
        }
 
        ir_fprintf(f, "label=\"%+F%s\" style=filled peripheries=%d color=%s shape=%s", irn, buf, peri,
@@ -1217,7 +1218,7 @@ static be_ifg_dump_dot_cb_t ifg_dot_cb = {
 };
 
 
-void co_solve_heuristic_new(copy_opt_t *co)
+int co_solve_heuristic_new(copy_opt_t *co)
 {
        char buf[256];
        co2_t env;
@@ -1257,4 +1258,5 @@ void co_solve_heuristic_new(copy_opt_t *co)
 
        writeback_colors(&env);
        phase_free(&env.ph);
+       return 0;
 }