becopyilp: fix size_reduction code
[libfirm] / ir / be / bessadestr.c
index 425f5c7..168eaea 100644 (file)
@@ -22,7 +22,6 @@
  * @brief       Performs SSA-Destruction.
  * @author      Daniel Grund
  * @date        25.05.2005
- * @version     $Id$
  */
 #include "config.h"
 
@@ -169,7 +168,10 @@ static void insert_all_perms_walker(ir_node *bl, void *data)
                        perm = be_new_Perm(chordal_env->cls, pred_bl, n_projs, in);
                        be_stat_ev("phi_perm", n_projs);
 
-                       insert_after = sched_skip(sched_last(pred_bl), 0, sched_skip_cf_predicator, NULL);
+                       insert_after = pred_bl;
+                       do {
+                               insert_after = sched_prev(insert_after);
+                       } while (is_cfop(insert_after));
                        sched_add_after(insert_after, perm);
 
                        /*
@@ -239,7 +241,6 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
             phi = (ir_node*)get_irn_link(phi)) {
                ir_node                     *phi_block = get_nodes_block(phi);
                const arch_register_t       *phi_reg   = arch_get_irn_register(phi);
-               const arch_register_class_t *cls       = phi_reg->reg_class;
                int                          max;
                int                          i;
 
@@ -268,6 +269,8 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
                        }
 
                        if (be_values_interfere(lv, phi, arg)) {
+                               ir_node *schedpoint;
+
                                /*
                                        Insert a duplicate in arguments block,
                                        make it the new phi arg,
@@ -275,11 +278,15 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
                                        insert it into schedule,
                                        pin it
                                */
-                               ir_node *dupl  = be_new_Copy(cls, arg_block, arg);
+                               ir_node *dupl = be_new_Copy(arg_block, arg);
 
                                set_irn_n(phi, i, dupl);
                                arch_set_irn_register(dupl, phi_reg);
-                               sched_add_after(sched_skip(sched_last(arg_block), 0, sched_skip_cf_predicator, NULL), dupl);
+                               schedpoint = arg_block;
+                               do {
+                                       schedpoint = sched_prev(schedpoint);
+                               } while (is_cfop(schedpoint));
+                               sched_add_after(schedpoint, dupl);
                                pin_irn(dupl, phi_block);
                                be_liveness_introduce(lv, dupl);
                                be_liveness_update(lv, arg);
@@ -327,7 +334,7 @@ static void set_regs_or_place_dupls_walker(ir_node *bl, void *data)
                                        pin it
                                */
                                ir_node *perm = get_Proj_pred(arg);
-                               ir_node *dupl = be_new_Copy(cls, arg_block, arg);
+                               ir_node *dupl = be_new_Copy(arg_block, arg);
                                ir_node *ins;
 
                                set_irn_n(phi, i, dupl);
@@ -407,7 +414,7 @@ static void ssa_destruction_check_walker(ir_node *bl, void *data)
                /* iterate over all args of phi */
                for (i = 0, max = get_irn_arity(phi); i < max; ++i) {
                        ir_node                   *arg = get_irn_n(phi, i);
-                       const arch_register_req_t *req = arch_get_register_req_out(arg);
+                       const arch_register_req_t *req = arch_get_irn_register_req(arg);
 
                        if (req->type & arch_register_req_type_ignore)
                                continue;