Commit c6182ec2 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ir: Remove unnecessary mode_b checks of Cond selectors.

All Conds are boolean.
parent 847c1b62
......@@ -217,16 +217,9 @@ static ir_node *gen_Cmp(ir_node *node)
*/
static ir_node *gen_Cond(ir_node *node)
{
ir_node *selector = get_Cond_selector(node);
ir_mode *mode = get_irn_mode(selector);
if (mode != mode_b) {
panic ("create_Switch not implemented yet!");
// return gen_SwitchJmp(node);
}
ir_node *const block = be_transform_node(get_nodes_block(node));
dbg_info *const dbgi = get_irn_dbg_info(node);
ir_node *const selector = get_Cond_selector(node);
ir_node *const flag_node = be_transform_node(selector);
ir_relation const relation = get_Cmp_relation(selector);
return new_bd_amd64_Jcc(dbgi, block, flag_node, relation);
......
......@@ -880,11 +880,9 @@ static void dump_node_nodeattr(FILE *F, const ir_node *n)
proj_nr = get_Proj_proj(n);
code = get_irn_opcode(pred);
if (code == iro_Proj && get_irn_opcode(get_Proj_pred(pred)) == iro_Start)
if (code == iro_Proj && get_irn_opcode(get_Proj_pred(pred)) == iro_Start) {
fprintf(F, "Arg %ld ", proj_nr);
else if (code == iro_Cond && get_irn_mode(get_Cond_selector(pred)) != mode_b)
fprintf(F, "%ld ", proj_nr);
else {
} else {
unsigned i, j, f = 0;
for (i = 0; i < ARRAY_SIZE(proj_lut); ++i) {
......
......@@ -3332,8 +3332,8 @@ static ir_node *transform_node_Cond(ir_node *n)
ta = compute_cmp_ext(a);
}
if (ta != tarval_bad && get_irn_mode(a) == mode_b) {
/* It's a boolean Cond, branching on a boolean constant.
if (ta != tarval_bad) {
/* It's branching on a boolean constant.
Replace it by a tuple (Bad, Jmp) or (Jmp, Bad) */
ir_node *blk = get_nodes_block(n);
jmp = new_r_Jmp(blk);
......
......@@ -583,8 +583,6 @@ restart:
ir_node *lower_block;
ir_node *lower_cf;
ir_node *cond;
ir_node *cond_selector;
ir_node *lower_pred;
lower_cf = get_Block_cfgpred(block, low_idx);
lower_cf = skip_empty_blocks(lower_cf);
......@@ -603,12 +601,8 @@ restart:
if (get_Block_mark(lower_block))
continue;
cond_selector = get_Cond_selector(cond);
if (get_irn_mode(cond_selector) != mode_b)
continue;
lower_pred = get_Block_cfgpred_block(lower_block, 0);
ir_node *const cond_selector = get_Cond_selector(cond);
ir_node *const lower_pred = get_Block_cfgpred_block(lower_block, 0);
for (up_idx = 0; up_idx < n_cfgpreds; ++up_idx) {
ir_node *upper_block;
ir_node *upper_cf;
......@@ -625,11 +619,6 @@ restart:
if (!block_dominates(upper_block, block))
continue;
ir_node *const upper_cond = get_Proj_pred(upper_cf);
ir_node *const upper_cond_selector = get_Cond_selector(upper_cond);
if (get_irn_mode(upper_cond_selector) != mode_b)
continue;
/* we have found the structure */
/* check Phis: There must be NO Phi in block that
depends on the existence of low block */
......@@ -637,6 +626,8 @@ restart:
continue;
/* all fine, try it */
ir_node *const upper_cond = get_Proj_pred(upper_cf);
ir_node *const upper_cond_selector = get_Cond_selector(upper_cond);
if (!find_cond_pair(cond_selector, upper_cond_selector, &cpair))
continue;
......
......@@ -78,13 +78,6 @@ static bool is_Block_removable(const ir_node *block)
return get_Block_mark(block);
}
/** checks if a given Cond node is a switch Cond. */
static bool is_switch_Cond(const ir_node *cond)
{
ir_node *sel = get_Cond_selector(cond);
return get_irn_mode(sel) != mode_b;
}
/** Walker: clear link fields and mark all blocks as removable. */
static void clear_link_and_mark_blocks_removable(ir_node *node, void *ctx)
{
......@@ -548,7 +541,6 @@ static bool optimize_pred_cond(ir_node *block, int i, int j)
if (!is_Cond(cond)) return false;
if (cond != get_Proj_pred(projB)) return false;
if (is_switch_Cond(cond)) return false;
/* cond should actually be a Jmp */
pred_block = get_nodes_block(cond);
......
......@@ -296,9 +296,6 @@ restart:
if (! is_Cond(cond))
continue;
/* We only handle boolean decisions, no switches */
if (get_irn_mode(get_Cond_selector(cond)) != mode_b) continue;
for (j = i + 1; j < arity; ++j) {
ir_node* projx1;
ir_node* sel;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment