X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbeuses.h;h=c0c6d789f0e7b083ed1453da9ad70e49071cbb5f;hb=b36dd117b8e841f1a3c78588036aed050ffd94e4;hp=2300bde6b3b809e861be8080ff5f4913dfc24628;hpb=48f893878b07f6e334389ff52abda5cc2adbf179;p=libfirm diff --git a/ir/be/beuses.h b/ir/be/beuses.h index 2300bde6b..c0c6d789f 100644 --- a/ir/be/beuses.h +++ b/ir/be/beuses.h @@ -1,31 +1,61 @@ -/** - * @file beuse.h - * @date 27.06.2005 - * @author Sebastian Hack - * - * Determine future usages of values. - * - * Copyright (C) 2005 Universitaet Karlsruhe - * Released under the GPL +/* + * This file is part of libFirm. + * Copyright (C) 2012 University of Karlsruhe. */ -#ifndef _BEUSES_H -#define _BEUSES_H +/** + * @file + * @brief Methods to compute when a value will be used again. + * @author Sebastian Hack, Matthias Braun + * @date 27.06.2005 + */ +#ifndef FIRM_BE_BEUSES_H +#define FIRM_BE_BEUSES_H -#include "bearch.h" +#include "firm_types.h" #include "belive.h" -#define USES_INFINITY 1000000 -#define USES_IS_INIFINITE(x) ((x) >= USES_INFINITY) +/** + * Describes a use of a value. + */ +typedef struct be_next_use_t { + unsigned time; + unsigned outermost_loop; + /* point of the next use is at the beginning of this node. */ + const ir_node *before; +} be_next_use_t; + +#define USES_INFINITY 10000000 +#define USES_PENDING 9999999 -typedef struct _loc_t loc_t; -typedef struct _be_uses_t be_uses_t; +static inline bool USES_IS_INFINITE(unsigned time) +{ + return time >= USES_INFINITY; +} -unsigned be_get_next_use(be_uses_t *uses, const ir_node *from, - unsigned from_step, const ir_node *def, int skip_from_uses); +static inline bool USES_IS_PENDING(unsigned time) +{ + return time == USES_PENDING; +} -be_uses_t *be_begin_uses(ir_graph *irg, const be_lv_t *lv, const arch_env_t *arch_env, const arch_register_class_t *cls); +typedef struct be_uses_t be_uses_t; +be_next_use_t be_get_next_use(be_uses_t *uses, ir_node *from, + const ir_node *def, int skip_from_uses); + +/** + * Creates a new uses environment for a graph. + * + * @param irg the graph + * @param lv liveness information for the graph + */ +be_uses_t *be_begin_uses(ir_graph *irg, const be_lv_t *lv); + +/** + * Destroys the given uses environment. + * + * @param uses the environment + */ void be_end_uses(be_uses_t *uses); -#endif /* _BEUSES_H */ +#endif