added get/set for CopyKeep operand
[libfirm] / ir / be / belive.h
1 /**
2  * Interblock liveness analysis.
3  * @author Sebastian Hack
4  * @date 6.12.2004
5  */
6
7 #ifndef _BELIVE_H
8 #define _BELIVE_H
9
10 #include "firm_types.h"
11 #include "pset.h"
12 #include "bearch_t.h"
13
14 #include <stdio.h>
15
16 /**
17  * Compute the inter block liveness for a graph.
18  * @param irg The graph.
19  */
20 void be_liveness(ir_graph *irg);
21
22 /**
23  * Dump the liveness information for a graph.
24  * @param f The output.
25  * @param irg The graph.
26  */
27 void be_liveness_dump(ir_graph *irg, FILE *f);
28
29 /**
30  * Dump the liveness information for a graph.
31  * @param irg The graph.
32  * @param cls_name A string used as substring in the filename.
33  */
34 void be_liveness_dumpto(ir_graph *irg, const char *cls_name);
35
36 /**
37  * Check, if a node is live in at a block.
38  * @param block The block.
39  * @param irn The node to check for.
40  * @return 1, if @p irn is live at the entrance of @p block, 0 if not.
41  */
42 int (is_live_in)(const ir_node *block, const ir_node *irn);
43
44 /**
45  * Check, if a node is live out at a block.
46  * @param block The block.
47  * @param irn The node to check for.
48  * @return 1, if @p irn is live at the exit of @p block, 0 if not.
49  */
50 int (is_live_out)(const ir_node *block, const ir_node *irn);
51
52 /**
53  * Check, if a node is live at the end of a block.
54  * @param block The block.
55  * @param irn The node to check for.
56  * @return 1, if @p irn is live at the end of the block, 0 if not.
57  */
58 int (is_live_end)(const ir_node *block, const ir_node *irn);
59
60 /**
61  * Check, if the SSA dominance property is fulfilled.
62  * @param irg The graph.
63  */
64 void be_check_dominance(ir_graph *irg);
65
66 /**
67  * The liveness transfer function.
68  * Updates a live set over a single step from a given node to its predecessor.
69  * Everything defined at the node is removed from the set, the uses of the node get inserted.
70  * @param arch_env The architecture environment.
71  * @param cls      The register class to consider.
72  * @param irn      The node at which liveness should be computed.
73  * @param live     The set of nodes live before @p irn. This set gets modified by updating it to
74  *                 the nodes live after irn.
75  * @return live.
76  */
77 pset *be_liveness_transfer(const arch_env_t *arch_env, const arch_register_class_t *cls, ir_node *irn, pset *live);
78
79 /**
80  * Put all node live at the end of a block into a set.
81  * @param arch_env The architecture environment.
82  * @param cls      The register class to consider.
83  * @param bl       The block.
84  * @param live     The set to put them into.
85  * @return live.
86  */
87 pset *be_liveness_end_of_block(const arch_env_t *arch_env, const arch_register_class_t *cls, const ir_node *bl, pset *live);
88
89 /**
90  * Compute a set of nodes which are live at another node.
91  * @param arch_env The architecture environment.
92  * @param cls      The register class to consider.
93  * @param pos      The node.
94  * @param live     The set to put them into.
95  * @return live.
96  */
97 pset *be_liveness_nodes_live_at(const arch_env_t *arch_env, const arch_register_class_t *cls, const ir_node *pos, pset *live);
98
99 #endif /* _BELIVE_H */