fixed CRLF
[libfirm] / ir / ana / height.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/height.h
4  * Purpose:     Compute heights of nodes inside basic blocks
5  * Author:      Sebastian Hack
6  * Modified by:
7  * Created:     19.04.2006
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2006 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifndef _FIRM_HEIGHTS_H
14 #define _FIRM_HEIGHTS_H
15
16 typedef struct _heights_t heights_t;
17
18 /**
19  * Get the height of a node inside a basic block.
20  * The height of the node is the maximal number of edges between a sink node in that block and the node itself (plus 1).
21  * @param h    The heights object.
22  * @param irn  The node.
23  * @return     The height of the node.
24  */
25 unsigned get_irn_height(heights_t *h, const ir_node *irn);
26
27 /**
28  * Check, if a certain node is reachable according to data dependence edges from another node.
29  * @param h The heights object.
30  * @param n The first node.
31  * @param m The other node.
32  * @return  1, if n is data dependent on m, 0 if not.
33  */
34 int heights_reachable_in_block(heights_t *h, const ir_node *n, const ir_node *m);
35
36 /**
37  * Recompute the height information.
38  * This can be used to recompute the height information if the graph has changed since the last computation.
39  * @param h The heights object.
40  */
41 void heights_recompute(heights_t *h);
42
43 /**
44  * Recompute the height information for a certain block.
45  * This can be used to recompute the height information of a block.
46  * @param h     The heights object.
47  * @param block The block
48  * @return The maximum over all heights in the block.
49  */
50 unsigned heights_recompute_block(heights_t *h, ir_node *block);
51
52 /**
53  * Make a new heights object.
54  * This also computes the heights for each block in the graph.
55  * @param irg The graph.
56  */
57 heights_t *heights_new(ir_graph *irg);
58
59 /**
60  * Free a heights object.
61  * @param h The heights object.
62  */
63 void heights_free(heights_t *h);
64
65
66 #endif /* _FIRM_HEIGHTS_H */