Coverage Report

Created: 2018-07-03 15:31

/home/travis/build/MoarVM/MoarVM/src/jit/register.h
Line
Count
Source (jump to first uncovered line)
1
/* different places in which we can store stuff */
2
typedef enum {
3
    MVM_JIT_STORAGE_LOCAL,
4
    MVM_JIT_STORAGE_STACK,
5
    MVM_JIT_STORAGE_GPR,  /* general purpose register */
6
    MVM_JIT_STORAGE_FPR,  /* floating point register */
7
    MVM_JIT_STORAGE_NVR   /* non-volatile register */
8
}  MVMJitStorageClass;
9
10
/* a reference to a place something is stored */
11
typedef struct {
12
    MVMJitStorageClass _cls;
13
    MVMint32           _pos;
14
} MVMJitStorageRef; /* I'll never run out of names for a CONS */
15
16
17
/* REGISTER REQUIREMENT SPECIFICATION
18
 *
19
 * The goal is to represent required registers for a tile. I've assumed that 6
20
 * bits are sufficient to specify a register number (64 possibilities; for
21
 * x86-64 we'd need 16 for GPR, 16 for the FPR, so that'd be 32, and I'm not
22
 * 100% sure that using register numbers that way is right for the FPR/GPR
23
 * distinction.
24
 *
25
 * We need to encode two facts:
26
 * - this value needs to be in a register
27
 * - and that register should be $such
28
 *
29
 * So we use the following layout:
30
 *
31
 * +---------------+--------------------------+-------------------------------+
32
 * | Used? (1 bit) | Has Requirement? (1 bit) | Required register nr (6 bits) |
33
 * +---------------+--------------------------+-------------------------------+
34
 *
35
 * Which is then repeated four times over an unsgined 32 bit integer. The first
36
 * value always specifies the output register, so that we can determine if a
37
 * tile has any register output simply by (spec & 1).
38
 */
39
40
585k
#define MVM_JIT_REG_MK2(arch,name) arch ## _ ## name
41
585k
#define MVM_JIT_REG_MK1(arch,name) MVM_JIT_REG_MK2(arch,name)
42
585k
#define MVM_JIT_REG(name) MVM_JIT_REG_MK1(MVM_JIT_ARCH,name)
43
44
45
#define MVM_JIT_REGISTER_NONE 0
46
0
#define MVM_JIT_REGISTER_ANY  1
47
#define MVM_JIT_REGISTER_REQUIRE(name) (3 | ((MVM_JIT_REG(name)) << 2))
48
#define MVM_JIT_REGISTER_ENCODE(spec,n) ((spec) << (8*(n)))
49
50
9.26M
#define MVM_JIT_REGISTER_FETCH(spec,n) (((spec) >> (8*(n)))&0xff)
51
7.91M
#define MVM_JIT_REGISTER_IS_USED(desc) ((desc) & 1)
52
7.78M
#define MVM_JIT_REGISTER_HAS_REQUIREMENT(desc) (((desc) & 2) >> 1)
53
1.42M
#define MVM_JIT_REGISTER_REQUIREMENT(desc) (((desc) & 0xfc) >> 2)
54
55
56
57
void MVM_jit_linear_scan_allocate(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJitTileList *list);
58
void MVM_jit_arch_storage_for_arglist(MVMThreadContext *tc, MVMJitCompiler *compiler,
59
                                      MVMJitExprTree *tree, MVMint32 arglist_node,
60
                                      MVMJitStorageRef *storage);