Commit 5b1f3d9c authored by Christoph Mallon's avatar Christoph Mallon
Browse files

beblocksched: Do not put the end block into the block schedule.

This way all the backends do not have to filter it by themselves.
parent 61566616
......@@ -179,6 +179,10 @@ static void collect_egde_frequency(ir_node *block, void *data)
{
blocksched_env_t *env = (blocksched_env_t*)data;
/* Exclude the end block from the block schedule. */
if (block == get_irg_end_block(env->irg))
return;
edge_t edge;
memset(&edge, 0, sizeof(edge));
......@@ -189,10 +193,9 @@ static void collect_egde_frequency(ir_node *block, void *data)
ir_loop *loop = get_irn_loop(block);
int arity = get_Block_n_cfgpreds(block);
if (arity == 0) {
/* must be the start block (or end-block for endless loops),
* everything else is dead code and should be removed by now */
assert(block == get_irg_start_block(env->irg)
|| block == get_irg_end_block(env->irg));
/* must be the start block, everything else is dead code and should be
* removed by now */
assert(block == get_irg_start_block(env->irg));
/* nothing to do here */
return;
} else if (arity == 1) {
......@@ -493,6 +496,8 @@ static blocksched_entry_t *finish_block_schedule(blocksched_env_t *env)
ir_reserve_resources(irg, IR_RESOURCE_IRN_VISITED);
inc_irg_visited(irg);
/* Exclude the end block from the block schedule. */
mark_irn_visited(get_irg_end_block(irg));
env->worklist = new_pdeq();
ir_node *const startblock = get_irg_start_block(irg);
......
......@@ -1484,10 +1484,6 @@ bool ia32_should_align_block(ir_node const *const block)
*/
static void ia32_emit_block_header(ir_node *block)
{
ir_graph *const irg = get_irn_irg(block);
if (block == get_irg_end_block(irg))
return;
if (ia32_cg_config.label_alignment > 0) {
/* align the current block if:
* a) if should be aligned due to its execution frequency
......
......@@ -1453,10 +1453,7 @@ void sparc_emit_function(ir_graph *irg)
pick_delay_slots(n_blocks, block_schedule);
for (size_t i = 0; i < n_blocks; ++i) {
ir_node *block = block_schedule[i];
if (block == get_irg_end_block(irg))
continue;
sparc_emit_block(block);
sparc_emit_block(block_schedule[i]);
}
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
......
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