rename edges_assure to assure_edges
[libfirm] / ir / lower / lower_switch.c
index 800312e..97c9b31 100644 (file)
@@ -21,7 +21,6 @@
  * @file
  * @brief   Lowering of Switches if necessary or advantageous.
  * @author  Moritz Kroll
- * @version $Id$
  */
 #include "config.h"
 
@@ -166,6 +165,7 @@ static void analyse_switch1(switch_info_t *info)
 
        info->default_block = targets[pn_Switch_default];
        info->cases         = cases;
+       free(targets);
 }
 
 static void normalize_table(ir_node *switchn, ir_mode *new_mode,
@@ -229,8 +229,8 @@ static void normalize_switch(switch_info_t *info)
                min_const = new_r_Const(irg, delta);
                selector  = new_rd_Sub(dbgi, block, selector, min_const, mode);
 
-               info->switch_min  = 0;
                info->switch_max -= info->switch_min;
+               info->switch_min  = 0;
        }
 
        if (delta != NULL || change_mode) {
@@ -398,8 +398,7 @@ static void create_out_of_bounds_check(switch_info_t *info)
 
        DEL_ARR_F(default_preds);
 
-       clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE
-                          | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS);
+       clear_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE);
 }
 
 /**
@@ -474,9 +473,8 @@ static void find_switch_nodes(ir_node *block, void *ctx)
 
        DEL_ARR_F(info.defusers);
        xfree(info.cases);
-       clear_irg_state(get_irn_irg(block), IR_GRAPH_STATE_NO_CRITICAL_EDGES
-                                         | IR_GRAPH_STATE_CONSISTENT_DOMINANCE
-                                         | IR_GRAPH_STATE_VALID_EXTENDED_BLOCKS);
+       clear_irg_properties(get_irn_irg(block), IR_GRAPH_PROPERTY_NO_CRITICAL_EDGES
+                                         | IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE);
 }
 
 void lower_switch(ir_graph *irg, unsigned small_switch, unsigned spare_size,