remove unnecessary comments before functions
[libfirm] / ir / ana / irextbb_t.h
1 /*
2  * Copyright (C) 1995-2011 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   Extended basis block support -- private header
23  * @author  Michael Beck
24  * @date    5.2005
25  */
26 #ifndef FIRM_ANA_IREXTBB_T_H
27 #define FIRM_ANA_IREXTBB_T_H
28
29 #include "irgraph_t.h"
30 #include "irextbb.h"
31 #include "irtools.h"
32
33 /**
34  * An extended block.
35  */
36 struct ir_extblk {
37         firm_kind kind;        /**< k_ir_extblk */
38         ir_visited_t visited;  /**< visited flag */
39         ir_node  **blks;       /**< blocks belonging to this extended block */
40         void *link;            /**< private link field */
41 };
42
43 /**
44  * Checks whether a pointer points to a extended basic block.
45  * Intern version for libFirm.
46  */
47 static inline int _is_ir_extbb(const void *thing)
48 {
49         return (get_kind(thing) == k_ir_extblk);
50 }
51
52 /**
53  * Gets the visited counter of an extended block.
54  * Internal version for libFirm.
55  */
56 static inline ir_visited_t _get_extbb_visited(const ir_extblk *blk)
57 {
58         assert(blk);
59         return blk->visited;
60 }
61
62 /**
63  * Sets the visited counter of an extended block.
64  * Internal version for libFirm.
65  */
66 static inline void _set_extbb_visited(ir_extblk *blk, ir_visited_t visited)
67 {
68         assert(blk);
69         blk->visited = visited;
70 }
71
72 /**
73  * Mark an extended block as visited in a graph.
74  * Internal version for libFirm.
75  */
76 static inline void _mark_extbb_visited(ir_extblk *blk)
77 {
78         assert(blk);
79         blk->visited = current_ir_graph->block_visited;
80 }
81
82 /**
83  * Returns non-zero if an extended was visited.
84  * Internal version for libFirm.
85  */
86 static inline int _extbb_visited(const ir_extblk *blk)
87 {
88         assert(blk);
89         return blk->visited >= current_ir_graph->block_visited;
90 }
91
92 /**
93  * Returns non-zero if an extended block was NOT visited.
94  * Internal version for libFirm.
95  */
96 static inline int _extbb_not_visited(const ir_extblk *blk)
97 {
98         assert(blk);
99         return blk->visited < current_ir_graph->block_visited;
100 }
101
102 /**
103  * Returns the link field of an extended block.
104  * Internal version for libFirm.
105  */
106 static inline void *_get_extbb_link(const ir_extblk *blk)
107 {
108         assert(blk);
109         return blk->link;
110 }
111
112 /**
113  * Sets the link field of an extended block.
114  * Internal version for libFirm.
115  */
116 static inline void _set_extbb_link(ir_extblk *blk, void *link)
117 {
118         assert(blk);
119         blk->link = link;
120 }
121
122 /**
123  * Return the number of basis blocks of an extended block
124  */
125 static inline int _get_extbb_n_blocks(const ir_extblk *blk)
126 {
127         assert(blk);
128         return (int)ARR_LEN(blk->blks);
129 }
130
131 /**
132  * Return the i'th basis block of an extended block
133  */
134 static inline ir_node *_get_extbb_block(const ir_extblk *blk, int pos)
135 {
136         assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
137         return blk->blks[pos];
138 }
139
140 /**
141  * Return the leader basis block of an extended block
142  */
143 static inline ir_node *_get_extbb_leader(const ir_extblk *blk)
144 {
145         return blk->blks[0];
146 }
147
148 #define is_ir_extbb(thing)        _is_ir_extbb(thing)
149 #define get_extbb_visited(blk)    _get_extbb_visited(blk)
150 #define set_extbb_visited(blk, v) _set_extbb_visited(blk, v)
151 #define mark_extbb_visited(blk)   _mark_extbb_visited(blk)
152 #define extbb_visited(blk)        _extbb_visited(blk)
153 #define extbb_not_visited(blk)    _extbb_not_visited(blk)
154 #define get_extbb_link(blk)       _get_extbb_link(blk)
155 #define set_extbb_link(blk, link) _set_extbb_link(blk, link)
156 #define get_extbb_n_blocks(blk)   _get_extbb_n_blocks(blk)
157 #define get_extbb_leader(blk)     _get_extbb_leader(blk)
158
159 #endif