- mostly implemented access to outer frame variables, however offset, is wrong yet
[libfirm] / ir / be / beirgmod.c
index ac09a21..5e4b051 100644 (file)
@@ -184,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
@@ -246,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);
        }