mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 15:20:10 +01:00
nir: Use a switch statement in nir_handle_add_jump
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5101>
This commit is contained in:
parent
8c87082c94
commit
d011fbde5c
1 changed files with 21 additions and 14 deletions
|
|
@ -471,21 +471,28 @@ nir_handle_add_jump(nir_block *block)
|
|||
nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node);
|
||||
nir_metadata_preserve(impl, nir_metadata_none);
|
||||
|
||||
if (jump_instr->type == nir_jump_break ||
|
||||
jump_instr->type == nir_jump_continue) {
|
||||
nir_loop *loop = nearest_loop(&block->cf_node);
|
||||
|
||||
if (jump_instr->type == nir_jump_continue) {
|
||||
nir_block *first_block = nir_loop_first_block(loop);
|
||||
link_blocks(block, first_block, NULL);
|
||||
} else {
|
||||
nir_cf_node *after = nir_cf_node_next(&loop->cf_node);
|
||||
nir_block *after_block = nir_cf_node_as_block(after);
|
||||
link_blocks(block, after_block, NULL);
|
||||
}
|
||||
} else {
|
||||
assert(jump_instr->type == nir_jump_return);
|
||||
switch (jump_instr->type) {
|
||||
case nir_jump_return:
|
||||
link_blocks(block, impl->end_block, NULL);
|
||||
break;
|
||||
|
||||
case nir_jump_break: {
|
||||
nir_loop *loop = nearest_loop(&block->cf_node);
|
||||
nir_cf_node *after = nir_cf_node_next(&loop->cf_node);
|
||||
nir_block *after_block = nir_cf_node_as_block(after);
|
||||
link_blocks(block, after_block, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_jump_continue: {
|
||||
nir_loop *loop = nearest_loop(&block->cf_node);
|
||||
nir_block *first_block = nir_loop_first_block(loop);
|
||||
link_blocks(block, first_block, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
unreachable("Invalid jump type");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue