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) {
29 DBG((dbg, LEVEL_1, "\nIRG: %s\n\n", get_entity_name(get_irg_entity(irg))));
30 co = new_copy_opt(irg, isa, cls);
31 co_check_allocation(co);
34 copies = co_get_copy_count(co);
35 curr_vals[I_COPIES_INIT] += copies;
36 DBG((dbg, 1, "Init copies: %3d\n", copies));
41 co_check_allocation(co);
43 copies = co_get_copy_count(co);
44 curr_vals[I_COPIES_HEUR] += copies;
45 DBG((dbg, 1, "Heur copies: %3d\n", copies));
50 lb = co_get_lower_bound(co);
51 copies = co_get_copy_count(co);
52 //TODO remove checks and enable lb
53 assert(copies>=lb && "At least one computation of these two is boooogy");
56 co_check_allocation(co);
58 copies = co_get_copy_count(co);
59 assert(copies>=lb && "At least one computation of these two is boooogy");
62 copies = co_get_copy_count(co);
63 curr_vals[I_COPIES_HEUR] += copies;
64 DBG((dbg, 1, "Opt copies: %3d\n", copies));