4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
7 * Main file for the optimization reducing the copies needed for:
9 * - Register-constrained nodes
10 * - Two-address code instructions
17 #include "bechordal.h"
20 typedef int(*cost_fct_t)(ir_node*, ir_node*, int);
22 typedef struct _copy_opt_t copy_opt_t;
25 * Has to be called during the firm init phase
27 void be_copy_opt_init(void);
30 * Generate the problem. Collect all information and optimizable nodes.
32 copy_opt_t *new_copy_opt(be_chordal_env_t *chordal_env, cost_fct_t get_costs);
35 * Free the space used...
37 void free_copy_opt(copy_opt_t *co);
40 * Computes the costs of a copy according to loop depth
41 * @param pos: the argument position of arg in the root arguments
42 * @return Must be >= 0 in all cases.
44 int co_get_costs_loop_depth(ir_node *root, ir_node* arg, int pos);
47 * All costs equal 1. Using this will reduce the _number_ of copies.
48 * @return Must be >= 0 in all cases.
50 int co_get_costs_all_one(ir_node *root, ir_node* arg, int pos);
53 * Solves the problem using a heuristic approach
55 int co_solve_heuristic(copy_opt_t *co);
58 * Solves the problem using mixed integer programming
59 * @returns 1 iff solution state was optimal
61 int co_solve_ilp1(copy_opt_t *co, double time_limit);
64 * Solves the problem using mixed integer programming
65 * @returns 1 iff solution state was optimal
67 int co_solve_ilp2(copy_opt_t *co, double time_limit);