introduce versioning magic into auto* build
[libfirm] / ir / ir / irphase.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
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 $
25  */
26 #ifndef FIRM_IR_PHASE_H
27 #define FIRM_IR_PHASE_H
28
29 #include "firm_types.h"
30
31 typedef struct ir_phase ir_phase;
32 typedef void *(phase_irn_init)(ir_phase *phase, const ir_node *irn, void *old);
33
34 /**
35  * Allocate and initialize a new phase object
36  *
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.
41  */
42 ir_phase *new_phase(ir_graph *irg, phase_irn_init *data_init);
43
44 /**
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)
48  */
49 void phase_init(ir_phase *phase, ir_graph *irg, phase_irn_init *data_init);
50
51 /**
52  * frees all internal memory used by the phase but does not free the
53  * phase struct itself.
54  */
55 void phase_deinit(ir_phase *phase);
56
57 /**
58  * free memory allocated by a phase
59  */
60 void phase_free(ir_phase *phase);
61
62 /**
63  * Re-initialize the irn data for all nodes in the node => data map using the given callback.
64  *
65  * @param phase  The phase.
66  */
67 void phase_reinit_irn_data(ir_phase *phase);
68
69 /**
70  * Re-initialize the irn data for all nodes having phase data in the given block.
71  *
72  * @param phase  The phase.
73  * @param block  The block.
74  *
75  * @note Beware: iterates over all nodes in the graph to find the nodes of the given block.
76  */
77 void phase_reinit_block_irn_data(ir_phase *phase, ir_node *block);
78
79 /**
80  * A default node initializer.
81  * It does nothing and returns NULL.
82  */
83 extern phase_irn_init phase_irn_init_default;
84
85 #endif