e5d6ae6bdb82618cfa703fd77e2811170f68788e
[mono.git] / mono / mini / regalloc.h
1 /**
2  * \file
3  */
4
5 #if defined(__native_client__) && defined(__x86_64__)
6 typedef guint64 regmask_t;
7 #else
8 typedef size_t regmask_t;
9 #endif
10
11 enum {
12         MONO_REG_INT,
13         MONO_REG_DOUBLE,
14         /* This is used only for allocating spill slots with GC tracking */
15         MONO_REG_INT_REF,
16         /* Ditto for managed pointers */
17         MONO_REG_INT_MP,
18         MONO_REG_SIMD
19 };
20
21  
22 #ifdef MONO_ARCH_NEED_SIMD_BANK
23 #define MONO_NUM_REGBANKS 5
24 #else
25 #define MONO_NUM_REGBANKS 4
26 #endif
27
28 typedef struct {
29         /* symbolic registers */
30         int next_vreg;
31
32         regmask_t ifree_mask;
33         regmask_t free_mask [MONO_NUM_REGBANKS];
34
35         /* symbolic -> hard register assignment */
36         /* 
37          * If the register is spilled, then this contains -spill - 1, where 'spill'
38          * is the index of the spill variable.
39          */
40         gint32 *vassign;
41
42         /* hard -> symbolic */
43         int isymbolic [MONO_MAX_IREGS];
44         int fsymbolic [MONO_MAX_FREGS];
45 #ifdef MONO_ARCH_NEED_SIMD_BANK
46         int xsymbolic [MONO_MAX_XREGS];
47 #endif
48         /* Points to the arrays above */
49         int *symbolic [MONO_NUM_REGBANKS];
50
51         int vassign_size;
52 } MonoRegState;
53
54 MonoRegState* mono_regstate_new (void);
55
56 void          mono_regstate_free      (MonoRegState *rs);