Uncommented missing function
[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 "belive.h"
13 #include "pset.h"
14
15 typedef struct _block_live_info_t {
16         pset *in;                               /**< The set of all values live in at that block. */
17         pset *out;                              /**< The set of all values live out. */
18 } block_live_info_t;
19
20 typedef struct _node_live_info_t {
21         int is_phi_op;          /**< Marks the node as a phi operand. */
22 } node_live_info_t;
23
24 typedef struct _live_info_t {
25         union {
26                 block_live_info_t block;
27                 node_live_info_t node;
28         } v;
29 } live_info_t;
30
31 extern size_t live_irn_data_offset;
32
33 #define get_irn_live_info(irn) get_irn_data(irn, live_info_t, live_irn_data_offset)
34 #define get_live_info_irn(inf) get_irn_data_base(inf, live_irn_data_offset)
35
36 #define get_block_live_info(irn) (&(get_irn_live_info(irn)->v.block))
37 #define get_node_live_info(irn) (&(get_irn_live_info(irn)->v.node))
38
39 static INLINE int __is_phi_operand(const ir_node *irn)
40 {
41         assert(!is_Block(irn) && "No block node allowed here");
42         return get_node_live_info(irn)->is_phi_op;
43 }
44
45 static INLINE int __is_live_in(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->in, irn) != NULL;
51 }
52
53 static INLINE int __is_live_out(const ir_node *block, const ir_node *irn)
54 {
55         block_live_info_t *info = get_block_live_info(block);
56
57         assert(is_Block(block) && "Need a block here");
58         return pset_find_ptr(info->out, irn) != NULL;
59 }
60
61 static INLINE pset *__get_live_in(const ir_node *block)
62 {
63         assert(is_Block(block) && "Need a block here");
64         return get_block_live_info(block)->in;
65 }
66
67 static INLINE pset *__get_live_out(const ir_node *block)
68 {
69         assert(is_Block(block) && "Need a block here");
70         return get_block_live_info(block)->out;
71 }
72
73 #define is_phi_operand(irn)                     __is_phi_operand(irn)
74 #define is_live_in(bl,irn)                      __is_live_in(bl, irn)
75 #define is_live_out(bl,irn)             __is_live_out(bl, irn)
76 #define get_live_in(bl)                                 __get_live_in(bl)
77 #define get_live_out(bl)                                __get_live_out(bl)
78
79 /**
80  * Initialize the liveness module.
81  * To be called from be_init().
82  */
83 void be_liveness_init(void);
84
85 #endif