verify that all blocks can be found by walk_block_graph
[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);
33 typedef void *(phase_irn_reinit)(ir_phase *phase, const ir_node *irn,
34                                  void *old_data);
35
36 /**
37  * Allocate and initialize a new phase object
38  *
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.
44  */
45 ir_phase *new_phase(ir_graph *irg, phase_irn_init *data_init);
46
47 /**
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)
51  */
52 void phase_init(ir_phase *phase, ir_graph *irg, phase_irn_init *data_init);
53
54 /**
55  * frees all internal memory used by the phase but does not free the
56  * phase struct itself.
57  */
58 void phase_deinit(ir_phase *phase);
59
60 /**
61  * free memory allocated by a phase
62  */
63 void phase_free(ir_phase *phase);
64
65 /**
66  * Re-initialize the irn data for all nodes in the node => data map using the
67  * given callback.
68  * This is mainly used for reusing already allocated memory which could speed
69  * things up a little bit.
70  *
71  * @param phase   The phase.
72  * @param called  to reinitialize phase data.
73  */
74 void phase_reinit_irn_data(ir_phase *phase, phase_irn_reinit *data_reinit);
75
76 /**
77  * A default node initializer.
78  * It does nothing and returns NULL.
79  */
80 extern phase_irn_init phase_irn_init_default;
81
82 #endif