return exec_node_data(nir_instr, tail, node);
}
+static inline bool
+nir_block_ends_in_jump(nir_block *block)
+{
+ return !exec_list_is_empty(&block->instr_list) &&
+ nir_block_last_instr(block)->type == nir_instr_type_jump;
+}
+
#define nir_foreach_instr(instr, block) \
foreach_list_typed(nir_instr, instr, node, &(block)->instr_list)
#define nir_foreach_instr_reverse(instr, block) \
*/
/*@{*/
-static bool
-block_ends_in_jump(nir_block *block)
-{
- return !exec_list_is_empty(&block->instr_list) &&
- nir_block_last_instr(block)->type == nir_instr_type_jump;
-}
-
static inline void
block_add_pred(nir_block *block, nir_block *pred)
{
nir_block *last_then_block = nir_if_last_then_block(if_stmt);
nir_block *last_else_block = nir_if_last_else_block(if_stmt);
- if (!block_ends_in_jump(last_then_block)) {
+ if (!nir_block_ends_in_jump(last_then_block)) {
unlink_block_successors(last_then_block);
link_blocks(last_then_block, block, NULL);
}
- if (!block_ends_in_jump(last_else_block)) {
+ if (!nir_block_ends_in_jump(last_else_block)) {
unlink_block_successors(last_else_block);
link_blocks(last_else_block, block, NULL);
}
new_block->cf_node.parent = block->cf_node.parent;
exec_node_insert_after(&block->cf_node.node, &new_block->cf_node.node);
- if (block_ends_in_jump(block)) {
+ if (nir_block_ends_in_jump(block)) {
/* Figure out what successor block would've had if it didn't have a jump
* instruction, and make new_block have that successor.
*/
* TODO: special case when before is empty and after isn't?
*/
- if (block_ends_in_jump(before)) {
+ if (nir_block_ends_in_jump(before)) {
assert(exec_list_is_empty(&after->instr_list));
if (after->successors[0])
remove_phi_src(after->successors[0], after);
* already been setup with the correct successors, so we need to set
* up jumps here as the block is being inserted.
*/
- if (block_ends_in_jump(block))
+ if (nir_block_ends_in_jump(block))
nir_handle_add_jump(block);
stitch_blocks(block, after);
return true;
}
-static bool
-ends_in_jump(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;
-}
-
static bool
dead_cf_list(struct exec_list *list, bool *list_ends_in_jump)
{
progress = true;
}
- if (ends_in_jump(block)) {
+ if (nir_block_ends_in_jump(block)) {
*list_ends_in_jump = true;
if (!exec_node_is_tail_sentinel(cur->node.next)) {