Bugfix in irdom.
[libfirm] / ir / ana / irdom.h
1 /* Copyright (C) 2002 by Universitaet Karlsruhe
2 ** All rights reserved.
3 **
4 ** Authors: Goetz Lindenmaier
5 **
6 ** irdom.h:  This file contains routines to construct and access dominator
7 **   information.
8 **   The dominator information is stored in three fields of block nodes:
9 **     idom: a reference to the block that is the immediate dominator of
10 **       this block.
11 **     dom_depth: a number giving the depth of the block in the dominator
12 **       tree.
13 **     pre_num:  Number in preorder traversal.
14 */
15
16 /* $Id$ */
17
18 # ifndef _IRDOM_H_
19 # define _IRDOM_H_
20
21 # include "irgraph.h"
22 # include "irnode.h"
23
24
25 /**********************************************************************/
26 /** Accessing the dopminator datastructure.                          **/
27 /** These routines only work properly if the ir_graph is in state    **/
28 /** outs_consistent or outs_inconsistent.                            **/
29 /**********************************************************************/
30
31 ir_node *get_Block_idom(ir_node *bl);
32 void set_Block_idom(ir_node *bl, ir_node *n);
33
34 int get_Block_dom_depth(ir_node *bl);
35 void set_Block_dom_depth(ir_node *bl, int depth);
36
37 int get_Block_pre_num(ir_node *bl);
38 void set_Block_pre_num(ir_node *bl, int num);
39
40
41 /**********************************************************************/
42 /* Building and Removing the dominator datasturcture                 **/
43 /**********************************************************************/
44
45 /* Computes the dominator trees.  Sets a flag in irg to "dom_consistent".
46    If the control flow of the graph is changed this flag must be set to
47    "dom_inconsistent".
48    Does not compute dominator information for control dead code.  Blocks
49    not reachable from Start contain the following information:
50      idom = NULL;
51      dom_depth = -1;
52      pre_num = -1; */
53 void compute_doms(ir_graph *irg);
54
55 /* Frees the dominator datastructures.  Sets the flag in irg to "no_dom". */
56 void free_dom_and_peace(ir_graph *irg);
57
58 #endif /* _IRDOM_H_ */