Commit a572aa3c authored by Matthias Braun's avatar Matthias Braun
Browse files

fix bestate code not respecting prolog/epilog

parent 8737c443
......@@ -135,7 +135,8 @@ static spill_info_t *create_spill(minibelady_env_t *env, ir_node *state, int for
do {
after = next;
next = sched_next(after);
} while (is_Proj(next) || is_Phi(next) || be_is_Keep(next));
} while (is_Proj(next) || is_Phi(next) || be_is_Keep(next)
|| (arch_irn_get_flags(next) & arch_irn_flags_prolog));
} else {
after = state;
}
......@@ -351,6 +352,17 @@ static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
return block_info;
}
static ir_node *get_reload_point(ir_node *before)
{
while (true) {
ir_node *prev = sched_prev(before);
if (! (arch_irn_get_flags(prev) & arch_irn_flags_epilog))
break;
before = prev;
}
return before;
}
/**
* For the given block @p block, decide for each values
* whether it is used from a register or is reloaded
......@@ -408,7 +420,8 @@ static void belady(minibelady_env_t *env, ir_node *block)
/* create a reload to match state if necessary */
if (need_val != NULL && need_val != current_state) {
DBG((dbg, LEVEL_3, "\t... reloading %+F\n", need_val));
create_reload(env, need_val, node, current_state);
ir_node *before = get_reload_point(node);
create_reload(env, need_val, before, current_state);
current_state = need_val;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment