2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Compute heights of nodes inside basic blocks
23 * @author Sebastian Hack
27 #ifndef FIRM_ANA_HEIGHTS_H
28 #define FIRM_ANA_HEIGHTS_H
30 #include "firm_types.h"
32 typedef struct _heights_t heights_t;
35 * Get the height of a node inside a basic block.
36 * The height of the node is the maximal number of edges between a sink node in that block and the node itself (plus 1).
37 * @param h The heights object.
38 * @param irn The node.
39 * @return The height of the node.
41 unsigned get_irn_height(heights_t *h, const ir_node *irn);
44 * Check, if a certain node is reachable according to data dependence edges from another node.
45 * @param h The heights object.
46 * @param n The first node.
47 * @param m The other node.
48 * @return 1, if n is data dependent on m, 0 if not.
50 int heights_reachable_in_block(heights_t *h, const ir_node *n, const ir_node *m);
53 * Recompute the height information.
54 * This can be used to recompute the height information if the graph has changed since the last computation.
55 * @param h The heights object.
57 void heights_recompute(heights_t *h);
60 * Recompute the height information for a certain block.
61 * This can be used to recompute the height information of a block.
62 * @param h The heights object.
63 * @param block The block
64 * @return The maximum over all heights in the block.
66 unsigned heights_recompute_block(heights_t *h, ir_node *block);
69 * Make a new heights object.
70 * This also computes the heights for each block in the graph.
71 * @param irg The graph.
73 heights_t *heights_new(ir_graph *irg);
76 * Free a heights object.
77 * @param h The heights object.
79 void heights_free(heights_t *h);
82 #endif /* FIRM_ANA_HEIGHTS_H */