2 * Main file for the optimization reducing the copies needed for:
4 * - register-constrained nodes
10 #include "becopyopt.h"
11 #include "becopystat.h"
12 #include "becopyoptmain.h"
17 #define DEBUG_LVL SET_LEVEL_1
18 static firm_dbg_module_t *dbg = NULL;
20 void be_copy_opt_init(void) {
21 dbg = firm_dbg_register("ir.be.copyopt");
22 firm_dbg_set_mask(dbg, DEBUG_LVL);
25 void be_copy_opt(ir_graph* irg, const arch_isa_if_t *isa, const arch_register_class_t *cls) {
28 co = new_copy_opt(irg, isa, cls);
29 DBG((dbg, LEVEL_1, "\n\n ===> %s <===\n\n", co->name));
30 co_check_allocation(co);
33 copies = co_get_copy_count(co);
34 curr_vals[I_COPIES_INIT] += copies;
35 DBG((dbg, 1, "Init copies: %3d\n", copies));
40 co_check_allocation(co);
42 copies = co_get_copy_count(co);
43 curr_vals[I_COPIES_HEUR] += copies;
44 DBG((dbg, 1, "Heur copies: %3d\n", copies));
49 lb = co_get_lower_bound(co);
50 copies = co_get_copy_count(co);
51 //TODO remove checks and enable lb
53 DBG((dbg, 0, "\n\nAt least one computation of these two is boooogy %d < %d\n\n", lb, copies));
57 co_check_allocation(co);
59 copies = co_get_copy_count(co);
60 assert(copies>=lb && "At least one computation of these two is boooogy");
63 copies = co_get_copy_count(co);
64 curr_vals[I_COPIES_HEUR] += copies;
65 DBG((dbg, 1, "Opt copies: %3d\n", copies));