aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-05-03 20:12:55 +0900
committernsfisis <nsfisis@gmail.com>2025-05-03 20:12:55 +0900
commit9de8ac56f23bb3a8a0adb40c359f0a83c839f9f2 (patch)
tree8955f4246bb3b2c2471eaf2bd8fedb3e425d4616 /main.c
parent7570e8a0af6b4d8ea28d422cd8e4645fb23300af (diff)
downloadP4Dcc-9de8ac56f23bb3a8a0adb40c359f0a83c839f9f2.tar.gz
P4Dcc-9de8ac56f23bb3a8a0adb40c359f0a83c839f9f2.tar.zst
P4Dcc-9de8ac56f23bb3a8a0adb40c359f0a83c839f9f2.zip
fizzbuzz
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index 5c86d53..13bd3ac 100644
--- a/main.c
+++ b/main.c
@@ -979,6 +979,7 @@ void gen_func_call(CODEGEN* g, AST* ast) {
}
}
// TODO: rsp align
+ printf(" mov rax, 0\n");
printf(" call %s\n", func_name);
printf(" push rax\n");
}
@@ -1141,10 +1142,9 @@ void gen(CODEGEN* g, AST* ast) {
printf(".intel_syntax noprefix\n\n");
- int str_index = 1;
char** str_lit = ast->str_literals;
while (*str_lit) {
- printf(".Lstr__%d:\n", str_index);
+ printf(".Lstr__%d:\n", str_lit - ast->str_literals + 1);
printf(" .string \"%s\"\n\n", *str_lit);
str_lit += 1;
}