pan/bi: Lift bi_predecessor_index helper
From AGX for handling phi node. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
committed by
Marge Bot
parent
a2affda89d
commit
181ed2d99a
@@ -1060,6 +1060,23 @@ bi_node_to_index(unsigned node, unsigned node_count)
|
||||
bi_foreach_instr_in_tuple(tuple, ins) \
|
||||
bi_foreach_src(ins, s)
|
||||
|
||||
/*
|
||||
* Find the index of a predecessor, used as the implicit order of phi sources.
|
||||
*/
|
||||
static inline unsigned
|
||||
bi_predecessor_index(bi_block *succ, bi_block *pred)
|
||||
{
|
||||
unsigned index = 0;
|
||||
|
||||
bi_foreach_predecessor(succ, x) {
|
||||
if (*x == pred) return index;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
unreachable("Invalid predecessor");
|
||||
}
|
||||
|
||||
static inline bi_instr *
|
||||
bi_prev_op(bi_instr *ins)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user