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. */
20 typedef struct _node_live_info_t {
21 int is_phi_op; /**< Marks the node as a phi operand. */
24 typedef struct _live_info_t {
26 block_live_info_t block;
27 node_live_info_t node;
31 extern size_t live_irn_data_offset;
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)
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))
39 static INLINE int __is_phi_operand(const ir_node *irn)
41 assert(!is_Block(irn) && "No block node allowed here");
42 return get_node_live_info(irn)->is_phi_op;
45 static INLINE int __is_live_in(const ir_node *block, const ir_node *irn)
47 block_live_info_t *info = get_block_live_info(block);
49 assert(is_Block(block) && "Need a block here");
50 return pset_find_ptr(info->in, irn) != NULL;
53 static INLINE int __is_live_out(const ir_node *block, const ir_node *irn)
55 block_live_info_t *info = get_block_live_info(block);
57 assert(is_Block(block) && "Need a block here");
58 return pset_find_ptr(info->out, irn) != NULL;
61 static INLINE pset *__get_live_in(const ir_node *block)
63 assert(is_Block(block) && "Need a block here");
64 return get_block_live_info(block)->in;
67 static INLINE pset *__get_live_out(const ir_node *block)
69 assert(is_Block(block) && "Need a block here");
70 return get_block_live_info(block)->out;
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)
80 * Initialize the liveness module.
81 * To be called from be_init().
83 void be_liveness_init(void);