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, void *old);
35 * Allocate and initialize a new phase object
37 * @param irg The graph the phase will run on.
38 * @param irn_data_init A callback that is called to initialize newly created
39 * node data. Must be non-null. You could use
40 * @return A new phase object.
42 ir_phase *new_phase(ir_graph *irg, phase_irn_init *data_init);
45 * Variant for custom memory-management/classes. Just initialize given phase
46 * structure (performs no allocation, you do not need to call this for phases
47 * allocated wiht new_phase)
49 void phase_init(ir_phase *phase, ir_graph *irg, phase_irn_init *data_init);
52 * frees all internal memory used by the phase but does not free the
53 * phase struct itself.
55 void phase_deinit(ir_phase *phase);
58 * free memory allocated by a phase
60 void phase_free(ir_phase *phase);
63 * Re-initialize the irn data for all nodes in the node => data map using the given callback.
65 * @param phase The phase.
67 void phase_reinit_irn_data(ir_phase *phase);
70 * Re-initialize the irn data for all nodes having phase data in the given block.
72 * @param phase The phase.
73 * @param block The block.
75 * @note Beware: iterates over all nodes in the graph to find the nodes of the given block.
77 void phase_reinit_block_irn_data(ir_phase *phase, ir_node *block);
80 * A default node initializer.
81 * It does nothing and returns NULL.
83 extern phase_irn_init phase_irn_init_default;