6b855d5bebed6954809b7cc56c269a34b9c4aa79
[libfirm] / ir / be / bespill.c
1 /*
2  * Author:      Daniel Grund, Sebastian Hack, Matthias Braun
3  * Date:                29.09.2005
4  * Copyright:   (c) Universitaet Karlsruhe
5  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
6  * CVS-Id:      $Id$
7  */
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11
12 #include <stdlib.h>
13
14 #include "pset.h"
15 #include "irnode_t.h"
16 #include "ircons_t.h"
17 #include "iredges_t.h"
18 #include "irbackedge_t.h"
19 #include "irprintf.h"
20 #include "ident_t.h"
21 #include "type_t.h"
22 #include "entity_t.h"
23 #include "debug.h"
24 #include "irgwalk.h"
25 #include "array.h"
26 #include "pdeq.h"
27 #include "unionfind.h"
28 #include "execfreq.h"
29
30 #include "belive_t.h"
31 #include "besched_t.h"
32 #include "bespill.h"
33 #include "belive_t.h"
34 #include "benode_t.h"
35 #include "bechordal_t.h"
36 #include "bejavacoal.h"
37 #include "benodesets.h"
38 #include "bespilloptions.h"
39 #include "bestatevent.h"
40
41 // only rematerialise when costs are less than REMAT_COST_LIMIT
42 // TODO determine a good value here...
43 #define REMAT_COST_LIMIT        10
44
45 typedef struct _reloader_t reloader_t;
46
47 struct _reloader_t {
48         reloader_t *next;
49         ir_node    *reloader;
50         ir_node    *rematted_node;
51         int        allow_remat;     /**< the node may be rematted instead of reloaded if global remat option is on */
52 };
53
54 typedef struct _spill_info_t {
55         /** the value that should get spilled */
56         ir_node *spilled_node;
57         /** list of places where the value should get reloaded */
58         reloader_t *reloaders;
59
60         /** the spill node, or a PhiM node */
61         ir_node *spill;
62         /** if we had the value of a phi spilled before but not the phi itself then
63          * this field contains the spill for the phi value */
64         ir_node *old_spill;
65
66         /** the register class in which the reload should be placed */
67         const arch_register_class_t *reload_cls;
68 } spill_info_t;
69
70 struct _spill_env_t {
71         const arch_env_t *arch_env;
72         ir_graph *irg;
73         struct obstack obst;
74         be_irg_t *birg;
75         int spill_cost;     /**< the cost of a single spill node */
76         int reload_cost;    /**< the cost of a reload node */
77         set *spills;        /**< all spill_info_t's, which must be placed */
78         pset *mem_phis;     /**< set of all special spilled phis. allocated and freed separately */
79
80         DEBUG_ONLY(firm_dbg_module_t *dbg;)
81 };
82
83 /**
84  * Compare two spill infos.
85  */
86 static int cmp_spillinfo(const void *x, const void *y, size_t size) {
87         const spill_info_t *xx = x;
88         const spill_info_t *yy = y;
89         return xx->spilled_node != yy->spilled_node;
90 }
91
92 /**
93  * Returns spill info for a specific value (returns NULL if the info doesn't
94  * exist yet)
95  */
96 static spill_info_t *find_spillinfo(const spill_env_t *env, ir_node *value) {
97         spill_info_t info;
98         int hash = nodeset_hash(value);
99
100         info.spilled_node = value;
101
102         return set_find(env->spills, &info, sizeof(info), hash);
103 }
104
105 /**
106  * Returns spill info for a specific value (the value that is to be spilled)
107  */
108 static spill_info_t *get_spillinfo(const spill_env_t *env, ir_node *value) {
109         spill_info_t info, *res;
110         int hash = nodeset_hash(value);
111
112         info.spilled_node = value;
113         res = set_find(env->spills, &info, sizeof(info), hash);
114
115         if (res == NULL) {
116                 info.reloaders = NULL;
117                 info.spill = NULL;
118                 info.old_spill = NULL;
119                 info.reload_cls = NULL;
120                 res = set_insert(env->spills, &info, sizeof(info), hash);
121         }
122
123         return res;
124 }
125
126 DEBUG_ONLY(
127 /* Sets the debug module of a spill environment. */
128 void be_set_spill_env_dbg_module(spill_env_t *env, firm_dbg_module_t *dbg) {
129         env->dbg = dbg;
130 }
131 )
132
133 /* Creates a new spill environment. */
134 spill_env_t *be_new_spill_env(be_irg_t *birg) {
135         spill_env_t *env        = xmalloc(sizeof(env[0]));
136         env->spills                     = new_set(cmp_spillinfo, 1024);
137         env->irg            = be_get_birg_irg(birg);
138         env->birg           = birg;
139         env->arch_env       = birg->main_env->arch_env;
140         env->mem_phis           = pset_new_ptr_default();
141         // TODO, ask backend about costs..., or even ask backend whether we should
142         // rematerialize...
143         env->spill_cost     = 8;
144         env->reload_cost    = 5;
145         obstack_init(&env->obst);
146         return env;
147 }
148
149 /* Deletes a spill environment. */
150 void be_delete_spill_env(spill_env_t *env) {
151         del_set(env->spills);
152         del_pset(env->mem_phis);
153         obstack_free(&env->obst, NULL);
154         free(env);
155 }
156
157 /*
158  *  ____  _                  ____      _                 _
159  * |  _ \| | __ _  ___ ___  |  _ \ ___| | ___   __ _  __| |___
160  * | |_) | |/ _` |/ __/ _ \ | |_) / _ \ |/ _ \ / _` |/ _` / __|
161  * |  __/| | (_| | (_|  __/ |  _ <  __/ | (_) | (_| | (_| \__ \
162  * |_|   |_|\__,_|\___\___| |_| \_\___|_|\___/ \__,_|\__,_|___/
163  *
164  */
165
166 void be_add_remat(spill_env_t *env, ir_node *to_spill, ir_node *before, ir_node *rematted_node, const arch_register_class_t *reload_cls) {
167         spill_info_t *spill_info;
168         reloader_t *reloader;
169
170         spill_info = get_spillinfo(env, to_spill);
171
172         /* add the remat information */
173         reloader                = obstack_alloc(&env->obst, sizeof(reloader[0]));
174         reloader->next          = spill_info->reloaders;
175         reloader->reloader      = before;
176         reloader->rematted_node = rematted_node;
177         reloader->allow_remat   = 1;
178
179         spill_info->reloaders  = reloader;
180         assert(spill_info->reload_cls == NULL || spill_info->reload_cls == reload_cls);
181         spill_info->reload_cls = reload_cls;
182 }
183
184 void be_add_reload(spill_env_t *env, ir_node *to_spill, ir_node *before,
185                 const arch_register_class_t *reload_cls, int allow_remat)
186 {
187         spill_info_t *info;
188         reloader_t *rel;
189
190         info = get_spillinfo(env, to_spill);
191
192         if (is_Phi(to_spill)) {
193                 int i, arity;
194
195                 /* create spillinfos for the phi arguments */
196                 for (i = 0, arity = get_irn_arity(to_spill); i < arity; ++i) {
197                         ir_node *arg = get_irn_n(to_spill, i);
198                         get_spillinfo(env, arg);
199                 }
200
201 #if 1
202                 // hackery... sometimes the morgan algo spilled the value of a phi,
203                 // the belady algo decides later to spill the whole phi, then sees the
204                 // spill node and adds a reload for that spill node, problem is the
205                 // reload gets attach to that same spill (and is totally unnecessary)
206                 if (info->old_spill != NULL &&
207                         (before == info->old_spill || value_dominates(before, info->old_spill)))
208                 {
209                         printf("spilledphi hack was needed...\n");
210                         before = sched_next(info->old_spill);
211                 }
212 #endif
213         }
214
215         /* put reload into list */
216         rel                = obstack_alloc(&env->obst, sizeof(rel[0]));
217         rel->next          = info->reloaders;
218         rel->reloader      = before;
219         rel->rematted_node = NULL;
220         rel->allow_remat   = allow_remat;
221
222         info->reloaders  = rel;
223         assert(info->reload_cls == NULL || info->reload_cls == reload_cls);
224         info->reload_cls = reload_cls;
225 }
226
227 static ir_node *get_reload_insertion_point(ir_node *block, int pos) {
228         ir_node *predblock, *last;
229
230         /* simply add the reload to the beginning of the block if we only have 1 predecessor
231          * (we don't need to check for phis as there can't be any in a block with only 1 pred)
232          */
233         if(get_Block_n_cfgpreds(block) == 1) {
234                 assert(!is_Phi(sched_first(block)));
235                 return sched_first(block);
236         }
237
238         /* We have to reload the value in pred-block */
239         predblock = get_Block_cfgpred_block(block, pos);
240         last = sched_last(predblock);
241
242         /* we might have projs and keepanys behind the jump... */
243         while(is_Proj(last) || be_is_Keep(last)) {
244                 last = sched_prev(last);
245                 assert(!sched_is_end(last));
246         }
247
248         if(!is_cfop(last)) {
249                 ir_graph *irg = get_irn_irg(block);
250                 ir_node *startblock = get_irg_start_block(irg);
251
252                 last = sched_next(last);
253                 // last node must be a cfop, only exception is the start block
254                 assert(last     == startblock);
255         }
256
257         // add the reload before the (cond-)jump
258         return last;
259 }
260
261 void be_add_reload_on_edge(spill_env_t *env, ir_node *to_spill, ir_node *block, int pos,
262                 const arch_register_class_t *reload_cls, int allow_remat)
263 {
264         ir_node *before = get_reload_insertion_point(block, pos);
265         be_add_reload(env, to_spill, before, reload_cls, allow_remat);
266 }
267
268 void be_spill_phi(spill_env_t *env, ir_node *node) {
269         spill_info_t* spill;
270         int i, arity;
271
272         assert(is_Phi(node));
273
274         pset_insert_ptr(env->mem_phis, node);
275
276         // create spillinfos for the phi arguments
277         spill = get_spillinfo(env, node);
278         for(i = 0, arity = get_irn_arity(node); i < arity; ++i) {
279                 ir_node *arg = get_irn_n(node, i);
280                 get_spillinfo(env, arg);
281         }
282
283         // if we had a spill for the phi value before, then remove this spill from
284         // schedule, as we will remove it in the insert spill/reload phase
285         if(spill->spill != NULL && !is_Phi(spill->spill)) {
286                 assert(spill->old_spill == NULL);
287                 spill->old_spill = spill->spill;
288                 spill->spill = NULL;
289         }
290 }
291
292 /*
293  *   ____                _         ____        _ _ _
294  *  / ___|_ __ ___  __ _| |_ ___  / ___| _ __ (_) | |___
295  * | |   | '__/ _ \/ _` | __/ _ \ \___ \| '_ \| | | / __|
296  * | |___| | |  __/ (_| | ||  __/  ___) | |_) | | | \__ \
297  *  \____|_|  \___|\__,_|\__\___| |____/| .__/|_|_|_|___/
298  *                                      |_|
299  */
300
301 /**
302  * Schedules a node after an instruction. (That is the place after all projs and phis
303  * that are scheduled after the instruction)
304  * This function also skips phi nodes at the beginning of a block
305  */
306 static void sched_add_after_insn(ir_node *sched_after, ir_node *node) {
307         ir_node *next = sched_next(sched_after);
308         while(is_Proj(next) || is_Phi(next)) {
309                 next = sched_next(next);
310         }
311         assert(next != NULL);
312
313         if(sched_is_end(next)) {
314                 sched_add_after(sched_last(get_nodes_block(sched_after)), node);
315         } else {
316                 sched_add_before(next, node);
317         }
318 }
319
320 /**
321  * Creates a spill.
322  *
323  * @param senv      the spill environment
324  * @param irn       the node that should be spilled
325  * @param ctx_irn   an user of the spilled node
326  *
327  * @return a be_Spill node
328  */
329 static void spill_irn(spill_env_t *env, spill_info_t *spillinfo) {
330         ir_node *to_spill = spillinfo->spilled_node;
331
332         DBG((env->dbg, LEVEL_1, "%+F\n", to_spill));
333
334         /* Trying to spill an already spilled value, no need for a new spill
335          * node then, we can simply connect to the same one for this reload
336          *
337          * (although rematerialization code should handle most of these cases
338          * this can still happen when spilling Phis)
339          */
340         if(be_is_Reload(to_spill)) {
341                 spillinfo->spill = get_irn_n(to_spill, be_pos_Reload_mem);
342                 return;
343         }
344
345         if (arch_irn_is(env->arch_env, to_spill, dont_spill)) {
346                 assert(0 && "Attempt to spill a node marked 'dont_spill'");
347         }
348
349         spillinfo->spill = be_spill(env->arch_env, to_spill);
350         sched_add_after_insn(to_spill, spillinfo->spill);
351 }
352
353 static void spill_node(spill_env_t *env, spill_info_t *spillinfo);
354
355 /**
356  * If the first usage of a Phi result would be out of memory
357  * there is no sense in allocating a register for it.
358  * Thus we spill it and all its operands to the same spill slot.
359  * Therefore the phi/dataB becomes a phi/Memory
360  *
361  * @param senv      the spill environment
362  * @param phi       the Phi node that should be spilled
363  * @param ctx_irn   an user of the spilled node
364  */
365 static void spill_phi(spill_env_t *env, spill_info_t *spillinfo) {
366         ir_node *phi = spillinfo->spilled_node;
367         int i;
368         int arity = get_irn_arity(phi);
369         ir_node     *block    = get_nodes_block(phi);
370         ir_node     **ins;
371
372         assert(is_Phi(phi));
373
374         /* build a new PhiM */
375         ins = alloca(sizeof(ir_node*) * arity);
376         for(i = 0; i < arity; ++i) {
377                 ins[i] = get_irg_bad(env->irg);
378         }
379         spillinfo->spill = new_r_Phi(env->irg, block, arity, ins, mode_M);
380
381         for(i = 0; i < arity; ++i) {
382                 ir_node *arg = get_irn_n(phi, i);
383                 spill_info_t *arg_info = get_spillinfo(env, arg);
384
385                 spill_node(env, arg_info);
386
387                 set_irn_n(spillinfo->spill, i, arg_info->spill);
388         }
389
390         // rewire reloads from old_spill to phi
391         if(spillinfo->old_spill != NULL) {
392                 const ir_edge_t *edge, *next;
393                 ir_node *old_spill = spillinfo->old_spill;
394
395                 foreach_out_edge_safe(old_spill, edge, next) {
396                         ir_node* reload = get_edge_src_irn(edge);
397                         assert(be_is_Reload(reload) || is_Phi(reload));
398                         set_irn_n(reload, get_edge_src_pos(edge), spillinfo->spill);
399                 }
400                 set_irn_n(old_spill, be_pos_Spill_val, new_Bad());
401                 //sched_remove(old_spill);
402                 spillinfo->old_spill = NULL;
403         }
404 }
405
406 /**
407  * Spill a node.
408  *
409  * @param senv      the spill environment
410  * @param to_spill  the node that should be spilled
411  */
412 static void spill_node(spill_env_t *env, spill_info_t *spillinfo) {
413         ir_node *to_spill;
414
415         // the node should be tagged for spilling already...
416         if(spillinfo->spill != NULL)
417                 return;
418
419         to_spill = spillinfo->spilled_node;
420         if (is_Phi(to_spill) && pset_find_ptr(env->mem_phis, spillinfo->spilled_node)) {
421                 spill_phi(env, spillinfo);
422         } else {
423                 spill_irn(env, spillinfo);
424         }
425 }
426
427 /*
428  *
429  *  ____                      _            _       _ _
430  * |  _ \ ___ _ __ ___   __ _| |_ ___ _ __(_) __ _| (_)_______
431  * | |_) / _ \ '_ ` _ \ / _` | __/ _ \ '__| |/ _` | | |_  / _ \
432  * |  _ <  __/ | | | | | (_| | ||  __/ |  | | (_| | | |/ /  __/
433  * |_| \_\___|_| |_| |_|\__,_|\__\___|_|  |_|\__,_|_|_/___\___|
434  *
435  */
436
437 /**
438  * Tests whether value @p arg is available before node @p reloader
439  * @returns 1 if value is available, 0 otherwise
440  */
441 static int is_value_available(spill_env_t *env, ir_node *arg, ir_node *reloader) {
442         if(is_Unknown(arg) || arg == new_NoMem())
443                 return 1;
444
445         if(be_is_Spill(arg))
446                 return 1;
447
448         if(arg == get_irg_frame(env->irg))
449                 return 1;
450
451         // hack for now (happens when command should be inserted at end of block)
452         if(is_Block(reloader)) {
453                 return 0;
454         }
455
456         /*
457          * Ignore registers are always available
458          */
459         if(arch_irn_is(env->arch_env, arg, ignore)) {
460                 return 1;
461         }
462
463 #if 0
464         /* the following test does not work while spilling,
465          * because the liveness info is not adapted yet to the effects of the
466          * additional spills/reloads.
467          */
468
469         /* we want to remat before the insn reloader
470          * thus an arguments is alive if
471          *   - it interferes with the reloaders result
472          *   - or it is (last-) used by reloader itself
473          */
474         if (values_interfere(env->birg->lv, reloader, arg)) {
475                 return 1;
476         }
477
478         arity = get_irn_arity(reloader);
479         for (i = 0; i < arity; ++i) {
480                 ir_node *rel_arg = get_irn_n(reloader, i);
481                 if (rel_arg == arg)
482                         return 1;
483         }
484 #endif
485
486         return 0;
487 }
488
489 /**
490  * Checks whether the node can principally be rematerialized
491  */
492 static int is_remat_node(spill_env_t *env, ir_node *node) {
493         const arch_env_t *arch_env = env->arch_env;
494
495         assert(!be_is_Spill(node));
496
497         if(arch_irn_is(arch_env, node, rematerializable)) {
498                 return 1;
499         }
500
501         if(be_is_StackParam(node))
502                 return 1;
503
504         return 0;
505 }
506
507 /**
508  * Check if a node is rematerializable. This tests for the following conditions:
509  *
510  * - The node itself is rematerializable
511  * - All arguments of the node are available or also rematerialisable
512  * - The costs for the rematerialisation operation is less or equal a limit
513  *
514  * Returns the costs needed for rematerialisation or something
515  * > REMAT_COST_LIMIT if remat is not possible.
516  */
517 static int check_remat_conditions_costs(spill_env_t *env, ir_node *spilled, ir_node *reloader, int parentcosts) {
518         int i, arity;
519         int argremats;
520         int costs = 0;
521
522         if(!is_remat_node(env, spilled))
523                 return REMAT_COST_LIMIT;
524
525         if(be_is_Reload(spilled)) {
526                 costs += 2;
527         } else {
528                 costs += arch_get_op_estimated_cost(env->arch_env, spilled);
529         }
530         if(parentcosts + costs >= REMAT_COST_LIMIT) {
531                 return REMAT_COST_LIMIT;
532         }
533
534         argremats = 0;
535         for(i = 0, arity = get_irn_arity(spilled); i < arity; ++i) {
536                 ir_node *arg = get_irn_n(spilled, i);
537
538                 if(is_value_available(env, arg, reloader))
539                         continue;
540
541                 // we have to rematerialize the argument as well...
542                 if(argremats >= 1) {
543                         /* we only support rematerializing 1 argument at the moment,
544                          * so that we don't have to care about register pressure
545                          */
546                         return REMAT_COST_LIMIT;
547                 }
548                 argremats++;
549
550                 costs += check_remat_conditions_costs(env, arg, reloader, parentcosts + costs);
551                 if(parentcosts + costs >= REMAT_COST_LIMIT)
552                         return REMAT_COST_LIMIT;
553         }
554
555         return costs;
556 }
557
558 static int check_remat_conditions(spill_env_t *env, ir_node *spilled, ir_node *reloader) {
559         int costs = check_remat_conditions_costs(env, spilled, reloader, 0);
560
561         return costs < REMAT_COST_LIMIT;
562 }
563
564 /**
565  * Re-materialize a node.
566  *
567  * @param senv      the spill environment
568  * @param spilled   the node that was spilled
569  * @param reloader  a irn that requires a reload
570  */
571 static ir_node *do_remat(spill_env_t *env, ir_node *spilled, ir_node *reloader) {
572         int i, arity;
573         ir_node *res;
574         ir_node *bl;
575         ir_node **ins;
576
577         if(is_Block(reloader)) {
578                 bl = reloader;
579         } else {
580                 bl = get_nodes_block(reloader);
581         }
582
583         ins = alloca(get_irn_arity(spilled) * sizeof(ins[0]));
584         for(i = 0, arity = get_irn_arity(spilled); i < arity; ++i) {
585                 ir_node *arg = get_irn_n(spilled, i);
586
587                 if(is_value_available(env, arg, reloader)) {
588                         ins[i] = arg;
589                 } else {
590                         ins[i] = do_remat(env, arg, reloader);
591                 }
592         }
593
594         /* create a copy of the node */
595         res = new_ir_node(get_irn_dbg_info(spilled), env->irg, bl,
596                 get_irn_op(spilled),
597                 get_irn_mode(spilled),
598                 get_irn_arity(spilled),
599                 ins);
600         copy_node_attr(spilled, res);
601         new_backedge_info(res);
602         sched_reset(res);
603
604         DBG((env->dbg, LEVEL_1, "Insert remat %+F before reloader %+F\n", res, reloader));
605
606         /* insert in schedule */
607         sched_add_before(reloader, res);
608
609         return res;
610 }
611
612 int be_get_reload_costs(spill_env_t *env, ir_node *to_spill, ir_node *before) {
613         spill_info_t *spill_info;
614
615         if(be_do_remats) {
616                 // is the node rematerializable?
617                 int costs = check_remat_conditions_costs(env, to_spill, before, 0);
618                 if(costs < REMAT_COST_LIMIT)
619                         return costs;
620         }
621
622         // do we already have a spill?
623         spill_info = find_spillinfo(env, to_spill);
624         if(spill_info != NULL && spill_info->spill != NULL)
625                 return env->reload_cost;
626
627         return env->spill_cost + env->reload_cost;
628 }
629
630 int be_get_reload_costs_on_edge(spill_env_t *env, ir_node *to_spill, ir_node *block, int pos) {
631         ir_node *before = get_reload_insertion_point(block, pos);
632         return be_get_reload_costs(env, to_spill, before);
633 }
634
635 /*
636  *  ___                     _     ____      _                 _
637  * |_ _|_ __  ___  ___ _ __| |_  |  _ \ ___| | ___   __ _  __| |___
638  *  | || '_ \/ __|/ _ \ '__| __| | |_) / _ \ |/ _ \ / _` |/ _` / __|
639  *  | || | | \__ \  __/ |  | |_  |  _ <  __/ | (_) | (_| | (_| \__ \
640  * |___|_| |_|___/\___|_|   \__| |_| \_\___|_|\___/ \__,_|\__,_|___/
641  *
642  */
643
644 void be_insert_spills_reloads(spill_env_t *env) {
645         const arch_env_t *arch_env = env->arch_env;
646         int              remats    = 0;
647         int              reloads   = 0;
648         int              spills    = 0;
649         spill_info_t     *si;
650
651         /* process each spilled node */
652         for (si = set_first(env->spills); si; si = set_next(env->spills)) {
653                 reloader_t *rld;
654                 ir_mode    *mode   = get_irn_mode(si->spilled_node);
655                 pset       *values = pset_new_ptr(16);
656
657                 /* go through all reloads for this spill */
658                 for (rld = si->reloaders; rld; rld = rld->next) {
659                         ir_node *new_val;
660
661                         if (rld->rematted_node != NULL) {
662                                 new_val = rld->rematted_node;
663                                 remats++;
664                                 sched_add_before(rld->reloader, new_val);
665                         }
666                         else if (be_do_remats && rld->allow_remat && check_remat_conditions(env, si->spilled_node, rld->reloader)) {
667                                 new_val = do_remat(env, si->spilled_node, rld->reloader);
668                                 remats++;
669                         }
670                         else {
671                                 /* make sure we have a spill */
672                                 if (si->spill == NULL) {
673                                         spill_node(env, si);
674                                         spills++;
675                                 }
676
677                                 /* create a reload */
678                                 new_val = be_reload(arch_env, si->reload_cls, rld->reloader, mode, si->spill);
679                                 reloads++;
680                         }
681
682                         DBG((env->dbg, LEVEL_1, " %+F of %+F before %+F\n", new_val, si->spilled_node, rld->reloader));
683                         pset_insert_ptr(values, new_val);
684                 }
685
686                 if (pset_count(values) > 0) {
687                         /* introduce copies, rewire the uses */
688                         pset_insert_ptr(values, si->spilled_node);
689                         be_ssa_constr_set_ignore(env->birg->dom_front, env->birg->lv, values, env->mem_phis);
690                 }
691
692                 del_pset(values);
693
694                 si->reloaders = NULL;
695         }
696
697 #ifdef FIRM_STATISTICS
698         if (be_stat_ev_is_active()) {
699                 be_stat_ev("spill_spills", spills);
700                 be_stat_ev("spill_reloads", reloads);
701                 be_stat_ev("spill_remats", remats);
702         }
703 #endif /* FIRM_STATISTICS */
704
705         be_remove_dead_nodes_from_schedule(env->irg);
706         //be_liveness_recompute(env->birg->lv);
707         be_invalidate_liveness(env->birg);
708 }