]> git.bts.cx Git - sun.git/blob - runtime/src/sun/vm/instruction.c
Fixed syntax for definitions
[sun.git] / runtime / src / sun / vm / instruction.c
1 #include <sun/vm/instruction.h>
2
3 #include <assert.h>
4
5 static_assert(sizeof(SVMInstruction) == sizeof(SVMOpcode) + sizeof(SVMOperand) * 3, "invalid size");
6 static_assert(sizeof(SVMOperand) == sizeof(uint32_t), "raw will not work...");
7
8 const char *svmOpcodeToString(SVMOpcode opcode) {
9 switch(opcode) {
10 default:
11 case SVMOpcodeInvalid:
12 return "<invalid>";
13
14 case SVMOpcodeMOV:
15 return "MOV";
16
17 case SVMOpcodeSET:
18 return "SET";
19
20 case SVMOpcodeINV:
21 return "INV";
22
23 case SVMOpcodeBNOT:
24 return "BNOT";
25
26 case SVMOpcodeNOT:
27 return "NOT";
28
29 case SVMOpcodeADD:
30 return "ADD";
31
32 case SVMOpcodeSUB:
33 return "SUB";
34
35 case SVMOpcodeMUL:
36 return "MUL";
37
38 case SVMOpcodeDIV:
39 return "DIV";
40
41 case SVMOpcodeMOD:
42 return "MOD";
43
44 case SVMOpcodeBAND:
45 return "BAND";
46
47 case SVMOpcodeBOR:
48 return "BOR";
49
50 case SVMOpcodeBXOR:
51 return "BXOR";
52
53 case SVMOpcodeAND:
54 return "AND";
55
56 case SVMOpcodeOR:
57 return "OR";
58
59 case SVMOpcodeEQ:
60 return "EQ";
61
62 case SVMOpcodeNEQ:
63 return "NEQ";
64
65 case SVMOpcodeLT:
66 return "LT";
67
68 case SVMOpcodeLTEQ:
69 return "LTEQ";
70
71 case SVMOpcodeGT:
72 return "GT";
73
74 case SVMOpcodeGTEQ:
75 return "GTEQ";
76
77 case SVMOpcodeSLEEP:
78 return "SLEEP";
79
80 case SVMOpcodeSTK:
81 return "STK";
82
83 case SVMOpcodePOPJUMP:
84 return "POPJUMP";
85
86 case SVMOpcodeJUMP:
87 return "JUMP";
88
89 case SVMOpcodePUSHJUMP:
90 return "PUSHJUMP";
91
92 case SVMOpcodeCALL:
93 return "CALL";
94
95 case SVMOpcodeJT:
96 return "JT";
97 }
98 }