X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fcfopt.c;h=765f57eba2af0a07edbfaa7b5b56de8d27bf3825;hb=b27ae245166bb695bc4e418ff416d91bc37d0f28;hp=feca4dbab56ac751947ba9d90140596accf88ed2;hpb=27fe9e1ea6a5045e378fdb75ed81ef4403302a5d;p=libfirm diff --git a/ir/opt/cfopt.c b/ir/opt/cfopt.c index feca4dbab..765f57eba 100644 --- a/ir/opt/cfopt.c +++ b/ir/opt/cfopt.c @@ -64,7 +64,6 @@ typedef struct merge_env { bool changed; /**< Set if the graph was changed. */ bool phis_moved; /**< Set if Phi nodes were moved. */ - ir_node **switch_conds; /**< Helper list for all found Switch Conds. */ } merge_env; static void set_Block_removable(ir_node *block, bool removable) @@ -77,6 +76,11 @@ static bool is_Block_removable(ir_node *block) return get_Block_mark(block); } +static bool is_switch_Cond(ir_node *cond) { + ir_node *sel = get_Cond_selector(cond); + return get_irn_mode(sel) != mode_b; +} + static void clear_link(ir_node *node, void *ctx) { (void) ctx; @@ -94,7 +98,7 @@ static void clear_link(ir_node *node, void *ctx) */ static void collect_nodes(ir_node *n, void *ctx) { - merge_env *env = (merge_env*)ctx; + ir_node ***switch_conds = (ir_node***)ctx; if (is_Phi(n)) { /* Collect Phi nodes to compact ins along with block's ins. */ @@ -114,12 +118,9 @@ static void collect_nodes(ir_node *n, void *ctx) ir_node *pred = get_Proj_pred(n); set_irn_link(n, get_irn_link(pred)); set_irn_link(pred, n); - } else if (is_Cond(n)) { - ir_node *sel = get_Cond_selector(n); - if (get_irn_mode(sel) != mode_b) { - /* found a switch-Cond, collect */ - ARR_APP1(ir_node*, env->switch_conds, n); - } + } else if (is_Cond(n) && is_switch_Cond(n)) { + /* found a switch-Cond, collect */ + ARR_APP1(ir_node*, *switch_conds, n); } } } @@ -536,10 +537,6 @@ static bool handle_switch_cond(ir_node *cond) return false; } -static bool is_switch_Cond(ir_node *cond) { - return get_irn_mode(get_Cond_selector(cond)) != mode_b; -} - static bool get_phase_flag(ir_phase *block_info, ir_node *block, int offset) { return ((int)phase_get_irn_data(block_info, block)) & (1<