bearch: Disallow passing Projs to get_irn_ops().
[libfirm] / ir / be / bestate.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief       Handles state switching. This is basically the belady spill
9  *              algorithm optimized for the 1-register case.
10  * @author      Matthias Braun
11  * @date        26.03.2007
12  */
13 #ifndef FIRM_BE_BESTATE_H
14 #define FIRM_BE_BESTATE_H
15
16 #include "firm_types.h"
17 #include "bearch.h"
18
19 /**
20  * Callback that should create a spill for a certain value. Can return NULL
21  * if @p force == 0 and the value can be easily rematerialized
22  */
23 typedef ir_node *(*create_spill_func) (void *env, ir_node *value, int force, ir_node *after);
24
25 /**
26  * Callback that should create a reload for a certain value
27  */
28 typedef ir_node *(*create_reload_func) (void *env, ir_node *value,
29                                         ir_node *spill, ir_node *before,
30                                         ir_node *last_value);
31
32 /**
33  * Some state is expressed as a register. nodes defining a value for this
34  * register are known states. You can connect these to nodes to express that a
35  * node needs the processor to be in a certain state.
36  * This functions asserts that the state is switched to fullfill all state
37  * requirements of nodes.
38  */
39 void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
40                      create_spill_func spill_func,
41                      create_reload_func reload_func);
42
43 #endif