New test.
[mono.git] / mono / mini / regalloc.h
1
2 typedef size_t regmask_t;
3
4 enum {
5         MONO_REG_FREE,
6         MONO_REG_FREEABLE,
7         MONO_REG_MOVEABLE,
8         MONO_REG_BUSY,
9         MONO_REG_RESERVED
10 };
11
12 enum {
13         MONO_REG_INT,
14         MONO_REG_DOUBLE
15 };
16
17 typedef struct {
18         /* symbolic registers */
19         int next_vireg;
20         int next_vfreg;
21
22         /* hard registers */
23         int num_iregs;
24         int num_fregs;
25
26         regmask_t ifree_mask;
27         regmask_t ffree_mask;
28
29         /* symbolic -> hard register assignment */
30         /* 
31          * If the register is spilled, then this contains -spill - 1, where 'spill'
32          * is the index of the spill variable.
33          */
34         int *iassign;
35         int *fassign;
36
37         /* hard -> symbolic */
38         int isymbolic [MONO_MAX_IREGS];
39         int fsymbolic [MONO_MAX_FREGS];
40
41         int max_ireg;
42         int ispills;
43
44         int iassign_size, fassign_size;
45 } MonoRegState;
46
47 #define mono_regstate_next_int(rs)   ((rs)->next_vireg++)
48 #define mono_regstate_next_float(rs) ((rs)->next_vfreg++)
49
50
51 MonoRegState* mono_regstate_new (void) MONO_INTERNAL;
52
53 void          mono_regstate_free      (MonoRegState *rs) MONO_INTERNAL;
54 void          mono_regstate_reset     (MonoRegState *rs) MONO_INTERNAL;
55 void          mono_regstate_assign    (MonoRegState *rs) MONO_INTERNAL;
56 int           mono_regstate_alloc_int   (MonoRegState *rs, regmask_t allow) MONO_INTERNAL;
57 void          mono_regstate_free_int  (MonoRegState *rs, int reg) MONO_INTERNAL;
58 int           mono_regstate_alloc_float (MonoRegState *rs, regmask_t allow) MONO_INTERNAL;
59 void          mono_regstate_free_float  (MonoRegState *rs, int reg) MONO_INTERNAL;
60 inline int    mono_regstate_next_long (MonoRegState *rs) MONO_INTERNAL;
61