Commit 6ac5dadb authored by Michael Beck's avatar Michael Beck
Browse files

Fixed removement of exceptions for Div/Mod/DivMod by const

removed all tabs
clear identify a bit

[r3989]
parent cb91bddc
......@@ -1206,80 +1206,34 @@ static ir_node *transform_node_Proj(ir_node *proj)
switch (get_irn_opcode(n)) {
case iro_Div:
if (get_Proj_proj(proj) == pn_Div_X_except) {
b = get_Div_right(n);
tb = computed_value(b);
/* we found an exception handler, see if we can remove it */
if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) { /* div(x, c) && c != 0 */
ir_node *div, *proj;
ir_node *a = get_Div_left(n);
ir_node *mem = get_Div_mem(n);
int rem = get_optimize();
set_optimize(0);
{
div = new_rd_Div(get_irn_dbg_info(n), current_ir_graph,
get_nodes_block(n), get_irg_initial_mem(current_ir_graph), a, b);
proj = new_r_Proj(current_ir_graph, get_nodes_block(n), div, get_irn_mode(a), pn_Div_res);
return new_Bad();
}
set_optimize(rem);
turn_into_tuple(n, 3);
set_Tuple_pred(n, pn_Mod_M, mem);
set_Tuple_pred(n, pn_Mod_X_except, new_Bad());
set_Tuple_pred(n, pn_Mod_res, proj);
}
break;
case iro_Mod:
if (get_Proj_proj(proj) == pn_Mod_X_except) {
b = get_Mod_right(n);
tb = computed_value(b);
if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) { /* mod(x, c) && c != 0 */
ir_node *mod, *proj;
ir_node *a = get_Mod_left(n);
ir_node *mem = get_Mod_mem(n);
int rem = get_optimize();
set_optimize(0);
{
mod = new_rd_Mod(get_irn_dbg_info(n), current_ir_graph,
get_nodes_block(n), get_irg_initial_mem(current_ir_graph), a, b);
proj = new_r_Proj(current_ir_graph, get_nodes_block(n), mod, get_irn_mode(a), pn_Mod_res);
return new_Bad();
}
set_optimize(rem);
turn_into_tuple(n, 3);
set_Tuple_pred(n, pn_Mod_M, mem);
set_Tuple_pred(n, pn_Mod_X_except, new_Bad());
set_Tuple_pred(n, pn_Mod_res, proj);
}
break;
case iro_DivMod:
if (get_Proj_proj(proj) == pn_DivMod_X_except) {
b = get_DivMod_right(n);
tb = computed_value(b);
if (tb != tarval_bad && classify_tarval(tb) != TV_CLASSIFY_NULL) { /* DivMod(x, c) && c != 0 */
ir_node *div_mod, *proj_div, *proj_mod;
ir_node *a = get_Mod_left(n);
ir_node *mem = get_Mod_mem(n);
int rem = get_optimize();
set_optimize(0);
{
div_mod = new_rd_DivMod(get_irn_dbg_info(n), current_ir_graph,
get_nodes_block(n), get_irg_initial_mem(current_ir_graph), a, b);
proj_div = new_r_Proj(current_ir_graph, get_nodes_block(n), div_mod, get_irn_mode(a), pn_DivMod_res_div);
proj_mod = new_r_Proj(current_ir_graph, get_nodes_block(n), div_mod, get_irn_mode(a), pn_DivMod_res_mod);
return new_Bad();
}
set_optimize(rem);
turn_into_tuple(n, 4);
set_Tuple_pred(n, pn_DivMod_M, mem);
set_Tuple_pred(n, pn_DivMod_X_except, new_Bad());
set_Tuple_pred(n, pn_DivMod_res_div, proj_div);
set_Tuple_pred(n, pn_DivMod_res_mod, proj_mod);
}
break;
......@@ -1306,7 +1260,7 @@ static ir_node *transform_node_Proj(ir_node *proj)
return proj;
case iro_Tuple:
/* should not happen, but if it doest will optimize */
/* should not happen, but if it does will optimize */
break;
default:
......@@ -1687,11 +1641,13 @@ identify (pset *value_table, ir_node *n)
/* TODO: use a generic commutative attribute */
if (get_opt_reassociation()) {
if (is_op_commutative(get_irn_op(n))) {
ir_node *l = get_binop_left(n);
ir_node *r = get_binop_right(n);
/* for commutative operators perform a OP b == b OP a */
if (get_binop_left(n) > get_binop_right(n)) {
ir_node *h = get_binop_left(n);
set_binop_left(n, get_binop_right(n));
set_binop_right(n, h);
if (l > r) {
set_binop_left(n, r);
set_binop_right(n, l);
}
}
}
......@@ -1710,6 +1666,7 @@ identify (pset *value_table, ir_node *n)
static INLINE ir_node *
identify_cons (pset *value_table, ir_node *n) {
ir_node *old = n;
n = identify(value_table, n);
if (get_irn_n(old, -1) != get_irn_n(n, -1))
set_irg_pinned(current_ir_graph, op_pin_state_floats);
......
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