From b8d367e5b2b7d647a7e9660f64fa75ab6058e69a Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 25 Oct 2012 20:16:28 +0200 Subject: [PATCH] remove no-out_of_bounds option from lower_switch noone was using it anyway --- include/libfirm/lowering.h | 5 +---- ir/be/arm/bearch_arm.c | 2 +- ir/be/ia32/bearch_ia32.c | 2 +- ir/be/sparc/bearch_sparc.c | 2 +- ir/lower/lower_switch.c | 15 +++++---------- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/include/libfirm/lowering.h b/include/libfirm/lowering.h index f9e2f2ddb..a8ad1a112 100644 --- a/include/libfirm/lowering.h +++ b/include/libfirm/lowering.h @@ -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. diff --git a/ir/be/arm/bearch_arm.c b/ir/be/arm/bearch_arm.c index a92f56c57..13abcbfbb 100644 --- a/ir/be/arm/bearch_arm.c +++ b/ir/be/arm/bearch_arm.c @@ -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) { diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index cc8d5f0ab..eb272ede1 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -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); diff --git a/ir/be/sparc/bearch_sparc.c b/ir/be/sparc/bearch_sparc.c index 46065967e..80c360c90 100644 --- a/ir/be/sparc/bearch_sparc.c +++ b/ir/be/sparc/bearch_sparc.c @@ -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); diff --git a/ir/lower/lower_switch.c b/ir/lower/lower_switch.c index ef4fbb015..ddc817b10 100644 --- a/ir/lower/lower_switch.c +++ b/ir/lower/lower_switch.c @@ -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); -- 2.20.1