remove no-out_of_bounds option from lower_switch
authorMatthias Braun <matze@braunis.de>
Thu, 25 Oct 2012 18:16:28 +0000 (20:16 +0200)
committerMatthias Braun <matze@braunis.de>
Thu, 25 Oct 2012 18:16:28 +0000 (20:16 +0200)
noone was using it anyway

include/libfirm/lowering.h
ir/be/arm/bearch_arm.c
ir/be/ia32/bearch_ia32.c
ir/be/sparc/bearch_sparc.c
ir/lower/lower_switch.c

index f9e2f2d..a8ad1a1 100644 (file)
@@ -70,12 +70,9 @@ FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_small_size,
  * @param small_switch  If switch has <= cases then change it to an if-cascade.
  * @param spare_size Allowed spare size for table switches in machine words.
  *                   (Default in edgfe: 128)
- * @param allow_out_of_bounds   backend can handle out-of-bounds values
- *                              (values bigger than minimum and maximum proj
- *                               number)
  */
 FIRM_API void lower_switch(ir_graph *irg, unsigned small_switch,
-                           unsigned spare_size, int allow_out_of_bounds);
+                           unsigned spare_size);
 
 /**
  * Replaces SymConsts by a real constant if possible.
index a92f56c..13abcbf 100644 (file)
@@ -499,7 +499,7 @@ static void arm_lower_for_target(void)
 
        for (i = 0; i < n_irgs; ++i) {
                ir_graph *irg = get_irp_irg(i);
-               lower_switch(irg, 4, 256, false);
+               lower_switch(irg, 4, 256);
        }
 
        for (i = 0; i < n_irgs; ++i) {
index cc8d5f0..eb272ed 100644 (file)
@@ -2054,7 +2054,7 @@ static void ia32_lower_for_target(void)
        for (i = 0; i < n_irgs; ++i) {
                ir_graph *irg = get_irp_irg(i);
                /* break up switches with wide ranges */
-               lower_switch(irg, 4, 256, false);
+               lower_switch(irg, 4, 256);
        }
 
        ir_prepare_dw_lowering(&lower_dw_params);
index 4606596..80c360c 100644 (file)
@@ -489,7 +489,7 @@ static void sparc_lower_for_target(void)
        for (i = 0; i < n_irgs; ++i) {
                ir_graph *irg = get_irp_irg(i);
                ir_lower_mode_b(irg, mode_Iu);
-               lower_switch(irg, 4, 256, false);
+               lower_switch(irg, 4, 256);
                /* TODO: Pass SPARC_MIN_STACKSIZE as addr_delta as soon as
                 * Alloc nodes are implemented more efficiently. */
                lower_alloc(irg, SPARC_STACK_ALIGNMENT, true, 0);
index ef4fbb0..ddc817b 100644 (file)
@@ -44,7 +44,6 @@
 typedef struct walk_env_t {
        unsigned      spare_size; /**< the allowed spare size for table switches */
        unsigned      small_switch;
-       bool          allow_out_of_bounds;
        bool          changed;    /**< indicates whether a change was performed */
        ir_nodeset_t  processed;
 } walk_env_t;
@@ -443,12 +442,10 @@ static void find_switch_nodes(ir_node *block, void *ctx)
         || (tarval_cmp(spare, spare_size) & ir_relation_greater_equal));
 
        if (!lower_switch) {
-               /* we won't decompose the switch. But we might have to add
-                * out-of-bounds checking */
-               if (!env->allow_out_of_bounds) {
-                       normalize_switch(&info);
-                       create_out_of_bounds_check(&info);
-               }
+               /* we won't decompose the switch. But we must add an out-of-bounds
+                * check */
+               normalize_switch(&info);
+               create_out_of_bounds_check(&info);
                return;
        }
 
@@ -470,14 +467,12 @@ static void find_switch_nodes(ir_node *block, void *ctx)
                                          | IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE);
 }
 
-void lower_switch(ir_graph *irg, unsigned small_switch, unsigned spare_size,
-                  int allow_out_of_bounds)
+void lower_switch(ir_graph *irg, unsigned small_switch, unsigned spare_size)
 {
        walk_env_t env;
        env.changed             = false;
        env.spare_size          = spare_size;
        env.small_switch        = small_switch;
-       env.allow_out_of_bounds = allow_out_of_bounds;
        ir_nodeset_init(&env.processed);
 
        remove_critical_cf_edges(irg);