diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-16 00:20:18 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-16 00:20:18 +0200 |
| commit | a83f6a2e53de7a9322755d68ebc9f13e3babecc2 (patch) | |
| tree | 599c2a5173f42d5a9b99e5cfdc1dcfe288bb2165 /src/compiler.c | |
| parent | c85e4b4d2411e60af7387dec663ea62b03743eab (diff) | |
| download | ek-a83f6a2e53de7a9322755d68ebc9f13e3babecc2.tar.gz ek-a83f6a2e53de7a9322755d68ebc9f13e3babecc2.zip | |
rework
+ Kind of only a partial commit, but whatever, this history is pretty
ugly anyway
Diffstat (limited to 'src/compiler.c')
| -rw-r--r-- | src/compiler.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/compiler.c b/src/compiler.c index a096878..5845283 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -103,7 +103,6 @@ static int process(struct scope **parent, int public, const char *file) scope->fctx.fbuf = buf; scope->fctx.fname = strdup(file); - scope->actuals = create_actuals(); scope_set_flags(scope, SCOPE_FILE); if (*parent) @@ -173,31 +172,21 @@ int compile(const char *input, const char *output) { return ret; } - ret = actualize_main(root); - if (ret) { + if ((ret = actualize_main(root))) { destroy_scope(root); destroy_ast_nodes(); error("compilation of %s stopped due to errors", input); return ret; } - struct ops *ops = create_ops(); - ret = lower_ops(root, ops); - destroy_scope(root); - destroy_ast_nodes(); - - if (ret) { - destroy_ops(ops); - error("compilation of %s stopped due to errors", input); - return ret; - } - - ret = alloc_regs(ops); - if (ret) { - destroy_ops(ops); + if ((ret = lower_ops(root, output))) { + destroy_scope(root); + destroy_ast_nodes(); error("compilation of %s stopped due to errors", input); return ret; } - return print_asm(ops, output); + destroy_scope(root); + destroy_ast_nodes(); + return 0; } |
