beutil.h bemain.c besched.c bemain.c belive.c belive.h benumb.h \
benumb_t.h benumb.c bechordal.c bera.c beutil.c \
bera.h bechordal_main.c beschedregpress.c beschedtrace.c beschedtrivial.c \
- becopyopt.c becopyheur.c becopyheur2.c becopyilp.c becopyilp1.c \
+ beschedrand.c becopyopt.c becopyheur.c becopyheur2.c becopyilp.c becopyilp1.c \
becopyilp2.c beifg.c becopystat.c bearch.c bechordal_draw.c \
bechordal_draw.h beirgmod.c beirgmod.h benode.c benode_t.h \
bessadestr.c beifg_std.c bespill.c bespillbelady.c \
if(perm) {
const ir_edge_t *edge;
- be_stat_ev("constr_perm", 1);
+ be_stat_ev("constr_perm", get_irn_arity(perm));
foreach_out_edge(perm, edge) {
ir_node *proj = get_edge_src_irn(edge);
arch_set_irn_register(aenv, proj, NULL);
typedef struct _node_stat_t {
unsigned int n_phis; /**< Phis of the current register class. */
unsigned int n_mem_phis; /**< Memory Phis (Phis with spill operands). */
+ unsigned int n_copies; /**< Copies */
+ unsigned int n_perms; /**< Perms */
unsigned int n_spills; /**< Spill nodes */
- unsigned int n_reloads; /**< Reloads. */
+ unsigned int n_reloads; /**< Reloads */
} node_stat_t;
struct node_stat_walker {
else if(arch_irn_classify(aenv, irn) & arch_irn_class_reload)
++env->stat->n_reloads;
+ else if(arch_irn_classify(aenv, irn) & arch_irn_class_copy)
+ ++env->stat->n_copies;
+
+ else if(arch_irn_classify(aenv, irn) & arch_irn_class_perm)
+ ++env->stat->n_perms;
}
/* a mem phi is a PhiM with a mem phi operand or a Spill operand */
BE_TIMER_POP(ra_timer.t_verify);
+ if(stat_file) {
+ node_stats(&chordal_env, &node_stat);
+ be_stat_ev("perms_before_coal", node_stat.n_perms);
+ be_stat_ev("copies_before_coal", node_stat.n_copies);
+ }
+
/* copy minimization */
BE_TIMER_PUSH(ra_timer.t_copymin);
co_driver(&chordal_env);
BE_TIMER_POP(ra_timer.t_copymin);
+
dump(BE_CH_DUMP_COPYMIN, irg, chordal_env.cls, "-copymin", dump_ir_block_graph_sched);
BE_TIMER_PUSH(ra_timer.t_verify);
pmap_destroy(chordal_env.border_heads);
bitset_free(chordal_env.ignore_colors);
+ if(stat_file) {
+ node_stats(&chordal_env, &node_stat);
+ be_stat_ev("perms_after_coal", node_stat.n_perms);
+ be_stat_ev("copies_after_coal", node_stat.n_copies);
+ }
+
be_stat_ev_pop();
}
*
*/
+#include "bestatevent.h"
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#endif
}
+ be_stat_ev_dbl("co_ilp_objval", ienv->lp->objval);
+ be_stat_ev_dbl("co_ilp_best_bound", ienv->lp->best_bound);
+ be_stat_ev ("co_ilp_iter", ienv->lp->iterations);
+ be_stat_ev_dbl("co_ilp_sol_time", ienv->lp->sol_time);
+
if(dump_flags & DUMP_ILP) {
FILE *f = be_chordal_open(ienv->co->cenv, "", "-co.ilp");
lpp_dump_plain(ienv->lp, f);
static int do_stats = 0;
static cost_fct_t cost_func = co_get_costs_exec_freq;
static int algo = CO_ALGO_HEUR2;
+static int improve = 1;
#ifdef WITH_LIBCORE
static const lc_opt_enum_mask_items_t dump_items[] = {
};
static const lc_opt_table_entry_t options[] = {
- LC_OPT_ENT_ENUM_INT ("algo", "select copy optimization algo (heur, heur2, heur3, ilp)", &algo_var),
- LC_OPT_ENT_ENUM_FUNC_PTR ("cost", "select a cost function (freq, loop, one)", &cost_func_var),
- LC_OPT_ENT_ENUM_MASK ("dump", "dump ifg before or after copy optimization", &dump_var),
- LC_OPT_ENT_ENUM_MASK ("style", "dump style for ifg dumping", &style_var),
- LC_OPT_ENT_BOOL ("stats", "dump statistics after each optimization", &do_stats),
+ LC_OPT_ENT_ENUM_INT ("algo", "select copy optimization algo (heur, heur2, heur3, ilp)", &algo_var),
+ LC_OPT_ENT_ENUM_FUNC_PTR ("cost", "select a cost function (freq, loop, one)", &cost_func_var),
+ LC_OPT_ENT_ENUM_MASK ("dump", "dump ifg before or after copy optimization", &dump_var),
+ LC_OPT_ENT_ENUM_MASK ("style", "dump style for ifg dumping", &style_var),
+ LC_OPT_ENT_BOOL ("stats", "dump statistics after each optimization", &do_stats),
+ LC_OPT_ENT_BOOL ("improve", "run heur3 before if algo can exploit start solutions", &improve),
{ NULL }
};
|___/
*/
-static co_algo_t *algos[] = {
- void_algo,
- co_solve_heuristic,
- co_solve_heuristic_new,
- co_solve_heuristic_java,
+typedef struct {
+ co_algo_t *algo;
+ const char *name;
+ int can_improve_existing;
+} co_algo_info_t;
+
+static co_algo_info_t algos[] = {
+ { void_algo, "none", 0 },
+ { co_solve_heuristic, "heur1", 0 },
+ { co_solve_heuristic_new, "heur2", 0 },
+ { co_solve_heuristic_java, "heur3", 0 },
#ifdef WITH_ILP
- co_solve_ilp2
+ { co_solve_ilp2, "ilp", 1 },
#endif
+ { NULL, "", 0 }
};
/*
fclose(f);
}
- algo_func = algos[algo];
+ /* if the algo can improve results, provide an initial solution with heur3 */
+ if(improve && algos[algo].can_improve_existing) {
+ co_complete_stats_t stats;
+
+ /* produce a heuristical solution */
+ co_solve_heuristic_java(co);
+
+ /* do the stats and provide the current costs */
+ co_complete_stats(co, &stats);
+ be_stat_ev("co_prepare_costs", stats.costs);
+ }
+
+ algo_func = algos[algo].algo;
was_optimal = algo_func(co);
be_stat_ev("co_optimal", was_optimal);
#include "bechordal_t.h"
#include "bejavacoal.h"
#include "benodesets.h"
+#include "bestatevent.h"
#define DBG_COALESCING 1
// insert node into schedule
blockend = get_end_of_block_insertion_point(memperm->block);
sched_add_before(blockend, mempermnode);
+ be_stat_ev("mem_perm", memperm->entrycount);
for(entry = memperm->entries, i = 0; entry != NULL; entry = entry->next, ++i) {
ir_node *proj;
in[pp->pos] = pp->arg;
perm = be_new_Perm(chordal_env->cls, irg, pred_bl, n_projs, in);
- be_stat_ev("phi_perm", 1);
+ be_stat_ev("phi_perm", n_projs);
free(in);
insert_after = sched_skip(sched_last(pred_bl), 0, sched_skip_cf_predicator, chordal_env->birg->main_env->arch_env);
}
}
+void be_stat_ev_dbl(const char *ev, double value)
+{
+ if(sp > 0) {
+ ev_env_t *env = &envs[sp - 1];
+ if(env->f)
+ fprintf(env->f, "%s%s;%f\n", env->tag, ev, value);
+ }
+}
+
int be_stat_ev_is_active(void)
{
return sp > 0 && envs[sp - 1].f;
void be_stat_ev_pop(void);
void be_stat_ev(const char *ev, int value);
+void be_stat_ev_dbl(const char *ev, double value);
int be_stat_ev_is_active(void);