diff options
| author | gingerBill <bill@gingerbill.org> | 2023-07-19 12:55:44 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-07-19 12:55:44 +0100 |
| commit | 32ac319525832794f3758daf3a08869deca30770 (patch) | |
| tree | f8a2778fa527a5d7bb70ca25f1f23217c7506871 /src/tilde_expr.cpp | |
| parent | 569397bd7eeb8db7aeff0033b3d8cb79af2c9893 (diff) | |
Implement if statements
Diffstat (limited to 'src/tilde_expr.cpp')
| -rw-r--r-- | src/tilde_expr.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/tilde_expr.cpp b/src/tilde_expr.cpp index e754d473f..61dabbb52 100644 --- a/src/tilde_expr.cpp +++ b/src/tilde_expr.cpp @@ -1850,15 +1850,13 @@ gb_internal cgValue cg_build_cond(cgProcedure *p, Ast *cond, TB_Node *true_block case_ast_node(be, BinaryExpr, cond); if (be->op.kind == Token_CmpAnd) { - TB_Node *block = tb_inst_region(p->func); - tb_inst_set_region_name(block, -1, "cmp.and"); + TB_Node *block = tb_inst_region_with_name(p->func, -1, "cmp_and"); cg_build_cond(p, be->left, block, false_block); tb_inst_set_control(p->func, block); cg_build_cond(p, be->right, true_block, false_block); return no_comptime_short_circuit; } else if (be->op.kind == Token_CmpOr) { - TB_Node *block = tb_inst_region(p->func); - tb_inst_set_region_name(block, -1, "cmp.or"); + TB_Node *block = tb_inst_region_with_name(p->func, -1, "cmp_or"); cg_build_cond(p, be->left, true_block, block); tb_inst_set_control(p->func, block); cg_build_cond(p, be->right, true_block, false_block); @@ -2053,12 +2051,9 @@ gb_internal cgValue cg_build_expr_internal(cgProcedure *p, Ast *expr) { cgValue incoming_values[2] = {}; TB_Node *incoming_regions[2] = {}; - TB_Node *then = tb_inst_region(p->func); - TB_Node *done = tb_inst_region(p->func); - TB_Node *else_ = tb_inst_region(p->func); - tb_inst_set_region_name(then, -1, "if.then"); - tb_inst_set_region_name(done, -1, "if.done"); - tb_inst_set_region_name(else_, -1, "if.else"); + TB_Node *then = tb_inst_region_with_name(p->func, -1, "if_then"); + TB_Node *done = tb_inst_region_with_name(p->func, -1, "if_done"); + TB_Node *else_ = tb_inst_region_with_name(p->func, -1, "if_else"); cg_build_cond(p, te->cond, then, else_); tb_inst_set_control(p->func, then); |