X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbecopyheur2.c;h=1653a2d934a5de0f81ebb2bc3854fc7bfcdd5edb;hb=80a6158fdd766f42ee6c508a773bc114ff1b61f3;hp=8a9138b326a489d636876109c8694d628b462297;hpb=8105317384cd99ef55d8c052684a401b2484f64b;p=libfirm diff --git a/ir/be/becopyheur2.c b/ir/be/becopyheur2.c index 8a9138b32..1653a2d93 100644 --- a/ir/be/becopyheur2.c +++ b/ir/be/becopyheur2.c @@ -30,6 +30,7 @@ #include "irprintf.h" #include "irtools.h" +#include "bemodule.h" #include "beabi.h" #include "benode_t.h" #include "becopyopt.h" @@ -41,10 +42,10 @@ #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,18 +63,24 @@ 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 } }; -void be_co2_register_options(lc_opt_entry_t *grp) +void be_init_copyheur2(void) { - lc_opt_entry_t *co2_grp = lc_opt_get_grp(grp, "co2"); + 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); #endif /* @@ -200,8 +207,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 +960,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 +1034,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 +1060,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 +1175,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,