X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=60ec67fd9545f6be2b279491428a9919d517b53b;hb=3e68436281dce9a55bca7ee6ab5483dc01e4936d;hp=0318352b986eea06172b8747441c9c34c9320238;hpb=8f3ea9944fc871759dcc9b1bec6ae4152e38ee17;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 0318352b9..60ec67fd9 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -2988,7 +2988,7 @@ static ir_node *transform_bitwise_distributive(ir_node *n, n = new_rd_And(dbgi, irg, blk, new_n, c, mode); } else { n = exact_copy(a); - set_irn_n(n, -1, blk); + set_nodes_block(n, blk); set_binop_left(n, new_n); set_binop_right(n, c); add_identities(current_ir_graph->value_table, n); @@ -3331,13 +3331,15 @@ static ir_node *transform_node_Minus(ir_node *n) { ir_node *mul_r = get_Mul_right(a); if (is_Const(mul_r)) { tarval *tv = tarval_neg(get_Const_tarval(mul_r)); - ir_node *cnst = new_Const(mode, tv); - dbg_info *dbg = get_irn_dbg_info(a); - ir_graph *irg = current_ir_graph; - ir_node *block = get_nodes_block(a); - n = new_rd_Mul(dbg, irg, block, mul_l, cnst, mode); - DBG_OPT_ALGSIM2(oldn, a, n, FS_OPT_MINUS_MUL_C); - return n; + if(tv != tarval_bad) { + ir_node *cnst = new_Const(mode, tv); + dbg_info *dbg = get_irn_dbg_info(a); + ir_graph *irg = current_ir_graph; + ir_node *block = get_nodes_block(a); + n = new_rd_Mul(dbg, irg, block, mul_l, cnst, mode); + DBG_OPT_ALGSIM2(oldn, a, n, FS_OPT_MINUS_MUL_C); + return n; + } } } @@ -4995,7 +4997,7 @@ static int node_cmp_attr_SymConst(ir_node *a, ir_node *b) { /** Compares the attributes of two Call nodes. */ static int node_cmp_attr_Call(ir_node *a, ir_node *b) { - return (get_irn_call_attr(a) != get_irn_call_attr(b)); + return get_irn_call_attr(a) != get_irn_call_attr(b); } /* node_cmp_attr_Call */ /** Compares the attributes of two Sel nodes. */ @@ -5015,8 +5017,8 @@ static int node_cmp_attr_Phi(ir_node *a, ir_node *b) { /* we can only enter this function if both nodes have the same number of inputs, hence it is enough to check if one of them is a Phi0 */ if (is_Phi0(a)) { - /* check the Phi0 attribute */ - return get_irn_phi0_attr(a) != get_irn_phi0_attr(b); + /* check the Phi0 pos attribute */ + return get_irn_phi_attr(a)->u.pos != get_irn_phi_attr(b)->u.pos; } return 0; } /* node_cmp_attr_Phi */ @@ -5055,6 +5057,49 @@ static int node_cmp_attr_Store(ir_node *a, ir_node *b) { get_Store_volatility(b) == volatility_is_volatile); } /* node_cmp_attr_Store */ +/** Compares two exception attributes */ +static int node_cmp_exception(ir_node *a, ir_node *b) { + const except_attr *ea = get_irn_except_attr(a); + const except_attr *eb = get_irn_except_attr(b); + + return ea->pin_state != eb->pin_state; +} + +#define node_cmp_attr_Bound node_cmp_exception + +/** Compares the attributes of two Div nodes. */ +static int node_cmp_attr_Div(ir_node *a, ir_node *b) { + const divmod_attr *ma = get_irn_divmod_attr(a); + const divmod_attr *mb = get_irn_divmod_attr(b); + return ma->exc.pin_state != mb->exc.pin_state || + ma->res_mode != mb->res_mode || + ma->no_remainder != mb->no_remainder; +} /* node_cmp_attr_Div */ + +/** Compares the attributes of two DivMod nodes. */ +static int node_cmp_attr_DivMod(ir_node *a, ir_node *b) { + const divmod_attr *ma = get_irn_divmod_attr(a); + const divmod_attr *mb = get_irn_divmod_attr(b); + return ma->exc.pin_state != mb->exc.pin_state || + ma->res_mode != mb->res_mode; +} /* node_cmp_attr_DivMod */ + +/** Compares the attributes of two Mod nodes. */ +static int node_cmp_attr_Mod(ir_node *a, ir_node *b) { + const divmod_attr *ma = get_irn_divmod_attr(a); + const divmod_attr *mb = get_irn_divmod_attr(b); + return ma->exc.pin_state != mb->exc.pin_state || + ma->res_mode != mb->res_mode; +} /* node_cmp_attr_Mod */ + +/** Compares the attributes of two Quot nodes. */ +static int node_cmp_attr_Quot(ir_node *a, ir_node *b) { + const divmod_attr *ma = get_irn_divmod_attr(a); + const divmod_attr *mb = get_irn_divmod_attr(b); + return ma->exc.pin_state != mb->exc.pin_state || + ma->res_mode != mb->res_mode; +} /* node_cmp_attr_Quot */ + /** Compares the attributes of two Confirm nodes. */ static int node_cmp_attr_Confirm(ir_node *a, ir_node *b) { return (get_Confirm_cmp(a) != get_Confirm_cmp(b)); @@ -5138,6 +5183,12 @@ static ir_op_ops *firm_set_default_node_cmp_attr(ir_opcode code, ir_op_ops *ops) CASE(Store); CASE(Confirm); CASE(ASM); + CASE(Div); + CASE(DivMod); + CASE(Mod); + CASE(Quot); + CASE(Bound); + /* FIXME CopyB */ default: /* leave NULL */; }