2 * Internal headers for liveness analysis.
3 * @author Sebastian Hack
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 pset *end; /**< The set of all values live at the end
19 of the block (contains all live out). */
22 typedef struct _node_live_info_t {
23 int is_phi_op; /**< Marks the node as a phi operand. */
26 typedef struct _live_info_t {
28 block_live_info_t block;
29 node_live_info_t node;
33 extern size_t live_irn_data_offset;
35 #define get_irn_live_info(irn) get_irn_data(irn, live_info_t, live_irn_data_offset)
36 #define get_live_info_irn(inf) get_irn_data_base(inf, live_irn_data_offset)
38 #define get_block_live_info(irn) (&(get_irn_live_info(irn)->v.block))
39 #define get_node_live_info(irn) (&(get_irn_live_info(irn)->v.node))
41 static INLINE int _is_phi_operand(const ir_node *irn)
43 assert(!is_Block(irn) && "No block node allowed here");
44 return get_node_live_info(irn)->is_phi_op;
47 static INLINE int _is_live_in(const ir_node *block, const ir_node *irn)
49 block_live_info_t *info = get_block_live_info(block);
51 assert(is_Block(block) && "Need a block here");
52 return pset_find_ptr(info->in, irn) != NULL;
55 static INLINE int _is_live_out(const ir_node *block, const ir_node *irn)
57 block_live_info_t *info = get_block_live_info(block);
59 assert(is_Block(block) && "Need a block here");
60 return pset_find_ptr(info->out, irn) != NULL;
63 static INLINE int _is_live_end(const ir_node *block, const ir_node *irn)
65 block_live_info_t *info = get_block_live_info(block);
67 assert(is_Block(block) && "Need a block here");
68 return pset_find_ptr(info->end, irn) != NULL;
71 static INLINE pset *_get_live_in(const ir_node *block)
73 assert(is_Block(block) && "Need a block here");
74 return get_block_live_info(block)->in;
77 static INLINE pset *_get_live_out(const ir_node *block)
79 assert(is_Block(block) && "Need a block here");
80 return get_block_live_info(block)->out;
83 static INLINE pset *_get_live_end(const ir_node *block)
85 assert(is_Block(block) && "Need a block here");
86 return get_block_live_info(block)->end;
89 #define is_phi_operand(irn) _is_phi_operand(irn)
90 #define is_live_in(bl,irn) _is_live_in(bl, irn)
91 #define is_live_out(bl,irn) _is_live_out(bl, irn)
92 #define is_live_end(bl,irn) _is_live_end(bl, irn)
93 #define get_live_in(bl) _get_live_in(bl)
94 #define get_live_out(bl) _get_live_out(bl)
95 #define get_live_end(bl) _get_live_end(bl)
98 * Initialize the liveness module.
99 * To be called from be_init().
101 void be_liveness_init(void);