aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/generator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/generator.c b/src/generator.c
index 0e79c07..7a960bf 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -100,9 +100,12 @@ void gen_function_declaration(const char name[], int return_type,
100void gen_function_end_declaration() { 100void gen_function_end_declaration() {
101 fprintf(output, "mov rsp, rbp\npop rbp\nret\n"); 101 fprintf(output, "mov rsp, rbp\npop rbp\nret\n");
102} 102}
103
103int gen_function_call(const char name[], int nb_param) { 104int gen_function_call(const char name[], int nb_param) {
105 Type return_type = fun_lookup(name, nb_param);
104 fprintf(output, "call %s\n", name); 106 fprintf(output, "call %s\n", name);
105 return fun_lookup(name, nb_param); 107 if (return_type != VOID) fprintf(output, "push rax\n");
108 return return_type;
106} 109}
107 110
108void gen_declaration(const char name[], int type, Scope scope) { 111void gen_declaration(const char name[], int type, Scope scope) {