2 * Author: Daniel Grund, Sebastian Hack
4 * Copyright: (c) Universitaet Karlsruhe
5 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 #include "iredges_t.h"
26 #include "besched_t.h"
29 #include "bechordal_t.h"
32 /* This enables re-computation of values. Current state: Unfinished and buggy. */
35 typedef struct _reloader_t reloader_t;
36 typedef struct _spill_info_t spill_info_t;
43 struct _spill_info_t {
44 ir_node *spilled_node;
45 reloader_t *reloaders;
48 typedef struct _spill_ctx_t {
49 ir_node *spilled; /**< The spilled node. */
50 ir_node *user; /**< The node this spill is for. */
51 ir_node *spill; /**< The spill itself. */
55 const arch_register_class_t *cls;
56 const be_chordal_env_t *chordal_env;
59 set *spills; /**< all spill_info_t's, which must be placed */
60 pset *mem_phis; /**< set of all special spilled phis. allocated and freed separately */
61 ir_node **copies; /**< set of copies placed because of phi spills */
62 DEBUG_ONLY(firm_dbg_module_t *dbg;)
65 /* associated Phi -> Spill*/
66 typedef struct _phi_spill_assoc_t {
72 * Compare two Phi->Spill associations.
74 static int cmp_phi_spill_assoc(const void *a, const void *b, size_t n) {
75 const phi_spill_assoc_t *p1 = a;
76 const phi_spill_assoc_t *p2 = b;
77 return p1->phi != p2->phi;
81 * compare two spill contexts.
83 static int cmp_spillctx(const void *a, const void *b, size_t n) {
84 const spill_ctx_t *p = a;
85 const spill_ctx_t *q = b;
86 return p->user != q->user || p->spilled != q->spilled;
90 * Compare two spill infos.
92 static int cmp_spillinfo(const void *x, const void *y, size_t size) {
93 const spill_info_t *xx = x;
94 const spill_info_t *yy = y;
95 return xx->spilled_node != yy->spilled_node;
99 /* Sets the debug module of a spill environment. */
100 void be_set_spill_env_dbg_module(spill_env_t *env, firm_dbg_module_t *dbg) {
105 /* Creates a new spill environment. */
106 spill_env_t *be_new_spill_env(const be_chordal_env_t *chordal_env) {
107 spill_env_t *env = xmalloc(sizeof(env[0]));
108 env->spill_ctxs = new_set(cmp_spillctx, 1024);
109 env->spills = new_set(cmp_spillinfo, 1024);
110 env->cls = chordal_env->cls;
111 env->chordal_env = chordal_env;
112 env->mem_phis = pset_new_ptr_default();
113 env->copies = NEW_ARR_F(ir_node*, 0);
114 obstack_init(&env->obst);
118 /* Deletes a spill environment. */
119 void be_delete_spill_env(spill_env_t *env) {
120 del_set(env->spill_ctxs);
121 del_set(env->spills);
122 del_pset(env->mem_phis);
123 DEL_ARR_F(env->copies);
124 obstack_free(&env->obst, NULL);
129 * Returns a spill context. If the context did not exists, create one.
131 * @param sc the set containing all spill contexts
132 * @param to_spill the node that should be spilled
133 * @param ctx_irn an user of the spilled node
135 * @return a spill context.
137 static spill_ctx_t *be_get_spill_ctx(set *sc, ir_node *to_spill, ir_node *ctx_irn) {
140 templ.spilled = to_spill;
141 templ.user = ctx_irn;
144 return set_insert(sc, &templ, sizeof(templ), HASH_COMBINE(HASH_PTR(to_spill), HASH_PTR(ctx_irn)));
150 * @param senv the spill environment
151 * @param irn the node that should be spilled
152 * @param ctx_irn an user of the spilled node
154 * @return a be_Spill node
156 static ir_node *be_spill_irn(spill_env_t *senv, ir_node *irn, ir_node *ctx_irn) {
158 const be_main_env_t *env = senv->chordal_env->birg->main_env;
159 DBG((senv->dbg, LEVEL_1, "%+F in ctx %+F\n", irn, ctx_irn));
161 // Has the value already been spilled?
162 ctx = be_get_spill_ctx(senv->spill_ctxs, irn, ctx_irn);
166 /* Trying to spill an already spilled value, no need for a new spill
167 * node then, we can simply connect to the same one for this reload
169 if(be_is_Reload(irn)) {
170 return get_irn_n(irn, be_pos_Reload_mem);
173 ctx->spill = be_spill(env->arch_env, irn, ctx_irn);
179 * Removes all copies introduced for phi-spills
181 static void remove_copies(spill_env_t *env) {
184 for(i = 0; i < ARR_LEN(env->copies); ++i) {
185 ir_node *node = env->copies[i];
187 const ir_edge_t *edge, *ne;
189 assert(be_is_Copy(node));
191 src = be_get_Copy_op(node);
192 foreach_out_edge_safe(node, edge, ne) {
193 ir_node *user = get_edge_src_irn(edge);
194 int user_pos = get_edge_src_pos(edge);
196 set_irn_n(user, user_pos, src);
200 ARR_SETLEN(ir_node*, env->copies, 0);
204 * Searchs the schedule of a block backwards until we reach the first
205 * use or def of a value or a phi.
206 * Returns the node before this node (so that you can do sched_add_before)
208 static ir_node *find_last_use_def(spill_env_t *env, ir_node *block, ir_node *value) {
209 ir_node *node, *last;
212 sched_foreach_reverse(block, node) {
221 for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
222 ir_node *arg = get_irn_n(node, i);
230 // simply return first node if no def or use found
231 return sched_first(block);
235 * If the first usage of a Phi result would be out of memory
236 * there is no sense in allocating a register for it.
237 * Thus we spill it and all its operands to the same spill slot.
238 * Therefore the phi/dataB becomes a phi/Memory
240 * @param senv the spill environment
241 * @param phi the Phi node that should be spilled
242 * @param ctx_irn an user of the spilled node
244 * @return a be_Spill node
246 static ir_node *spill_phi(spill_env_t *senv, ir_node *phi, ir_node *ctx_irn, set *already_visited_phis, bitset_t *bs) {
248 int arity = get_irn_arity(phi);
249 ir_graph *irg = senv->chordal_env->irg;
250 ir_node *bl = get_nodes_block(phi);
251 ir_node **ins, *phi_spill;
252 phi_spill_assoc_t key;
256 DBG((senv->dbg, LEVEL_1, "%+F in ctx %+F\n", phi, ctx_irn));
258 /* build a new PhiM */
259 NEW_ARR_A(ir_node *, ins, arity);
260 for (i = 0; i < arity; ++i) {
261 ins[i] = new_r_Bad(irg);
263 phi_spill = new_r_Phi(senv->chordal_env->irg, bl, arity, ins, mode_M);
265 key.spill = phi_spill;
266 set_insert(already_visited_phis, &key, sizeof(key), HASH_PTR(phi));
267 bitset_set(bs, get_irn_idx(phi));
269 /* search an existing spill for this context */
270 ctx = be_get_spill_ctx(senv->spill_ctxs, phi, ctx_irn);
272 /* if not found spill the phi */
274 /* collect all arguments of the phi */
275 for (i = 0; i < arity; ++i) {
276 ir_node *arg = get_irn_n(phi, i);
278 phi_spill_assoc_t *entry;
280 if(is_Phi(arg) && pset_find_ptr(senv->mem_phis, arg)) {
284 } else if (! bitset_is_set(bs, get_irn_idx(arg))) {
285 sub_res = spill_phi(senv, arg, ctx_irn, already_visited_phis, bs);
287 /* we already visited the argument phi: get it's spill */
290 entry = set_find(already_visited_phis, &key, sizeof(key), HASH_PTR(arg));
291 assert(entry && "argument phi already visited, but no spill found?!?");
292 sub_res = entry->spill;
293 assert(sub_res && "spill missing?!?");
296 sub_res = be_spill_irn(senv, arg, ctx_irn);
299 set_irn_n(phi_spill, i, sub_res);
302 ctx->spill = phi_spill;
310 * @param senv the spill environment
311 * @param to_spill the node that should be spilled
313 * @return a be_Spill node
315 static ir_node *be_spill_node(spill_env_t *senv, ir_node *to_spill) {
316 ir_graph *irg = get_irn_irg(to_spill);
319 if (pset_find_ptr(senv->mem_phis, to_spill)) {
320 set *already_visited_phis = new_set(cmp_phi_spill_assoc, 10);
321 bitset_t *bs = bitset_alloca(get_irg_last_idx(irg));
322 res = spill_phi(senv, to_spill, to_spill, already_visited_phis, bs);
323 del_set(already_visited_phis);
325 res = be_spill_irn(senv, to_spill, to_spill);
336 * Check if a spilled node could be rematerialized.
338 * @param senv the spill environment
339 * @param spill the Spill node
340 * @param spilled the node that was spilled
341 * @param reloader a irn that requires a reload
343 static int check_remat_conditions(spill_env_t *senv, ir_node *spill, ir_node *spilled, ir_node *reloader) {
346 /* check for 'normal' spill and general remat condition */
347 if (!be_is_Spill(spill) || !arch_irn_is(senv->chordal_env->birg->main_env->arch_env, spilled, rematerializable))
350 /* check availability of original arguments */
351 if (is_Block(reloader)) {
353 /* we want to remat at the end of a block.
354 * thus all arguments must be alive at the end of the block
356 for (pos=0, max=get_irn_arity(spilled); pos<max; ++pos) {
357 ir_node *arg = get_irn_n(spilled, pos);
358 if (!is_live_end(reloader, arg))
364 /* we want to remat before the insn reloader
365 * thus an arguments is alive if
366 * - it interferes with the reloaders result
368 * - or it is (last-) used by reloader itself
370 for (pos=0, max=get_irn_arity(spilled); pos<max; ++pos) {
371 ir_node *arg = get_irn_n(spilled, pos);
374 if (values_interfere(reloader, arg))
377 for (i=0, m=get_irn_arity(reloader); i<m; ++i) {
378 ir_node *rel_arg = get_irn_n(reloader, i);
383 /* arg is not alive before reloader */
395 #else /* BUGGY_REMAT */
398 * A very simple rematerialization checker.
400 * @param senv the spill environment
401 * @param spill the Spill node
402 * @param spilled the node that was spilled
403 * @param reloader a irn that requires a reload
405 static int check_remat_conditions(spill_env_t *senv, ir_node *spill, ir_node *spilled, ir_node *reloader) {
406 const arch_env_t *aenv = senv->chordal_env->birg->main_env->arch_env;
408 return get_irn_arity(spilled) == 0 &&
409 be_is_Spill(spill) &&
410 arch_irn_is(aenv, spilled, rematerializable);
413 #endif /* BUGGY_REMAT */
418 * Re-materialize a node.
420 * @param senv the spill environment
421 * @param spilled the node that was spilled
422 * @param reloader a irn that requires a reload
424 static ir_node *do_remat(spill_env_t *senv, ir_node *spilled, ir_node *reloader) {
426 ir_node *bl = (is_Block(reloader)) ? reloader : get_nodes_block(reloader);
428 /* recompute the value */
429 res = new_ir_node(get_irn_dbg_info(spilled), senv->chordal_env->irg, bl,
431 get_irn_mode(spilled),
432 get_irn_arity(spilled),
433 get_irn_in(spilled) + 1);
434 copy_node_attr(spilled, res);
436 DBG((senv->dbg, LEVEL_1, "Insert remat %+F before reloader %+F\n", res, reloader));
438 /* insert in schedule */
439 if (is_Block(reloader)) {
440 ir_node *insert = sched_skip(reloader, 0, sched_skip_cf_predicator, (void *) senv->chordal_env->birg->main_env->arch_env);
441 sched_add_after(insert, res);
443 sched_add_before(reloader, res);
449 void be_spill_phi(spill_env_t *env, ir_node *node) {
452 assert(is_Phi(node));
454 pset_insert_ptr(env->mem_phis, node);
456 /* We have to place copy nodes in the predecessor blocks to temporarily
457 * produce new values that get separate spill slots
459 for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
460 ir_node *pred_block, *arg, *copy, *insert_point;
462 /* Don't do anything for looping edges (there's no need
463 * and placing copies here breaks stuff as it suddenly
464 * generates new living values through the whole loop)
466 arg = get_irn_n(node, i);
470 pred_block = get_Block_cfgpred_block(get_nodes_block(node), i);
471 copy = be_new_Copy(env->cls, get_irn_irg(arg), pred_block, arg);
473 ARR_APP1(ir_node*, env->copies, copy);
474 insert_point = find_last_use_def(env, pred_block, arg);
475 sched_add_before(insert_point, copy);
477 set_irn_n(node, i, copy);
481 void be_insert_spills_reloads(spill_env_t *env) {
482 const arch_env_t *arch_env = env->chordal_env->birg->main_env->arch_env;
486 DBG((env->dbg, LEVEL_1, "Reloads for mem-phis:\n"));
487 foreach_pset(env->mem_phis, node) {
490 assert(is_Phi(node));
492 /* Add reloads for mem_phis */
493 /* BETTER: These reloads (1) should only be inserted, if they are really needed */
494 DBG((env->dbg, LEVEL_1, " Mem-phi %+F\n", node));
495 foreach_out_edge(node, e) {
496 ir_node *user = e->src;
497 if (is_Phi(user) && !pset_find_ptr(env->mem_phis, user)) {
498 ir_node *use_bl = get_nodes_block(user);
499 DBG((env->dbg, LEVEL_1, " non-mem-phi user %+F\n", user));
500 be_add_reload_on_edge(env, node, use_bl, e->pos); /* (1) */
505 /* process each spilled node */
506 DBG((env->dbg, LEVEL_1, "Insert spills and reloads:\n"));
507 for(si = set_first(env->spills); si; si = set_next(env->spills)) {
509 ir_mode *mode = get_irn_mode(si->spilled_node);
510 pset *values = pset_new_ptr(16);
512 /* go through all reloads for this spill */
513 for(rld = si->reloaders; rld; rld = rld->next) {
516 /* the spill for this reloader */
517 ir_node *spill = be_spill_node(env, si->spilled_node);
520 if (check_remat_conditions(env, spill, si->spilled_node, rld->reloader)) {
521 new_val = do_remat(env, si->spilled_node, rld->reloader);
525 new_val = be_reload(arch_env, env->cls, rld->reloader, mode, spill);
527 DBG((env->dbg, LEVEL_1, " %+F of %+F before %+F\n", new_val, si->spilled_node, rld->reloader));
528 pset_insert_ptr(values, new_val);
531 /* introduce copies, rewire the uses */
532 assert(pset_count(values) > 0 && "???");
533 pset_insert_ptr(values, si->spilled_node);
534 be_ssa_constr_set_ignore(env->chordal_env->dom_front, values, env->mem_phis);
541 // reloads are placed now, but we might reuse the spill environment for further spilling decisions
542 del_set(env->spills);
543 env->spills = new_set(cmp_spillinfo, 1024);
546 void be_add_reload(spill_env_t *env, ir_node *to_spill, ir_node *before) {
547 spill_info_t templ, *res;
550 assert(sched_is_scheduled(before));
551 assert(arch_irn_consider_in_reg_alloc(env->chordal_env->birg->main_env->arch_env, env->cls, to_spill));
553 templ.spilled_node = to_spill;
554 templ.reloaders = NULL;
555 res = set_insert(env->spills, &templ, sizeof(templ), HASH_PTR(to_spill));
557 rel = obstack_alloc(&env->obst, sizeof(rel[0]));
558 rel->reloader = before;
559 rel->next = res->reloaders;
560 res->reloaders = rel;
563 void be_add_reload_on_edge(spill_env_t *env, ir_node *to_spill, ir_node *block, int pos) {
564 ir_node *predblock, *last;
566 /* simply add the reload to the beginning of the block if we only have 1 predecessor
567 * (we don't need to check for phis as there can't be any in a block with only 1 pred)
569 if(get_Block_n_cfgpreds(block) == 1) {
570 assert(!is_Phi(sched_first(block)));
571 be_add_reload(env, to_spill, sched_first(block));
575 // We have to reload the value in pred-block
576 predblock = get_Block_cfgpred_block(block, pos);
577 last = sched_last(predblock);
578 // there should be exactly 1 jump at the end of the block
579 assert(is_cfop(last));
581 // add the reload before the (cond-)jump
582 be_add_reload(env, to_spill, last);
585 /****************************************
587 SPILL SLOT MANAGEMENT AND OPTS
589 ****************************************/
591 typedef struct _spill_slot_t {
595 ir_mode *largest_mode; /* the mode of all members with largest size */
598 typedef struct _ss_env_t {
600 be_chordal_env_t *cenv;
601 pmap *slots; /* maps spill_contexts to spill_slots */
602 pmap *types; /* maps modes to types */
603 DEBUG_ONLY(firm_dbg_module_t *dbg;)
608 * Walker: compute the spill slots
610 static void compute_spill_slots_walker(ir_node *spill, void *env) {
611 ss_env_t *ssenv = env;
616 if (!be_is_Spill(spill))
619 /* check, if this spill is for a context already known */
620 ctx = be_get_Spill_context(spill);
621 entry = pmap_find(ssenv->slots, ctx);
624 struct _arch_env_t *arch_env = ssenv->cenv->birg->main_env->arch_env;
625 const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, spill, be_pos_Spill_val);
626 ir_mode *largest_mode = arch_register_class_mode(cls);
628 /* this is a new spill context */
629 ss = obstack_alloc(&ssenv->ob, sizeof(*ss));
630 ss->members = pset_new_ptr(8);
631 ss->largest_mode = largest_mode;
632 ss->size = get_mode_size_bytes(ss->largest_mode);
633 ss->align = arch_isa_get_reg_class_alignment(arch_env->isa, cls);
634 pmap_insert(ssenv->slots, ctx, ss);
636 /* values with the same spill_ctx must go into the same spill slot */
640 /* ugly mega assert :-) */
643 struct _arch_env_t *arch_env = ssenv->cenv->birg->main_env->arch_env;
644 const arch_register_class_t *cls = arch_get_irn_reg_class(arch_env, spill, be_pos_Spill_val);
645 int size = get_mode_size_bytes(arch_register_class_mode(cls));
646 assert((int) ss->size == size && "Different sizes for the same spill slot are not allowed.");
647 for (irn = pset_first(ss->members); irn; irn = pset_next(ss->members)) {
648 /* use values_interfere here, because it uses the dominance check,
649 which does work for values in memory */
650 assert(!values_interfere(spill, irn) && "Spills for the same spill slot must not interfere!");
656 pset_insert_ptr(ss->members, spill);
660 * qsort compare function, sort spill slots by size.
662 static int ss_sorter(const void *v1, const void *v2) {
663 const spill_slot_t **ss1 = (const spill_slot_t **)v1;
664 const spill_slot_t **ss2 = (const spill_slot_t **)v2;
665 return ((int) (*ss2)->size) - ((int) (*ss1)->size);
670 * This function should optimize the spill slots.
671 * - Coalescing of multiple slots
672 * - Ordering the slots
674 * Input slots are in @p ssenv->slots
675 * @p size The count of initial spill slots in @p ssenv->slots
676 * This also is the size of the preallocated array @p ass
678 * @return An array of spill slots @p ass in specific order
680 static void optimize_slots(ss_env_t *ssenv, int size, spill_slot_t *ass[]) {
681 int i, o, used_slots;
685 pmap_foreach(ssenv->slots, entr)
686 ass[i++] = entr->value;
688 /* Sort the array to minimize fragmentation and cache footprint.
689 Large slots come first */
690 qsort(ass, size, sizeof(ass[0]), ss_sorter);
692 /* For each spill slot:
693 - assign a new offset to this slot
694 - xor find another slot to coalesce with */
696 for (i=0; i<size; ++i) { /* for each spill slot */
700 DBG((ssenv->dbg, LEVEL_1, "Spill slot %d members:\n", i));
701 for(n1 = pset_first(ass[i]->members); n1; n1 = pset_next(ass[i]->members))
702 DBG((ssenv->dbg, LEVEL_1, " %+F\n", n1));
705 for (o=0; o < used_slots && tgt_slot == -1; ++o) { /* for each offset-assigned spill slot */
706 /* check inter-slot-pairs for interference */
708 for(n1 = pset_first(ass[i]->members); n1; n1 = pset_next(ass[i]->members))
709 for(n2 = pset_first(ass[o]->members); n2; n2 = pset_next(ass[o]->members))
710 if(values_interfere(n1, n2)) {
711 pset_break(ass[i]->members);
712 pset_break(ass[o]->members);
713 DBG((ssenv->dbg, LEVEL_1, " Interf %+F -- %+F\n", n1, n2));
714 goto interf_detected;
717 /* if we are here, there is no interference between ass[i] and ass[o] */
720 interf_detected: /*nothing*/ ;
723 /* now the members of ass[i] join the members of ass[tgt_slot] */
725 /* do we need a new slot? */
726 if (tgt_slot == -1) {
727 tgt_slot = used_slots;
732 ass[tgt_slot]->size = ass[i]->size;
733 del_pset(ass[tgt_slot]->members);
734 ass[tgt_slot]->members = pset_new_ptr(8);
738 /* copy the members to the target pset */
739 /* NOTE: If src and tgt pset are the same, inserting while iterating is not allowed */
741 for(n1 = pset_first(ass[i]->members); n1; n1 = pset_next(ass[i]->members))
742 pset_insert_ptr(ass[tgt_slot]->members, n1);
746 #define ALIGN_SPILL_AREA 16
747 #define pset_foreach(pset, elm) for(elm=pset_first(pset); elm; elm=pset_next(pset))
750 * Returns a spill type for a mode. Keep them in a map to reduce
751 * the number of types.
753 * @param types a map containing all created types
754 * @param ss the spill slot
756 * Note that type types should are identical for every mode.
757 * This rule might break if two different register classes return the same
758 * mode but different alignments.
760 static ir_type *get_spill_type(pmap *types, spill_slot_t *ss) {
761 pmap_entry *e = pmap_find(types, ss->largest_mode);
766 snprintf(buf, sizeof(buf), "spill_slot_type_%s", get_mode_name(ss->largest_mode));
767 res = new_type_primitive(new_id_from_str(buf), ss->largest_mode);
768 set_type_alignment_bytes(res, ss->align);
769 pmap_insert(types, ss->largest_mode, res);
772 assert(get_type_alignment_bytes(res) == (int)ss->align);
779 * Create spill slot entities on the frame type.
781 * @param ssenv the spill environment
782 * @param n number of spill slots
783 * @param ss array of spill slots
785 static void assign_entities(ss_env_t *ssenv, int n_slots, spill_slot_t *ss[]) {
786 int i, offset, frame_align;
787 ir_type *frame = get_irg_frame_type(ssenv->cenv->irg);
789 /* aligning by increasing frame size */
790 offset = get_type_size_bits(frame) / 8;
791 offset = round_up2(offset, ALIGN_SPILL_AREA);
792 set_type_size_bytes(frame, -1);
794 /* create entities and assign offsets according to size and alignment*/
795 for (i = 0; i < n_slots; ++i) {
802 snprintf(buf, sizeof(buf), "spill_slot_%d", i);
803 name = new_id_from_str(buf);
805 spill_ent = new_entity(frame, name, get_spill_type(ssenv->types, ss[i]));
808 offset = round_up2(offset, ss[i]->align);
810 set_entity_offset_bytes(spill_ent, offset);
811 /* next possible offset */
812 offset += round_up2(ss[i]->size, ss[i]->align);
814 pset_foreach(ss[i]->members, irn)
815 be_set_Spill_entity(irn, spill_ent);
819 /* set final size of stack frame */
820 frame_align = get_type_alignment_bytes(frame);
821 set_type_size_bytes(frame, round_up2(offset, frame_align));
824 void be_compute_spill_offsets(be_chordal_env_t *cenv) {
830 obstack_init(&ssenv.ob);
832 ssenv.slots = pmap_create();
833 ssenv.types = pmap_create();
834 FIRM_DBG_REGISTER(ssenv.dbg, "ir.be.spillslots");
836 /* Get initial spill slots */
837 irg_walk_graph(cenv->irg, NULL, compute_spill_slots_walker, &ssenv);
839 /* Build an empty array for optimized spill slots */
840 ss_size = pmap_count(ssenv.slots);
841 ss = obstack_alloc(&ssenv.ob, ss_size * sizeof(*ss));
842 optimize_slots(&ssenv, ss_size, ss);
844 /* Integrate slots into the stack frame entity */
845 assign_entities(&ssenv, ss_size, ss);
848 pmap_foreach(ssenv.slots, pme)
849 del_pset(((spill_slot_t *)pme->value)->members);
850 pmap_destroy(ssenv.slots);
851 pmap_destroy(ssenv.types);
852 obstack_free(&ssenv.ob, NULL);
854 be_copy_entities_to_reloads(cenv->irg);