2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Extended basis block support -- private header
23 * @author Michael Beck
27 #ifndef FIRM_ANA_IREXTBB_T_H
28 #define FIRM_ANA_IREXTBB_T_H
30 #include "irgraph_t.h"
38 firm_kind kind; /**< k_ir_extblk */
39 ir_visited_t visited; /**< visited flag */
40 ir_node **blks; /**< blocks belonging to this extended block */
41 void *link; /**< private link field */
45 * Checks whether a pointer points to a extended basic block.
46 * Intern version for libFirm.
48 static inline int _is_ir_extbb(const void *thing)
50 return (get_kind(thing) == k_ir_extblk);
54 * Gets the visited counter of an extended block.
55 * Internal version for libFirm.
57 static inline ir_visited_t _get_extbb_visited(const ir_extblk *blk)
64 * Sets the visited counter of an extended block.
65 * Internal version for libFirm.
67 static inline void _set_extbb_visited(ir_extblk *blk, ir_visited_t visited)
70 blk->visited = visited;
74 * Mark an extended block as visited in a graph.
75 * Internal version for libFirm.
77 static inline void _mark_extbb_visited(ir_extblk *blk)
80 blk->visited = current_ir_graph->block_visited;
84 * Returns non-zero if an extended was visited.
85 * Internal version for libFirm.
87 static inline int _extbb_visited(const ir_extblk *blk)
90 return blk->visited >= current_ir_graph->block_visited;
94 * Returns non-zero if an extended block was NOT visited.
95 * Internal version for libFirm.
97 static inline int _extbb_not_visited(const ir_extblk *blk)
100 return blk->visited < current_ir_graph->block_visited;
104 * Returns the link field of an extended block.
105 * Internal version for libFirm.
107 static inline void *_get_extbb_link(const ir_extblk *blk)
114 * Sets the link field of an extended block.
115 * Internal version for libFirm.
117 static inline void _set_extbb_link(ir_extblk *blk, void *link)
124 * Return the number of basis blocks of an extended block
126 static inline int _get_extbb_n_blocks(const ir_extblk *blk)
129 return ARR_LEN(blk->blks);
133 * Return the i'th basis block of an extended block
135 static inline ir_node *_get_extbb_block(const ir_extblk *blk, int pos)
137 assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
138 return blk->blks[pos];
142 * Return the leader basis block of an extended block
144 static inline ir_node *_get_extbb_leader(const ir_extblk *blk)
149 #define is_ir_extbb(thing) _is_ir_extbb(thing)
150 #define get_extbb_visited(blk) _get_extbb_visited(blk)
151 #define set_extbb_visited(blk, v) _set_extbb_visited(blk, v)
152 #define mark_extbb_visited(blk) _mark_extbb_visited(blk)
153 #define extbb_visited(blk) _extbb_visited(blk)
154 #define extbb_not_visited(blk) _extbb_not_visited(blk)
155 #define get_extbb_link(blk) _get_extbb_link(blk)
156 #define set_extbb_link(blk, link) _set_extbb_link(blk, link)
157 #define get_extbb_n_blocks(blk) _get_extbb_n_blocks(blk)
158 #define get_extbb_leader(blk) _get_extbb_leader(blk)