do C99 compliance
[libfirm] / ir / be / belive_t.h
1 /**
2  * Internal headers for liveness analysis.
3  * @author Sebastian Hack
4  * @date 6.12.2004
5  */
6
7 #ifndef _BELIVE_T_H
8 #define _BELIVE_T_H
9
10 #include "config.h"
11
12 #include "pset.h"
13
14 typedef struct _block_live_info_t {
15         pset *in;
16         pset *out;
17 } block_live_info_t;
18
19 typedef struct _node_live_info_t {
20         unsigned last_use_in_block : 1;
21 } node_live_info_t;
22
23 typedef struct _live_info_t {
24         union {
25                 block_live_info_t block;
26                 node_live_info_t node;
27         } v;
28 } live_info_t;
29
30 extern size_t live_irn_data_offset;
31
32 #define get_irn_live_info(irn) get_irn_data(irn, live_info_t, live_irn_data_offset)
33 #define get_live_info_irn(inf) get_irn_data_base(inf, live_irn_data_offset)
34
35 #define get_block_live_info(irn) &(get_irn_live_info(irn)->v.block)
36
37 static INLINE int _is_live_in(const ir_node *block, const ir_node *irn)
38 {
39         block_live_info_t *info = get_block_live_info(block);
40
41         assert(is_Block(block) && "Need a block here");
42         return pset_find_ptr(info->in, irn) != NULL;
43 }
44
45 static INLINE int _is_live_out(const ir_node *block, const ir_node *irn)
46 {
47         block_live_info_t *info = get_block_live_info(block);
48
49         assert(is_Block(block) && "Need a block here");
50         return pset_find_ptr(info->out, irn) != NULL;
51 }
52
53 #define is_live_in(block,irn) _is_live_in(block, irn)
54 #define is_live_out(block,irn) _is_live_out(block, irn)
55
56 /**
57  * Initialize the liveness module.
58  * To be called from be_init().
59  */
60 void be_liveness_init(void);
61
62 #endif