2 * Copyright (C) 1995-2011 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
26 #ifndef FIRM_ANA_IREXTBB_T_H
27 #define FIRM_ANA_IREXTBB_T_H
29 #include "irgraph_t.h"
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 */
44 * Checks whether a pointer points to a extended basic block.
45 * Intern version for libFirm.
47 static inline int _is_ir_extbb(const void *thing)
49 return (get_kind(thing) == k_ir_extblk);
53 * Gets the visited counter of an extended block.
54 * Internal version for libFirm.
56 static inline ir_visited_t _get_extbb_visited(const ir_extblk *blk)
63 * Sets the visited counter of an extended block.
64 * Internal version for libFirm.
66 static inline void _set_extbb_visited(ir_extblk *blk, ir_visited_t visited)
69 blk->visited = visited;
73 * Mark an extended block as visited in a graph.
74 * Internal version for libFirm.
76 static inline void _mark_extbb_visited(ir_extblk *blk)
79 blk->visited = current_ir_graph->block_visited;
83 * Returns non-zero if an extended was visited.
84 * Internal version for libFirm.
86 static inline int _extbb_visited(const ir_extblk *blk)
89 return blk->visited >= current_ir_graph->block_visited;
93 * Returns non-zero if an extended block was NOT visited.
94 * Internal version for libFirm.
96 static inline int _extbb_not_visited(const ir_extblk *blk)
99 return blk->visited < current_ir_graph->block_visited;
103 * Returns the link field of an extended block.
104 * Internal version for libFirm.
106 static inline void *_get_extbb_link(const ir_extblk *blk)
113 * Sets the link field of an extended block.
114 * Internal version for libFirm.
116 static inline void _set_extbb_link(ir_extblk *blk, void *link)
123 * Return the number of basis blocks of an extended block
125 static inline int _get_extbb_n_blocks(const ir_extblk *blk)
128 return (int)ARR_LEN(blk->blks);
132 * Return the i'th basis block of an extended block
134 static inline ir_node *_get_extbb_block(const ir_extblk *blk, int pos)
136 assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
137 return blk->blks[pos];
141 * Return the leader basis block of an extended block
143 static inline ir_node *_get_extbb_leader(const ir_extblk *blk)
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)