c1d7cdf926158db79e56f5071b9e54ceeea04a66
[libfirm] / ir / be / bechordal_main.c
1 /**
2  * @file   bechordal_main.c
3  * @date   29.11.2005
4  * @author Sebastian Hack
5  * @cvs-id $Id$
6  *
7  * Copyright (C) 2005 Universitaet Karlsruhe
8  * Released under the GPL
9  *
10  * Driver for the chordal register allocator.
11  */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #include "obst.h"
17 #include "pset.h"
18 #include "list.h"
19 #include "bitset.h"
20 #include "iterator.h"
21 #include "firm_config.h"
22
23 #ifdef WITH_LIBCORE
24 #include <libcore/lc_opts.h>
25 #include <libcore/lc_opts_enum.h>
26 #include <libcore/lc_timing.h>
27 #endif /* WITH_LIBCORE */
28
29 #include "irmode_t.h"
30 #include "irgraph_t.h"
31 #include "irprintf_t.h"
32 #include "irgwalk.h"
33 #include "ircons.h"
34 #include "irdump.h"
35 #include "irdom.h"
36 #include "ircons.h"
37 #include "irbitset.h"
38 #include "debug.h"
39 #include "xmalloc.h"
40 #include "execfreq.h"
41
42 #include "bechordal_t.h"
43 #include "beabi.h"
44 #include "bejavacoal.h"
45 #include "beutil.h"
46 #include "besched.h"
47 #include "benumb_t.h"
48 #include "besched_t.h"
49 #include "belive_t.h"
50 #include "bearch.h"
51 #include "beifg_t.h"
52 #include "beifg_impl.h"
53 #include "benode_t.h"
54
55 #include "bespillbelady.h"
56 #include "bespillmorgan.h"
57 #include "belower.h"
58
59 #ifdef WITH_ILP
60 #include "bespillremat.h"
61 #endif /* WITH_ILP */
62
63 #include "becopystat.h"
64 #include "becopyopt.h"
65 #include "bessadestr.h"
66 #include "beverify.h"
67 #include "bespillcost.h"
68
69 void be_ra_chordal_check(be_chordal_env_t *chordal_env) {
70         const arch_env_t *arch_env = chordal_env->birg->main_env->arch_env;
71         struct obstack ob;
72         pmap_entry *pme;
73         ir_node **nodes, *n1, *n2;
74         int i, o;
75         DEBUG_ONLY(firm_dbg_module_t *dbg = chordal_env->dbg;)
76
77         /* Collect all irns */
78         obstack_init(&ob);
79         pmap_foreach(chordal_env->border_heads, pme) {
80                 border_t *curr;
81                 struct list_head *head = pme->value;
82                 list_for_each_entry(border_t, curr, head, list)
83                         if (curr->is_def && curr->is_real)
84                                 if (arch_get_irn_reg_class(arch_env, curr->irn, -1) == chordal_env->cls)
85                                         obstack_ptr_grow(&ob, curr->irn);
86         }
87         obstack_ptr_grow(&ob, NULL);
88         nodes = (ir_node **) obstack_finish(&ob);
89
90         /* Check them */
91         for (i = 0, n1 = nodes[i]; n1; n1 = nodes[++i]) {
92                 const arch_register_t *n1_reg, *n2_reg;
93
94                 n1_reg = arch_get_irn_register(arch_env, n1);
95                 if (!arch_reg_is_allocatable(arch_env, n1, -1, n1_reg)) {
96                         DBG((dbg, 0, "Register %s assigned to %+F is not allowed\n", n1_reg->name, n1));
97                         assert(0 && "Register constraint does not hold");
98                 }
99                 for (o = i+1, n2 = nodes[o]; n2; n2 = nodes[++o]) {
100                         n2_reg = arch_get_irn_register(arch_env, n2);
101                         if (values_interfere(chordal_env->lv, n1, n2) && n1_reg == n2_reg) {
102                                 DBG((dbg, 0, "Values %+F and %+F interfere and have the same register assigned: %s\n", n1, n2, n1_reg->name));
103                                 assert(0 && "Interfering values have the same color!");
104                         }
105                 }
106         }
107         obstack_free(&ob, NULL);
108 }
109
110 int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node *b)
111 {
112         if(env->ifg)
113                 return be_ifg_connected(env->ifg, a, b);
114         else
115                 return values_interfere(env->lv, a, b);
116 }
117
118
119 static be_ra_chordal_opts_t options = {
120         BE_CH_DUMP_NONE,
121         BE_CH_SPILL_BELADY,
122         BE_CH_IFG_STD,
123         BE_CH_LOWER_PERM_SWAP,
124         BE_CH_VRFY_WARN,
125 };
126
127 static be_ra_timer_t ra_timer = {
128         NULL,
129         NULL,
130         NULL,
131         NULL,
132         NULL,
133         NULL,
134         NULL,
135         NULL,
136         NULL,
137         NULL,
138 };
139
140 #ifdef WITH_LIBCORE
141 static const lc_opt_enum_int_items_t spill_items[] = {
142         { "morgan", BE_CH_SPILL_MORGAN },
143         { "belady", BE_CH_SPILL_BELADY },
144 #ifdef WITH_ILP
145         { "remat",  BE_CH_SPILL_REMAT },
146 #endif /* WITH_ILP */
147         { NULL, 0 }
148 };
149
150 static const lc_opt_enum_int_items_t ifg_flavor_items[] = {
151         { "std",     BE_CH_IFG_STD     },
152         { "fast",    BE_CH_IFG_FAST    },
153         { "clique",  BE_CH_IFG_CLIQUE  },
154         { "pointer", BE_CH_IFG_POINTER },
155         { "list",    BE_CH_IFG_LIST    },
156         { "check",   BE_CH_IFG_CHECK   },
157         { NULL,      0                 }
158 };
159
160 static const lc_opt_enum_int_items_t lower_perm_items[] = {
161         { "copy", BE_CH_LOWER_PERM_COPY },
162         { "swap", BE_CH_LOWER_PERM_SWAP },
163         { NULL, 0 }
164 };
165
166 static const lc_opt_enum_int_items_t lower_perm_stat_items[] = {
167         { NULL, 0 }
168 };
169
170 static const lc_opt_enum_int_items_t dump_items[] = {
171         { "spill",    BE_CH_DUMP_SPILL     },
172         { "live",     BE_CH_DUMP_LIVE      },
173         { "color",    BE_CH_DUMP_COLOR     },
174         { "copymin",  BE_CH_DUMP_COPYMIN   },
175         { "ssadestr", BE_CH_DUMP_SSADESTR  },
176         { "tree",     BE_CH_DUMP_TREE_INTV },
177         { "constr",   BE_CH_DUMP_CONSTR    },
178         { "lower",    BE_CH_DUMP_LOWER     },
179         { "appel",    BE_CH_DUMP_APPEL     },
180         { "all",      BE_CH_DUMP_ALL       },
181         { NULL, 0 }
182 };
183
184 static const lc_opt_enum_int_items_t be_ch_vrfy_items[] = {
185         { "off",    BE_CH_VRFY_OFF    },
186         { "warn",   BE_CH_VRFY_WARN   },
187         { "assert", BE_CH_VRFY_ASSERT },
188         { NULL, 0 }
189 };
190
191 static lc_opt_enum_int_var_t spill_var = {
192         &options.spill_method, spill_items
193 };
194
195 static lc_opt_enum_int_var_t ifg_flavor_var = {
196         &options.ifg_flavor, ifg_flavor_items
197 };
198
199 static lc_opt_enum_int_var_t lower_perm_var = {
200         &options.lower_perm_opt, lower_perm_items
201 };
202
203 static lc_opt_enum_int_var_t dump_var = {
204         &options.dump_flags, dump_items
205 };
206
207 static lc_opt_enum_int_var_t be_ch_vrfy_var = {
208         &options.vrfy_option, be_ch_vrfy_items
209 };
210
211 /** Enable extreme live range splitting. */
212 static int be_elr_split = 0;
213
214 /** Assumed loop iteration count for execution frequency estimation. */
215 static int be_loop_weight = 9;
216
217 static const lc_opt_table_entry_t be_chordal_options[] = {
218         LC_OPT_ENT_ENUM_INT ("spill",         "spill method (belady, morgan or remat)", &spill_var),
219         LC_OPT_ENT_ENUM_PTR ("ifg",           "interference graph flavour (std, fast, clique, pointer, list, check)", &ifg_flavor_var),
220         LC_OPT_ENT_ENUM_PTR ("perm",          "perm lowering options (copy or swap)", &lower_perm_var),
221         LC_OPT_ENT_ENUM_MASK("dump",          "select dump phases", &dump_var),
222         LC_OPT_ENT_ENUM_PTR ("vrfy",          "verify options (off, warn, assert)", &be_ch_vrfy_var),
223         LC_OPT_ENT_BOOL     ("elrsplit",      "enable extreme live range splitting", &be_elr_split),
224         LC_OPT_ENT_INT      ("loop_weight",   "assumed amount of loop iterations for guessing the execution frequency", &be_loop_weight),
225         { NULL }
226 };
227
228 static void be_ra_chordal_register_options(lc_opt_entry_t *grp)
229 {
230         static int run_once = 0;
231         lc_opt_entry_t *chordal_grp;
232
233         if (! run_once) {
234                 run_once    = 1;
235                 chordal_grp = lc_opt_get_grp(grp, "chordal");
236
237                 lc_opt_add_table(chordal_grp, be_chordal_options);
238         }
239
240         co_register_options(chordal_grp);
241         java_coal_register_options(chordal_grp);
242 }
243 #endif /* WITH_LIBCORE */
244
245 static void dump(unsigned mask, ir_graph *irg,
246                                  const arch_register_class_t *cls,
247                                  const char *suffix,
248                                  void (*dump_func)(ir_graph *, const char *))
249 {
250         if((options.dump_flags & mask) == mask) {
251                 if (cls) {
252                         char buf[256];
253                         snprintf(buf, sizeof(buf), "-%s%s", cls->name, suffix);
254                         be_dump(irg, buf, dump_func);
255                 }
256                 else
257                         be_dump(irg, suffix, dump_func);
258         }
259 }
260
261 static void put_ignore_colors(be_chordal_env_t *chordal_env)
262 {
263         int n_colors = chordal_env->cls->n_regs;
264         int i;
265
266         bitset_clear_all(chordal_env->ignore_colors);
267         be_abi_put_ignore_regs(chordal_env->birg->abi, chordal_env->cls, chordal_env->ignore_colors);
268         for(i = 0; i < n_colors; ++i)
269                 if(arch_register_type_is(&chordal_env->cls->regs[i], ignore))
270                         bitset_set(chordal_env->ignore_colors, i);
271 }
272
273 FILE *be_chordal_open(const be_chordal_env_t *env, const char *prefix, const char *suffix)
274 {
275         char buf[1024];
276
277         ir_snprintf(buf, sizeof(buf), "%s%F_%s%s", prefix, env->irg, env->cls->name, suffix);
278         return fopen(buf, "wt");
279 }
280
281 void check_ifg_implementations(be_chordal_env_t *chordal_env)
282 {
283         FILE *f;
284
285         f = be_chordal_open(chordal_env, "std", ".log");
286         chordal_env->ifg = be_ifg_std_new(chordal_env);
287         be_ifg_check_sorted_to_file(chordal_env->ifg, f);
288         fclose(f);
289
290         f = be_chordal_open(chordal_env, "list", ".log");
291         be_ifg_free(chordal_env->ifg);
292         chordal_env->ifg = be_ifg_list_new(chordal_env);
293         be_ifg_check_sorted_to_file(chordal_env->ifg, f);
294         fclose(f);
295
296         f = be_chordal_open(chordal_env, "clique", ".log");
297         be_ifg_free(chordal_env->ifg);
298         chordal_env->ifg = be_ifg_clique_new(chordal_env);
299         be_ifg_check_sorted_to_file(chordal_env->ifg, f);
300         fclose(f);
301
302         f = be_chordal_open(chordal_env, "pointer", ".log");
303         be_ifg_free(chordal_env->ifg);
304         chordal_env->ifg = be_ifg_pointer_new(chordal_env);
305         be_ifg_check_sorted_to_file(chordal_env->ifg, f);
306         fclose(f);
307
308         chordal_env->ifg = NULL;
309 };
310
311 /**
312  * Checks for every reload if it's user can perform the load on itself.
313  */
314 static void memory_operand_walker(ir_node *irn, void *env) {
315         be_chordal_env_t *cenv = env;
316         const arch_env_t *aenv = cenv->birg->main_env->arch_env;
317         const ir_edge_t  *edge, *ne;
318         ir_node          *block;
319
320         if (! be_is_Reload(irn))
321                 return;
322
323         block = get_nodes_block(irn);
324
325         foreach_out_edge_safe(irn, edge, ne) {
326                 ir_node *src = get_edge_src_irn(edge);
327                 int     pos  = get_edge_src_pos(edge);
328
329                 if (! src)
330                         continue;
331
332                 if (get_nodes_block(src) == block && arch_possible_memory_operand(aenv, src, pos)) {
333                         DBG((cenv->dbg, LEVEL_3, "performing memory operand %+F at %+F\n", irn, src));
334                         arch_perform_memory_operand(aenv, src, irn, pos);
335                 }
336         }
337
338         /* kill the Reload */
339         if (get_irn_n_edges(irn) == 0) {
340                 sched_remove(irn);
341                 set_irn_n(irn, 0, new_Bad());
342                 set_irn_n(irn, 1, new_Bad());
343         }
344 }
345
346 /**
347  * Starts a walk for memory operands if supported by the backend.
348  */
349 static INLINE void check_for_memory_operands(be_chordal_env_t *chordal_env) {
350         irg_walk_graph(chordal_env->irg, NULL, memory_operand_walker, chordal_env);
351 }
352
353 /**
354  * Performs chordal register allocation for each register class on given irg.
355  *
356  * @param bi  Backend irg object
357  * @return Structure containing timer for the single phases or NULL if no timing requested.
358  */
359 static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
360 {
361         const be_main_env_t *main_env  = bi->main_env;
362         const arch_isa_t    *isa       = arch_env_get_isa(main_env->arch_env);
363         ir_graph            *irg       = bi->irg;
364         be_options_t        *main_opts = main_env->options;
365         int                  splitted  = 0;
366
367         int j, m;
368         be_chordal_env_t chordal_env;
369
370         if (main_opts->timing == BE_TIME_ON) {
371                 ra_timer.t_prolog  = lc_timer_register("ra_prolog",   "regalloc prolog");
372                 ra_timer.t_epilog  = lc_timer_register("ra_epilog",   "regalloc epilog");
373                 ra_timer.t_live    = lc_timer_register("ra_liveness", "be liveness");
374                 ra_timer.t_spill   = lc_timer_register("ra_spill",    "spiller");
375                 ra_timer.t_color   = lc_timer_register("ra_color",    "graph coloring");
376                 ra_timer.t_ifg     = lc_timer_register("ra_ifg",      "interference graph");
377                 ra_timer.t_copymin = lc_timer_register("ra_copymin",  "copy minimization");
378                 ra_timer.t_ssa     = lc_timer_register("ra_ssadestr", "ssa destruction");
379                 ra_timer.t_verify  = lc_timer_register("ra_verify",   "graph verification");
380                 ra_timer.t_other   = lc_timer_register("ra_other",    "other time");
381
382                 LC_STOP_AND_RESET_TIMER(ra_timer.t_prolog);
383                 LC_STOP_AND_RESET_TIMER(ra_timer.t_epilog);
384                 LC_STOP_AND_RESET_TIMER(ra_timer.t_live);
385                 LC_STOP_AND_RESET_TIMER(ra_timer.t_spill);
386                 LC_STOP_AND_RESET_TIMER(ra_timer.t_color);
387                 LC_STOP_AND_RESET_TIMER(ra_timer.t_ifg);
388                 LC_STOP_AND_RESET_TIMER(ra_timer.t_copymin);
389                 LC_STOP_AND_RESET_TIMER(ra_timer.t_ssa);
390                 LC_STOP_AND_RESET_TIMER(ra_timer.t_verify);
391                 LC_STOP_AND_RESET_TIMER(ra_timer.t_other);
392         }
393
394 #define BE_TIMER_PUSH(timer)                                                        \
395         if (main_opts->timing == BE_TIME_ON) {                                          \
396                 int res = lc_timer_push(timer);                                             \
397                 if (options.vrfy_option == BE_CH_VRFY_ASSERT)                               \
398                         assert(res && "Timer already on stack, cannot be pushed twice.");       \
399                 else if (options.vrfy_option == BE_CH_VRFY_WARN && ! res)                   \
400                         fprintf(stderr, "Timer %s already on stack, cannot be pushed twice.\n", \
401                                 lc_timer_get_name(timer));                                          \
402         }
403 #define BE_TIMER_POP(timer)                                                                    \
404         if (main_opts->timing == BE_TIME_ON) {                                                     \
405                 lc_timer_t *tmp = lc_timer_pop();                                                      \
406                 if (options.vrfy_option == BE_CH_VRFY_ASSERT)                                          \
407                         assert(tmp == timer && "Attempt to pop wrong timer.");                             \
408                 else if (options.vrfy_option == BE_CH_VRFY_WARN && tmp != timer)                       \
409                         fprintf(stderr, "Attempt to pop wrong timer. %s is on stack, trying to pop %s.\n", \
410                                 lc_timer_get_name(tmp), lc_timer_get_name(timer));                             \
411                 timer = tmp;                                                                           \
412         }
413
414         BE_TIMER_PUSH(ra_timer.t_other);
415         BE_TIMER_PUSH(ra_timer.t_prolog);
416
417         compute_doms(irg);
418
419         chordal_env.opts      = &options;
420         chordal_env.irg       = irg;
421         chordal_env.birg      = bi;
422         chordal_env.dom_front = be_compute_dominance_frontiers(irg);
423         chordal_env.exec_freq = compute_execfreq(irg, be_loop_weight);
424         chordal_env.lv        = be_liveness(irg);
425         FIRM_DBG_REGISTER(chordal_env.dbg, "firm.be.chordal");
426
427         obstack_init(&chordal_env.obst);
428
429         BE_TIMER_POP(ra_timer.t_prolog);
430
431         /* Perform the following for each register class. */
432         for (j = 0, m = arch_isa_get_n_reg_class(isa); j < m; ++j) {
433                 FILE *f;
434                 copy_opt_t *co = NULL;
435
436                 chordal_env.cls           = arch_isa_get_reg_class(isa, j);
437                 chordal_env.border_heads  = pmap_create();
438                 chordal_env.ignore_colors = bitset_malloc(chordal_env.cls->n_regs);
439
440                 /* put all ignore registers into the ignore register set. */
441                 put_ignore_colors(&chordal_env);
442
443                 BE_TIMER_PUSH(ra_timer.t_live);
444                 be_liveness_recompute(chordal_env.lv);
445                 BE_TIMER_POP(ra_timer.t_live);
446                 dump(BE_CH_DUMP_LIVE, irg, chordal_env.cls, "-live", dump_ir_block_graph_sched);
447
448                 be_pre_spill_prepare_constr(&chordal_env);
449                 dump(BE_CH_DUMP_CONSTR, irg, chordal_env.cls, "-constr-pre", dump_ir_block_graph_sched);
450
451                 BE_TIMER_PUSH(ra_timer.t_spill);
452
453                 /* spilling */
454                 switch(options.spill_method) {
455                 case BE_CH_SPILL_MORGAN:
456                         be_spill_morgan(&chordal_env);
457                         break;
458                 case BE_CH_SPILL_BELADY:
459                         be_spill_belady(&chordal_env);
460                         break;
461 #ifdef WITH_ILP
462                 case BE_CH_SPILL_REMAT:
463                         be_spill_remat(&chordal_env);
464                         break;
465 #endif /* WITH_ILP */
466                 default:
467                         fprintf(stderr, "no valid spiller selected. falling back to belady\n");
468                         be_spill_belady(&chordal_env);
469                 }
470
471                 BE_TIMER_POP(ra_timer.t_spill);
472
473                 DBG((chordal_env.dbg, LEVEL_1, "spill costs for %+F in regclass %s: %g\n",
474                       irg,
475                       chordal_env.cls->name,
476                       get_irg_spill_cost(&chordal_env))
477                     );
478
479                 dump(BE_CH_DUMP_SPILL, irg, chordal_env.cls, "-spill", dump_ir_block_graph_sched);
480                 be_compute_spill_offsets(&chordal_env);
481                 check_for_memory_operands(&chordal_env);
482                 be_abi_fix_stack_nodes(bi->abi, chordal_env.lv);
483
484                 BE_TIMER_PUSH(ra_timer.t_verify);
485
486                 /* verify schedule and register pressure */
487                 if (options.vrfy_option == BE_CH_VRFY_WARN) {
488                         be_verify_schedule(irg);
489                         be_verify_register_pressure(chordal_env.birg->main_env->arch_env, chordal_env.cls, irg);
490                 }
491                 else if (options.vrfy_option == BE_CH_VRFY_ASSERT) {
492                         assert(be_verify_schedule(irg) && "Schedule verification failed");
493                         assert(be_verify_register_pressure(chordal_env.birg->main_env->arch_env, chordal_env.cls, irg)
494                                 && "Register pressure verification failed");
495                 }
496                 BE_TIMER_POP(ra_timer.t_verify);
497
498                 if (be_elr_split && ! splitted) {
499                         extreme_liverange_splitting(&chordal_env);
500                         splitted = 1;
501                 }
502
503
504                 /* Color the graph. */
505                 BE_TIMER_PUSH(ra_timer.t_color);
506                 be_ra_chordal_color(&chordal_env);
507                 BE_TIMER_POP(ra_timer.t_color);
508
509                 dump(BE_CH_DUMP_CONSTR, irg, chordal_env.cls, "-color", dump_ir_block_graph_sched);
510
511                 /* Create the ifg with the selected flavor */
512                 BE_TIMER_PUSH(ra_timer.t_ifg);
513                 switch (options.ifg_flavor) {
514                         default:
515                                 fprintf(stderr, "no valid ifg flavour selected. falling back to std\n");
516                         case BE_CH_IFG_STD:
517                         case BE_CH_IFG_FAST:
518                                 chordal_env.ifg = be_ifg_std_new(&chordal_env);
519                                 break;
520                         case BE_CH_IFG_CLIQUE:
521                                 chordal_env.ifg = be_ifg_clique_new(&chordal_env);
522                                 break;
523                         case BE_CH_IFG_POINTER:
524                                 chordal_env.ifg = be_ifg_pointer_new(&chordal_env);
525                                 break;
526                         case BE_CH_IFG_LIST:
527                                 chordal_env.ifg = be_ifg_list_new(&chordal_env);
528                                 break;
529                         case BE_CH_IFG_CHECK:
530                                 check_ifg_implementations(&chordal_env);
531                                 /* Build the interference graph. */
532                                 chordal_env.ifg = be_ifg_std_new(&chordal_env);
533                                 break;
534                 }
535                 BE_TIMER_POP(ra_timer.t_ifg);
536
537                 BE_TIMER_PUSH(ra_timer.t_verify);
538                 if (options.vrfy_option != BE_CH_VRFY_OFF)
539                         be_ra_chordal_check(&chordal_env);
540
541                 BE_TIMER_POP(ra_timer.t_verify);
542
543                 /* copy minimization */
544                 BE_TIMER_PUSH(ra_timer.t_copymin);
545                 co_driver(&chordal_env);
546                 BE_TIMER_POP(ra_timer.t_copymin);
547                 dump(BE_CH_DUMP_COPYMIN, irg, chordal_env.cls, "-copymin", dump_ir_block_graph_sched);
548
549                 BE_TIMER_PUSH(ra_timer.t_verify);
550
551                 if (options.vrfy_option != BE_CH_VRFY_OFF)
552                         be_ra_chordal_check(&chordal_env);
553
554                 BE_TIMER_POP(ra_timer.t_verify);
555                 BE_TIMER_PUSH(ra_timer.t_ssa);
556
557                 /* ssa destruction */
558                 be_ssa_destruction(&chordal_env);
559
560                 BE_TIMER_POP(ra_timer.t_ssa);
561
562                 dump(BE_CH_DUMP_SSADESTR, irg, chordal_env.cls, "-ssadestr", dump_ir_block_graph_sched);
563
564                 BE_TIMER_PUSH(ra_timer.t_verify);
565                 if (options.vrfy_option != BE_CH_VRFY_OFF) {
566                         be_ssa_destruction_check(&chordal_env);
567                         be_ra_chordal_check(&chordal_env);
568                 }
569                 BE_TIMER_POP(ra_timer.t_verify);
570
571                 be_ifg_free(chordal_env.ifg);
572                 pmap_destroy(chordal_env.border_heads);
573                 bitset_free(chordal_env.ignore_colors);
574         }
575
576         BE_TIMER_PUSH(ra_timer.t_epilog);
577
578         dump(BE_CH_DUMP_LOWER, irg, NULL, "-spilloff", dump_ir_block_graph_sched);
579
580         lower_nodes_after_ra(&chordal_env, options.lower_perm_opt & BE_CH_LOWER_PERM_COPY ? 1 : 0);
581         dump(BE_CH_DUMP_LOWER, irg, NULL, "-belower-after-ra", dump_ir_block_graph_sched);
582
583         obstack_free(&chordal_env.obst, NULL);
584         be_free_dominance_frontiers(chordal_env.dom_front);
585         be_liveness_free(chordal_env.lv);
586         free_execfreq(chordal_env.exec_freq);
587
588         BE_TIMER_POP(ra_timer.t_epilog);
589         BE_TIMER_POP(ra_timer.t_other);
590
591 #undef BE_TIMER_PUSH
592 #undef BE_TIMER_POP
593
594         return main_opts->timing == BE_TIME_ON ? &ra_timer : NULL;
595 }
596
597 const be_ra_t be_ra_chordal_allocator = {
598 #ifdef WITH_LIBCORE
599         be_ra_chordal_register_options,
600 #endif
601         be_ra_chordal_main
602 };