nir: move nir_block_ends_in_break() to nir.h

Will be used in a following commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12064>
This commit is contained in:
Timothy Arceri 2021-07-29 15:43:26 +10:00 committed by Marge Bot
parent a9ed4538ab
commit a7f2e683de
2 changed files with 11 additions and 11 deletions

View file

@ -2938,6 +2938,17 @@ nir_block_ends_in_jump(nir_block *block)
nir_block_last_instr(block)->type == nir_instr_type_jump;
}
static inline bool
nir_block_ends_in_break(nir_block *block)
{
if (exec_list_is_empty(&block->instr_list))
return false;
nir_instr *instr = nir_block_last_instr(block);
return instr->type == nir_instr_type_jump &&
nir_instr_as_jump(instr)->type == nir_jump_break;
}
#define nir_foreach_instr(instr, block) \
foreach_list_typed(nir_instr, instr, node, &(block)->instr_list)
#define nir_foreach_instr_reverse(instr, block) \

View file

@ -92,15 +92,4 @@ nir_is_trivial_loop_if(nir_if *nif, nir_block *break_block)
return true;
}
static inline bool
nir_block_ends_in_break(nir_block *block)
{
if (exec_list_is_empty(&block->instr_list))
return false;
nir_instr *instr = nir_block_last_instr(block);
return instr->type == nir_instr_type_jump &&
nir_instr_as_jump(instr)->type == nir_jump_break;
}
#endif /* NIR_LOOP_ANALYZE_H */