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
26 #ifndef FIRM_ANA_HEIGHTS_H
27 #define FIRM_ANA_HEIGHTS_H
29 #include "firm_types.h"
34 * @defgroup ir_heights Node Heights
36 * The height is a measure for the longest datadependencies path from a node to
37 * the end of a basic block. This is usefull for scheduling heuristics and can
38 * also be used to speedup reachability queries.
44 * Returns the height of a node inside a basic block.
45 * The height of the node is the maximal number of edges between a sink node in
46 * that block and the node itself (plus 1).
47 * @param h The heights object.
48 * @param irn The node.
49 * @return The height of the node.
51 FIRM_API unsigned get_irn_height(const ir_heights_t *h, const ir_node *irn);
54 * Checks if a certain node is reachable according to data dependence edges
55 * from another node. Both nodes must be in the same block.
56 * @param h The heights object.
57 * @param n The first node.
58 * @param m The other node.
59 * @return 1, if n is data dependent on m, 0 if not.
61 FIRM_API int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
65 * Recomputes the height information for a certain block.
66 * This can be used to recompute the height information of a block.
67 * @param h The heights object.
68 * @param block The block
69 * @return The maximum over all heights in the block.
71 FIRM_API unsigned heights_recompute_block(ir_heights_t *h, ir_node *block);
74 * Creates a new heights object. This also computes the heights for each block
76 * @param irg The graph.
78 FIRM_API ir_heights_t *heights_new(ir_graph *irg);
81 * Frees a heights object.
82 * @param h The heights object.
84 FIRM_API void heights_free(ir_heights_t *h);