-
Notifications
You must be signed in to change notification settings - Fork 5
/
virtual_opcodes.h
67 lines (53 loc) · 969 Bytes
/
virtual_opcodes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef VIRTUAL_OPCODES_H
#define VIRTUAL_OPCODES_H
#include <stdbool.h>
static const char* vopcode_names[] = {
"add", "sub", "mul", "div", "mod", "fadd", "fsub", "fmul", "fdiv", "fmod", "sitofp", "fptosi", "and",
"or", "xor", "not", "mov", "load", "lea", "store", "push", "pop", "enter", "leave", "call", "ret",
"test", "cmp", "jmp", "jnz", "jz", "jle", "jge", "jg", "jl", "label", "alloca", "hlt", NULL};
typedef enum
{
VOP_ADD,
VOP_SUB,
VOP_MUL,
VOP_DIV,
VOP_MOD,
VOP_FADD,
VOP_FSUB,
VOP_FMUL,
VOP_FDIV,
VOP_FMOD,
VOP_SITOFP,
VOP_FPTOSI,
VOP_AND,
VOP_OR,
VOP_XOR,
VOP_NOT,
VOP_MOV,
VOP_LOAD,
VOP_LEA,
VOP_STORE,
VOP_PUSH,
VOP_POP,
VOP_ENTER,
VOP_LEAVE,
VOP_CALL,
VOP_RET,
VOP_TEST,
VOP_CMP,
VOP_JMP,
VOP_JNZ,
VOP_JZ,
VOP_JLE,
VOP_JGE,
VOP_JG,
VOP_JL,
VOP_LABEL,
VOP_ALLOCA,
VOP_HLT
} vopcode_t;
static bool vopcode_overwrites_first_operand(vopcode_t op)
{
return op <= VOP_LEA;
}
#endif