X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firphase.c;h=f041a4747f86b93110e52ed4f4fa60a40d624dc1;hb=d566f952dd686c0afda6d9e4cd967c5c67651d9c;hp=60a8ecf2dd68da9fc5d532d67f8eca854e9233a3;hpb=863d31d7a5c8210432fef88b30fc3e8353131538;p=libfirm diff --git a/ir/ir/irphase.c b/ir/ir/irphase.c index 60a8ecf2d..f041a4747 100644 --- a/ir/ir/irphase.c +++ b/ir/ir/irphase.c @@ -1,15 +1,31 @@ /* - * Project: libFIRM - * File name: ir/ir/irphase.c - * Purpose: Phase information handling using node indexes. - * Author: Sebastian Hack - * Modified by: - * Created: - * CVS-ID: $Id$ - * Copyright: (c) 1998-2006 Universitaet 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 Phase information handling using node indexes. + * @author Sebastian Hack + * @version $Id$ + * @summary + * A phase contains a link to private data for each node in an ir graph. + * A phase is independent from the globally visible link field of ir nodes. + */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -18,7 +34,7 @@ #include "irnode_t.h" #include "irphase_t.h" -phase_t *phase_init(phase_t *ph, const char *name, ir_graph *irg, unsigned growth_factor, phase_irn_data_init_t *data_init) +ir_phase *phase_init(ir_phase *ph, const char *name, ir_graph *irg, unsigned growth_factor, phase_irn_data_init_t *data_init, void *priv) { assert(growth_factor >= 256 && "growth factor must greater or equal to 256/256"); assert(data_init && "You must provide a data constructor"); @@ -31,18 +47,19 @@ phase_t *phase_init(phase_t *ph, const char *name, ir_graph *irg, unsigned growt ph->irg = irg; ph->n_data_ptr = 0; ph->data_ptr = NULL; + ph->priv = priv; return ph; } -void phase_free(phase_t *phase) +void phase_free(ir_phase *phase) { obstack_free(&phase->obst, NULL); if(phase->data_ptr) xfree(phase->data_ptr); } -phase_stat_t *phase_stat(const phase_t *phase, phase_stat_t *stat) +phase_stat_t *phase_stat(const ir_phase *phase, phase_stat_t *stat) { int i, n; memset(stat, 0, sizeof(stat[0])); @@ -54,11 +71,11 @@ phase_stat_t *phase_stat(const phase_t *phase, phase_stat_t *stat) stat->node_slots_used++; } } - stat->overall_bytes = stat->node_map_bytes + obstack_memory_used(&((phase_t *)phase)->obst); + stat->overall_bytes = stat->node_map_bytes + obstack_memory_used(&((ir_phase *)phase)->obst); return stat; } -void phase_reinit_irn_data(phase_t *phase) +void phase_reinit_irn_data(ir_phase *phase) { int i, n; @@ -71,7 +88,7 @@ void phase_reinit_irn_data(phase_t *phase) } } -void phase_reinit_block_irn_data(phase_t *phase, ir_node *block) +void phase_reinit_block_irn_data(ir_phase *phase, ir_node *block) { int i, n; @@ -87,8 +104,8 @@ void phase_reinit_block_irn_data(phase_t *phase, ir_node *block) } } -ir_node *phase_get_first_node(phase_t *phase) { - int i; +ir_node *phase_get_first_node(const ir_phase *phase) { + unsigned i; for (i = 0; i < phase->n_data_ptr; ++i) if (phase->data_ptr[i]) @@ -97,8 +114,8 @@ ir_node *phase_get_first_node(phase_t *phase) { return NULL; } -ir_node *phase_get_next_node(phase_t *phase, ir_node *start) { - int i; +ir_node *phase_get_next_node(const ir_phase *phase, ir_node *start) { + unsigned i; for (i = get_irn_idx(start) + 1; i < phase->n_data_ptr; ++i) if (phase->data_ptr[i])