/** 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 &&
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);
* 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 */
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();
* 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.
*
/* @@@ move to irgopt ?! */
/* @@@ not fully implemented as buggy !!! */
void opt_call_addrs(void);
+
+
#endif /* _CGANA_H_ */