-/**
- * Optimize a / 1 = a.
- */
-static ir_node *equivalent_node_Div(ir_node *n) {
- ir_node *a = get_Div_left(n);
- ir_node *b = get_Div_right(n);
-
- /* Div is not commutative. */
- if (is_Const(b) && is_Const_one(b)) { /* div(x, 1) == x */
- /* Turn Div into a tuple (mem, bad, a) */
- ir_node *mem = get_Div_mem(n);
- ir_node *blk = get_irn_n(n, -1);
- turn_into_tuple(n, pn_Div_max);
- set_Tuple_pred(n, pn_Div_M, mem);
- set_Tuple_pred(n, pn_Div_X_regular, new_r_Jmp(current_ir_graph, blk));
- set_Tuple_pred(n, pn_Div_X_except, new_Bad()); /* no exception */
- set_Tuple_pred(n, pn_Div_res, a);
- }
- return n;
-} /* equivalent_node_Div */
-
-/**
- * Optimize a / 1.0 = a.
- */
-static ir_node *equivalent_node_Quot(ir_node *n) {
- ir_node *a = get_Quot_left(n);
- ir_node *b = get_Quot_right(n);
-
- /* Div is not commutative. */
- if (is_Const(b) && is_Const_one(b)) { /* Quot(x, 1) == x */
- /* Turn Quot into a tuple (mem, jmp, bad, a) */
- ir_node *mem = get_Quot_mem(n);
- ir_node *blk = get_irn_n(n, -1);
- turn_into_tuple(n, pn_Quot_max);
- set_Tuple_pred(n, pn_Quot_M, mem);
- set_Tuple_pred(n, pn_Quot_X_regular, new_r_Jmp(current_ir_graph, blk));
- set_Tuple_pred(n, pn_Quot_X_except, new_Bad()); /* no exception */
- set_Tuple_pred(n, pn_Quot_res, a);
- }
- return n;
-} /* equivalent_node_Quot */
-
-/**
- * Optimize a / 1 = a.
- */
-static ir_node *equivalent_node_DivMod(ir_node *n) {
- ir_node *b = get_DivMod_right(n);
-
- /* Div is not commutative. */
- if (is_Const(b) && is_Const_one(b)) { /* div(x, 1) == x */
- /* Turn DivMod into a tuple (mem, jmp, bad, a, 0) */
- ir_node *a = get_DivMod_left(n);
- ir_node *mem = get_Div_mem(n);
- ir_node *blk = get_irn_n(n, -1);
- ir_mode *mode = get_DivMod_resmode(n);
-
- turn_into_tuple(n, pn_DivMod_max);
- set_Tuple_pred(n, pn_DivMod_M, mem);
- set_Tuple_pred(n, pn_DivMod_X_regular, new_r_Jmp(current_ir_graph, blk));
- set_Tuple_pred(n, pn_DivMod_X_except, new_Bad()); /* no exception */
- set_Tuple_pred(n, pn_DivMod_res_div, a);
- set_Tuple_pred(n, pn_DivMod_res_mod, new_Const(mode, get_mode_null(mode)));
- }
- return n;
-} /* equivalent_node_DivMod */
-