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