X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fldstopt.c;h=2e9aeeab0e5e56476b30a94263b25ee65fdeb69d;hb=d2dc2564b47d9c113d7e6e598574e9733627fcca;hp=c3aa0e09c20b58224bd95ce75f762bf6006d3001;hpb=2706ed8c117df357a861a192b230fe9bc055431c;p=libfirm diff --git a/ir/opt/ldstopt.c b/ir/opt/ldstopt.c index c3aa0e09c..2e9aeeab0 100644 --- a/ir/opt/ldstopt.c +++ b/ir/opt/ldstopt.c @@ -286,10 +286,10 @@ static entity *find_constant_entity(ir_node *ptr) return get_SymConst_entity(ptr); } else if (op == op_Sel) { - entity *ent = get_Sel_entity(ptr); - type *tp = get_entity_owner(ent); + entity *ent = get_Sel_entity(ptr); + ir_type *tp = get_entity_owner(ent); - /* Do not fiddle about polymorphy. */ + /* Do not fiddle with polymorphism. */ if (is_Class_type(get_entity_owner(ent)) && ((get_entity_n_overwrites(ent) != 0) || (get_entity_n_overwrittenby(ent) != 0) ) ) @@ -421,16 +421,16 @@ static unsigned optimize_load(ir_node *load) * like x = new O; x->t; */ if (info->projs[pn_Load_X_except]) { - if (get_irn_op(ptr) == op_Sel) { + if (is_Sel(ptr)) { ir_node *mem = get_Sel_mem(ptr); if (get_irn_op(skip_Proj(mem)) == op_Alloc) { /* ok, check the types */ - entity *ent = get_Sel_entity(ptr); - type *s_type = get_entity_type(ent); - type *a_type = get_Alloc_type(mem); + entity *ent = get_Sel_entity(ptr); + ir_type *s_type = get_entity_type(ent); + ir_type *a_type = get_Alloc_type(mem); - if (is_subclass_of(s_type, a_type)) { + if (is_SubClass_of(s_type, a_type)) { /* ok, condition met: there can't be an exception because * Alloc guarantees that enough memory was allocated */ @@ -464,7 +464,7 @@ static unsigned optimize_load(ir_node *load) } /* Load from a constant polymorphic field, where we can resolve - polymorphy. */ + polymorphism. */ new_node = transform_node_Load(load); if (new_node != load) { if (info->projs[pn_Load_M]) { @@ -514,7 +514,7 @@ static unsigned optimize_load(ir_node *load) /* no result :-) */ if (info->projs[pn_Load_res]) { if (is_atomic_entity(ent)) { - ir_node *c = copy_const_value(get_atomic_ent_value(ent)); + ir_node *c = copy_const_value(get_irn_dbg_info(load), get_atomic_ent_value(ent)); DBG_OPT_RC(load, c); exchange(info->projs[pn_Load_res], c); @@ -552,7 +552,7 @@ static unsigned optimize_load(ir_node *load) res |= DF_CHANGED; } if (info->projs[pn_Load_res]) { - exchange(info->projs[pn_Load_res], copy_const_value(c)); + exchange(info->projs[pn_Load_res], copy_const_value(get_irn_dbg_info(load), c)); return res | DF_CHANGED; } } @@ -584,19 +584,17 @@ static unsigned optimize_load(ir_node *load) */ INC_MASTER(); for (pred = skip_Proj(mem); load != pred; pred = skip_Proj(get_Load_mem(pred))) { - ldst_info_t *info; + ldst_info_t *pred_info = get_irn_link(pred); /* * BEWARE: one might think that checking the modes is useless, because * if the pointers are identical, they refer to the same object. * This is only true in strong typed languages, not in C were the following - * is possible a = *(type1 *)p; b = *(type2 *)p ... + * is possible a = *(ir_type1 *)p; b = *(ir_type2 *)p ... */ if (get_irn_op(pred) == op_Store && get_Store_ptr(pred) == ptr && get_irn_mode(get_Store_value(pred)) == load_mode) { - ldst_info_t *pred_info = get_irn_link(pred); - /* * a Load immediately after a Store -- a read after write. * We may remove the Load, if both Load & Store does not have an exception handler @@ -641,8 +639,6 @@ static unsigned optimize_load(ir_node *load) * hander because they would have exact the same exception... */ if (! info->projs[pn_Load_X_except] || get_nodes_block(load) == get_nodes_block(pred)) { - ldst_info_t *pred_info = get_irn_link(pred); - DBG_OPT_RAR(load, pred); if (pred_info->projs[pn_Load_res]) { @@ -681,10 +677,9 @@ static unsigned optimize_load(ir_node *load) break; /* check for cycles */ - info = get_irn_link(pred); - if (NODE_VISITED(info)) + if (NODE_VISITED(pred_info)) break; - MARK_NODE(info); + MARK_NODE(pred_info); } return res; } @@ -706,7 +701,7 @@ static unsigned optimize_store(ir_node *store) * BEWARE: one might think that checking the modes is useless, because * if the pointers are identical, they refer to the same object. * This is only true in strong typed languages, not is C were the following - * is possible *(type1 *)p = a; *(type2 *)p = b ... + * is possible *(ir_type1 *)p = a; *(ir_type2 *)p = b ... */ ptr = get_Store_ptr(store); @@ -758,10 +753,9 @@ static unsigned optimize_store(ir_node *store) break; /* check for cycles */ - info = get_irn_link(pred); - if (NODE_VISITED(info)) + if (NODE_VISITED(pred_info)) break; - MARK_NODE(info); + MARK_NODE(pred_info); } return res; } @@ -926,7 +920,7 @@ static unsigned optimize_phi(ir_node *phi, void *env) } /** - * walker, do the optiimizations + * walker, do the optimizations */ static void do_load_store_optimize(ir_node *n, void *env) { @@ -961,7 +955,7 @@ void optimize_load_store(ir_graph *irg) assert(get_irg_pinned(irg) != op_pin_state_floats && "LoadStore optimization needs pinned graph"); - if (!get_opt_redundant_LoadStore()) + if (! get_opt_redundant_loadstore()) return; obstack_init(&env.obst); @@ -984,7 +978,6 @@ void optimize_load_store(ir_graph *irg) if (env.changes & CF_CHANGED) { /* is this really needed: Yes, control flow changed, block might get Bad. */ - if (get_irg_dom_state(current_ir_graph) == dom_consistent) - set_irg_dom_inconsistent(current_ir_graph); + set_irg_doms_inconsistent(current_ir_graph); } }