removed unitialized used vartiable
[libfirm] / ir / be / bessaconstr.h
1 /**
2  * @file
3  * @brief     Introduce several copies for one node.
4  * @author    Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
5  * @date      30.03.2007
6  * @version   $Id$
7  * Copyright: (c) Universitaet Karlsruhe
8  * Licence:   This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
9
10  * A copy in this context means, that you want to introduce several new
11  * abstract values (in Firm: nodes) for which you know, that they
12  * represent the same concrete value. This is the case if you
13  * - copy
14  * - spill and reload
15  * - re-materialize
16  * a value.
17  *
18  * This function reroutes all uses of the original value to the copies in the
19  * corresponding dominance subtrees and creates Phi functions where necessary.
20  */
21 #ifndef FIRM_BE_SSACONSTR_H
22 #define FIRM_BE_SSACONSTR_H
23
24 #include <stdlib.h>
25 #include "bedomfront.h"
26 #include "irnode.h"
27 #include "irnodeset.h"
28 #include "belive.h"
29 #include "beirg.h"
30 #include "pdeq.h"
31
32 typedef struct be_ssa_construction_env_t {
33         ir_graph                   *irg;
34         const be_dom_front_info_t  *domfronts;
35         ir_mode                    *mode;
36         waitq                      *worklist;
37         const ir_nodeset_t         *ignore_uses;
38         ir_node                   **new_phis;
39         int                         iterated_domfront_calculated;
40 } be_ssa_construction_env_t;
41
42 /**
43  * Initializes an ssa construction environment.
44  */
45 void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg);
46
47 void be_ssa_construction_add_copy(be_ssa_construction_env_t *env,
48                                   ir_node *value);
49
50 void be_ssa_construction_add_copies(be_ssa_construction_env_t *env,
51                                     ir_node **copies, size_t copies_len);
52
53 void be_ssa_construction_set_ignore_uses(be_ssa_construction_env_t *env,
54                                          const ir_nodeset_t *ignore_uses);
55
56 /**
57  * Reconstructs the ssa form for all users of node @p node
58  */
59 void be_ssa_construction_fix_users(be_ssa_construction_env_t *env,
60                                    ir_node *node);
61
62 void be_ssa_construction_fix_users_array(be_ssa_construction_env_t *env,
63                                          ir_node **nodes, size_t nodes_len);
64
65 /**
66  * Recompute the liveness of the inserted phis.
67  * @note Remember that you have to call update_liveness on the copies yourself
68  */
69 void be_ssa_construction_update_liveness_phis(be_ssa_construction_env_t *env,
70                                              be_lv_t *lv);
71
72 ir_node **be_ssa_construction_get_new_phis(be_ssa_construction_env_t *env);
73
74 /**
75  * Destroys an ssa construction environment.
76  */
77 void be_ssa_construction_destroy(be_ssa_construction_env_t *env);
78
79 #endif