added new licence header
[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  * Project:     libFIRM
22  * File name:   ir/st/st.h
23  * Purpose:     Provide some auxilliary structures for firm graphs.
24  * Author:      Florian Liekweg
25  * Modified by:
26  * Created:     26.2.2002
27  * CVS-ID:      $Id$
28  * Copyright:   (c) 2002-2003 Universität Karlsruhe
29  */
30 /**
31    @file st.h
32
33    Provide some auxilliary structures for firm graphs.
34
35    @author Florian Liekweg
36
37    @note
38      not quite complete
39 */
40
41 # ifndef _ST_H_
42 # define _ST_H_
43
44 /* Includes:  */
45 #include "irgraph.h"
46 #include "irnode.h"
47
48 #include "bs.h"
49
50 #include <stdbool.h>
51
52
53 /* Data Types: */
54
55 /**  One dominator tree */
56 typedef struct
57 {
58   int n_blocks;
59   ir_graph *graph;      /**< PRE */
60   ir_node **blocks;
61   ir_node **idoms;      /**< idom [n] == immediate dominator of blocks [n] */
62   bs_t *masks;
63 }
64 dt_t;
65
66 /** List entry.  */
67 typedef struct dtree_t
68 {
69   dt_t *tree;
70   ir_graph *graph;
71
72   struct dtree_t *next;
73 }
74 dtree_t;
75
76 /** dominator environment for a node dom_env_t::a in graph dom_env_t::graph */
77 typedef struct dom_env_t
78 {
79   dt_t     *dt;
80   ir_graph *graph;
81   ir_node  *a;
82   int       index_a;
83   bs_t      mask;
84 } dom_env_t;
85
86 /* Forwards for Globals:  */
87 extern dtree_t *trees;
88 extern dtree_t *last;
89
90 /* Prototypes: */
91 void     st_build_dominator_tree (ir_graph*);
92 bool     dominates            (ir_graph*, ir_node*, ir_node*);
93 ir_node *get_idom             (ir_graph*, ir_node*);
94
95 dom_env_t *get_dom_env (ir_graph*, ir_node*);
96 void delete_dom_env (dom_env_t*);
97 bool dominates_l (dom_env_t*, ir_node*);
98
99 # endif /* defined _ST_H_ */