remove license stuff from files
[libfirm] / include / libfirm / heights.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief   Compute heights of nodes inside basic blocks
9  * @author  Sebastian Hack
10  * @date    19.04.2006
11  */
12 #ifndef FIRM_ANA_HEIGHTS_H
13 #define FIRM_ANA_HEIGHTS_H
14
15 #include "firm_types.h"
16 #include "begin.h"
17
18 /**
19  * @ingroup irana
20  * @defgroup ir_heights  Node Heights
21  *
22  * The height is a measure for the longest datadependencies path from a node to
23  * the end of a basic block. This is usefull for scheduling heuristics and can
24  * also be used to speedup reachability queries.
25  *
26  * @{
27  */
28
29 /**
30  * Returns the height of a node inside a basic block.
31  * The height of the node is the maximal number of edges between a sink node in
32  * that block and the node itself (plus 1).
33  * @param h    The heights object.
34  * @param irn  The node.
35  * @return     The height of the node.
36  */
37 FIRM_API unsigned get_irn_height(const ir_heights_t *h, const ir_node *irn);
38
39 /**
40  * Checks if a certain node is reachable according to data dependence edges
41  * from another node. Both nodes must be in the same block.
42  * @param h The heights object.
43  * @param n The first node.
44  * @param m The other node.
45  * @return  1, if n is data dependent on m, 0 if not.
46  */
47 FIRM_API int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
48                                         const ir_node *m);
49
50 /**
51  * Recomputes the height information for a certain block.
52  * This can be used to recompute the height information of a block.
53  * @param h     The heights object.
54  * @param block The block
55  * @return The maximum over all heights in the block.
56  */
57 FIRM_API unsigned heights_recompute_block(ir_heights_t *h, ir_node *block);
58
59 /**
60  * Creates a new heights object. This also computes the heights for each block
61  * in the graph.
62  * @param irg The graph.
63  */
64 FIRM_API ir_heights_t *heights_new(ir_graph *irg);
65
66 /**
67  * Frees a heights object.
68  * @param h The heights object.
69  */
70 FIRM_API void heights_free(ir_heights_t *h);
71
72 /** @} */
73
74 #include "end.h"
75
76 #endif