X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbelive_t.h;h=61ce41236a65e1a7a68f48f98182da7b5ddd15b9;hb=321ae93c651a24f17e2b7540e67a959db803c40d;hp=57bcc837d62f74696bf51cafbcf15544c95799c3;hpb=d26125ca5720072a4975d37c0a17f7ad6c18de2d;p=libfirm diff --git a/ir/be/belive_t.h b/ir/be/belive_t.h index 57bcc837d..61ce41236 100644 --- a/ir/be/belive_t.h +++ b/ir/be/belive_t.h @@ -9,15 +9,18 @@ #include "config.h" +#include "belive.h" #include "pset.h" typedef struct _block_live_info_t { - pset *in; - pset *out; + pset *in; /**< The set of all values live in at that block. */ + pset *out; /**< The set of all values live out. */ + pset *end; /**< The set of all values live at the end + of the block (contains all live out). */ } block_live_info_t; typedef struct _node_live_info_t { - unsigned last_use_in_block : 1; + int is_phi_op; /**< Marks the node as a phi operand. */ } node_live_info_t; typedef struct _live_info_t { @@ -32,9 +35,16 @@ extern size_t live_irn_data_offset; #define get_irn_live_info(irn) get_irn_data(irn, live_info_t, live_irn_data_offset) #define get_live_info_irn(inf) get_irn_data_base(inf, live_irn_data_offset) -#define get_block_live_info(irn) &(get_irn_live_info(irn)->v.block) +#define get_block_live_info(irn) (&(get_irn_live_info(irn)->v.block)) +#define get_node_live_info(irn) (&(get_irn_live_info(irn)->v.node)) -static INLINE int _is_live_in(const ir_node *block, const ir_node *irn) +static INLINE int __is_phi_operand(const ir_node *irn) +{ + assert(!is_Block(irn) && "No block node allowed here"); + return get_node_live_info(irn)->is_phi_op; +} + +static INLINE int __is_live_in(const ir_node *block, const ir_node *irn) { block_live_info_t *info = get_block_live_info(block); @@ -42,7 +52,7 @@ static INLINE int _is_live_in(const ir_node *block, const ir_node *irn) return pset_find_ptr(info->in, irn) != NULL; } -static INLINE int _is_live_out(const ir_node *block, const ir_node *irn) +static INLINE int __is_live_out(const ir_node *block, const ir_node *irn) { block_live_info_t *info = get_block_live_info(block); @@ -50,8 +60,39 @@ static INLINE int _is_live_out(const ir_node *block, const ir_node *irn) return pset_find_ptr(info->out, irn) != NULL; } -#define is_live_in(block,irn) _is_live_in(block, irn) -#define is_live_out(block,irn) _is_live_out(block, irn) +static INLINE int __is_live_end(const ir_node *block, const ir_node *irn) +{ + block_live_info_t *info = get_block_live_info(block); + + assert(is_Block(block) && "Need a block here"); + return pset_find_ptr(info->end, irn) != NULL; +} + +static INLINE pset *__get_live_in(const ir_node *block) +{ + assert(is_Block(block) && "Need a block here"); + return get_block_live_info(block)->in; +} + +static INLINE pset *__get_live_out(const ir_node *block) +{ + assert(is_Block(block) && "Need a block here"); + return get_block_live_info(block)->out; +} + +static INLINE pset *__get_live_end(const ir_node *block) +{ + assert(is_Block(block) && "Need a block here"); + return get_block_live_info(block)->end; +} + +#define is_phi_operand(irn) __is_phi_operand(irn) +#define is_live_in(bl,irn) __is_live_in(bl, irn) +#define is_live_out(bl,irn) __is_live_out(bl, irn) +#define is_live_end(bl,irn) __is_live_end(bl, irn) +#define get_live_in(bl) __get_live_in(bl) +#define get_live_out(bl) __get_live_out(bl) +#define get_live_end(bl) __get_live_end(bl) /** * Initialize the liveness module.