X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fgarbage_collect.c;h=4892264a86a773af53a0e10a5147fbba2f800c57;hb=6be797281b157f8f71b9c47d28b3d09f2a7918cc;hp=64c0a67cc61ccd9e1bd1b719d1229f64cabba99d;hpb=1a3b7d363474ab544c13093a2f0b578718d37c7a;p=libfirm diff --git a/ir/opt/garbage_collect.c b/ir/opt/garbage_collect.c index 64c0a67cc..4892264a8 100644 --- a/ir/opt/garbage_collect.c +++ b/ir/opt/garbage_collect.c @@ -21,7 +21,6 @@ * @file * @brief Removal of unreachable methods. * @author Matthias Braun - * @version $Id$ */ #include "config.h" @@ -36,7 +35,7 @@ #include "error.h" #include "debug.h" -DEBUG_ONLY(static firm_dbg_module_t *dbg); +DEBUG_ONLY(static firm_dbg_module_t *dbg;) static void visit_entity(ir_entity *entity); @@ -101,13 +100,6 @@ static void visit_entity(ir_entity *entity) if (entity->initializer != NULL) { visit_initializer(entity->initializer); - } else if (entity_has_compound_ent_values(entity)) { - size_t i; - size_t n_members = get_compound_ent_n_values(entity); - for (i = 0; i < n_members; ++i) { - ir_node *node = get_compound_ent_value(entity, i); - start_visit_node(node); - } } irg = get_entity_irg(entity); @@ -123,8 +115,9 @@ static void visit_segment(ir_type *segment) for (i = 0; i < n_entities; ++i) { ir_entity *entity = get_compound_member(segment, i); - if (get_entity_visibility(entity) != ir_visibility_default - && !(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER)) + if (get_entity_visibility(entity) != ir_visibility_external + && !(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER) + && !(get_entity_linkage(entity) & IR_LINKAGE_NO_CODEGEN)) continue; visit_entity(entity); @@ -155,7 +148,7 @@ void garbage_collect_entities(void) FIRM_DBG_REGISTER(dbg, "firm.opt.garbagecollect"); /* start a type walk for all externally visible entities */ - irp_reserve_resources(irp, IR_RESOURCE_TYPE_VISITED); + irp_reserve_resources(irp, IRP_RESOURCE_TYPE_VISITED); inc_master_type_visited(); inc_max_irg_visited(); @@ -167,8 +160,8 @@ void garbage_collect_entities(void) } /* remove graphs of non-visited functions - * (we have to count backwards so we can safely call remove_irp_irg - * while iterating) */ + * (we have to count backwards, because freeing the graph moves the last + * graph in the list to the free position) */ for (i = get_irp_n_irgs(); i > 0;) { ir_graph *irg = get_irp_irg(--i); ir_entity *entity = get_irg_entity(irg); @@ -177,7 +170,7 @@ void garbage_collect_entities(void) continue; DB((dbg, LEVEL_1, " freeing method %+F\n", entity)); - remove_irp_irg(irg); + free_ir_graph(irg); } /* we can now remove all non-visited (global) entities */ @@ -185,7 +178,7 @@ void garbage_collect_entities(void) ir_type *type = get_segment_type(s); garbage_collect_in_segment(type); } - irp_free_resources(irp, IR_RESOURCE_TYPE_VISITED); + irp_free_resources(irp, IRP_RESOURCE_TYPE_VISITED); } ir_prog_pass_t *garbage_collect_entities_pass(const char *name)