removed unitialized used vartiable
[libfirm] / ir / be / bespill.c
index 62ffddc..20b3915 100644 (file)
@@ -38,7 +38,7 @@
 #include "benodesets.h"
 #include "bespilloptions.h"
 #include "bestatevent.h"
-#include "beirgmod.h"
+#include "bessaconstr.h"
 
 // only rematerialise when costs are less than REMAT_COST_LIMIT
 // TODO determine a good value here...
@@ -406,7 +406,7 @@ static void spill_phi(spill_env_t *env, spill_info_t *spillinfo) {
 
                set_irn_n(spillinfo->spill, i, arg_info->spill);
        }
-       DBG((env->dbg, LEVEL_1, "... done spilling Phi %+F\n", phi));
+       DBG((env->dbg, LEVEL_1, "... done spilling Phi %+F, created PhiM %+F\n", phi, spillinfo->spill));
 
        // rewire reloads from old_spill to phi
        if (spillinfo->old_spill != NULL) {
@@ -683,7 +683,7 @@ void be_insert_spills_reloads(spill_env_t *env) {
           spilled phis work correctly */
        foreach_ir_nodeset(&env->mem_phis, node, iter) {
                spill_info_t *info = get_spillinfo(env, node);
-               spill_phi(env, info);
+               spill_node(env, info);
        }
 
        /* process each spilled node */
@@ -727,14 +727,25 @@ void be_insert_spills_reloads(spill_env_t *env) {
                /* if we had any reloads or remats, then we need to reconstruct the
                 * SSA form for the spilled value */
                if (ARR_LEN(copies) > 0) {
-                       /* Matze: used mem_phis as ignore uses in the past, I don't see how
-                          one of the mem_phis can be a use of the spilled value...
-                          so I changed this to NULL now */
-                       be_ssa_construction(
-                                       be_get_birg_dom_front(env->birg),
-                                       be_get_birg_liveness(env->birg),
-                                       spilled_node, ARR_LEN(copies), copies,
-                                       NULL, 0);
+                       be_ssa_construction_env_t senv;
+                       /* be_lv_t *lv = be_get_birg_liveness(env->birg); */
+
+                       be_ssa_construction_init(&senv, env->birg);
+                       be_ssa_construction_add_copy(&senv, spilled_node);
+                       be_ssa_construction_add_copies(&senv, copies, ARR_LEN(copies));
+                       be_ssa_construction_fix_users(&senv, spilled_node);
+
+#if 0
+                       /* no need to enable this as long as we invalidate liveness
+                          after this function... */
+                       be_ssa_construction_update_liveness_phis(&senv);
+                       be_liveness_update(spilled_node);
+                       len = ARR_LEN(copies);
+                       for(i = 0; i < len; ++i) {
+                               be_liveness_update(lv, copies[i]);
+                       }
+#endif
+                       be_ssa_construction_destroy(&senv);
                }
 
                DEL_ARR_F(copies);