-ir_node *transform_node_Sel(ir_node *node)
-{
- ir_node *new_node, *ptr;
- ir_type *dyn_tp;
- entity *ent = get_Sel_entity(node);
-
- if (get_irp_phase_state() == phase_building) return node;
-
- if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
- return node;
-
- if (!is_Method_type(get_entity_type(ent)))
- return node;
-
- /* If the entity is a leave in the inheritance tree,
- we can replace the Sel by a constant. */
- if (is_final_ent(ent)) {
- /* 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) {
- /* We could remove the Call depending on this Sel. */
- new_node = node;
- } else {
- ir_node *rem_block = get_cur_block();
- set_cur_block(get_nodes_block(node));
- new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(ent));
- set_cur_block(rem_block);
- DBG_OPT_POLY(node, new_node);
- }
- return new_node;
- }
-
- /* If we know the dynamic type, we can replace the Sel by a constant. */
- ptr = get_Sel_ptr(node); /* The address we select from. */
- dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
-
- if (dyn_tp != firm_unknown_type) {
- entity *called_ent;
- ir_node *rem_block;
-
- /* We know which method will be called, no dispatch necessary. */
- called_ent = resolve_ent_polymorphy(dyn_tp, ent);
- /* called_ent may not be description: has no Address/Const to Call! */
- assert(get_entity_peculiarity(called_ent) != peculiarity_description);
-
- rem_block = get_cur_block();
- set_cur_block(get_nodes_block(node));
- new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(called_ent));
- set_cur_block(rem_block);
- DBG_OPT_POLY(node, new_node);
-
- return new_node;
- }
-
- return node;
+ir_node *transform_node_Sel(ir_node *node) {
+ ir_node *new_node, *ptr;
+ ir_type *dyn_tp;
+ ir_entity *ent = get_Sel_entity(node);
+
+ if (get_irp_phase_state() == phase_building) return node;
+
+ if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
+ return node;
+
+ if (!is_Method_type(get_entity_type(ent)))
+ return node;
+
+ /* If the entity is a leave in the inheritance tree,
+ we can replace the Sel by a constant. */
+ if (is_final_ent(ent)) {
+ /* 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) {
+ /* We could remove the Call depending on this Sel. */
+ new_node = node;
+ } else {
+ ir_node *rem_block = get_cur_block();
+ set_cur_block(get_nodes_block(node));
+ new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(ent));
+ set_cur_block(rem_block);
+ DBG_OPT_POLY(node, new_node);
+ }
+ return new_node;
+ }
+
+ /* If we know the dynamic type, we can replace the Sel by a constant. */
+ ptr = get_Sel_ptr(node); /* The address we select from. */
+ dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
+
+ if (dyn_tp != firm_unknown_type) {
+ ir_entity *called_ent;
+ ir_node *rem_block;
+
+ /* We know which method will be called, no dispatch necessary. */
+ called_ent = resolve_ent_polymorphy(dyn_tp, ent);
+ /* called_ent may not be description: has no Address/Const to Call! */
+ assert(get_entity_peculiarity(called_ent) != peculiarity_description);
+
+ rem_block = get_cur_block();
+ set_cur_block(get_nodes_block(node));
+ new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(called_ent));
+ set_cur_block(rem_block);
+ DBG_OPT_POLY(node, new_node);
+
+ return new_node;
+ }
+
+ return node;