X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Firlivechk.h;h=0c7b790c62bbd5228dc5be6e86e8fb73f9cf3866;hb=e97a86a5e90141c2cb4ccdc34195cab035627c3f;hp=fc22e66fa9b28205fadebb9272673592151e8175;hpb=f616f878aa0ea06ad96e9c92a58c75d4fe5b3162;p=libfirm diff --git a/ir/ana/irlivechk.h b/ir/ana/irlivechk.h index fc22e66fa..0c7b790c6 100644 --- a/ir/ana/irlivechk.h +++ b/ir/ana/irlivechk.h @@ -1,40 +1,54 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. - * * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. + * Copyright (C) 2012 Inria Rhone-Alpes. */ /** - * @file irlivechk.h + * @file * @author Sebastian Hack * @date 22.04.2007 - * @version $Id$ - * @summary + * @brief * * Live in/end checks whose only precomputation concerns the structure of the CFG. * Hence, nothing has to be updated if the program is modified unless the CFG is touched. * See .c file for more comments. */ + #ifndef FIRM_ANA_IRLIVECHK_H #define FIRM_ANA_IRLIVECHK_H #include "irgraph.h" #include "irnode.h" +#include -typedef struct _lv_chk_t lv_chk_t; +typedef enum { + lv_chk_state_in = 1, + lv_chk_state_end = 2, + lv_chk_state_out = 4, + lv_chk_state_through = lv_chk_state_in | lv_chk_state_out | lv_chk_state_end, +} lv_chk_state_t; + +typedef struct lv_chk_t lv_chk_t; + +/** + * Filter out some nodes for which we never need liveness. + * + * @param irn the node t check + * @return 0 if no liveness info is needed, 1 else + */ +static inline bool is_liveness_node(const ir_node *irn) +{ + switch (get_irn_opcode(irn)) { + case iro_Block: + case iro_Bad: + case iro_End: + case iro_Anchor: + case iro_NoMem: + return 0; + default: + return 1; + } +} /** * Make a new liveness check environment. @@ -49,31 +63,18 @@ extern lv_chk_t *lv_chk_new(ir_graph *irg); */ extern void lv_chk_free(lv_chk_t *lv); -/** - * Check, if a node is live end of a given block. - * @param lv The liveness environment. - * @param bl The block to investigate. - * @param irn The node to check for. - * @return 1, if @p what is live end at @p bl, 0 else. - */ -extern int lv_chk_bl_end(const lv_chk_t *lv, const ir_node *bl, const ir_node *irn); /** - * Check, if a node is live out of a given block. + * Return liveness information for a node concerning a block. * @param lv The liveness environment. * @param bl The block to investigate. * @param irn The node to check for. - * @return 1, if @p what is live out at @p bl, 0 else. + * @return A bitmask of lv_chk_state_t. */ -extern int lv_chk_bl_out(const lv_chk_t *lv, const ir_node *bl, const ir_node *irn); +extern unsigned lv_chk_bl_xxx(lv_chk_t *lv, const ir_node *bl, const ir_node *irn); -/** - * Check, if a node is live in of a given block. - * @param lv The liveness environment. - * @param bl The block to investigate. - * @param irn The node to check for. - * @return 1, if @p what is live in at @p bl, 0 else. - */ -extern int lv_chk_bl_in(const lv_chk_t *lv, const ir_node *bl, const ir_node *irn); +#define lv_chk_bl_in(lv, bl, irn) ((lv_chk_bl_xxx((lv), (bl), (irn)) & lv_chk_state_in) != 0) +#define lv_chk_bl_end(lv, bl, irn) ((lv_chk_bl_xxx((lv), (bl), (irn)) & lv_chk_state_end) != 0) +#define lv_chk_bl_out(lv, bl, irn) ((lv_chk_bl_xxx((lv), (bl), (irn)) & lv_chk_state_out) != 0) #endif /* FIRM_ANA_IRLIVECHK_H */