X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firphase.h;h=965d9c710300b258805b8bdff66d79fc11db7e30;hb=4f92e524762e0febc361676111b3b5b79addd03a;hp=715d0b976c54ae24874a59d215270d939bc7e74b;hpb=863d31d7a5c8210432fef88b30fc3e8353131538;p=libfirm diff --git a/ir/ir/irphase.h b/ir/ir/irphase.h index 715d0b976..965d9c710 100644 --- a/ir/ir/irphase.h +++ b/ir/ir/irphase.h @@ -1,18 +1,82 @@ /* - * Project: libFIRM - * File name: ir/ir/irphase.h - * 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-2008 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. */ -#ifndef _FIRM_IR_PHASE_H -#define _FIRM_IR_PHASE_H +/** + * @file + * @brief Phase information handling using node indexes. + * @author Sebastian Hack + * @version $Id: irphase_t.h 27270 2010-03-07 22:20:43Z matze $ + */ +#ifndef FIRM_IR_PHASE_H +#define FIRM_IR_PHASE_H + +#include "firm_types.h" + +typedef struct ir_phase ir_phase; +typedef void *(phase_irn_init)(ir_phase *phase, const ir_node *irn); +typedef void *(phase_irn_reinit)(ir_phase *phase, const ir_node *irn, + void *old_data); + +/** + * Allocate and initialize a new phase object + * + * @param irg The graph the phase will run on. + * @param irn_data_init A callback that is called to initialize newly created + * node data. Must be non-null. You could use + * phase_irn_init_default + * @return A new phase object. + */ +ir_phase *new_phase(ir_graph *irg, phase_irn_init *data_init); + +/** + * Variant for custom memory-management/classes. Just initialize given phase + * structure (performs no allocation, you do not need to call this for phases + * allocated with new_phase) + */ +void phase_init(ir_phase *phase, ir_graph *irg, phase_irn_init *data_init); -typedef struct _phase_t phase_t; +/** + * frees all internal memory used by the phase but does not free the + * phase struct itself. + */ +void phase_deinit(ir_phase *phase); + +/** + * free memory allocated by a phase + */ +void phase_free(ir_phase *phase); + +/** + * Re-initialize the irn data for all nodes in the node => data map using the + * given callback. + * This is mainly used for reusing already allocated memory which could speed + * things up a little bit. + * + * @param phase The phase. + * @param called to reinitialize phase data. + */ +void phase_reinit_irn_data(ir_phase *phase, phase_irn_reinit *data_reinit); + +/** + * A default node initializer. + * It does nothing and returns NULL. + */ +extern phase_irn_init phase_irn_init_default; -#endif /* _FIRM_IR_PHASE_H */ +#endif