2 * Main file for the optimization reducing the copies needed for:
4 * - register-constrained nodes
13 #include "becopyopt.h"
14 #include "becopystat.h"
15 #include "becopyoptmain.h"
20 #define DEBUG_LVL SET_LEVEL_1
21 static firm_dbg_module_t *dbg = NULL;
23 void be_copy_opt_init(void) {
24 dbg = firm_dbg_register("ir.be.copyopt");
25 firm_dbg_set_mask(dbg, DEBUG_LVL);
28 void be_copy_opt(ir_graph* irg, const arch_isa_if_t *isa, const arch_register_class_t *cls) {
31 co = new_copy_opt(irg, isa, cls);
32 DBG((dbg, LEVEL_1, "\n\n ===> %s <===\n\n", co->name));
33 co_check_allocation(co);
36 copies = co_get_copy_count(co);
37 curr_vals[I_COPIES_INIT] += copies;
38 DBG((dbg, 1, "Init copies: %3d\n", copies));
43 co_check_allocation(co);
45 copies = co_get_copy_count(co);
46 curr_vals[I_COPIES_HEUR] += copies;
47 DBG((dbg, 1, "Heur copies: %3d\n", copies));
52 lb = co_get_lower_bound(co);
53 copies = co_get_copy_count(co);
54 //TODO remove checks and enable lb
56 DBG((dbg, 0, "\n\nAt least one computation of these two is boooogy %d < %d\n\n", lb, copies));
60 co_check_allocation(co);
62 copies = co_get_copy_count(co);
63 assert(copies>=lb && "At least one computation of these two is boooogy");
66 copies = co_get_copy_count(co);
67 curr_vals[I_COPIES_HEUR] += copies;
68 DBG((dbg, 1, "Opt copies: %3d\n", copies));