3 * File name: ir/ana/irextbb_t.h
4 * Purpose: Extended basis block support.
9 * Copyright: (c) 2002-2005 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
16 * Computes extended basic blocks.
18 * @author Michael Beck
23 #include "firm_config.h"
24 #include "irgraph_t.h"
32 firm_kind kind; /**< k_ir_extblk */
33 unsigned long visited; /**< visited flag */
34 ir_node **blks; /**< blocks belonging to this extended block */
35 void *link; /**< private link field */
39 * Checks whether a pointer points to a extended basic block.
40 * Intern version for libFirm.
43 _is_ir_extbb (const void *thing) {
44 return (get_kind(thing) == k_ir_extblk);
48 * Gets the visited counter of an extended block.
49 * Internal version for libFirm.
51 static INLINE unsigned long
52 _get_extbb_visited(const ir_extblk *blk) {
58 * Sets the visited counter of an extended block.
59 * Internal version for libFirm.
62 _set_extbb_visited(ir_extblk *blk, unsigned long visited) {
64 blk->visited = visited;
68 * Mark an extended block as visited in a graph.
69 * Internal version for libFirm.
72 _mark_extbb_visited(ir_extblk *blk) {
74 blk->visited = current_ir_graph->block_visited;
78 * Returns non-zero if an extended was visited.
79 * Internal version for libFirm.
82 _extbb_visited(const ir_extblk *blk) {
84 return blk->visited >= current_ir_graph->block_visited;
88 * Returns non-zero if an extended block was NOT visited.
89 * Internal version for libFirm.
92 _extbb_not_visited(const ir_extblk *blk) {
94 return blk->visited < current_ir_graph->block_visited;
98 * Returns the link field of an extended block.
99 * Internal version for libFirm.
102 _get_extbb_link(const ir_extblk *blk) {
108 * Sets the link field of an extended block.
109 * Internal version for libFirm.
112 _set_extbb_link(ir_extblk *blk, void *link) {
118 * Return the number of basis blocks of an extended block
121 _get_extbb_n_blocks(const ir_extblk *blk) {
123 return ARR_LEN(blk->blks);
127 * Return the i'th basis block of an extended block
129 static INLINE ir_node *
130 _get_extbb_block(ir_extblk *blk, int pos)
132 assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
133 return blk->blks[pos];
137 * Return the leader basis block of an extended block
139 static INLINE ir_node *
140 _get_extbb_leader(ir_extblk *blk)
145 #define is_ir_extbb(thing) _is_ir_extbb(thing)
146 #define get_extbb_visited(blk) _get_extbb_visited(blk)
147 #define set_extbb_visited(blk, v) _set_extbb_visited(blk, v)
148 #define mark_extbb_visited(blk) _mark_extbb_visited(blk)
149 #define extbb_visited(blk) _extbb_visited(blk)
150 #define extbb_not_visited(blk) _extbb_not_visited(blk)
151 #define get_extbb_link(blk) _get_extbb_link(blk)
152 #define set_extbb_link(blk, link) _set_extbb_link(blk, link)
153 #define get_extbb_n_blocks(blk) _get_extbb_n_blocks(blk)
154 #define get_extbb_leader(blk) _get_extbb_leader(blk)
156 #endif /* _IREXTBB_H_ */