renamed remove_outs,
[libfirm] / ir / ana / irextbb_t.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/irextbb_t.h
4  * Purpose:     Extended basis block support.
5  * Author:      Michael Beck
6  * Modified by:
7  * Created:     5.2005
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2002-2005 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14  * @file irextbb_t.h
15  *
16  *  Computes extended basic blocks.
17  *
18  *  @author Michael Beck
19  */
20 #ifndef _IREXTBB_T_H_
21 #define _IREXTBB_T_H_
22
23 #include "firm_config.h"
24 #include "irgraph_t.h"
25 #include "irextbb.h"
26
27 /**
28  * An extended block.
29  */
30 struct _ir_extblk {
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 */
35 };
36
37
38 /**
39  * Gets the visited counter of an extended block.
40  * Internal version for libFirm.
41  */
42 static INLINE unsigned long
43 _get_extbb_visited(const ir_extblk *blk) {
44   assert(blk);
45   return blk->visited;
46 }
47
48 /**
49  * Sets the visited counter of an extended block.
50  * Internal version for libFirm.
51  */
52 static INLINE void
53 _set_extbb_visited(ir_extblk *blk, unsigned long visited) {
54   assert(blk);
55   blk->visited = visited;
56 }
57
58 /**
59  * Mark an extended block as visited in a graph.
60  * Internal version for libFirm.
61  */
62 static INLINE void
63 _mark_extbb_visited(ir_extblk *blk) {
64   assert(blk);
65   blk->visited = current_ir_graph->visited;
66 }
67
68 /**
69  * Returns non-zero if an extended was visited.
70  * Internal version for libFirm.
71  */
72 static INLINE int
73 _extbb_visited(const ir_extblk *blk) {
74   assert(blk);
75   return blk->visited >= current_ir_graph->visited;
76 }
77
78 /**
79  * Returns non-zero if an extended block was NOT visited.
80  * Internal version for libFirm.
81  */
82 static INLINE int
83 _extbb_not_visited(const ir_extblk *blk) {
84   assert(blk);
85   return blk->visited < current_ir_graph->visited;
86 }
87
88 /**
89  * Returns the link field of an extended block.
90  * Internal version for libFirm.
91  */
92 static INLINE void *
93 _get_extbb_link(const ir_extblk *blk) {
94   assert(blk);
95   return blk->link;
96 }
97
98 /**
99  * Sets the link field of an extended block.
100  * Internal version for libFirm.
101  */
102 static INLINE void
103 _set_extbb_link(ir_extblk *blk, void *link) {
104   assert(blk);
105   blk->link = link;
106 }
107
108 /**
109  * Return the number of basis blocks of an extended block
110  */
111 static INLINE int
112 _get_extbb_n_blocks(const ir_extblk *blk) {
113   assert(blk);
114   return ARR_LEN(blk->blks);
115 }
116
117 /**
118  * Return the i'th basis block of an extended block
119  */
120 static INLINE ir_node *
121 _get_extbb_block(ir_extblk *blk, int pos)
122 {
123   assert(blk && 0 <= pos && pos < _get_extbb_n_blocks(blk));
124   return blk->blks[pos];
125 }
126
127 #define get_extbb_visited(blk)          _get_extbb_visited(blk)
128 #define set_extbb_visited(blk, v)       _set_extbb_visited(blk, v)
129 #define mark_extbb_visited(blk)   _mark_extbb_visited(blk)
130 #define extbb_visited(blk)        _extbb_visited(blk)
131 #define extbb_not_visited(blk)    _extbb_not_visited(blk)
132 #define get_extbb_link(blk)       _get_extbb_link(blk)
133 #define set_extbb_link(blk, link) _set_extbb_link(blk, link)
134 #define get_extbb_n_blocks(blk)   _get_extbb_n_blocks(blk)
135
136 #endif /* _IREXTBB_H_ */