4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
7 * Implementation of the RA-Interface for an external, (non-SSA) register allocator.
9 * The external register allocator is a program taking 2 arguments:
10 * 1) An input file in which the interference graph is defined
11 * 2) An output file containing the instructions to perform
16 ----------------------
18 inputfile ::= regs nodes interf affinities .
20 regs ::= 'regs' regcount . // Anzahl der register (0..regcount-1), die zur Verfuegung stehen
22 nodes ::= 'nodes' '{' node* '}' . // All nodes in the graph
25 | node-info '<' reg-nr '>' . // Reg-nr is present in case of constraints
27 node-info ::= node-nr spill-costs .
29 interf ::= 'interferences' '{' edge* '}' . // Interference edges of the graph
31 affinities ::= 'affinities' '{' edge* '}' . // Affinity edges of the graph
33 edge ::= '(' node-nr ',' node-nr ')' .
36 spill-costs, regcount, node-nr ::= integer .
39 The output file format
40 -----------------------
42 outputfile ::= spills | allocs .
44 spills ::= 'spills' node-nr+ .
46 allocs ::= 'allocs' alloc* .
48 alloc ::= node-nr reg-nr .
51 ******** End of file format docu ********/
66 #include <libcore/lc_opts.h>
67 #include <libcore/lc_opts_enum.h>
75 #include "irprintf_t.h"
77 #include "irgraph_t.h"
79 #include "iredges_t.h"
83 #include "beraextern.h"
90 typedef struct _var_info_t var_info_t;
93 * Environment with all the needed stuff
95 typedef struct _be_raext_env_t {
97 const arch_register_class_t *cls;
99 dom_front_info_t *dom_info;
101 FILE *f; /**< file handle used for out- and input file */
102 set *vars; /**< contains all var_info_t */
103 int n_cls_vars; /**< length of the array cls_vars */
104 var_info_t **cls_vars; /**< only the var_infos for current cls. needed for double iterating */
109 /******************************************************************************
112 | |__| | ___| |_ __ ___ _ __ ___
113 | __ |/ _ \ | '_ \ / _ \ '__/ __|
114 | | | | __/ | |_) | __/ | \__ \
115 |_| |_|\___|_| .__/ \___|_| |___/
118 *****************************************************************************/
121 #define pset_foreach(pset, irn) for(irn=pset_first(pset); irn; irn=pset_next(pset))
122 #define set_foreach(set, e) for(e=set_first(set); e; e=set_next(set))
125 * Checks if _the_ result of the irn belongs to the
126 * current register class (raenv->cls)
127 * NOTE: Only the first result is checked.
129 #define is_res_in_reg_class(irn) arch_irn_has_reg_class(raenv->aenv, irn, -1, raenv->cls)
131 static INLINE ir_node *get_first_non_phi(pset *s) {
140 assert(0 && "There must be a non-phi-irn in this");
144 static INLINE ir_node *get_first_phi(pset *s) {
153 assert(0 && "There must be a phi in this");
157 /******************************************************************************
159 / ____| | | / ____| (_)
160 | | ___ _ __ ___| |_ _ __ | | ___ _ __ _ ___ ___
161 | | / _ \| '_ \/ __| __| '__| | | / _ \| '_ \| |/ _ \/ __|
162 | |___| (_) | | | \__ \ |_| | | |___| (_) | |_) | | __/\__ \
163 \_____\___/|_| |_|___/\__|_| \_____\___/| .__/|_|\___||___/
166 *****************************************************************************/
168 static void handle_constraints_walker(ir_node *irn, void *env) {
169 be_raext_env_t *raenv = env;
170 arch_register_req_t req;
173 /* handle output constraints
174 * user -> irn becomes user -> cpy -> irn
176 arch_get_register_req(raenv->aenv, &req, irn, -1);
177 if (arch_register_req_is(&req, limited)) {
178 ir_node *cpy = be_new_Copy(req.cls, raenv->irg, get_nodes_block(irn), irn);
179 const ir_edge_t *edge;
181 /* all users of the irn use the copy instead */
182 sched_add_after(irn, cpy);
183 foreach_out_edge(irn, edge)
184 set_irn_n(edge->src, edge->pos, cpy);
188 /* handle input constraints by converting them into output constraints
189 * of copies of the former argument
190 * irn -> arg becomes irn -> copy -> arg
192 for (pos = 0, max = get_irn_arity(irn); pos<max; ++pos) {
193 arch_get_register_req(raenv->aenv, &req, irn, pos);
194 if (arch_register_req_is(&req, limited)) {
195 ir_node *arg = get_irn_n(irn, pos);
196 ir_node *cpy = be_new_Copy(req.cls, raenv->irg, get_nodes_block(irn), arg);
198 /* use the copy instead */
199 sched_add_before(irn, cpy);
200 set_irn_n(irn, pos, cpy);
202 /* set an out constraint for the copy */
203 be_set_constr_limited(cpy, -1, &req);
208 static void handle_constraints(be_raext_env_t *raenv) {
209 irg_block_walk_graph(raenv->irg, NULL, handle_constraints_walker, raenv);
213 /******************************************************************************
215 / ____/ ____| /\ | __ \ | |
216 | (___| (___ / \ ______| | | | ___ ___| |_ _ __
217 \___ \\___ \ / /\ \______| | | |/ _ \/ __| __| '__|
218 ____) |___) / ____ \ | |__| | __/\__ \ |_| |
219 |_____/_____/_/ \_\ |_____/ \___||___/\__|_|
221 *****************************************************************************/
223 #define mark_as_done(irn, pos) set_irn_link(irn, INT_TO_PTR(pos+1))
224 #define has_been_done(irn, pos) (PTR_TO_INT(get_irn_link(irn)) > pos)
227 * Insert a copy for the argument of @p start_phi found at position @p pos.
228 * Also searches a phi-loop of arbitrary length to detect and resolve
229 * the class of phi-swap-problems. To search for a loop recursion is used.
231 * 1) Simplest case (phi with a non-phi arg):
232 * A single copy is inserted.
234 * 2) Phi chain (phi (with phi-arg)* with non=phi arg):
235 * Several copies are placed, each after returning from recursion.
238 * On detection a loop breaker is inserted, which is a copy of the start_phi.
239 * This copy then pretends beeing the argumnent of the last phi.
240 * Now case 2) can be used.
242 * The values of @p start_phi and @p pos never change during recursion.
244 * @p raenv Environment with all the stuff needed
245 * @p start_phi Phi node to process
246 * @p pos Argument position to insert copy/copies for
247 * @p curr_phi Phi node currently processed during recursion. Equals start_phi on initial call
249 * @return NULL If no copy is necessary
250 * NULL If the phi has already been processed at this pos
251 * Link field is used to keep track of processed positions
252 * In all other cases the ir_node *copy which was placed is returned.
254 static ir_node *insert_copies(be_raext_env_t *raenv, ir_node *start_phi, int pos, ir_node *curr_phi) {
255 ir_node *arg = get_irn_n(curr_phi, pos);
256 ir_node *arg_blk = get_nodes_block(arg);
257 ir_node *pred_blk = get_Block_cfgpred_block(get_nodes_block(curr_phi), pos);
258 ir_node *curr_cpy, *last_cpy;
260 assert(is_Phi(start_phi) && is_Phi(curr_phi));
262 if (has_been_done(start_phi, pos))
265 /* In case this is a 'normal' phi we insert into
266 * the schedule before the pred_blk irn */
269 /* If we detect a loop stop recursion. */
270 if (arg == start_phi) {
271 ir_node *loop_breaker;
272 if (start_phi == curr_phi) {
273 /* Phi directly uses itself. No copy necessary */
277 /* At least 2 phis are involved */
278 /* Insert a loop breaking copy (an additional variable T) */
279 loop_breaker = be_new_Copy(raenv->cls, raenv->irg, pred_blk, start_phi);
280 sched_add_before(pred_blk, loop_breaker);
285 /* If arg is a phi in the same block we have to continue search */
286 if (is_Phi(arg) && arg_blk == get_nodes_block(start_phi))
287 last_cpy = insert_copies(raenv, start_phi, pos, arg);
289 /* Insert copy of argument (may be the loop-breaker) */
290 curr_cpy = be_new_Copy(raenv->cls, raenv->irg, pred_blk, arg);
291 set_irn_n(curr_phi, pos, curr_cpy);
292 mark_as_done(curr_phi, pos);
293 sched_add_before(last_cpy, curr_cpy);
299 * Perform simple SSA-destruction with copies.
300 * The order of processing _must_ be
301 * for all positions {
306 * else the magic to keep track of processed phi-positions will fail in
307 * function 'insert_copies'
309 static void ssa_destr_simple_walker(ir_node *blk, void *env) {
310 be_raext_env_t *raenv = env;
314 /* for all argument positions of the phis */
315 for (pos=0, max=get_irn_arity(blk); pos<max; ++pos) {
317 /* for all phi nodes (which are scheduled first) */
318 sched_foreach(blk, phi) {
322 raenv->cls = arch_get_irn_reg_class(raenv->aenv, phi, -1);
323 insert_copies(raenv, phi, pos, phi);
329 static void ssa_destr_simple(be_raext_env_t *raenv) {
330 be_clear_links(raenv->irg);
331 irg_block_walk_graph(raenv->irg, ssa_destr_simple_walker, NULL, raenv);
335 static void ssa_destr_rastello(be_raext_env_t *raenv) {
339 phi_class_compute(raenv->irg);
340 irg_block_walk_graph(irg, ssa_destr_rastello, NULL, &raenv);
344 /******************************************************************************
346 \ \ / / | | |__ \ \ \ / /
347 \ \ / /_ _| |___ ) | \ \ / /_ _ _ __ ___
348 \ \/ / _` | / __| / / \ \/ / _` | '__/ __|
349 \ / (_| | \__ \ / /_ \ / (_| | | \__ \
350 \/ \__,_|_|___/ |____| \/ \__,_|_| |___/
351 *****************************************************************************/
354 * This struct maps a variable (nr) to the values belonging to this variable
357 int var_nr; /* the key */
358 pset *values; /* the ssa-values belonging to this variable */
361 #define SET_REMOVED -1
364 * The link field of an irn points to the var_info struct
365 * representing the corresponding variable.
367 #define set_var_info(irn, vi) set_irn_link(irn, vi)
368 #define get_var_info(irn) ((var_info_t *)get_irn_link(irn))
370 #define HASH_VAR_NR(var_nr) var_nr
372 static int compare_var_infos(const void *e1, const void *e2, size_t size) {
373 const var_info_t *v1 = e1;
374 const var_info_t *v2 = e2;
376 if (v1->var_nr == SET_REMOVED || v2->var_nr == SET_REMOVED)
379 return v1->var_nr != v2->var_nr;
382 static INLINE var_info_t *var_find(set *vars, int var_nr) {
386 return set_find(vars, &vi, sizeof(vi), HASH_VAR_NR(var_nr));
389 static INLINE var_info_t *var_find_or_insert(set *vars, int var_nr) {
390 var_info_t vi, *found;
391 memset(&vi, 0, sizeof(vi));
394 found = set_insert(vars, &vi, sizeof(vi), HASH_VAR_NR(var_nr));
397 found->values = pset_new_ptr(1);
403 * Adds a value to a variable. Sets all pointers accordingly.
405 static INLINE var_info_t *var_add_value(be_raext_env_t *raenv, int var_nr, ir_node *irn) {
406 var_info_t *vi = var_find_or_insert(raenv->vars, var_nr);
408 /* var 2 value mapping */
409 pset_insert_ptr(vi->values, irn);
411 /* value 2 var mapping */
412 set_var_info(irn, vi);
417 static INLINE pset *get_var_values(be_raext_env_t *raenv, int var_nr) {
418 var_info_t *vi = var_find(raenv->vars, var_nr);
419 assert(vi && "Variable does not exist");
424 * Define variables (numbers) for all SSA-values.
425 * All values in a phi class get assigned the same variable name.
426 * The link field maps values to the var-name
428 static void values_to_vars(ir_node *irn, void *env) {
429 be_raext_env_t *raenv = env;
433 vals = get_phi_class(irn);
436 nr = get_irn_node_nr(get_first_phi(vals));
438 /* not a phi class member, value == var */
439 nr = get_irn_node_nr(irn);
440 vals = pset_new_ptr(1);
441 pset_insert_ptr(vals, irn);
444 /* values <--> var mapping */
445 pset_foreach(vals, irn)
446 var_add_value(raenv, nr, irn);
450 /******************************************************************************
453 | | | |_ _ _ __ ___ _ __ ___ _ __
454 | | | | | | | '_ ` _ \| '_ \ / _ \ '__|
455 | |__| | |_| | | | | | | |_) | __/ |
456 |_____/ \__,_|_| |_| |_| .__/ \___|_|
459 *****************************************************************************/
462 static void extract_vars_of_cls(be_raext_env_t *raenv) {
466 raenv->cls_vars = malloc(set_count(raenv->vars) * sizeof(*raenv->cls_vars));
467 assert(raenv->cls_vars);
469 set_foreach(raenv->vars, vi)
470 if (is_res_in_reg_class(get_first_non_phi(vi->values)))
471 raenv->cls_vars[count++] = vi;
473 raenv->cls_vars = realloc(raenv->cls_vars, count * sizeof(*raenv->cls_vars));
474 assert(raenv->cls_vars);
476 raenv->n_cls_vars = count;
481 * Check if node irn has a limited-constraint at position pos.
482 * If yes, dump it to FILE raenv->f
484 static INLINE void dump_constraint(be_raext_env_t *raenv, ir_node *irn, int pos) {
485 bitset_t *bs = bitset_alloca(raenv->cls->n_regs);
486 arch_register_req_t req;
488 arch_get_register_req(raenv->aenv, &req, irn, pos);
489 if (arch_register_req_is(&req, limited)) {
491 req.limited(req.limited_env, bs);
492 reg_nr = bitset_next_set(bs, 0);
493 fprintf(raenv->f, "<%d>", reg_nr);
494 assert(-1 == bitset_next_set(bs, reg_nr+1) && "Constraints with more than 1 possible register are not supported");
498 static INLINE int get_spill_costs(var_info_t *vi) {
500 int n_spills=0, n_reloads=0;
502 pset_foreach(vi->values, irn) {
504 /* number of reloads is the number of non-phi uses of all values of this var */
505 const ir_edge_t *edge;
506 foreach_out_edge(irn, edge)
507 if (!is_Phi(edge->src))
510 /* number of spills is the number of non-phi values for this var */
515 return n_spills + n_reloads;
518 static void dump_nodes(be_raext_env_t *raenv) {
522 fprintf(f, "\nnodes {\n");
524 for (i=0; i<raenv->n_cls_vars; ++i) {
525 var_info_t *vi = raenv->cls_vars[i];
527 if (vi->var_nr == SET_REMOVED)
530 fprintf(f, "%d %d", vi->var_nr, get_spill_costs(vi));
531 dump_constraint(raenv, get_first_non_phi(vi->values), -1);
539 static void dump_interferences(be_raext_env_t *raenv) {
541 var_info_t *vi1, *vi2;
542 ir_node *irn1, *irn2;
545 fprintf(f, "\ninterferences {\n");
547 for (i=0; i<raenv->n_cls_vars; ++i) {
548 vi1 = raenv->cls_vars[i];
550 if (vi1->var_nr == SET_REMOVED)
553 for (o=i+1; o<raenv->n_cls_vars; ++o) {
554 vi2 = raenv->cls_vars[o];
556 if (vi2->var_nr == SET_REMOVED)
559 pset_foreach(vi1->values, irn1)
560 pset_foreach(vi2->values, irn2)
561 if (values_interfere(irn1, irn2)) {
562 pset_break(vi1->values);
563 pset_break(vi2->values);
564 fprintf(f, "(%d, %d)\n", vi1->var_nr, vi2->var_nr);
572 static void dump_affinities_walker(ir_node *irn, void *env) {
573 be_raext_env_t *raenv = env;
574 arch_register_req_t req;
576 var_info_t *vi1, *vi2;
578 vi1 = get_var_info(irn);
580 /* copies have affinities */
581 /* TODO? remove this case by adding should_be_equal requirements */
582 if (arch_irn_classify(raenv->aenv, irn) == arch_irn_class_copy) {
583 vi2 = get_var_info(get_irn_n(irn, 0));
585 fprintf(raenv->f, "(%d, %d)\n", vi1->var_nr, vi2->var_nr);
589 /* should_be_equal constraints are affinites */
590 for (pos = 0, max = get_irn_arity(irn); pos<max; ++pos) {
591 arch_get_register_req(raenv->aenv, &req, irn, pos);
593 if (arch_register_req_is(&req, should_be_same)) {
594 vi2 = get_var_info(req.other_same);
596 fprintf(raenv->f, "(%d, %d)\n", vi1->var_nr, vi2->var_nr);
602 static void dump_affinities(be_raext_env_t *raenv) {
603 fprintf(raenv->f, "\ninterferences {\n");
604 irg_walk_graph(raenv->irg, NULL, dump_affinities_walker, raenv);
605 fprintf(raenv->f, "}\n");
609 * Dump all information needed by the external
610 * register allocator to a single file.
612 static void dump_to_file(be_raext_env_t *raenv, char *filename) {
615 if (!(f = fopen(filename, "wt"))) {
616 fprintf(stderr, "Could not open file %s for writing\n", filename);
621 /* dump register info */
622 fprintf(f, "regs %d\n", arch_register_class_n_regs(raenv->cls));
624 /* dump the interference graph */
626 dump_interferences(raenv);
627 dump_affinities(raenv);
632 /******************************************************************************
635 | |__ __ _____ ___ _ _| |_ ___
636 | __| \ \/ / _ \/ __| | | | __/ _ \
637 | |____ > < __/ (__| |_| | || __/
638 |______/_/\_\___|\___|\__,_|\__\___|
639 *****************************************************************************/
642 * Execute the external register allocator specified in the
643 * firm-option firm.be.ra.ext.callee
645 static void execute(char *prog_to_call, char *out_file, char *result_file) {
649 snprintf(cmd_line, sizeof(cmd_line), "%s %s %s", prog_to_call, out_file, result_file);
651 ret_status = system(cmd_line);
652 assert(ret_status != -1 && "Invokation of external register allocator failed");
655 /******************************************************************************
658 / \ _ __ _ __ | |_ _ | |__) |___ ___ _ _| | |_
659 / /\ \ | '_ \| '_ \| | | | | | _ // _ \/ __| | | | | __|
660 / ____ \| |_) | |_) | | |_| | | | \ \ __/\__ \ |_| | | |_
661 /_/ \_\ .__/| .__/|_|\__, | |_| \_\___||___/\__,_|_|\__|
664 *****************************************************************************/
667 * Spill a variable and add reloads before all uses.
669 static INLINE void var_add_spills_and_reloads(be_raext_env_t *raenv, int var_nr) {
670 var_info_t *vi = var_find(raenv->vars, var_nr);
671 ir_node *spill=NULL, *ctx, *irn;
672 const ir_edge_t *edge;
673 pset *spills = pset_new_ptr(4); /* the spills of this variable */
674 pset *reloads = pset_new_ptr(4); /* the reloads of this variable */
675 int new_size, n_spills, n_reloads;
677 assert(vi && "Variable nr does not exist!");
678 assert(pset_count(vi->values) && "There are no values associated to this variable");
680 /* the spill context is set to an arbitrary node of the phi-class */
681 ctx = get_first_phi(vi->values);
683 /* for each value of this variable insert the spills */
684 pset_foreach(vi->values, irn) {
688 /* all ordinary nodes must be spilled */
689 spill = be_new_Spill(raenv->cls, raenv->irg, get_nodes_block(irn), irn, ctx);
690 sched_add_after(irn, spill);
692 /* remember the spill */
693 pset_insert_ptr(spills, spill);
696 assert(spill && "There must be at least one non-phi-node");
698 /* insert reloads and wire them arbitrary*/
699 pset_foreach(vi->values, irn)
700 foreach_out_edge(irn, edge) {
701 ir_node *reload, *src = edge->src;
705 /* all real uses must be reloaded */
706 reload = be_new_Reload(raenv->cls, raenv->irg, get_nodes_block(src), get_irn_mode(get_irn_n(spill, 0)), spill);
707 sched_add_before(src, reload);
709 /* remember the reload */
710 pset_insert_ptr(reloads, reload);
713 /* correct the reload->spill pointers... */
714 be_ssa_constr_sets(raenv->dom_info, spills, reloads);
717 /****** correct the variable <--> values mapping: ******
719 * - if we had a phi class it gets split into several new variables
720 * - all reloads are new variables
722 n_spills = pset_count(spills);
723 n_reloads = pset_count(reloads);
725 /* first make room for new pointers in the cls_var array */
726 new_size = raenv->n_cls_vars + n_reloads + ((n_spills>1) ? n_spills : 0);
727 raenv->cls_vars = realloc(raenv->cls_vars, (new_size) * sizeof(*raenv->cls_vars));
728 assert(raenv->cls_vars && "Out of mem!?");
730 /* if we had a real phi-class, we must... */
731 if (pset_count(spills) > 1) {
732 /* ...remove the old variable corresponding to the phi class */
733 vi->var_nr = SET_REMOVED;
735 /* ...add new vars for each non-phi-member */
736 pset_foreach(spills, irn) {
737 ir_node *spilled = get_irn_n(irn, 0);
738 raenv->cls_vars[raenv->n_cls_vars++] = var_add_value(raenv, get_irn_node_nr(spilled), spilled);
742 /* add new variables for all reloads */
743 pset_foreach(reloads, irn)
744 raenv->cls_vars[raenv->n_cls_vars++] = var_add_value(raenv, get_irn_node_nr(irn), irn);
752 #define INVALID_FILE_FORMAT assert(0 && "Invalid file format.")
754 #define BUFCONV " %32s "
757 * Read in the actions performed by the external allocator.
758 * Apply these transformations to the irg.
759 * @return 1 if an allocation was read in. 0 otherwise.
761 static int read_and_apply_results(be_raext_env_t *raenv, char *filename) {
764 int is_allocation = 0;
766 if (!(f = fopen(filename, "rt"))) {
767 fprintf(stderr, "Could not open file %s for reading\n", filename);
772 /* read the action */
773 if (fscanf(f, BUFCONV, buf) != 1)
777 if (!strcmp(buf, "spills")) {
779 while (fscanf(f, " %d ", &var_nr) == 1)
780 var_add_spills_and_reloads(raenv, var_nr);
783 /* or do we allocate */
784 if (!strcmp(buf, "allocs")) {
788 while (fscanf(f, " %d %d ", &var_nr, ®_nr) == 2) {
790 pset *vals = get_var_values(raenv, var_nr);
792 assert(vals && "Variable nr does not exist!");
793 pset_foreach(vals, irn)
794 arch_set_irn_register(raenv->aenv, irn, arch_register_for_index(raenv->cls, reg_nr));
804 return is_allocation;
807 /******************************************************************************
811 | |\/| |/ _` | | '_ \
812 | | | | (_| | | | | |
813 |_| |_|\__,_|_|_| |_|
814 *****************************************************************************/
817 * Default values for options
819 static void (*ssa_destr)(be_raext_env_t*) = ssa_destr_simple;
820 static char callee[128] = "echo";
824 * Allocate registers with an external program using a text-file interface.
826 * Do some computations (SSA-destruction and mapping of values--vars)
828 * Execute external program
829 * Read in results and apply them
832 static void be_ra_extern_main(const be_main_env_t *env, ir_graph *irg) {
833 be_raext_env_t raenv;
840 raenv.aenv = env->arch_env;
841 raenv.dom_info = be_compute_dominance_frontiers(irg);
842 raenv.vars = new_set(compare_var_infos, 64);
844 /* Insert copies for constraints */
845 handle_constraints(&raenv);
846 dump_ir_block_graph_sched(irg, "-extern-constr");
848 /* SSA destruction respectively transformation into "Conventional SSA" */
850 dump_ir_block_graph_sched(irg, "-extern-ssadestr");
853 /* Mapping of SSA-Values <--> Variables */
854 phi_class_compute(irg);
856 irg_walk_graph(irg, values_to_vars, NULL, &raenv);
858 /* For all register classes */
859 for(clsnr = 0, clss = arch_isa_get_n_reg_class(raenv.aenv->isa); clsnr < clss; ++clsnr) {
861 char out[256], in[256];
863 raenv.cls = arch_isa_get_reg_class(raenv.aenv->isa, clsnr);
864 ir_snprintf(out, sizeof(out), "%F-%s.ra", irg, raenv.cls->name);
865 ir_snprintf(in, sizeof(in), "%F-%s.ra.res", irg, raenv.cls->name);
867 extract_vars_of_cls(&raenv);
870 dump_to_file(&raenv, out);
871 execute(callee, out, in);
872 done = read_and_apply_results(&raenv, in);
875 free(raenv.cls_vars);
878 dump_ir_block_graph_sched(irg, "-extern-alloc");
881 set_foreach(raenv.vars, vi)
882 del_pset(vi->values);
884 be_free_dominance_frontiers(raenv.dom_info);
887 /******************************************************************************
890 | | | |_ __ | |_ _ ___ _ __ ___
891 | | | | '_ \| __| |/ _ \| '_ \/ __|
892 | |__| | |_) | |_| | (_) | | | \__ \
893 \____/| .__/ \__|_|\___/|_| |_|___/
896 *****************************************************************************/
900 static const lc_opt_enum_const_ptr_items_t ssa_destr_items[] = {
901 { "simple", ssa_destr_simple },
902 { "rastello", ssa_destr_rastello },
906 static lc_opt_enum_const_ptr_var_t ssa_destr_var = {
907 (const void **) &ssa_destr, ssa_destr_items
910 static const lc_opt_table_entry_t be_ra_extern_options[] = {
911 LC_OPT_ENT_ENUM_FUNC_PTR("ssa_destr", "SSA destruction flavor", &ssa_destr_var),
912 LC_OPT_ENT_STR("callee", "The external program to call", callee, sizeof(callee)),
916 static void be_ra_extern_register_options(lc_opt_entry_t *root) {
917 lc_opt_entry_t *grp = lc_opt_get_grp(root, "ext");
919 lc_opt_add_table(grp, be_ra_extern_options);
922 #endif /* WITH_LIBCORE */
924 const be_ra_t be_ra_external_allocator = {
926 be_ra_extern_register_options,