pan/bi: Add bi_after_block_logical helper

Useful for lowering phis.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
Alyssa Rosenzweig 2022-05-12 11:43:54 -04:00 committed by Marge Bot
parent 29f53ee8bb
commit a2affda89d

View file

@ -1270,6 +1270,21 @@ bi_after_instr(bi_instr *instr)
};
}
static inline bi_cursor
bi_after_block_logical(bi_block *block)
{
if (list_is_empty(&block->instructions))
return bi_after_block(block);
bi_instr *last = list_last_entry(&block->instructions, bi_instr, link);
assert(last != NULL);
if (last->branch_target)
return bi_before_instr(last);
else
return bi_after_block(block);
}
static inline bi_cursor
bi_before_nonempty_block(bi_block *block)
{