Skip to content

Commit

Permalink
Branch instructions must be at end of basic blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
rui314 committed Sep 1, 2018
1 parent d8cc52f commit 6f7c3f2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gen_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,15 @@ static void gen_stmt(Node *node) {
break;
case ND_BREAK:
jmp(node->target->break_);
out = new_bb();
break;
case ND_CONTINUE:
jmp(node->target->continue_);
out = new_bb();
break;
case ND_RETURN: {
emit1(IR_RETURN, gen_expr(node->expr));

BB *bb = new_bb();
jmp(bb);
out = bb;
out = new_bb();
return;
}
case ND_EXPR_STMT:
Expand Down

0 comments on commit 6f7c3f2

Please sign in to comment.