aboutsummaryrefslogtreecommitdiffstats
path: root/src/viz.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/viz.c')
-rw-r--r--src/viz.c75
1 files changed, 42 insertions, 33 deletions
diff --git a/src/viz.c b/src/viz.c
index 3d6a0f7..8e31387 100644
--- a/src/viz.c
+++ b/src/viz.c
@@ -237,39 +237,41 @@ viz_symtables(Scope **scopes) {
237} 237}
238 238
239static const char* basm_op_str[] = { 239static const char* basm_op_str[] = {
240 [OP_ADD] = "add ", 240 [OP_ADD] = "add ",
241 [OP_SUB] = "sub ", 241 [OP_SUB] = "sub ",
242 [OP_MUL] = "mul ", 242 [OP_MUL] = "mul ",
243 [OP_DIV] = "div ", 243 [OP_DIV] = "div ",
244 [OP_MOD] = "mod ", 244 [OP_MOD] = "mod ",
245 [OP_LD8] = "ld8 ", 245 [OP_LD8] = "ld8 ",
246 [OP_LD16] = "ld16 ", 246 [OP_LD16] = "ld16 ",
247 [OP_LD32] = "ld32 ", 247 [OP_LD32] = "ld32 ",
248 [OP_LD64] = "ld64 ", 248 [OP_LD64] = "ld64 ",
249 [OP_ST8] = "st8 ", 249 [OP_ST8] = "st8 ",
250 [OP_ST16] = "st16 ", 250 [OP_ST16] = "st16 ",
251 [OP_ST32] = "st32 ", 251 [OP_ST32] = "st32 ",
252 [OP_ST64] = "st64 ", 252 [OP_ST64] = "st64 ",
253 [OP_CP8] = "cp8 ", 253 [OP_CP8] = "cp8 ",
254 [OP_CP16] = "cp16 ", 254 [OP_CP16] = "cp16 ",
255 [OP_CP32] = "cp32 ", 255 [OP_CP32] = "cp32 ",
256 [OP_CP64] = "cp64 ", 256 [OP_CP64] = "cp64 ",
257 [OP_NOT] = "not ", 257 [OP_NOT] = "not ",
258 [OP_AND] = "and ", 258 [OP_AND] = "and ",
259 [OP_OR] = "or ", 259 [OP_OR] = "or ",
260 [OP_XOR] = "xor ", 260 [OP_XOR] = "xor ",
261 [OP_LSHIFT] = "lshift", 261 [OP_LSHIFT] = "lshift",
262 [OP_RSHIFT] = "rshift", 262 [OP_RSHIFT] = "rshift",
263 [OP_LROT] = "lrot ", 263 [OP_LROT] = "lrot ",
264 [OP_RROT] = "rrot ", 264 [OP_RROT] = "rrot ",
265 [OP_LABEL] = "lab ", 265 [OP_LABEL] = "lab ",
266 [OP_JMP] = "jmp ", 266 [OP_JMP] = "jmp ",
267 [OP_JMP_EQ] = "jeq ", 267 [OP_JMP_TRUE] = "jt ",
268 [OP_JMP_NEQ] = "jne ", 268 [OP_JMP_FALSE] = "jf ",
269 [OP_JMP_GT] = "jgt ", 269 [OP_JMP_EQ] = "jeq ",
270 [OP_JMP_LT] = "jlt ", 270 [OP_JMP_NEQ] = "jne ",
271 [OP_JMP_GE] = "jge ", 271 [OP_JMP_GT] = "jgt ",
272 [OP_JMP_LE] = "jle ", 272 [OP_JMP_LT] = "jlt ",
273 [OP_JMP_GE] = "jge ",
274 [OP_JMP_LE] = "jle ",
273}; 275};
274 276
275void 277void
@@ -314,6 +316,13 @@ viz_instruction(Instruction *inst, LineInfo *line) {
314 printf(" "); 316 printf(" ");
315 viz_operand(inst->dst); 317 viz_operand(inst->dst);
316 } break; 318 } break;
319 case OP_JMP_TRUE:
320 case OP_JMP_FALSE: {
321 printf(" ");
322 viz_operand(inst->dst);
323 printf(", ");
324 viz_operand(inst->src_a);
325 } break;
317 default: { 326 default: {
318 printf(" "); 327 printf(" ");
319 viz_operand(inst->dst); 328 viz_operand(inst->dst);