/**
+ * Author: Daniel Grund
+ * Date: 11.04.2005
+ * Copyright: (c) Universitaet Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+
* Main file for the optimization reducing the copies needed for:
* - phi coalescing
* - register-constrained nodes
- *
- * @author Daniel Grund
- * @date 11.04.2005
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "debug.h"
#include "becopyopt.h"
#include "becopystat.h"
#include "becopyoptmain.h"
#define DO_HEUR
-#define DO_ILP
+#undef DO_ILP
#define DEBUG_LVL SET_LEVEL_1
static firm_dbg_module_t *dbg = NULL;
void be_copy_opt_init(void) {
- dbg = firm_dbg_register("ir.be.copyopt");
- firm_dbg_set_mask(dbg, DEBUG_LVL);
+ dbg = firm_dbg_register("ir.be.copyoptmain");
+ firm_dbg_set_mask(dbg, LEVEL_1);
}
-void be_copy_opt(ir_graph* irg, const arch_isa_if_t *isa, const arch_register_class_t *cls) {
+void be_copy_opt(be_chordal_env_t *chordal_env) {
copy_opt_t *co;
int lb, copies;
- DBG((dbg, LEVEL_1, "\nIRG: %s\n\n", get_entity_name(get_irg_entity(irg))));
- co = new_copy_opt(irg, isa, cls);
+ co = new_copy_opt(chordal_env);
+ DBG((dbg, LEVEL_1, "===> %s <===\n", co->name));
co_check_allocation(co);
#ifdef DO_STAT
copies = co_get_copy_count(co);
curr_vals[I_COPIES_INIT] += copies;
- DBG((dbg, 1, "Init copies: %3d\n", copies));
+ DBG((dbg, LEVEL_1, "Init copies: %3d\n", copies));
#endif
#ifdef DO_HEUR
#ifdef DO_STAT
copies = co_get_copy_count(co);
curr_vals[I_COPIES_HEUR] += copies;
- DBG((dbg, 1, "Heur copies: %3d\n", copies));
+ DBG((dbg, LEVEL_1, "Heur copies: %3d\n", copies));
#endif
#endif
#ifdef DO_ILP
lb = co_get_lower_bound(co);
copies = co_get_copy_count(co);
-//TODO remove checks and enable lb
assert(copies>=lb && "At least one computation of these two is boooogy");
-// if (copies > lb) {
+
+ if (copies > lb) {
co_ilp_opt(co);
co_check_allocation(co);
-// }
- copies = co_get_copy_count(co);
- assert(copies>=lb && "At least one computation of these two is boooogy");
+ }
#ifdef DO_STAT
copies = co_get_copy_count(co);
- curr_vals[I_COPIES_HEUR] += copies;
- DBG((dbg, 1, "Opt copies: %3d\n", copies));
+ curr_vals[I_COPIES_OPT] += copies;
+ DBG((dbg, LEVEL_1, "Opt copies: %3d\n", copies));
+ assert(copies>=lb && "At least one computation of these two is boooogy");
#endif
#endif