Handle fallthrough when generating IR for case labels.
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 16 Nov 2007 23:01:46 +0000 (23:01 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 16 Nov 2007 23:01:46 +0000 (23:01 +0000)
[r18427]

ast2firm.c

index 552e961..749a3f6 100644 (file)
@@ -1840,6 +1840,8 @@ static void case_label_to_firm(const case_label_statement_t *statement)
 {
        dbg_info *dbgi = get_dbg_info(&statement->statement.source_position);
 
+       ir_node *const fallthrough = (get_cur_block() == NULL ? NULL : new_Jmp());
+
        /* let's create a node and hope firm constant folding creates a Const
         * node... */
        ir_node *proj;
@@ -1858,6 +1860,9 @@ static void case_label_to_firm(const case_label_statement_t *statement)
        }
 
        ir_node *block = new_immBlock();
+       if (fallthrough != NULL) {
+               add_immBlock_pred(block, fallthrough);
+       }
        add_immBlock_pred(block, proj);
        mature_immBlock(block);
 }