X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fopt_polymorphy.c;h=c11be8c6baeab0a44d7fa9831ecfb13fbbb0926e;hb=466dc8de3ba69ea7f4d7cfc2e48b124fdebeef6c;hp=67ca5a9f4a64dc8ab812f84323d51c19024ca5ca;hpb=1714809afac25e69694b58423430c03f5af20228;p=libfirm diff --git a/ir/opt/opt_polymorphy.c b/ir/opt/opt_polymorphy.c index 67ca5a9f4..c11be8c6b 100644 --- a/ir/opt/opt_polymorphy.c +++ b/ir/opt/opt_polymorphy.c @@ -5,7 +5,7 @@ * Author: * Created: * CVS-ID: $Id$ - * Copyright: (c) 2005 Universität Karlsruhe + * Copyright: (c) 2005 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ @@ -28,7 +28,7 @@ * If we find a dynamic type this means that the pointer always points * to an object of this type during runtime. We resolved polymorphy. */ -static type *get_dynamic_type(ir_node *ptr) { +static ir_type *get_dynamic_type(ir_node *ptr) { ptr = skip_Cast(skip_Proj(ptr)); if (get_irn_op(ptr) == op_Alloc) return get_Alloc_type(ptr); @@ -36,13 +36,12 @@ static type *get_dynamic_type(ir_node *ptr) { } /* - * Transform Sel(Alloc)[method] - * to SymC[method] + * Transform Sel[method] to SymC[method] if possible. */ ir_node *transform_node_Sel(ir_node *node) { ir_node *new_node, *ptr; - type *dyn_tp; + ir_type *dyn_tp; entity *ent = get_Sel_entity(node); if (get_irp_phase_state() == phase_building) return node; @@ -55,7 +54,7 @@ ir_node *transform_node_Sel(ir_node *node) /* If the entity is a leave in the inheritance tree, we can replace the Sel by a constant. */ - if ((get_irp_phase_state() != phase_building) && (get_entity_n_overwrittenby(ent) == 0)) { + if (get_entity_n_overwrittenby(ent) == 0) { /* In dead code, we might call a leave entity that is a description. Do not turn the Sel to a SymConst. */ if (get_entity_peculiarity(ent) == peculiarity_description) { @@ -64,9 +63,9 @@ ir_node *transform_node_Sel(ir_node *node) } else { ir_node *rem_block = get_cur_block(); set_cur_block(get_nodes_block(node)); - new_node = copy_const_value(get_atomic_ent_value(ent)); + new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(ent)); set_cur_block(rem_block); - DBG_OPT_POLY_ALLOC(node, new_node); + DBG_OPT_POLY(node, new_node); } return new_node; @@ -87,9 +86,9 @@ ir_node *transform_node_Sel(ir_node *node) rem_block = get_cur_block(); set_cur_block(get_nodes_block(node)); - new_node = copy_const_value(get_atomic_ent_value(called_ent)); + new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(called_ent)); set_cur_block(rem_block); - DBG_OPT_POLY_ALLOC(node, new_node); + DBG_OPT_POLY(node, new_node); return new_node; } @@ -103,20 +102,20 @@ ir_node *transform_node_Sel(ir_node *node) * This function returns a node replacing the Proj(Load)[Value]. * If this is actually called in transform_node, we must build * a tuple, or replace the Projs of the load. - * Therefore we call this optimization in ldstopt. + * Therefore we call this optimization in ldstopt(). */ ir_node *transform_node_Load(ir_node *n) { ir_node *field_ptr, *new_node, *ptr; entity *ent; - type *dyn_tp; + ir_type *dyn_tp; if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch())) return n; field_ptr = get_Load_ptr(n); - if (get_irn_op(field_ptr) != op_Sel) return n; + if (! is_Sel(field_ptr)) return n; ent = get_Sel_entity(field_ptr); if ((get_entity_allocation(ent) != allocation_static) || @@ -126,8 +125,8 @@ ir_node *transform_node_Load(ir_node *n) /* If the entity is a leave in the inheritance tree, we can replace the Sel by a constant. */ if ((get_irp_phase_state() != phase_building) && (get_entity_n_overwrittenby(ent) == 0)) { - new_node = copy_const_value(get_atomic_ent_value(ent)); - DBG_OPT_POLY_ALLOC(field_ptr, new_node); + new_node = copy_const_value(get_irn_dbg_info(n), get_atomic_ent_value(ent)); + DBG_OPT_POLY(field_ptr, new_node); return new_node; } @@ -144,8 +143,8 @@ ir_node *transform_node_Load(ir_node *n) /* called_ent may not be description: has no Address/Const to Call! */ assert(get_entity_peculiarity(loaded_ent) != peculiarity_description); - new_node = copy_const_value(get_atomic_ent_value(loaded_ent)); - DBG_OPT_POLY_ALLOC(field_ptr, new_node); + new_node = copy_const_value(get_irn_dbg_info(n), get_atomic_ent_value(loaded_ent)); + DBG_OPT_POLY(field_ptr, new_node); return new_node; }