X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fcombo.c;h=29b210cda9c937587e4d72119a22a577b73f5f45;hb=151f1b110fe2c1ead4ae8dd66a2521f35c324946;hp=9e68175fad372cd8d976748f2e8eb968c1b5766d;hpb=384fa74b40e75d771ad513a58886c546b42d67f8;p=libfirm diff --git a/ir/opt/combo.c b/ir/opt/combo.c index 9e68175fa..29b210cda 100644 --- a/ir/opt/combo.c +++ b/ir/opt/combo.c @@ -112,6 +112,9 @@ struct opcode_key_t { long proj; /**< For Proj nodes, its proj number */ ir_entity *ent; /**< For Sel Nodes, its entity */ int intVal; /**< For Conv/Div Nodes: strict/remainderless */ + unsigned uintVal;/**< for Builtin: the kind */ + ir_node *block; /**< for Block: itself */ + void *ptr; /**< generic pointer for hash/cmp */ } u; }; @@ -285,14 +288,23 @@ static void check_opcode(const partition_t *Z) { key.u.intVal = get_Conv_strict(irn); break; case iro_Div: - key.u.intVal = is_Div_remainderless(irn); + key.u.intVal = get_Div_no_remainder(irn); + break; + case iro_Block: + key.u.block = irn; + break; + case iro_Load: + key.mode = get_Load_mode(irn); + break; + case iro_Builtin: + key.u.intVal = get_Builtin_kind(irn); break; default: break; } first = 0; } else { - assert(key.code == get_irn_opcode(irn)); + assert((unsigned)key.code == get_irn_opcode(irn)); assert(key.mode == get_irn_mode(irn)); assert(key.arity == get_irn_arity(irn)); @@ -307,7 +319,16 @@ static void check_opcode(const partition_t *Z) { assert(key.u.intVal == get_Conv_strict(irn)); break; case iro_Div: - assert(key.u.intVal == is_Div_remainderless(irn)); + assert(key.u.intVal == get_Div_no_remainder(irn)); + break; + case iro_Block: + assert(key.u.block == irn); + break; + case iro_Load: + assert(key.mode == get_Load_mode(irn)); + break; + case iro_Builtin: + assert(key.u.intVal == (int) get_Builtin_kind(irn)); break; default: break; @@ -550,7 +571,7 @@ static listmap_entry_t *listmap_find(listmap_t *map, void *id) { * @return a hash value for the given opcode map entry */ static unsigned opcode_hash(const opcode_key_t *entry) { - return (entry->mode - (ir_mode *)0) * 9 + entry->code + entry->u.proj * 3 + HASH_PTR(entry->u.ent) + entry->arity; + return (entry->mode - (ir_mode *)0) * 9 + entry->code + entry->u.proj * 3 + HASH_PTR(entry->u.ptr) + entry->arity; } /* opcode_hash */ /** @@ -563,8 +584,9 @@ static int cmp_opcode(const void *elt, const void *key, size_t size) { (void) size; return o1->code != o2->code || o1->mode != o2->mode || o1->arity != o2->arity || - o1->u.proj != o2->u.proj || o1->u.ent != o2->u.ent || - o1->u.intVal != o2->u.intVal; + o1->u.proj != o2->u.proj || + o1->u.intVal != o2->u.intVal || /* this already checks uIntVal */ + o1->u.ptr != o2->u.ptr; } /* cmp_opcode */ /** @@ -1651,7 +1673,22 @@ static void *lambda_opcode(const node_t *node, environment_t *env) { key.u.intVal = get_Conv_strict(irn); break; case iro_Div: - key.u.intVal = is_Div_remainderless(irn); + key.u.intVal = get_Div_no_remainder(irn); + break; + case iro_Block: + /* + * Some ugliness here: Two Blocks having the same + * IJmp predecessor would be congruent, which of course is wrong. + * We fix it by never letting blocks be congruent + * which cannot be detected by combo either. + */ + key.u.block = irn; + break; + case iro_Load: + key.mode = get_Load_mode(irn); + break; + case iro_Builtin: + key.u.intVal = get_Builtin_kind(irn); break; default: break; @@ -1686,7 +1723,6 @@ static void *lambda_partition(const node_t *node, environment_t *env) { pred = i == -1 ? get_irn_n(skipped, i) : get_irn_n(node->node, i); p = get_irn_node(pred); - return p->part; } /* lambda_partition */ @@ -2340,7 +2376,7 @@ static void compute_Proj_Cond(node_t *node, ir_node *cond) { node->type.tv = tarval_reachable; } else if (selector->type.tv == tarval_top) { if (tarval_UNKNOWN == tarval_top && - pnc == get_Cond_defaultProj(cond)) { + pnc == get_Cond_default_proj(cond)) { /* a switch based of Top is always "default" */ node->type.tv = tarval_reachable; } else { @@ -2348,7 +2384,7 @@ static void compute_Proj_Cond(node_t *node, ir_node *cond) { } } else { long value = get_tarval_long(selector->type.tv); - if (pnc == get_Cond_defaultProj(cond)) { + if (pnc == get_Cond_default_proj(cond)) { /* default switch, have to check ALL other cases */ int i; @@ -3506,6 +3542,7 @@ void combo(ir_graph *irg) { set_irg_extblk_inconsistent(irg); set_irg_doms_inconsistent(irg); set_irg_loopinfo_inconsistent(irg); + set_irg_entity_usage_state(irg, ir_entity_usage_not_computed); } ir_free_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);