-static void sel_methods_walker(ir_node * node, void *env) {
- pmap *ldname_map = env;
- ir_entity **arr;
-
- /* Call standard optimizations */
- if (is_Sel(node)) {
- ir_node *new_node = optimize_in_place(node);
- if (node != new_node)
- exchange(node, new_node);
- }
-
- /* replace SymConst(name)-operations by SymConst(ent) */
- if (get_irn_op(node) == op_SymConst) {
- if (get_SymConst_kind(node) == symconst_addr_name) {
- pmap_entry * entry = pmap_find(ldname_map, (void *) get_SymConst_name(node));
- if (entry != NULL) { /* Method is declared in the compiled code */
- assert(0 && "There should not be a SymConst[addr_name] addressing a method with an implementation"
- "in this compilation unit. Use a SymConst[addr_ent].");
- }
- }
- }
- else if (get_irn_op(node) == op_Sel &&
- is_Method_type(get_entity_type(get_Sel_entity(node)))) {
- ir_entity * ent = get_SymConst_entity(get_atomic_ent_value(get_Sel_entity(node)));
- assert(get_entity_peculiarity(ent) != peculiarity_inherited);
-
- if (!eset_contains(entities, ent)) {
- /* Entity not yet handled. Find all (internal or external)
- * implemented methods that overwrites this entity.
- * This set is stored in the entity link. */
- set_entity_link(ent, get_impl_methods(ent));
- eset_insert(entities, ent);
- }
-
- /* -- As an add on we get an optimization that removes polymorphic calls.
- This optimization is more powerful than that in transform_node_Sel(). -- */
- arr = get_entity_link(ent);
- if (arr == NULL) {
- /*
- * The Sel node never returns a pointer to a usable method.
- * We could not call it, but it may be description:
- * We call a method in a dead part of the program.
- */
- assert (get_entity_peculiarity(ent) == peculiarity_description);
- }
- else if (get_opt_optimize() && get_opt_closed_world() && get_opt_dyn_meth_dispatch() &&
- (ARR_LEN(arr) == 1 && arr[0] != NULL)) {
- ir_node *new_node;
-
- /*
- * The Sel node returns only one possible method.
- * So we could replace the Sel node by a SymConst.
- * This method must exists.
- */
- set_irg_current_block(current_ir_graph, get_nodes_block(node));
- assert(get_entity_peculiarity(get_SymConst_entity(get_atomic_ent_value(arr[0]))) ==
- peculiarity_existent);
- new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(arr[0]));
- DBG_OPT_POLY(node, new_node);
- exchange(node, new_node);
- }
- }
+static void sel_methods_walker(ir_node *node, void *env)
+{
+ ir_entity **arr;
+ (void)env;
+
+ /* Call standard optimizations */
+ if (is_Sel(node)) {
+ ir_node *new_node = optimize_in_place(node);
+ if (node != new_node) {
+ exchange(node, new_node);
+ node = new_node;
+ }
+ }
+
+ if (is_Sel(node) && is_Method_type(get_entity_type(get_Sel_entity(node)))) {
+ ir_entity *ent = get_SymConst_entity(get_atomic_ent_value(get_Sel_entity(node)));
+
+ if (!eset_contains(entities, ent)) {
+ /* Entity not yet handled. Find all (internal or external)
+ * implemented methods that overwrites this entity.
+ * This set is stored in the entity link. */
+ set_entity_link(ent, get_impl_methods(ent));
+ eset_insert(entities, ent);
+ }
+
+ /* -- As an add on we get an optimization that removes polymorphic calls.
+ This optimization is more powerful than that in transform_node_Sel(). -- */
+ arr = get_entity_link(ent);
+ if (arr == NULL) {
+ /*
+ * The Sel node never returns a pointer to a usable method.
+ * We could not call it, but it may be description:
+ * We call a method in a dead part of the program.
+ */
+ assert(get_entity_irg(ent) == NULL);
+ }
+ else if (get_opt_closed_world() && get_opt_dyn_meth_dispatch() &&
+ (ARR_LEN(arr) == 1 && arr[0] != NULL)) {
+ ir_node *new_node;
+
+ /*
+ * The Sel node returns only one possible method.
+ * So we could replace the Sel node by a SymConst.
+ * This method must exists.
+ */
+ set_irg_current_block(current_ir_graph, get_nodes_block(node));
+ assert(get_entity_irg(arr[0]) != NULL);
+ new_node = copy_const_value(get_irn_dbg_info(node), get_atomic_ent_value(arr[0]));
+ DBG_OPT_POLY(node, new_node);
+ exchange(node, new_node);
+ }
+ }