diff options
Diffstat (limited to 'src/gas_assembly_generator.c')
-rw-r--r-- | src/gas_assembly_generator.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gas_assembly_generator.c b/src/gas_assembly_generator.c index 00897fd..bf98255 100644 --- a/src/gas_assembly_generator.c +++ b/src/gas_assembly_generator.c @@ -100,27 +100,26 @@ gas_assembly_generator_binary_operation(ast_visitor_t *visitor, ast_binary_opera fprintf(gen->out, " pop %%rcx\n"); - if (string_view_eq(binary_operation->op, string_view_from_str("+"))) { + if (binary_operation->kind == AST_BINOP_ADITION) { fprintf(gen->out, " add %%rcx, %%rax\n"); return; } - if (string_view_eq(binary_operation->op, string_view_from_str("-"))) { + if (binary_operation->kind == AST_BINOP_SUBTRACTION) { fprintf(gen->out, " sub %%rcx, %%rax\n"); return; } - if (string_view_eq(binary_operation->op, string_view_from_str("*"))) { + if (binary_operation->kind == AST_BINOP_MULTIPLICATION) { fprintf(gen->out, " mul %%rcx\n"); return; } - if (string_view_eq(binary_operation->op, string_view_from_str("/"))) { + if (binary_operation->kind == AST_BINOP_DIVISION) { fprintf(gen->out, " xor %%rdx, %%rdx\n"); fprintf(gen->out, " div %%rcx\n"); return; } - fprintf(stderr, "no strategy defined for: " SVFMT "\n", SVARG(&binary_operation->op)); - assert(false); + assert(false && "No strategy defined for binary operation"); } |