3 * File name: ir/ana/irdom.h
4 * Purpose: Construct and access dominator tree.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2002-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * This file contains routines to construct and access dominator information.
18 * The dominator information is stored in three fields of block nodes:
19 * - idom: a reference to the block that is the immediate dominator of
21 * - dom_depth: a number giving the depth of the block in the dominator
23 * - pre_num: Number in preorder traversal.
25 * @author Goetz Lindenmaier
36 /** Accessing the dominator datastructure.
38 * These routines only work properly if the ir_graph is in state
39 * dom_consistent or dom_inconsistent.
41 * If the block is not reachable from Start, returns a Bad node.
43 ir_node *get_Block_idom(ir_node *bl);
44 void set_Block_idom(ir_node *bl, ir_node *n);
46 int get_Block_dom_depth(ir_node *bl);
47 void set_Block_dom_depth(ir_node *bl, int depth);
49 int get_Block_pre_num(ir_node *bl);
50 void set_Block_pre_num(ir_node *bl, int num);
53 /* ------------ Building and Removing the dominator datasturcture ----------- */
55 /** Computes the dominator trees.
57 * Sets a flag in irg to "dom_consistent".
58 * If the control flow of the graph is changed this flag must be set to
60 * Does not compute dominator information for control dead code. Blocks
61 * not reachable from Start contain the following information:
65 * Also constructs outs information. As this information is correct after
66 * the run does not free the outs information.
68 void compute_doms(ir_graph *irg);
70 /** Frees the dominator datastructures. Sets the flag in irg to "dom_none". */
71 void free_dom_and_peace(ir_graph *irg);
73 #endif /* _IRDOM_H_ */