X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbecopystat.c;h=fc1df4efdd64f753feec72abf016775744c1ae96;hb=80a6158fdd766f42ee6c508a773bc114ff1b61f3;hp=fa6ee3eb33d0e0a71f07bff62a04d193dc0e3414;hpb=e442e5fd0f994c3d50e4838fb754b2b7a298326f;p=libfirm diff --git a/ir/be/becopystat.c b/ir/be/becopystat.c index fa6ee3eb3..fc1df4efd 100644 --- a/ir/be/becopystat.c +++ b/ir/be/becopystat.c @@ -21,6 +21,8 @@ #include "beutil.h" #include "becopyopt_t.h" #include "becopystat.h" +#include "beirg_t.h" +#include "bemodule.h" #define DEBUG_LVL SET_LEVEL_1 DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;) @@ -93,24 +95,26 @@ static pset *all_phi_classes; static pset *all_copy_nodes; static ir_graph *last_irg; -void copystat_init(void) { +void be_init_copystat(void) { FIRM_DBG_REGISTER(dbg, "firm.be.copystat"); all_phi_nodes = pset_new_ptr_default(); all_phi_classes = pset_new_ptr_default(); all_copy_nodes = pset_new_ptr_default(); + memset(curr_vals, 0, sizeof(curr_vals)); } +BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copystat); -void copystat_reset(void) { - int i; - for (i = 0; i < ASIZE; ++i) - curr_vals[i] = 0; +void be_quit_copystat(void) { del_pset(all_phi_nodes); del_pset(all_phi_classes); del_pset(all_copy_nodes); - all_phi_nodes = pset_new_ptr_default(); - all_phi_classes = pset_new_ptr_default(); - all_copy_nodes = pset_new_ptr_default(); +} +BE_REGISTER_MODULE_DESTRUCTOR(be_quit_copystat); + +void copystat_reset(void) { + be_quit_copystat(); + be_init_copystat(); } /** @@ -444,10 +448,12 @@ static void save_colors(color_save_t *color_saver) { irg_walk_graph(color_saver->chordal_env->irg, save_load, NULL, color_saver); } +#ifdef WITH_ILP static void load_colors(color_save_t *color_saver) { color_saver->flag = 1; irg_walk_graph(color_saver->chordal_env->irg, save_load, NULL, color_saver); } +#endif /** * Main compare routine