aboutsummaryrefslogtreecommitdiffhomepage
path: root/codegen.c
diff options
context:
space:
mode:
Diffstat (limited to 'codegen.c')
-rw-r--r--codegen.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/codegen.c b/codegen.c
index 234b4e5..0a90602 100644
--- a/codegen.c
+++ b/codegen.c
@@ -268,9 +268,8 @@ void codegen_func_call(CodeGen* g, AstNode* ast) {
}
void codegen_lvar(CodeGen* g, AstNode* ast, GenMode gen_mode) {
- int offset = 8 + ast->node_idx * 8;
printf(" mov rax, rbp\n");
- printf(" sub rax, %d\n", offset);
+ printf(" sub rax, %d\n", ast->node_stack_offset);
printf(" push rax\n");
if (gen_mode == GenMode_rval) {
codegen_lval2rval(ast->ty);