X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Fircgopt.c;h=da2b33efc8e9a0f7aec6b33850165f383c7a284e;hb=eda9d668d0e8c8246015b4c5e743316a6a835a23;hp=ac84200f57fb6e4f677d159af87a1cfba7dffc66;hpb=478fdb370b1098bd2efcbb964d60e9fcbeb5d205;p=libfirm diff --git a/ir/ir/ircgopt.c b/ir/ir/ircgopt.c index ac84200f5..da2b33efc 100644 --- a/ir/ir/ircgopt.c +++ b/ir/ir/ircgopt.c @@ -1,16 +1,31 @@ /* - * Project: libFIRM - * File name: ir/ir/ircgopt.c - * Purpose: Removal of unreachable methods. - * Author: Hubert Schmid - * Modified by: - * Created: 09.06.2002 - * CVS-ID: $Id$ - * Copyright: (c) 2002-2003 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. */ /** + * @file + * @brief Removal of unreachable methods. + * @author Hubert Schmid + * @date 09.06.2002 + * @version $Id$ + */ + +/* * Entfernen von nicht erreichbaren (aufrufbaren) Methoden. Die Menge * der nicht erreichbaren Methoden wird aus der Abschätzung der * Aufrufrelation bestimmt. @@ -44,12 +59,12 @@ static void collect_call(ir_node * node, void *env) { static void make_entity_to_description(type_or_ent *tore, void *env) { if (get_kind(tore) == k_entity) { - entity *ent = (entity *)tore; + ir_entity *ent = (ir_entity *)tore; if ((is_Method_type(get_entity_type(ent))) && (get_entity_peculiarity(ent) != peculiarity_description) && (get_entity_visibility(ent) != visibility_external_allocated) ) { - entity *impl = get_SymConst_entity(get_atomic_ent_value(ent)); + ir_entity *impl = get_SymConst_entity(get_atomic_ent_value(ent)); if (get_entity_link(impl) != env) { set_entity_peculiarity(ent, peculiarity_description); } @@ -58,7 +73,7 @@ static void make_entity_to_description(type_or_ent *tore, void *env) { } /* garbage collect methods: mark and remove */ -void gc_irgs(int n_keep, entity ** keep_arr) { +void gc_irgs(int n_keep, ir_entity ** keep_arr) { void * MARK = &MARK; /* @@@ gefaehrlich!!! Aber wir markieren hoechstens zu viele ... */ int i; @@ -71,7 +86,7 @@ void gc_irgs(int n_keep, entity ** keep_arr) { /* Mark entities that are alive. */ if (n_keep > 0) { - entity ** marked = NEW_ARR_F(entity *, n_keep); + ir_entity ** marked = NEW_ARR_F(ir_entity *, n_keep); for (i = 0; i < n_keep; ++i) { marked[i] = keep_arr[i]; set_entity_link(marked[i], MARK); @@ -95,11 +110,11 @@ void gc_irgs(int n_keep, entity ** keep_arr) { assert(get_irn_op(node) == op_Call); for (i = get_Call_n_callees(node) - 1; i >= 0; --i) { - entity * ent = get_Call_callee(node, i); + ir_entity * ent = get_Call_callee(node, i); if (get_entity_irg(ent) && get_entity_link(ent) != MARK) { set_entity_link(ent, MARK); - ARR_APP1(entity *, marked, ent); + ARR_APP1(ir_entity *, marked, ent); if (get_opt_dead_method_elimination_verbose() && get_firm_verbosity() > 2) { printf("dead method elimination: method %s can be called from Call %ld: kept alive.\n", get_entity_ld_name(ent), get_irn_node_nr(node)); @@ -116,7 +131,7 @@ void gc_irgs(int n_keep, entity ** keep_arr) { type_walk(make_entity_to_description, NULL, MARK); for (i = get_irp_n_irgs() - 1; i >= 0; --i) { ir_graph * irg = get_irp_irg(i); - entity * ent = get_irg_entity(irg); + ir_entity * ent = get_irg_entity(irg); /* Removing any graph invalidates all interprocedural loop trees. */ if (get_irg_loopinfo_state(irg) == loopinfo_ip_consistent || get_irg_loopinfo_state(irg) == loopinfo_ip_inconsistent) {