2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Compute heights of nodes inside basic blocks
9 * @author Sebastian Hack
12 #ifndef FIRM_ANA_HEIGHTS_H
13 #define FIRM_ANA_HEIGHTS_H
15 #include "firm_types.h"
20 * @defgroup ir_heights Node Heights
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.
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.
37 FIRM_API unsigned get_irn_height(const ir_heights_t *h, const ir_node *irn);
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.
47 FIRM_API int heights_reachable_in_block(ir_heights_t *h, const ir_node *n,
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.
57 FIRM_API unsigned heights_recompute_block(ir_heights_t *h, ir_node *block);
60 * Creates a new heights object. This also computes the heights for each block
62 * @param irg The graph.
64 FIRM_API ir_heights_t *heights_new(ir_graph *irg);
67 * Frees a heights object.
68 * @param h The heights object.
70 FIRM_API void heights_free(ir_heights_t *h);