8cffc849edaae32d5e7a5d5f06f170587804adda
[libfirm] / ir / be / bespill.h
1 /**
2  * Author:      Daniel Grund, Sebastian Hack
3  * Date:                29.09.2005
4  * Copyright:   (c) Universitaet Karlsruhe
5  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
6  */
7
8 #ifndef BESPILL_H_
9 #define BESPILL_H_
10
11 #include "firm_types.h"
12 #include "set.h"
13 #include "pset.h"
14 #include "debug.h"
15
16 #include "bechordal.h"
17 #include "be_t.h"
18
19 #include "bearch.h"
20
21 typedef struct _spill_env_t spill_env_t;
22
23 /**
24  * Creates a new spill environment.
25  *
26  * @param chordal
27  * @param is_spilled_phi        a function that evaluates a phi node and returns true if it is a spilled phi node
28  * @param data                          context parameter for the is_spilled_phi function
29  */
30 spill_env_t *be_new_spill_env(const be_chordal_env_t *chordal);
31
32 /**
33  * Marks a phi-node for spilling
34  */
35 void be_spill_phi(spill_env_t *env, ir_node *node);
36
37 /**
38  * Deletes a spill environment.
39  */
40 void be_delete_spill_env(spill_env_t *senv);
41
42 void be_add_reload(spill_env_t *senv, ir_node *to_spill, ir_node *before);
43
44 void be_add_reload_on_edge(spill_env_t *senv, ir_node *to_spill, ir_node *bl, int pos);
45
46 void be_insert_spills_reloads(spill_env_t *senv);
47
48 /**
49  * Computes the spill offsets for all spill nodes in the irg
50  */
51 void be_compute_spill_offsets(be_chordal_env_t *cenv);
52
53 /**
54  * Sets the debug module of a spill environment.
55  */
56 DEBUG_ONLY(void be_set_spill_env_dbg_module(spill_env_t *env, firm_dbg_module_t *dbg));
57
58 #endif /* BESPILL_H_ */