X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=0c7cf979ae8f470c81f26de68611afad451fc02c;hb=7719bf6a7bd442f4763731d56d856cb082156877;hp=663af594ac86dae83902c30473fa5bc38510cefe;hpb=c79fe4adc914d8d867772053bedf449a4f85645d;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 663af594a..0c7cf979a 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -697,8 +697,7 @@ static tarval *computed_value_Proj(const ir_node *proj) tarval *computed_value(const ir_node *n) { vrp_attr *vrp = vrp_get_info(n); - if (vrp && tarval_is_all_one( - tarval_or(vrp->bits_set, vrp->bits_not_set))) { + if (vrp && vrp->valid && tarval_cmp(vrp->bits_set, vrp->bits_not_set) == pn_Cmp_Eq) { return vrp->bits_set; } if (n->op->ops.computed_value) @@ -2424,8 +2423,8 @@ static ir_node *transform_node_Add(ir_node *n) if (a_vrp && b_vrp) { tarval *c = tarval_and( - tarval_not(a_vrp->bits_not_set), - tarval_not(b_vrp->bits_not_set) + a_vrp->bits_not_set, + b_vrp->bits_not_set ); if (tarval_is_null(c)) { @@ -3596,17 +3595,17 @@ static ir_node *transform_node_And(ir_node *n) } b_vrp = vrp_get_info(b); - if (b_vrp && is_Const(a) && - (tarval_is_all_one(tarval_or(get_Const_tarval(a), b_vrp->bits_not_set)))) { + if (is_Const(a) && b_vrp && (tarval_cmp(tarval_or(get_Const_tarval(a), + b_vrp->bits_not_set), get_Const_tarval(a)) == pn_Cmp_Eq)) { + return b; } a_vrp = vrp_get_info(a); - if (a_vrp &&is_Const(b) && - (tarval_is_all_one(tarval_or(get_Const_tarval(b), a_vrp->bits_not_set)))) { + if (is_Const(b) && a_vrp && (tarval_cmp(tarval_or(get_Const_tarval(b), + a_vrp->bits_not_set), get_Const_tarval(b)) == pn_Cmp_Eq)) { return a; - } n = transform_bitwise_distributive(n, transform_node_And); @@ -4104,16 +4103,16 @@ static ir_node *transform_node_Proj_Cond(ir_node *proj) pn_Cmp cmp_result = tarval_cmp(b_vrp->range_bottom, tp); pn_Cmp cmp_result2 = tarval_cmp(b_vrp->range_top, tp); - if ((cmp_result & pn_Cmp_Lt) == cmp_result && (cmp_result2 - & pn_Cmp_Gt) == cmp_result2) { + if ((cmp_result & pn_Cmp_Gt) == cmp_result && (cmp_result2 + & pn_Cmp_Lt) == cmp_result2) { return get_irg_bad(current_ir_graph); } } else if (b_vrp->range_type == VRP_ANTIRANGE) { pn_Cmp cmp_result = tarval_cmp(b_vrp->range_bottom, tp); pn_Cmp cmp_result2 = tarval_cmp(b_vrp->range_top, tp); - if ((cmp_result & pn_Cmp_Ge) == cmp_result && (cmp_result2 - & pn_Cmp_Le) == cmp_result2) { + if ((cmp_result & pn_Cmp_Le) == cmp_result && (cmp_result2 + & pn_Cmp_Ge) == cmp_result2) { return get_irg_bad(current_ir_graph); } } @@ -4129,8 +4128,8 @@ static ir_node *transform_node_Proj_Cond(ir_node *proj) if (!(tarval_cmp( tarval_and( tarval_not(tp), - b_vrp->bits_not_set), - b_vrp->bits_not_set) + tarval_not(b_vrp->bits_not_set)), + tarval_not(b_vrp->bits_not_set)) == pn_Cmp_Eq)) { return get_irg_bad(current_ir_graph); @@ -6143,7 +6142,7 @@ static int node_cmp_attr_Const(ir_node *a, ir_node *b) /** Compares the attributes of two Proj nodes. */ static int node_cmp_attr_Proj(ir_node *a, ir_node *b) { - return get_irn_proj_attr(a) != get_irn_proj_attr(b); + return a->attr.proj != b->attr.proj; } /* node_cmp_attr_Proj */ /** Compares the attributes of two Filter nodes. */ @@ -6155,24 +6154,24 @@ static int node_cmp_attr_Filter(ir_node *a, ir_node *b) /** Compares the attributes of two Alloc nodes. */ static int node_cmp_attr_Alloc(ir_node *a, ir_node *b) { - const alloc_attr *pa = get_irn_alloc_attr(a); - const alloc_attr *pb = get_irn_alloc_attr(b); + const alloc_attr *pa = &a->attr.alloc; + const alloc_attr *pb = &b->attr.alloc; return (pa->where != pb->where) || (pa->type != pb->type); } /* node_cmp_attr_Alloc */ /** Compares the attributes of two Free nodes. */ static int node_cmp_attr_Free(ir_node *a, ir_node *b) { - const free_attr *pa = get_irn_free_attr(a); - const free_attr *pb = get_irn_free_attr(b); + const free_attr *pa = &a->attr.free; + const free_attr *pb = &b->attr.free; return (pa->where != pb->where) || (pa->type != pb->type); } /* node_cmp_attr_Free */ /** Compares the attributes of two SymConst nodes. */ static int node_cmp_attr_SymConst(ir_node *a, ir_node *b) { - const symconst_attr *pa = get_irn_symconst_attr(a); - const symconst_attr *pb = get_irn_symconst_attr(b); + const symconst_attr *pa = &a->attr.symc; + const symconst_attr *pb = &b->attr.symc; return (pa->kind != pb->kind) || (pa->sym.type_p != pb->sym.type_p) || (pa->tp != pb->tp); @@ -6181,8 +6180,8 @@ 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) { - const call_attr *pa = get_irn_call_attr(a); - const call_attr *pb = get_irn_call_attr(b); + const call_attr *pa = &a->attr.call; + const call_attr *pb = &b->attr.call; return (pa->type != pb->type) || (pa->tail_call != pb->tail_call); } /* node_cmp_attr_Call */ @@ -6192,16 +6191,6 @@ static int node_cmp_attr_Sel(ir_node *a, ir_node *b) { const ir_entity *a_ent = get_Sel_entity(a); const ir_entity *b_ent = get_Sel_entity(b); -#if 0 - return - (a_ent->kind != b_ent->kind) || - (a_ent->name != b_ent->name) || - (a_ent->owner != b_ent->owner) || - (a_ent->ld_name != b_ent->ld_name) || - (a_ent->type != b_ent->type); -#endif - /* Matze: inlining of functions can produce 2 entities with same type, - * name, etc. */ return a_ent != b_ent; } /* node_cmp_attr_Sel */ @@ -6212,7 +6201,7 @@ static int node_cmp_attr_Phi(ir_node *a, ir_node *b) hence it is enough to check if one of them is a Phi0 */ if (is_Phi0(a)) { /* check the Phi0 pos attribute */ - return get_irn_phi_attr(a)->u.pos != get_irn_phi_attr(b)->u.pos; + return a->attr.phi.u.pos != b->attr.phi.u.pos; } return 0; } /* node_cmp_attr_Phi */ @@ -6258,8 +6247,8 @@ static int node_cmp_attr_Store(ir_node *a, ir_node *b) /** 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); + const except_attr *ea = &a->attr.except; + const except_attr *eb = &b->attr.except; return ea->pin_state != eb->pin_state; } @@ -6269,8 +6258,8 @@ static int node_cmp_exception(ir_node *a, ir_node *b) /** 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); + const divmod_attr *ma = &a->attr.divmod; + const divmod_attr *mb = &b->attr.divmod; return ma->exc.pin_state != mb->exc.pin_state || ma->resmode != mb->resmode || ma->no_remainder != mb->no_remainder; @@ -6279,8 +6268,8 @@ static int node_cmp_attr_Div(ir_node *a, ir_node *b) /** 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); + const divmod_attr *ma = &a->attr.divmod; + const divmod_attr *mb = &b->attr.divmod; return ma->exc.pin_state != mb->exc.pin_state || ma->resmode != mb->resmode; } /* node_cmp_attr_DivMod */ @@ -6288,19 +6277,13 @@ static int node_cmp_attr_DivMod(ir_node *a, ir_node *b) /** 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->resmode != mb->resmode; + return node_cmp_attr_DivMod(a, b); } /* 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->resmode != mb->resmode; + return node_cmp_attr_DivMod(a, b); } /* node_cmp_attr_Quot */ /** Compares the attributes of two Confirm nodes. */ @@ -6313,11 +6296,8 @@ static int node_cmp_attr_Confirm(ir_node *a, ir_node *b) /** Compares the attributes of two Builtin nodes. */ static int node_cmp_attr_Builtin(ir_node *a, ir_node *b) { - const builtin_attr *ma = get_irn_builtin_attr(a); - const builtin_attr *mb = get_irn_builtin_attr(b); - /* no need to compare the type, equal kind means equal type */ - return ma->kind != mb->kind; + return get_Builtin_kind(a) != get_Builtin_kind(b); } /* node_cmp_attr_Builtin */ /** Compares the attributes of two ASM nodes. */ @@ -6967,7 +6947,7 @@ static unsigned hash_Const(const ir_node *node) unsigned h; /* special value for const, as they only differ in their tarval. */ - h = HASH_PTR(node->attr.con.tv); + h = HASH_PTR(node->attr.con.tarval); return h; } /* hash_Const */