2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Phase information handling using node indexes.
23 * @author Sebastian Hack
24 * @version $Id: irphase_t.h 27270 2010-03-07 22:20:43Z matze $
26 #ifndef FIRM_IR_PHASE_H
27 #define FIRM_IR_PHASE_H
29 #include "firm_types.h"
31 typedef struct ir_phase ir_phase;
32 typedef void *(phase_irn_init)(ir_phase *phase, const ir_node *irn);
33 typedef void *(phase_irn_reinit)(ir_phase *phase, const ir_node *irn,
37 * Allocate and initialize a new phase object
39 * @param irg The graph the phase will run on.
40 * @param irn_data_init A callback that is called to initialize newly created
41 * node data. Must be non-null. You could use
42 * phase_irn_init_default
43 * @return A new phase object.
45 ir_phase *new_phase(ir_graph *irg, phase_irn_init *data_init);
48 * Variant for custom memory-management/classes. Just initialize given phase
49 * structure (performs no allocation, you do not need to call this for phases
50 * allocated with new_phase)
52 void phase_init(ir_phase *phase, ir_graph *irg, phase_irn_init *data_init);
55 * frees all internal memory used by the phase but does not free the
56 * phase struct itself.
58 void phase_deinit(ir_phase *phase);
61 * free memory allocated by a phase
63 void phase_free(ir_phase *phase);
66 * Re-initialize the irn data for all nodes in the node => data map using the
68 * This is mainly used for reusing already allocated memory which could speed
69 * things up a little bit.
71 * @param phase The phase.
72 * @param called to reinitialize phase data.
74 void phase_reinit_irn_data(ir_phase *phase, phase_irn_reinit *data_reinit);
77 * A default node initializer.
78 * It does nothing and returns NULL.
80 extern phase_irn_init phase_irn_init_default;