2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief PBQP based register allocation.
9 * @author Thomas Bersch
13 /* miscellaneous includes */
21 #include "iredges_t.h"
26 #include "execfreq_t.h"
27 #include "bipartite.h"
29 /* libfirm/ir/be includes */
34 #include "bechordal_common.h"
35 #include "bechordal.h"
36 #include "bechordal_t.h"
44 #include "becopyopt.h"
51 #include "heuristical_co.h"
52 #include "heuristical_co_ld.h"
54 #include "html_dumper.h"
55 #include "pbqp_node_t.h"
56 #include "pbqp_node.h"
57 #include "pbqp_edge_t.h"
61 #define USE_BIPARTIT_MATCHING 0
62 #define DO_USEFUL_OPT 1
65 static int use_exec_freq = true;
66 static int use_late_decision = false;
68 typedef struct be_pbqp_alloc_env_t {
69 pbqp_t *pbqp_inst; /**< PBQP instance for register allocation */
70 ir_graph *irg; /**< The graph under examination. */
71 const arch_register_class_t *cls; /**< Current processed register class */
73 bitset_t *allocatable_regs;
74 pbqp_matrix_t *ife_matrix_template;
75 pbqp_matrix_t *aff_matrix_template;
77 unsigned *restr_nodes;
78 unsigned *ife_edge_num;
79 ir_execfreq_int_factors execfreq_factors;
80 be_chordal_env_t *env;
81 } be_pbqp_alloc_env_t;
84 #define is_Reg_Phi(irn) (is_Phi(irn) && mode_is_data(get_irn_mode(irn)))
85 #define get_Perm_src(irn) (get_irn_n(get_Proj_pred(irn), get_Proj_proj(irn)))
86 #define is_Perm_Proj(irn) (is_Proj(irn) && be_is_Perm(get_Proj_pred(irn)))
87 #define insert_edge(pbqp, src_node, trg_node, template_matrix) (add_edge_costs(pbqp, get_irn_idx(src_node), get_irn_idx(trg_node), pbqp_matrix_copy(pbqp, template_matrix)))
88 #define get_free_regs(restr_nodes, cls, irn) (arch_register_class_n_regs(cls) - restr_nodes[get_irn_idx(irn)])
90 static const lc_opt_table_entry_t options[] = {
91 LC_OPT_ENT_BOOL("exec_freq", "use exec_freq", &use_exec_freq),
92 LC_OPT_ENT_BOOL("late_decision", "use late decision for register allocation", &use_late_decision),
97 static FILE *my_open(const be_chordal_env_t *env, const char *prefix, const char *suffix)
104 const char *cup_name = be_get_irg_main_env(env->irg)->cup_name;
106 n = strlen(cup_name);
107 tu_name = XMALLOCN(char, n + 1);
108 strcpy(tu_name, cup_name);
109 for (i = 0; i < n; ++i)
110 if (tu_name[i] == '.')
113 ir_snprintf(buf, sizeof(buf), "%s%s_%F_%s%s", prefix, tu_name, env->irg, env->cls->name, suffix);
115 result = fopen(buf, "wt");
116 if (result == NULL) {
117 panic("Couldn't open '%s' for writing.", buf);
125 static void create_pbqp_node(be_pbqp_alloc_env_t *pbqp_alloc_env, ir_node *irn)
127 const arch_register_class_t *cls = pbqp_alloc_env->cls;
128 pbqp_t *pbqp_inst = pbqp_alloc_env->pbqp_inst;
129 bitset_t *allocatable_regs = pbqp_alloc_env->allocatable_regs;
130 unsigned colors_n = arch_register_class_n_regs(cls);
131 unsigned cntConstrains = 0;
133 /* create costs vector depending on register constrains */
134 vector_t *costs_vector = vector_alloc(pbqp_inst, colors_n);
136 /* set costs depending on register constrains */
138 for (idx = 0; idx < colors_n; idx++) {
139 const arch_register_req_t *req = arch_get_irn_register_req(irn);
140 const arch_register_t *reg = arch_register_for_index(cls, idx);
141 if (!bitset_is_set(allocatable_regs, idx)
142 || !arch_reg_is_allocatable(req, reg)) {
144 vector_set(costs_vector, idx, INF_COSTS);
149 /* add vector to pbqp node */
150 add_node_costs(pbqp_inst, get_irn_idx(irn), costs_vector);
151 pbqp_alloc_env->restr_nodes[get_irn_idx(irn)] = cntConstrains;
154 static void insert_ife_edge(be_pbqp_alloc_env_t *pbqp_alloc_env, ir_node *src_node, ir_node *trg_node)
156 pbqp_t *pbqp = pbqp_alloc_env->pbqp_inst;
157 const arch_register_class_t *cls = pbqp_alloc_env->cls;
158 pbqp_matrix_t *ife_matrix_template = pbqp_alloc_env->ife_matrix_template;
159 unsigned *restr_nodes = pbqp_alloc_env->restr_nodes;
161 if (get_edge(pbqp, get_irn_idx(src_node), get_irn_idx(trg_node)) == NULL) {
163 /* increase ife edge counter */
164 pbqp_alloc_env->ife_edge_num[get_irn_idx(src_node)]++;
165 pbqp_alloc_env->ife_edge_num[get_irn_idx(trg_node)]++;
167 #if DO_USEFUL_OPT || USE_BIPARTIT_MATCHING
168 /* do useful optimization to speed up pbqp solving (we can do this because we know our matrix) */
169 if (get_free_regs(restr_nodes, cls, src_node) == 1 && get_free_regs(restr_nodes, cls, trg_node) == 1) {
170 assert(vector_get_min_index(get_node(pbqp, get_irn_idx(src_node))->costs) !=
171 vector_get_min_index(get_node(pbqp, get_irn_idx(trg_node))->costs) &&
172 "Interfering nodes must not have the same register!");
175 if (get_free_regs(restr_nodes, cls, src_node) == 1 || get_free_regs(restr_nodes, cls, trg_node) == 1) {
176 if (get_free_regs(restr_nodes, cls, src_node) == 1) {
177 unsigned idx = vector_get_min_index(get_node(pbqp, get_irn_idx(src_node))->costs);
178 vector_set(get_node(pbqp, get_irn_idx(trg_node))->costs, idx, INF_COSTS);
181 unsigned idx = vector_get_min_index(get_node(pbqp, get_irn_idx(trg_node))->costs);
182 vector_set(get_node(pbqp, get_irn_idx(src_node))->costs, idx, INF_COSTS);
187 /* insert interference edge */
188 insert_edge(pbqp, src_node, trg_node, ife_matrix_template);
192 static void insert_afe_edge(be_pbqp_alloc_env_t *pbqp_alloc_env, ir_node *src_node, ir_node *trg_node, int pos)
194 pbqp_t *pbqp = pbqp_alloc_env->pbqp_inst;
195 const arch_register_class_t *cls = pbqp_alloc_env->cls;
196 unsigned *restr_nodes = pbqp_alloc_env->restr_nodes;
197 pbqp_matrix_t *afe_matrix = pbqp_matrix_alloc(pbqp, arch_register_class_n_regs(cls), arch_register_class_n_regs(cls));
198 unsigned colors_n = arch_register_class_n_regs(cls);
200 if (get_edge(pbqp, get_irn_idx(src_node), get_irn_idx(trg_node)) == NULL) {
202 /* get exec_freq for copy_block */
203 ir_node *root_bl = get_nodes_block(src_node);
204 ir_node *copy_bl = is_Phi(src_node) ? get_Block_cfgpred_block(root_bl, pos) : root_bl;
205 int res = get_block_execfreq_int(&pbqp_alloc_env->execfreq_factors, copy_bl);
207 /* create afe-matrix */
209 for (row = 0; row < colors_n; row++) {
210 for (col = 0; col < colors_n; col++) {
212 pbqp_matrix_set(afe_matrix, row, col, (num)res);
217 afe_matrix = pbqp_alloc_env->aff_matrix_template;
219 #if DO_USEFUL_OPT || USE_BIPARTIT_MATCHING
220 /* do useful optimization to speed up pbqp solving */
221 if (get_free_regs(restr_nodes, cls, src_node) == 1 && get_free_regs(restr_nodes, cls, trg_node) == 1) {
224 if (get_free_regs(restr_nodes, cls, src_node) == 1 || get_free_regs(restr_nodes, cls, trg_node) == 1) {
225 if (get_free_regs(restr_nodes, cls, src_node) == 1) {
226 unsigned regIdx = vector_get_min_index(get_node(pbqp, get_irn_idx(src_node))->costs);
227 vector_add_matrix_col(get_node(pbqp, get_irn_idx(trg_node))->costs, afe_matrix, regIdx);
230 unsigned regIdx = vector_get_min_index(get_node(pbqp, get_irn_idx(trg_node))->costs);
231 vector_add_matrix_col(get_node(pbqp, get_irn_idx(src_node))->costs, afe_matrix, regIdx);
236 /* insert interference edge */
237 insert_edge(pbqp, src_node, trg_node, afe_matrix);
241 static void create_affinity_edges(ir_node *irn, void *env)
243 be_pbqp_alloc_env_t *pbqp_alloc_env = (be_pbqp_alloc_env_t*)env;
244 const arch_register_class_t *cls = pbqp_alloc_env->cls;
245 const arch_register_req_t *req = arch_get_irn_register_req(irn);
249 if (is_Reg_Phi(irn)) { /* Phis */
250 for (pos = 0, max = get_irn_arity(irn); pos < max; ++pos) {
251 ir_node *arg = get_irn_n(irn, pos);
253 if (!arch_irn_consider_in_reg_alloc(cls, arg))
256 /* no edges to itself */
261 insert_afe_edge(pbqp_alloc_env, irn, arg, pos);
264 else if (is_Perm_Proj(irn)) { /* Perms */
265 ir_node *arg = get_Perm_src(irn);
266 if (!arch_irn_consider_in_reg_alloc(cls, arg))
269 insert_afe_edge(pbqp_alloc_env, irn, arg, -1);
270 } else if (arch_register_req_is(req, should_be_same)) {
271 const unsigned other = req->other_same;
274 for (i = 0; 1U << i <= other; ++i) {
275 if (other & (1U << i)) {
276 ir_node *other = get_irn_n(skip_Proj(irn), i);
277 if (!arch_irn_consider_in_reg_alloc(cls, other))
280 /* no edges to itself */
285 insert_afe_edge(pbqp_alloc_env, irn, other, i);
291 static void create_pbqp_coloring_instance(ir_node *block, void *data)
293 be_pbqp_alloc_env_t *pbqp_alloc_env = (be_pbqp_alloc_env_t*)data;
294 be_lv_t *lv = pbqp_alloc_env->lv;
295 const arch_register_class_t *cls = pbqp_alloc_env->cls;
296 plist_t *rpeo = pbqp_alloc_env->rpeo;
297 pbqp_t *pbqp_inst = pbqp_alloc_env->pbqp_inst;
298 plist_t *temp_list = plist_new();
300 ir_nodeset_t live_nodes;
301 #if USE_BIPARTIT_MATCHING
302 int *assignment = ALLOCAN(int, cls->n_regs);
304 unsigned *restr_nodes = pbqp_alloc_env->restr_nodes;
305 pqueue_t *restr_nodes_queue = new_pqueue();
306 pqueue_t *queue = new_pqueue();
307 plist_t *sorted_list = plist_new();
308 ir_node *last_element = NULL;
311 /* first, determine the pressure */
312 /* (this is only for compatibility with copymin optimization, it's not needed for pbqp coloring) */
313 create_borders(block, pbqp_alloc_env->env);
315 /* calculate living nodes for the first step */
316 ir_nodeset_init(&live_nodes);
317 be_liveness_end_of_block(lv, cls, block, &live_nodes);
319 /* create pbqp nodes, interference edges and reverse perfect elimination order */
320 sched_foreach_reverse(block, irn) {
321 be_foreach_value(irn, value,
322 if (!arch_irn_consider_in_reg_alloc(cls, value))
325 /* create pbqp source node if it dosn't exist */
326 if (!get_node(pbqp_inst, get_irn_idx(value)))
327 create_pbqp_node(pbqp_alloc_env, value);
329 /* create nodes and interference edges */
330 foreach_ir_nodeset(&live_nodes, live, iter) {
331 /* create pbqp source node if it dosn't exist */
332 if (!get_node(pbqp_inst, get_irn_idx(live)))
333 create_pbqp_node(pbqp_alloc_env, live);
335 /* no edges to itself */
339 insert_ife_edge(pbqp_alloc_env, value, live);
343 /* get living nodes for next step */
345 be_liveness_transfer(cls, irn, &live_nodes);
348 #if USE_BIPARTIT_MATCHING
349 if (get_irn_mode(irn) == mode_T) {
350 unsigned clique_size = 0;
351 unsigned n_alloc = 0;
352 pbqp_node *clique[cls->n_regs];
353 bipartite_t *bp = bipartite_new(cls->n_regs, cls->n_regs);
355 /* add all proj after a perm to clique */
356 foreach_out_edge(irn, edge) {
357 ir_node *proj = get_edge_src_irn(edge);
359 /* ignore node if it is not necessary for register allocation */
360 if (!arch_irn_consider_in_reg_alloc(cls, proj))
363 /* insert pbqp node into temp rpeo list of this block */
364 plist_insert_front(temp_list, get_node(pbqp_inst, get_irn_idx(proj)));
366 if(is_Perm_Proj(proj)) {
367 /* add proj to clique */
368 pbqp_node *clique_member = get_node(pbqp_inst,proj->node_idx);
369 vector *costs = clique_member->costs;
372 clique[clique_size] = clique_member;
374 for(idx = 0; idx < costs->len; idx++) {
375 if(costs->entries[idx].data != INF_COSTS) {
376 bipartite_add(bp, clique_size, idx);
380 /* increase node counter */
386 if(clique_size > 0) {
387 plist_element_t *listElement;
388 foreach_plist(temp_list, listElement) {
389 pbqp_node *clique_candidate = listElement->data;
391 bool isMember = true;
393 /* clique size not bigger then register class size */
394 if(clique_size >= cls->n_regs) break;
396 for(idx = 0; idx < clique_size; idx++) {
397 pbqp_node *member = clique[idx];
399 if(member == clique_candidate) {
404 if(get_edge(pbqp_inst, member->index, clique_candidate->index) == NULL && get_edge(pbqp_inst, clique_candidate->index, member->index) == NULL) {
410 /* goto next list element if current node is not a member of the clique */
411 if(!isMember) { continue; }
413 /* add candidate to clique */
414 clique[clique_size] = clique_candidate;
416 vector *costs = clique_candidate->costs;
417 for(idx = 0; idx < costs->len; idx++) {
418 if(costs->entries[idx].data != INF_COSTS) {
419 bipartite_add(bp, clique_size, idx);
423 /* increase node counter */
428 /* solve bipartite matching */
429 bipartite_matching(bp, assignment);
432 unsigned nodeIdx = 0;
433 for(nodeIdx = 0; nodeIdx < clique_size; nodeIdx++) {
434 vector *costs = clique[nodeIdx]->costs;
436 for(idx = 0; idx < (int)costs->len; idx++) {
437 if(assignment[nodeIdx] != idx) {
438 costs->entries[idx].data = INF_COSTS;
441 assert(assignment[nodeIdx] >= 0 && "there must have been a register assigned (node not register pressure faithful?)");
448 if (arch_irn_consider_in_reg_alloc(cls, irn)) {
449 plist_insert_front(temp_list, get_node(pbqp_inst, get_irn_idx(irn)));
453 /* order nodes for perfect elimination order */
454 if (get_irn_mode(irn) == mode_T) {
455 bool allHaveIFEdges = true;
456 foreach_out_edge(irn, edge) {
457 ir_node *proj = get_edge_src_irn(edge);
458 if (!arch_irn_consider_in_reg_alloc(cls, proj))
461 /* insert proj node into priority queue (descending by the number of interference edges) */
462 if (get_free_regs(restr_nodes, cls, proj) <= 4) {
463 pqueue_put(restr_nodes_queue, proj, pbqp_alloc_env->ife_edge_num[get_irn_idx(proj)]);
466 pqueue_put(queue, proj, pbqp_alloc_env->ife_edge_num[get_irn_idx(proj)]);
469 /* skip last step if there is no last_element */
470 if(last_element == NULL)
473 /* check if proj has an if edge to last_element (at this time pbqp contains only if edges) */
474 if(get_edge(pbqp_inst, proj->node_idx, last_element->node_idx) == NULL && get_edge(pbqp_inst, last_element->node_idx, proj->node_idx) == NULL) {
475 allHaveIFEdges = false; /* there is no if edge between proj and last_element */
479 if(last_element != NULL && allHaveIFEdges) {
480 if (get_free_regs(restr_nodes, cls, last_element) <= 4) {
481 pqueue_put(restr_nodes_queue, last_element, pbqp_alloc_env->ife_edge_num[get_irn_idx(last_element)]);
484 pqueue_put(queue, last_element, pbqp_alloc_env->ife_edge_num[get_irn_idx(last_element)]);
486 plist_erase(temp_list, plist_find_value(temp_list, get_node(pbqp_inst, last_element->node_idx)));
490 /* first insert all restricted proj nodes */
491 while (!pqueue_empty(restr_nodes_queue)) {
492 ir_node *node = (ir_node*)pqueue_pop_front(restr_nodes_queue);
493 plist_insert_front(sorted_list, get_node(pbqp_inst, get_irn_idx(node)));
496 /* insert proj nodes descending by their number of interference edges */
497 while (!pqueue_empty(queue)) {
498 ir_node *node = (ir_node*)pqueue_pop_front(queue);
499 plist_insert_front(sorted_list, get_node(pbqp_inst, get_irn_idx(node)));
502 /* invert sorted list */
503 foreach_plist(sorted_list, el) {
504 plist_insert_front(temp_list, el->data);
507 plist_clear(sorted_list);
511 if (arch_irn_consider_in_reg_alloc(cls, irn)) {
512 // remember last colorable node
514 plist_insert_front(temp_list, get_node(pbqp_inst, get_irn_idx(irn)));
517 // node not colorable, so ignore it
524 /* add the temp rpeo list of this block to the global reverse perfect elimination order list*/
525 foreach_plist(temp_list, el) {
526 plist_insert_back(rpeo, el->data);
529 /* free reserved memory */
530 ir_nodeset_destroy(&live_nodes);
531 plist_free(temp_list);
532 #if USE_BIPARTIT_MATCHING
534 plist_free(sorted_list);
536 del_pqueue(restr_nodes_queue);
540 static void insert_perms(ir_node *block, void *data)
542 be_chordal_env_t *env = (be_chordal_env_t*)data;
545 for (irn = sched_first(block); !sched_is_end(irn);) {
546 ir_node *const next = sched_next(irn);
547 be_insn_t * insn = be_scan_insn(env, irn);
549 pre_process_constraints(env, &insn);
555 static void be_pbqp_coloring(be_chordal_env_t *env)
557 ir_graph *irg = env->irg;
558 const arch_register_class_t *cls = env->cls;
560 plist_element_t *element = NULL;
561 unsigned colors_n = arch_register_class_n_regs(cls);
562 be_pbqp_alloc_env_t pbqp_alloc_env;
565 pbqp_matrix_t *ife_matrix;
571 ir_timer_t *t_ra_pbqp_alloc_create = ir_timer_new();
572 ir_timer_t *t_ra_pbqp_alloc_solve = ir_timer_new();
573 ir_timer_t *t_ra_pbqp_alloc_create_aff = ir_timer_new();
575 printf("#### ----- === Allocating registers of %s (%s) ===\n", cls->name, get_entity_name(get_irg_entity(irg)));
577 be_assure_live_sets(irg);
578 lv = be_get_irg_liveness(irg);
582 dom_tree_walk_irg(irg, insert_perms, NULL, env);
584 /* dump graph after inserting perms */
585 if (env->opts->dump_flags & BE_CH_DUMP_CONSTR) {
587 snprintf(buf, sizeof(buf), "%s-constr", cls->name);
588 dump_ir_graph(irg, buf);
591 ir_calculate_execfreq_int_factors(&pbqp_alloc_env.execfreq_factors, irg);
593 /* initialize pbqp allocation data structure */
594 pbqp_alloc_env.pbqp_inst = alloc_pbqp(get_irg_last_idx(irg)); /* initialize pbqp instance */
595 pbqp_alloc_env.cls = cls;
596 pbqp_alloc_env.irg = irg;
597 pbqp_alloc_env.lv = lv;
598 pbqp_alloc_env.allocatable_regs = bitset_malloc(colors_n);
599 pbqp_alloc_env.rpeo = plist_new();
600 pbqp_alloc_env.restr_nodes = XMALLOCNZ(unsigned, get_irg_last_idx(irg));
601 pbqp_alloc_env.ife_edge_num = XMALLOCNZ(unsigned, get_irg_last_idx(irg));
602 pbqp_alloc_env.env = env;
603 be_put_allocatable_regs(irg, cls, pbqp_alloc_env.allocatable_regs);
606 /* create costs matrix template for interference edges */
607 ife_matrix = pbqp_matrix_alloc(pbqp_alloc_env.pbqp_inst, colors_n, colors_n);
609 for (row = 0, col = 0; row < colors_n; row++, col++)
610 pbqp_matrix_set(ife_matrix, row, col, INF_COSTS);
612 pbqp_alloc_env.ife_matrix_template = ife_matrix;
615 if (!use_exec_freq) {
616 /* create costs matrix template for affinity edges */
617 pbqp_matrix_t *afe_matrix = pbqp_matrix_alloc(pbqp_alloc_env.pbqp_inst, colors_n, colors_n);
619 for (row = 0; row < colors_n; row++) {
620 for (col = 0; col < colors_n; col++) {
622 pbqp_matrix_set(afe_matrix, row, col, 2);
625 pbqp_alloc_env.aff_matrix_template = afe_matrix;
629 /* create pbqp instance */
631 ir_timer_reset_and_start(t_ra_pbqp_alloc_create);
634 dom_tree_walk_irg(irg, create_pbqp_coloring_instance , NULL, &pbqp_alloc_env);
636 ir_timer_stop(t_ra_pbqp_alloc_create);
640 /* set up affinity edges */
642 ir_timer_reset_and_start(t_ra_pbqp_alloc_create_aff);
644 foreach_plist(pbqp_alloc_env.rpeo, element) {
645 pbqp_node_t *node = (pbqp_node_t*)element->data;
646 ir_node *irn = get_idx_irn(irg, node->index);
648 create_affinity_edges(irn, &pbqp_alloc_env);
651 ir_timer_stop(t_ra_pbqp_alloc_create_aff);
656 // dump graph before solving pbqp
657 file_before = my_open(env, "", "-pbqp_coloring.html");
658 set_dumpfile(pbqp_alloc_env.pbqp_inst, file_before);
661 /* print out reverse perfect elimination order */
664 plist_element_t *elements;
665 foreach_plist(pbqp_alloc_env.rpeo, elements) {
666 pbqp_node_t *node = elements->data;
667 printf(" %d(%ld);", node->index, get_idx_irn(irg, node->index)->node_nr);
673 /* solve pbqp instance */
675 ir_timer_reset_and_start(t_ra_pbqp_alloc_solve);
677 if(use_late_decision) {
678 solve_pbqp_heuristical_co_ld(pbqp_alloc_env.pbqp_inst,pbqp_alloc_env.rpeo);
681 solve_pbqp_heuristical_co(pbqp_alloc_env.pbqp_inst,pbqp_alloc_env.rpeo);
684 ir_timer_stop(t_ra_pbqp_alloc_solve);
688 solution = get_solution(pbqp_alloc_env.pbqp_inst);
689 if (solution == INF_COSTS)
690 panic("No PBQP solution found");
694 foreach_plist(pbqp_alloc_env.rpeo, element) {
695 pbqp_node_t *node = (pbqp_node_t*)element->data;
696 ir_node *irn = get_idx_irn(irg, node->index);
697 num color = get_node_solution(pbqp_alloc_env.pbqp_inst, node->index);
698 const arch_register_t *reg = arch_register_for_index(cls, color);
700 arch_set_irn_register(irn, reg);
705 printf("PBQP alloc create: %10.3lf msec\n",
706 (double)ir_timer_elapsed_usec(t_ra_pbqp_alloc_create) / 1000.0);
707 printf("PBQP alloc solve: %10.3lf msec\n",
708 (double)ir_timer_elapsed_usec(t_ra_pbqp_alloc_solve) / 1000.0);
709 printf("PBQP alloc create aff: %10.3lf msec\n",
710 (double)ir_timer_elapsed_usec(t_ra_pbqp_alloc_create_aff) / 1000.0);
714 /* free reserved memory */
718 bitset_free(pbqp_alloc_env.allocatable_regs);
719 free_pbqp(pbqp_alloc_env.pbqp_inst);
720 plist_free(pbqp_alloc_env.rpeo);
721 xfree(pbqp_alloc_env.restr_nodes);
722 xfree(pbqp_alloc_env.ife_edge_num);
727 * Initializes this module.
729 BE_REGISTER_MODULE_CONSTRUCTOR(be_init_pbqp_coloring)
730 void be_init_pbqp_coloring(void)
732 lc_opt_entry_t *be_grp = lc_opt_get_grp(firm_opt_get_root(), "be");
733 lc_opt_entry_t *ra_grp = lc_opt_get_grp(be_grp, "ra");
734 lc_opt_entry_t *chordal_grp = lc_opt_get_grp(ra_grp, "chordal");
735 lc_opt_entry_t *coloring_grp = lc_opt_get_grp(chordal_grp, "coloring");
736 lc_opt_entry_t *pbqp_grp = lc_opt_get_grp(coloring_grp, "pbqp");
738 static be_ra_chordal_coloring_t coloring = {
742 lc_opt_add_table(pbqp_grp, options);
743 be_register_chordal_coloring("pbqp", &coloring);