diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-03 17:57:17 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-03 17:57:17 +0900 |
| commit | 5e630e9d34f082c5737cf61aa103b1db3c1ed6e8 (patch) | |
| tree | 1db8b06c0a9a70e442268abe9f3bc533144bd5f7 /main.c | |
| parent | 79e00de77709e1a8a9a12939c59606e38b27e52f (diff) | |
| download | P4Dcc-5e630e9d34f082c5737cf61aa103b1db3c1ed6e8.tar.gz P4Dcc-5e630e9d34f082c5737cf61aa103b1db3c1ed6e8.tar.zst P4Dcc-5e630e9d34f082c5737cf61aa103b1db3c1ed6e8.zip | |
for stmt
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -852,8 +852,8 @@ void gen_for_stmt(CODEGEN* g, AST* ast) { printf(" # gen_for_stmt\n"); int label = gen_new_label(g); - *g->loop_labels = label; g->loop_labels += 1; + *g->loop_labels = label; gen_expr(g, ast->expr1, GEN_RVAL); printf(".Lbegin%d:\n", label); @@ -875,14 +875,16 @@ void gen_break_stmt(CODEGEN* g, AST* ast) { assert_ast_kind(ast, AST_BREAK_STMT); printf(" # gen_break_stmt\n"); - todo(); + int label = *g->loop_labels; + printf(" jmp .Lend%d\n", label); } void gen_continue_stmt(CODEGEN* g, AST* ast) { assert_ast_kind(ast, AST_CONTINUE_STMT); printf(" # gen_continue_stmt\n"); - todo(); + int label = *g->loop_labels; + printf(" jmp .Lcontinue%d\n", label); } void gen_expr_stmt(CODEGEN* g, AST* ast) { |
