X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbelive_t.h;h=086171b53ce345692d746d6a6dea949a44a53e41;hb=e6ad8ee4680a88db8652483c2c6f3124f3d9a888;hp=f8085115125326a078ede07160ad94423524f502;hpb=9b24fe0ec0f4412c790ee4a7c6fc022fd28064a1;p=libfirm diff --git a/ir/be/belive_t.h b/ir/be/belive_t.h index f80851151..086171b53 100644 --- a/ir/be/belive_t.h +++ b/ir/be/belive_t.h @@ -7,9 +7,10 @@ #ifndef _BELIVE_T_H #define _BELIVE_T_H -#include "config.h" +#include "firm_config.h" #include "irgraph_t.h" +#include "iredges_t.h" #include "belive.h" #include "pset.h" @@ -20,7 +21,7 @@ typedef enum _live_state_t { live_state_in = 1, live_state_end = 2, - live_state_out = 6, + live_state_out = 4, live_state_block = 8, } live_state_t; @@ -39,19 +40,23 @@ extern size_t live_irg_data_offset; #define get_irg_live_info(irg) (get_irg_data(irg, irg_live_info_t, live_irg_data_offset)) -#define HASH_PTR_PAIR(x,y) (HASH_PTR(x) + 37 * HASH_PTR(y)) +#define live_is_in(live) (((live)->state & live_state_in) != 0) +#define live_is_end(live) (((live)->state & live_state_end) != 0) +#define live_is_out(live) (((live)->state & live_state_out) != 0) -static INLINE irn_live_t *_get_or_set_live(const ir_node *block, const ir_node *irn, int state) +static INLINE irn_live_t *_get_or_set_live(const ir_node *block, + const ir_node *irn, int state) { irg_live_info_t *live_info = get_irg_live_info(get_irn_irg(block)); irn_live_t *live, templ; + unsigned hash = HASH_PTR(block) + 37 * HASH_PTR(irn); templ.block = block; templ.irn = irn; templ.state = -1; templ.next = NULL; - live = set_insert(live_info->live, &templ, sizeof(templ), HASH_PTR_PAIR(block, irn)); + live = set_insert(live_info->live, &templ, sizeof(templ), hash); if(live->state == -1) { if(!is_Block(irn)) { @@ -114,13 +119,26 @@ static INLINE pset *_put_live_end(const ir_node *block, pset *s) return s; } +static INLINE int _is_phi_arg(const ir_node *irn) +{ + const ir_edge_t *edge; + + assert(edges_activated(get_irn_irg(irn)) && "Please compute the out edges"); + foreach_out_edge(irn, edge) + if(is_Phi(edge->src)) + return 1; + + return 0; +} + #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 put_live_in(bl,s) _put_live_in(bl, s) +#define put_live_in(bl,s) _put_live_in(bl, s) #define put_live_out(bl,s) _put_live_out(bl, s) #define put_live_end(bl,s) _put_live_end(bl, s) +#define is_phi_arg(irn) _is_phi_arg(irn) /** * Initialize the liveness module.