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 "irgraph_t.h"
31 firm_kind kind; /**< k_ir_extblk */
32 unsigned long visited; /**< visited flag */
33 ir_node **blks; /**< blocks belonging to this extended block */
34 void *link; /**< private link field */
38 * Checks whether a pointer points to a extended basic block.
39 * Intern version for libFirm.
42 _is_ir_extbb (const void *thing) {
43 return (get_kind(thing) == k_ir_extblk);
47 * Gets the visited counter of an extended block.
48 * Internal version for libFirm.
50 static INLINE unsigned long
51 _get_extbb_visited(const ir_extblk *blk) {
57 * Sets the visited counter of an extended block.
58 * Internal version for libFirm.
61 _set_extbb_visited(ir_extblk *blk, unsigned long visited) {
63 blk->visited = visited;
67 * Mark an extended block as visited in a graph.
68 * Internal version for libFirm.
71 _mark_extbb_visited(ir_extblk *blk) {
73 blk->visited = current_ir_graph->block_visited;
77 * Returns non-zero if an extended was visited.
78 * Internal version for libFirm.
81 _extbb_visited(const ir_extblk *blk) {
83 return blk->visited >= current_ir_graph->block_visited;
87 * Returns non-zero if an extended block was NOT visited.
88 * Internal version for libFirm.
91 _extbb_not_visited(const ir_extblk *blk) {
93 return blk->visited < current_ir_graph->block_visited;
97 * Returns the link field of an extended block.
98 * Internal version for libFirm.
101 _get_extbb_link(const ir_extblk *blk) {
107 * Sets the link field of an extended block.
108 * Internal version for libFirm.
111 _set_extbb_link(ir_extblk *blk, void *link) {
117 * Return the number of basis blocks of an extended block
120 _get_extbb_n_blocks(const ir_extblk *blk) {
122 return ARR_LEN(blk->blks);
126 * Return the i'th basis block of an extended block
128 static INLINE ir_node *
129 _get_extbb_block(ir_extblk *blk, int pos)
131 assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
132 return blk->blks[pos];
136 * Return the leader basis block of an extended block
138 static INLINE ir_node *
139 _get_extbb_leader(ir_extblk *blk)
144 #define is_ir_extbb(thing) _is_ir_extbb(thing)
145 #define get_extbb_visited(blk) _get_extbb_visited(blk)
146 #define set_extbb_visited(blk, v) _set_extbb_visited(blk, v)
147 #define mark_extbb_visited(blk) _mark_extbb_visited(blk)
148 #define extbb_visited(blk) _extbb_visited(blk)
149 #define extbb_not_visited(blk) _extbb_not_visited(blk)
150 #define get_extbb_link(blk) _get_extbb_link(blk)
151 #define set_extbb_link(blk, link) _set_extbb_link(blk, link)
152 #define get_extbb_n_blocks(blk) _get_extbb_n_blocks(blk)
153 #define get_extbb_leader(blk) _get_extbb_leader(blk)
155 #endif /* _IREXTBB_H_ */