From a83f6a2e53de7a9322755d68ebc9f13e3babecc2 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 16 Feb 2024 00:20:18 +0200 Subject: rework + Kind of only a partial commit, but whatever, this history is pretty ugly anyway --- src/compiler.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'src/compiler.c') 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; } -- cgit v1.3