added license infos
[libfirm] / ir / ana / height.h
1 /*
2  * Copyrigth (C) 1995-2007 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    Compute heights of nodes inside basic blocks
23  * @author   Sebastian Hack
24  * @date     19.04.2006
25  * @version  $Id$
26  */
27 #ifndef _FIRM_HEIGHTS_H
28 #define _FIRM_HEIGHTS_H
29
30 typedef struct _heights_t heights_t;
31
32 /**
33  * Get the height of a node inside a basic block.
34  * The height of the node is the maximal number of edges between a sink node in that block and the node itself (plus 1).
35  * @param h    The heights object.
36  * @param irn  The node.
37  * @return     The height of the node.
38  */
39 unsigned get_irn_height(heights_t *h, const ir_node *irn);
40
41 /**
42  * Check, if a certain node is reachable according to data dependence edges from another node.
43  * @param h The heights object.
44  * @param n The first node.
45  * @param m The other node.
46  * @return  1, if n is data dependent on m, 0 if not.
47  */
48 int heights_reachable_in_block(heights_t *h, const ir_node *n, const ir_node *m);
49
50 /**
51  * Recompute the height information.
52  * This can be used to recompute the height information if the graph has changed since the last computation.
53  * @param h The heights object.
54  */
55 void heights_recompute(heights_t *h);
56
57 /**
58  * Recompute the height information for a certain block.
59  * This can be used to recompute the height information of a block.
60  * @param h     The heights object.
61  * @param block The block
62  * @return The maximum over all heights in the block.
63  */
64 unsigned heights_recompute_block(heights_t *h, ir_node *block);
65
66 /**
67  * Make a new heights object.
68  * This also computes the heights for each block in the graph.
69  * @param irg The graph.
70  */
71 heights_t *heights_new(ir_graph *irg);
72
73 /**
74  * Free a heights object.
75  * @param h The heights object.
76  */
77 void heights_free(heights_t *h);
78
79
80 #endif /* _FIRM_HEIGHTS_H */