- Implement all the state switching stuff needed for efficient fpu mode
[libfirm] / ir / be / bera.h
1 /**
2  * Register allocation functions.
3  * @author Sebastian Hack
4  * @date 13.1.2005
5  */
6 #ifndef _BERA_H
7 #define _BERA_H
8
9 #include "firm_config.h"
10
11 #include <libcore/lc_timing.h>
12
13 #include "firm_types.h"
14
15 #include "be.h"
16 #include "belive.h"
17 #include "beirg.h"
18 #include "bemodule.h"
19
20 typedef struct {
21         lc_timer_t *t_prolog;      /**< timer for prolog */
22         lc_timer_t *t_epilog;      /**< timer for epilog */
23         lc_timer_t *t_live;        /**< timer for liveness calculation */
24         lc_timer_t *t_spill;       /**< timer for spilling */
25         lc_timer_t *t_spillslots;  /**< spillslot coalescing */
26         lc_timer_t *t_color;       /**< timer for graph coloring */
27         lc_timer_t *t_ifg;         /**< timer for building interference graph */
28         lc_timer_t *t_copymin;     /**< timer for copy minimization */
29         lc_timer_t *t_ssa;         /**< timer for ssa destruction */
30         lc_timer_t *t_verify;      /**< timer for verification runs */
31         lc_timer_t *t_other;       /**< timer for remaining stuff */
32 } be_ra_timer_t;
33
34 extern be_ra_timer_t *global_ra_timer;
35
36 typedef struct be_ra_t {
37         void (*allocate)(be_irg_t *bi);   /**< allocate registers on a graph */
38 } be_ra_t;
39
40 void be_register_allocator(const char *name, be_ra_t *allocator);
41
42 /**
43  * Do register allocation with currently selected register allocator
44  */
45 void be_allocate_registers(be_irg_t *birg);
46
47 /**
48  * Check, if two values interfere.
49  * @param lv Liveness information.
50  * @param a The first value.
51  * @param b The second value.
52  * @return 1, if @p a and @p b interfere, 0 if not.
53  */
54 int values_interfere(const be_lv_t *lv, const ir_node *a, const ir_node *b);
55
56 /**
57  * Check, if a value dominates the other one.
58  * Note, that this function also considers the schedule and does thus
59  * more than block_dominates().
60  *
61  * @param a The first.
62  * @param b The second value.
63  * @return 1 if a dominates b, 0 else.
64  */
65 int value_dominates(const ir_node *a, const ir_node *b);
66
67 /**
68  * Like value_dominates(), but the nodes have to be in the same block
69  */
70 int value_dominates_intrablock(const ir_node *a, const ir_node *b);
71
72 #endif /* _BERA_H */