2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Methods to compute when a value will be used again.
9 * @author Sebastian Hack, Matthias Braun
12 #ifndef FIRM_BE_BEUSES_H
13 #define FIRM_BE_BEUSES_H
15 #include "firm_types.h"
19 * Describes a use of a value.
21 typedef struct be_next_use_t {
23 unsigned outermost_loop;
24 /* point of the next use is at the beginning of this node. */
25 const ir_node *before;
28 #define USES_INFINITY 10000000
29 #define USES_PENDING 9999999
31 static inline bool USES_IS_INFINITE(unsigned time)
33 return time >= USES_INFINITY;
36 static inline bool USES_IS_PENDING(unsigned time)
38 return time == USES_PENDING;
41 typedef struct be_uses_t be_uses_t;
43 be_next_use_t be_get_next_use(be_uses_t *uses, ir_node *from,
44 const ir_node *def, int skip_from_uses);
47 * Creates a new uses environment for a graph.
49 * @param irg the graph
50 * @param lv liveness information for the graph
52 be_uses_t *be_begin_uses(ir_graph *irg, const be_lv_t *lv);
55 * Destroys the given uses environment.
57 * @param uses the environment
59 void be_end_uses(be_uses_t *uses);