not needed
[libfirm] / ir / be / bessaconstr.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief     Introduce several copies for one node.
23  * @author    Sebastian Hack, Daniel Grund, Matthias Braun, Christian Wuerdig
24  * @date      30.03.2007
25  * @version   $Id$
26  * Copyright: (c) Universitaet Karlsruhe
27  * Licence:   This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
28
29  * A copy in this context means, that you want to introduce several new
30  * abstract values (in Firm: nodes) for which you know, that they
31  * represent the same concrete value. This is the case if you
32  * - copy
33  * - spill and reload
34  * - re-materialize
35  * a value.
36  *
37  * This function reroutes all uses of the original value to the copies in the
38  * corresponding dominance subtrees and creates Phi functions where necessary.
39  */
40 #ifndef FIRM_BE_SSACONSTR_H
41 #define FIRM_BE_SSACONSTR_H
42
43 #include <stdlib.h>
44 #include "bedomfront.h"
45 #include "irnode.h"
46 #include "irnodeset.h"
47 #include "belive.h"
48 #include "beirg.h"
49 #include "pdeq.h"
50
51 typedef struct be_ssa_construction_env_t {
52         ir_graph                   *irg;
53         const be_dom_front_info_t  *domfronts;
54         ir_mode                    *mode;
55         waitq                      *worklist;
56         const ir_nodeset_t         *ignore_uses;
57         ir_node                   **new_phis;
58         int                         iterated_domfront_calculated;
59 } be_ssa_construction_env_t;
60
61 /**
62  * Initializes an ssa construction environment.
63  */
64 void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg);
65
66 void be_ssa_construction_add_copy(be_ssa_construction_env_t *env,
67                                   ir_node *value);
68
69 void be_ssa_construction_add_copies(be_ssa_construction_env_t *env,
70                                     ir_node **copies, size_t copies_len);
71
72 void be_ssa_construction_set_ignore_uses(be_ssa_construction_env_t *env,
73                                          const ir_nodeset_t *ignore_uses);
74
75 /**
76  * Reconstructs the ssa form for all users of node @p node
77  */
78 void be_ssa_construction_fix_users(be_ssa_construction_env_t *env,
79                                    ir_node *node);
80
81 void be_ssa_construction_fix_users_array(be_ssa_construction_env_t *env,
82                                          ir_node **nodes, size_t nodes_len);
83
84 /**
85  * Recompute the liveness of the inserted phis.
86  * @note Remember that you have to call update_liveness on the copies yourself
87  */
88 void be_ssa_construction_update_liveness_phis(be_ssa_construction_env_t *env,
89                                              be_lv_t *lv);
90
91 ir_node **be_ssa_construction_get_new_phis(be_ssa_construction_env_t *env);
92
93 /**
94  * Destroys an ssa construction environment.
95  */
96 void be_ssa_construction_destroy(be_ssa_construction_env_t *env);
97
98 #endif