2 * Header for copy optimization problem. Analysis and set up of the problem.
17 #include <sys/types.h>
26 #include "sp_matrix.h"
38 #include "bechordal_t.h"
41 * TODO external things
42 * define get_weight to sth representing the _gain_ if node n and m
43 * have the same color. Must return values MIN_WEIGHT <= . <= MAX_WEIGHT.
45 #define get_weight(n,m) 1
46 #define is_possible_color(irn, col) 1
50 * A single unit of optimization. Lots of these form a copy-opt problem
52 typedef struct _unit_t {
53 struct list_head units; /**< chain for all units */
54 int interf; /**< number of nodes dropped due to interference */
55 int node_count; /**< size of the nodes array */
56 const ir_node **nodes; /**< [0] is the root-node, others are non interfering args of it. */
59 int mis_size; /**< size of a mis considering only ifg (not coloring conflicts) */
60 struct list_head queue; /**< list of (mis/color) sorted by size of mis */
64 * Data representing the problem of copy minimization.
66 typedef struct _copy_opt_t {
67 ir_graph *irg; /**< the irg which is processed */
68 struct list_head units; /**< all units to optimize in right oreder */
69 pset *roots; /**< used only temporary for detecting multiple appends */
74 * Generate the problem. Collect all infos and optimizable nodes.
76 copy_opt_t *new_copy_opt(ir_graph *irg);
81 void free_copy_opt(copy_opt_t *co);
84 * Returns a lower bound for the number of copies needed based on interfering
85 * arguments and the size of a max indep. set (only ifg-edges) of the other args.
87 int co_get_lower_bound(copy_opt_t *co);
90 * Returns the number of arguments interfering with their root node. This also
91 * is a (worse) lower bound for the number of copies needed.
93 int co_get_interferer_count(copy_opt_t *co);
96 * Solves the problem using a heuristic approach
98 void co_heur_opt(copy_opt_t *co);
101 * Solves the problem using mixed integer programming
103 void co_ilp_opt(copy_opt_t *co);