refactor mode_b lowerer to have a create_set callback
[libfirm] / ir / be / beirgmod.c
index ce59d59..7339df9 100644 (file)
@@ -79,11 +79,10 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
 */
 
-ir_node *insert_Perm_after(be_irg_t *birg,
-                                                  const arch_register_class_t *cls,
+ir_node *insert_Perm_after(ir_graph *irg, const arch_register_class_t *cls,
                                                   ir_node *pos)
 {
-       be_lv_t *lv     = birg->lv;
+       be_lv_t *lv     = be_get_irg_liveness(irg);
        ir_node *bl     = is_Block(pos) ? pos : get_nodes_block(pos);
        ir_nodeset_t          live;
        ir_nodeset_iterator_t iter;
@@ -124,12 +123,12 @@ ir_node *insert_Perm_after(be_irg_t *birg,
                be_ssa_construction_env_t senv;
 
                ir_mode *mode = get_irn_mode(perm_op);
-               ir_node *proj = new_r_Proj(bl, perm, mode, i);
+               ir_node *proj = new_r_Proj(perm, mode, i);
                arch_set_irn_register(proj, reg);
 
                curr = proj;
 
-               be_ssa_construction_init(&senv, birg);
+               be_ssa_construction_init(&senv, irg);
                be_ssa_construction_add_copy(&senv, perm_op);
                be_ssa_construction_add_copy(&senv, proj);
                be_ssa_construction_fix_users(&senv, perm_op);
@@ -208,12 +207,6 @@ static void remove_empty_block(ir_node *block)
 
                if (node == jump)
                        continue;
-               if (is_Block(node)) {
-                       /* a Block->Block edge: This should be the MacroBlock
-                          edge, ignore it. */
-                       assert(get_Block_MacroBlock(node) == block && "Wrong Block->Block edge");
-                       continue;
-               }
                /* we simply kill Pins, because there are some strange interactions
                 * between jump threading, which produce PhiMs with Pins, we simply
                 * kill the pins here, everything is scheduled anyway */
@@ -280,9 +273,8 @@ int be_remove_empty_blocks(ir_graph *irg)
        return blocks_removed;
 }
 
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_irgmod);
 void be_init_irgmod(void)
 {
        FIRM_DBG_REGISTER(dbg, "firm.be.irgmod");
 }
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_irgmod);