X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Frta.c;h=ed9d8eb23b8da73269b7353b2f9875f78dcd6334;hb=3da5ed2598245b896255bc444aaa1768f6098cfe;hp=d0dc5a8e83e46347b4e22bd31b66d4f3a05b4ffc;hpb=2a78dbfb4ad9fbf9dbc46a11e737ef5ba75d205e;p=libfirm diff --git a/ir/ana/rta.c b/ir/ana/rta.c index d0dc5a8e8..ed9d8eb23 100644 --- a/ir/ana/rta.c +++ b/ir/ana/rta.c @@ -56,19 +56,6 @@ static eset *_live_classes = NULL; /* cache computed results */ static eset *_live_graphs = NULL; -/** - * Given a method, find the firm graph that implements that method. - */ -static ir_graph *get_implementing_graph(ir_entity *method) -{ - ir_graph *graph = NULL; - - if (get_entity_peculiarity(method) != peculiarity_description) - graph = get_entity_irg(get_SymConst_entity(get_atomic_ent_value(method))); - - return graph; -} - /** * Add a graph to the set of live graphs. * @@ -120,7 +107,7 @@ static int add_implementing_graphs(ir_entity *method) int change = FALSE; if (NULL == graph) - graph = get_implementing_graph(method); + graph = get_entity_irg(method); DB((dbg, LEVEL_2, "RTA: new call to %+F\n", method)); @@ -170,11 +157,6 @@ static void rta_act(ir_node *node, void *env) } else { /* it's an external allocated thing. */ } - } else if (get_SymConst_kind(ptr) == symconst_addr_name) { - /* Entities of kind addr_name may not be allocated in this compilation unit. - If so, the frontend built faulty Firm. So just ignore. */ - /* if (get_SymConst_name(ptr) != new_id_from_str("iro_Catch")) - assert(ent && "couldn't determine entity of call to SymConst of kind addr_name."); */ } else { /* other symconst. */ panic("This SymConst can not be an address for a method call."); @@ -223,9 +205,10 @@ static int rta_fill_incremental(void) for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph *graph = get_irp_irg(i); ir_entity *ent = get_irg_entity(graph); + ir_linkage linkage = get_entity_linkage(ent); - if ((visibility_external_visible == get_entity_visibility(ent)) || - (stickyness_sticky == get_entity_stickyness(ent))) { + if (entity_is_externally_visible(ent) + || (linkage & IR_LINKAGE_HIDDEN_USER)) { eset_insert(_live_graphs, graph); } } @@ -260,6 +243,7 @@ static int rta_fill_incremental(void) return n_runs; } +#ifdef DEBUG_libfirm /** * Count the number of graphs that we have found to be live. */ @@ -277,6 +261,7 @@ static int stats(void) return n_live_graphs; } +#endif /* remove a graph, part I */ /* @@ -372,16 +357,16 @@ void rta_init(void) * Changes the peculiarity of entities that represents * dead graphs to peculiarity_description. */ -static void make_entity_to_description(type_or_ent tore, void *env) { +static void make_entity_to_description(type_or_ent tore, void *env) +{ (void) env; if (is_entity(tore.ent)) { ir_entity *ent = tore.ent; - if ((is_Method_type(get_entity_type(ent))) && - (get_entity_peculiarity(ent) != peculiarity_description) && - (get_entity_visibility(ent) != visibility_external_allocated) ) { - ir_graph *irg = get_entity_irg(get_SymConst_entity(get_atomic_ent_value(ent))); - if (! eset_contains(_live_graphs, irg)) { + if ((is_Method_type(get_entity_type(ent))) && + !entity_is_externally_visible(ent)) { + ir_graph *irg = get_entity_irg(ent); + if (irg != NULL && ! eset_contains(_live_graphs, irg)) { set_entity_peculiarity(ent, peculiarity_description); set_entity_irg(ent, NULL); } @@ -408,10 +393,6 @@ void rta_delete_dead_graphs(void) irg = get_irp_irg(i); if (! rta_is_alive_graph(irg)) { -#ifndef NDEBUG - ir_entity *ent = get_irg_entity(irg); - assert(visibility_external_visible != get_entity_visibility(ent)); -#endif set_irg_link(irg, dead_irgs); dead_irgs = irg; ++n_dead_irgs;