fix
[libfirm] / ir / st / st.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief     Provide some auxilliary structures for firm graphs.
23  * @author    Florian Liekweg
24  * @date      26.2.2002
25  * @version   $Id$
26  * @note      not quite complete
27  */
28 #ifndef FIRM_ST_ST_H
29 #define FIRM_ST_ST_H
30
31 /* Includes:  */
32 #include "irgraph.h"
33 #include "irnode.h"
34
35 #include "bs.h"
36
37 #include <stdbool.h>
38
39
40 /* Data Types: */
41
42 /**  One dominator tree */
43 typedef struct
44 {
45   int n_blocks;
46   ir_graph *graph;      /**< PRE */
47   ir_node **blocks;
48   ir_node **idoms;      /**< idom [n] == immediate dominator of blocks [n] */
49   bs_t *masks;
50 }
51 dt_t;
52
53 /** List entry.  */
54 typedef struct dtree_t
55 {
56   dt_t *tree;
57   ir_graph *graph;
58
59   struct dtree_t *next;
60 }
61 dtree_t;
62
63 /** dominator environment for a node dom_env_t::a in graph dom_env_t::graph */
64 typedef struct dom_env_t
65 {
66   dt_t     *dt;
67   ir_graph *graph;
68   ir_node  *a;
69   int       index_a;
70   bs_t      mask;
71 } dom_env_t;
72
73 /* Forwards for Globals:  */
74 extern dtree_t *trees;
75 extern dtree_t *last;
76
77 /* Prototypes: */
78 void     st_build_dominator_tree (ir_graph*);
79 bool     dominates            (ir_graph*, ir_node*, ir_node*);
80 ir_node *get_idom             (ir_graph*, ir_node*);
81
82 dom_env_t *get_dom_env (ir_graph*, ir_node*);
83 void delete_dom_env (dom_env_t*);
84 bool dominates_l (dom_env_t*, ir_node*);
85
86 #endif