a new garbage collection pass less conservative than gc_irgs (but does not respect...
authorMatthias Braun <matze@braunis.de>
Fri, 5 Feb 2010 18:30:05 +0000 (18:30 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 5 Feb 2010 18:30:05 +0000 (18:30 +0000)
[r27056]

ast2firm.c
driver/firm_opt.c

index 32344b5..f149422 100644 (file)
@@ -5658,7 +5658,7 @@ static void add_function_pointer(ir_type *segment, ir_entity *method,
 
        set_entity_compiler_generated(ptr, 1);
        set_entity_visibility(ptr, ir_visibility_local);
-       add_entity_linkage(ptr, IR_LINKAGE_CONSTANT);
+       add_entity_linkage(ptr, IR_LINKAGE_CONSTANT|IR_LINKAGE_HIDDEN_USER);
        set_atomic_ent_value(ptr, val);
 }
 
index 3eb6a91..8b2046d 100644 (file)
@@ -200,21 +200,6 @@ static void dump_graph_count(ir_graph *const irg, const char *const suffix)
        timer_pop(t_vcg_dump);
 }
 
-static void remove_unused_functions(void)
-{
-       ir_entity **keep_methods;
-       int         arr_len;
-
-       /* Analysis that finds the free methods,
-          i.e. methods that are dereferenced.
-          Optimizes polymorphic calls :-). */
-       cgana(&arr_len, &keep_methods);
-
-       /* Remove methods that are never called. */
-       gc_irgs(arr_len, keep_methods);
-       free(keep_methods);
-}
-
 static int firm_const_exists;
 
 static void do_optimize_funccalls(void)
@@ -327,7 +312,7 @@ static opt_config_t opts[] = {
        { OPT_TARGET_IRG, "combo",           (func_ptr_t) combo,                   "combined CCE, UCE and GVN",               OPT_FLAG_NONE},
        { OPT_TARGET_IRG, "control-flow",    (func_ptr_t) optimize_cf,             "optimization of control-flow",            OPT_FLAG_HIDE_OPTIONS },
        { OPT_TARGET_IRG, "local",           (func_ptr_t) optimize_graph_df,       "local graph optimizations",               OPT_FLAG_HIDE_OPTIONS },
-       { OPT_TARGET_IRP, "remove-unused",   (func_ptr_t) remove_unused_functions, "removal of unused functions",             OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY },
+       { OPT_TARGET_IRP, "remove-unused",   (func_ptr_t) garbage_collect_entities,"removal of unused functions/variables",   OPT_FLAG_NO_DUMP | OPT_FLAG_NO_VERIFY },
        { OPT_TARGET_IRP, "opt-tail-rec",    (func_ptr_t) opt_tail_recursion,      "tail-recursion eliminiation",             OPT_FLAG_NONE },
        { OPT_TARGET_IRP, "opt-func-call",   (func_ptr_t) do_optimize_funccalls,   "function call optimization",              OPT_FLAG_NONE },
        { OPT_TARGET_IRG, "lower",           (func_ptr_t) do_lower_highlevel,      "lowering",                                OPT_FLAG_HIDE_OPTIONS | OPT_FLAG_ESSENTIAL },