From 606235a7824fadb03f38504dd190542164a2977b Mon Sep 17 00:00:00 2001 From: Daniel Grund Date: Tue, 23 Aug 2005 20:50:10 +0000 Subject: [PATCH] bugfix --- ir/be/becopyilp.c | 8 +------- ir/be/becopystat.c | 12 +++++++++--- ir/be/becopystat.h | 2 -- ir/be/bemain.c | 6 +++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ir/be/becopyilp.c b/ir/be/becopyilp.c index ebcacb6f7..3ff18daf7 100644 --- a/ir/be/becopyilp.c +++ b/ir/be/becopyilp.c @@ -598,8 +598,6 @@ static void check_ecc_and_add_cut(problem_instance_t *pi, ir_node **path, int le int cst_idx, var_idx, i, nnr1, nnr2; char buf[30]; - printf("+++++++++++++++++++++++++++++++ PATH: %d\n", length); - /* add cut to ilp */ mangle_cst(buf, 'Q', pi->cst_counter++); cst_idx = lpp_add_cst(pi->curr_lp, buf, lpp_greater, 1); @@ -845,10 +843,6 @@ static problem_instance_t *new_pi(const copy_opt_t *co) { pi_add_constr_preColoring(pi); #endif - FILE *out = fopen(pi->co->name, "wt"); - lpp_dump_plain(pi->curr_lp, out); - fclose(out); - return pi; } @@ -898,7 +892,7 @@ static void pi_solve_ilp(problem_instance_t *pi) { pi_set_start_sol(pi); lpp_solve_net(pi->curr_lp, LPP_HOST, LPP_SOLVER); // lpp_solve_cplex(pi->curr_lp); -// printf(" SOLUTION TIME: %.2f\n", pi->curr_lp->sol_time); + DBG((dbg, LEVEL_1, "Solution time: %.2f\n", pi->curr_lp->sol_time)); } /** diff --git a/ir/be/becopystat.c b/ir/be/becopystat.c index 85bc5fbbb..bb2d96eb3 100644 --- a/ir/be/becopystat.c +++ b/ir/be/becopystat.c @@ -86,6 +86,7 @@ int curr_vals[ASIZE]; static pset *all_phi_nodes; static pset *all_phi_classes; static pset *all_copy_nodes; +static ir_graph *last_irg; void copystat_init(void) { dbg = firm_dbg_register("ir.be.copystat"); @@ -118,7 +119,6 @@ static void irg_stat_walker(ir_node *node, void *env) { if (is_Block(node)) /* count all blocks */ curr_vals[I_BLOCKS]++; - //TODO if (is_Phi(node) && mode_is_datab(get_irn_mode(node))) /* collect phis */ pset_insert_ptr(all_phi_nodes, node); @@ -126,10 +126,10 @@ static void irg_stat_walker(ir_node *node, void *env) { pset_insert_ptr(all_copy_nodes, node); } -void copystat_collect_irg(ir_graph *irg, arch_env_t *arch_env) { +static void copystat_collect_irg(ir_graph *irg, arch_env_t *arch_env) { irg_walk_graph(irg, irg_stat_walker, NULL, arch_env); - curr_vals[I_BLOCKS] -= 2; /* substract 2 for start and end block */ all_phi_classes = phi_class_compute_by_phis(all_phi_nodes); + last_irg = irg; } /** @@ -277,6 +277,12 @@ static void stat_phi_class(be_chordal_env_t *chordal_env, pset *pc) { void copystat_collect_cls(be_chordal_env_t *chordal_env) { ir_node *n; pset *pc; + ir_graph *irg = chordal_env->session_env->irg; + + if (last_irg != irg) { + copystat_reset(); + copystat_collect_irg(irg, chordal_env->session_env->main_env->arch_env); + } for (n = pset_first(all_phi_nodes); n; n = pset_next(all_phi_nodes)) if (is_curr_reg_class(n)) diff --git a/ir/be/becopystat.h b/ir/be/becopystat.h index 3674ee211..0ed4b4b4d 100644 --- a/ir/be/becopystat.h +++ b/ir/be/becopystat.h @@ -17,7 +17,6 @@ void copystat_init(void); void copystat_reset(void); -void copystat_collect_irg(ir_graph *irg, arch_env_t *arch_env); void copystat_collect_cls(be_chordal_env_t *chordal_env); void copystat_add_max_costs(int costs); void copystat_add_inevit_costs(int costs); @@ -37,7 +36,6 @@ void copystat_dump_pretty(ir_graph *irg); #define copy_copystat_init(); #define copystat_reset(); -#define copystat_collect_irg(irg, arch_env); #define copystat_collect_cls(env); #define copystat_add_max_costs(costs); #define copystat_add_inevit_costs(costs); diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 7283ebf77..5f2413b78 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -55,6 +55,7 @@ void be_init(void) be_ra_chordal_init(); be_copy_opt_init(); copystat_init(); + phi_class_init(); } static be_main_env_t *be_init_env(be_main_env_t *env) @@ -152,9 +153,6 @@ static void be_main_loop(void) /* Build liveness information */ be_liveness(irg); - copystat_reset(); - copystat_collect_irg(irg, env.arch_env); - /* Perform the following for each register class. */ for(j = 0, m = isa->get_n_reg_class(); j < m; ++j) { be_chordal_env_t *chordal_env; @@ -188,7 +186,9 @@ static void be_main_loop(void) #endif copystat_collect_cls(chordal_env); +// dump_allocated_irg(env.arch_env, irg, "pre"); be_copy_opt(chordal_env); +// dump_allocated_irg(env.arch_env, irg, "post"); be_ssa_destruction(chordal_env); be_ssa_destruction_check(chordal_env); -- 2.20.1