X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=inline;f=ast2firm.c;h=a7d60dd7346864eb3a592786b20736ddac5d3342;hb=99ae9203c924c96590375ffb7791dd77a75804d1;hp=829a4d28d86b5552e2e6ed9dac76f92644531e61;hpb=6f412788b166fc65c92444c7aedbeaeeabc67f43;p=cparser diff --git a/ast2firm.c b/ast2firm.c index 829a4d2..a7d60dd 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -4982,18 +4982,13 @@ static void while_statement_to_firm(while_statement_t *statement) static void do_while_statement_to_firm(do_while_statement_t *statement) { - ir_node *jmp = NULL; - if (get_cur_block() != NULL) { - jmp = new_Jmp(); - } - /* create the header block */ ir_node *header_block = new_immBlock(); /* the loop body */ ir_node *body_block = new_immBlock(); - if (jmp != NULL) { - add_immBlock_pred(body_block, jmp); + if (get_cur_block() != NULL) { + add_immBlock_pred(body_block, new_Jmp()); } ir_node *old_continue_label = continue_label; @@ -5221,9 +5216,7 @@ static void switch_statement_to_firm(switch_statement_t *statement) set_Cond_default_proj(cond, default_proj_nr); } - if (statement->body != NULL) { - statement_to_firm(statement->body); - } + statement_to_firm(statement->body); if (get_cur_block() != NULL) { ir_node *jmp = new_Jmp(); @@ -5255,11 +5248,14 @@ static void case_label_to_firm(const case_label_statement_t *statement) dbg_info *dbgi = get_dbg_info(&statement->base.source_position); - ir_node *const fallthrough = (get_cur_block() == NULL ? NULL : new_Jmp()); - ir_node *proj; ir_node *block = new_immBlock(); + if (get_cur_block() != NULL) { + /* Fallthrough from previous case */ + add_immBlock_pred(block, new_Jmp()); + } + if (current_switch_cond != NULL) { set_cur_block(get_nodes_block(current_switch_cond)); if (statement->expression != NULL) { @@ -5280,15 +5276,10 @@ static void case_label_to_firm(const case_label_statement_t *statement) } } - if (fallthrough != NULL) { - add_immBlock_pred(block, fallthrough); - } mature_immBlock(block); set_cur_block(block); - if (statement->statement != NULL) { - statement_to_firm(statement->statement); - } + statement_to_firm(statement->statement); } static void label_to_firm(const label_statement_t *statement) @@ -5304,9 +5295,7 @@ static void label_to_firm(const label_statement_t *statement) keep_alive(block); keep_all_memory(block); - if (statement->statement != NULL) { - statement_to_firm(statement->statement); - } + statement_to_firm(statement->statement); } static void goto_to_firm(const goto_statement_t *statement)