- mostly implemented access to outer frame variables, however offset, is wrong yet
[libfirm] / ir / be / beirgmod.c
index d747fe2..5e4b051 100644 (file)
@@ -29,9 +29,7 @@
  * - empty block elimination
  * - a simple dead node elimination (set inputs of unreachable nodes to BAD)
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 
@@ -97,7 +95,7 @@ ir_node *insert_Perm_after(be_irg_t *birg,
        DBG((dbg, LEVEL_1, "Insert Perm after: %+F\n", pos));
 
        ir_nodeset_init(&live);
-       be_liveness_nodes_live_at(lv, birg->main_env->arch_env, cls, pos, &live);
+       be_liveness_nodes_live_at(lv, cls, pos, &live);
 
        n = ir_nodeset_size(&live);
        if(n == 0) {
@@ -186,16 +184,29 @@ static void remove_empty_block(ir_node *block)
 
                assert(succ_block == NULL);
                succ_block = get_edge_src_irn(edge);
+               if (has_Block_label(succ_block) && has_Block_label(block)) {
+                       /*
+                        * Currently we can add only one label for a block.
+                        * Therefore we cannot combine them if  both block already have one.
+                        */
+                       goto check_preds;
+               }
 
                set_irn_n(succ_block, pos, pred);
        }
 
+       if (has_Block_label(block)) {
+               /* move the label to the successor block */
+               ir_label_t label = get_Block_label(block);
+               set_Block_label(succ_block, label);
+       }
+
        /* there can be some non-scheduled Pin nodes left in the block, move them
         * to the succ block (Pin) or pred block (Sync) */
        foreach_out_edge_safe(block, edge, next) {
                node = get_edge_src_irn(edge);
 
-               if(node == jump)
+               if (node == jump)
                        continue;
                if (is_Block(node)) {
                        /* a Block->Block edge: This should be the MacroBlock
@@ -248,9 +259,9 @@ int be_remove_empty_blocks(ir_graph *irg)
        remove_empty_block(get_irg_end_block(irg));
        end   = get_irg_end(irg);
        arity = get_irn_arity(end);
-       for(i = 0; i < arity; ++i) {
+       for (i = 0; i < arity; ++i) {
                ir_node *pred = get_irn_n(end, i);
-               if(!is_Block(pred))
+               if (!is_Block(pred))
                        continue;
                remove_empty_block(pred);
        }