summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2012-10-18 09:47:08 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2012-10-19 09:31:59 +0200
commit674ca98846447eaacde47d5c1e81e1e0622bdc26 (patch)
tree4a03cc23fbf9e018059e8f52858a6f52daa3ca5b
parent047816dabd8d795a099cc46eebb896642d67297a (diff)
Let jump_to() handle setting the current block.
-rw-r--r--ast2firm.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/ast2firm.c b/ast2firm.c
index 47e19b9..6df004a 100644
--- a/ast2firm.c
+++ b/ast2firm.c
@@ -4501,6 +4501,7 @@ static void jump_to(ir_node *const target_block)
{
ir_node *const pred = currently_reachable() ? new_Jmp() : new_Bad(mode_X);
add_immBlock_pred(target_block, pred);
+ set_cur_block(target_block);
}
/**
@@ -4538,7 +4539,6 @@ static ir_node *do_while_statement_to_firm(do_while_statement_t *statement)
continue_label = header_block;
break_label = NULL;
- set_cur_block(body_block);
statement_to_firm(statement->body);
ir_node *const false_block = get_break_label();
@@ -4583,19 +4583,17 @@ static ir_node *for_statement_to_firm(for_statement_t *statement)
jump_to(header_block);
/* Create the condition. */
- ir_node *body_block;
ir_node *false_block;
expression_t *const cond = statement->condition;
if (cond && (is_constant_expression(cond) != EXPR_CLASS_CONSTANT || !fold_constant_to_bool(cond))) {
- body_block = new_immBlock();
false_block = new_immBlock();
- set_cur_block(header_block);
+ ir_node *const body_block = new_immBlock();
create_condition_evaluation(cond, body_block, false_block);
mature_immBlock(body_block);
+ set_cur_block(body_block);
} else {
/* for-ever. */
- body_block = header_block;
false_block = NULL;
keep_alive(header_block);
@@ -4615,7 +4613,6 @@ static ir_node *for_statement_to_firm(for_statement_t *statement)
break_label = false_block;
/* Create the loop body. */
- set_cur_block(body_block);
statement_to_firm(statement->body);
jump_if_reachable(step_block);
@@ -4761,7 +4758,6 @@ static ir_node *label_to_firm(const label_statement_t *statement)
ir_node *block = get_label_block(statement->label);
jump_to(block);
- set_cur_block(block);
keep_alive(block);
keep_all_memory(block);