From: Götz Lindenmaier Date: Fri, 24 Sep 2004 11:21:37 +0000 (+0000) Subject: removed whole flag: X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=5c749a5eaac783cf648c750dac823d8d5634e861;p=libfirm removed whole flag: with this flag set, external visible methods were removed, which is wrong. [r3932] --- diff --git a/ir/ana/cgana.c b/ir/ana/cgana.c index 71e588999..a79661be9 100644 --- a/ir/ana/cgana.c +++ b/ir/ana/cgana.c @@ -53,7 +53,7 @@ static eset * entities = NULL; /** Bestimmt die eindeutige Methode, die die Methode für den - * übergebenen (dynamischen) Typ überschreibt. */ + * übergebenen (dynamischen) Typ überschreibt. */ static entity * get_implementation(type * class, entity * method) { int i; if (get_entity_peculiarity(method) != peculiarity_description && @@ -81,13 +81,16 @@ static entity * get_implementation(type * class, entity * method) { static entity *get_inherited_methods_implementation(entity *inh_meth) { entity *impl_meth = NULL; ir_node *addr = get_atomic_ent_value(inh_meth); + assert(addr && "constant entity without value"); + if ((get_irn_op(addr) == op_SymConst) && - (get_SymConst_kind(addr) == symconst_addr_ent)) { + (get_SymConst_kind(addr) == symconst_addr_ent)) { impl_meth = get_SymConst_entity(addr); } else { assert(0 && "Complex constant values not supported -- address of method should be straight constant!"); } + if (impl_meth && (get_entity_peculiarity(impl_meth) != peculiarity_existent)) { /* printf("this_meth: "); DDMEO(inh_meth); @@ -719,25 +722,23 @@ static void free_ana_walker(ir_node * node, eset * set) { * SymConst-Operationen müssen in passende Const-Operationen * umgewandelt worden sein, d.h. SymConst-Operationen verweisen immer * auf eine echt externe Methode. */ -static entity ** get_free_methods(int whole) +static entity ** get_free_methods(void) { eset * set = eset_create(); int i; entity ** arr = NEW_ARR_F(entity *, 0); entity * ent; - if (! whole) { - for (i = get_irp_n_irgs() - 1; i >= 0; --i) { - ir_graph * irg = get_irp_irg(i); - entity * ent = get_irg_entity(irg); - /* insert "external visible" methods. */ - if (get_entity_visibility(ent) != visibility_local) { - eset_insert(set, ent); - } - /* Finde alle Methoden die in dieser Methode extern sichtbar werden, - z.B. da die Adresse einer Methode abgespeichert wird. */ - irg_walk_graph(irg, NULL, (irg_walk_func *) free_ana_walker, set); + for (i = get_irp_n_irgs() - 1; i >= 0; --i) { + ir_graph * irg = get_irp_irg(i); + entity * ent = get_irg_entity(irg); + /* insert "external visible" methods. */ + if (get_entity_visibility(ent) != visibility_local) { + eset_insert(set, ent); } + /* Finde alle Methoden die in dieser Methode extern sichtbar werden, + z.B. da die Adresse einer Methode abgespeichert wird. */ + irg_walk_graph(irg, NULL, (irg_walk_func *) free_ana_walker, set); } /* insert sticky methods, too */ @@ -764,12 +765,12 @@ static entity ** get_free_methods(int whole) return arr; } -void cgana(int *length, entity ***free_methods, int whole) { +void cgana(int *length, entity ***free_methods) { entity ** free_meths; int i; sel_methods_init(); - free_meths = get_free_methods(whole); + free_meths = get_free_methods(); callee_ana(); sel_methods_dispose(); diff --git a/ir/ana/cgana.h b/ir/ana/cgana.h index 381af6a64..c64b87bed 100644 --- a/ir/ana/cgana.h +++ b/ir/ana/cgana.h @@ -55,17 +55,18 @@ * and Craig Chambers. * * Performs some optimizations possible by the analysed information: - * - Replace SymConst nodes by Const nodes if possible, - * - Replace (Sel-method(Alloc)) by Const method, - * - Replaces Sel nodes by Bad if there is no implementation for the selected entity. (@@@ was genau meint unreachable?) - * - Replaces Sel-method by Const if the Method is never overwritten - * - Replaces Calls by Tuple containing Bads if callee array is empty (there is no implementation to call) - * + * - Replace SymConst-name nodes by SymConst-entity nodes if possible. + * - Replace (Sel-method(Alloc)) by SymConst-entity. + * - Replaces Sel nodes by Bad if there is no implementation for the + * selected entity. (@@@ was genau meint unreachable?) + * - Replaces Sel-method by SymConst-entity if the method is never overwritten. + * - Replaces Calls by Tuple containing Bads if callee array is empty + * (there is no implementation to call) * * Leaves Bad control predecessors in the graph! */ /* @@@ I assume this can not be called via JNI :-( -- how to obtain the array pointer? */ -void cgana(int *len, entity ***free_methods, int whole); +void cgana(int *len, entity ***free_methods); /** Free callee information. * @@ -78,4 +79,6 @@ void free_callee_info(ir_graph *irg); /* @@@ move to irgopt ?! */ /* @@@ not fully implemented as buggy !!! */ void opt_call_addrs(void); + + #endif /* _CGANA_H_ */