agx: add more iterator macros

will be used for spiller.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28483>
This commit is contained in:
Alyssa Rosenzweig 2024-02-22 08:28:42 -04:00 committed by Marge Bot
parent 645f5187ed
commit ffd2b846c4
2 changed files with 27 additions and 0 deletions

View File

@ -196,6 +196,7 @@ ForEachMacros:
- agx_foreach_block_from_rev
- agx_foreach_block_rev
- agx_foreach_dest
- agx_foreach_dest_rev
- agx_foreach_instr_global
- agx_foreach_instr_global_rev
- agx_foreach_instr_global_safe
@ -208,10 +209,14 @@ ForEachMacros:
- agx_foreach_instr_in_block_safe_rev
- agx_foreach_non_phi_in_block_rev
- agx_foreach_phi_in_block
- agx_foreach_phi_in_block_safe
- agx_foreach_predecessor
- agx_foreach_src
- agx_foreach_src_rev
- agx_foreach_ssa_dest
- agx_foreach_ssa_dest_rev
- agx_foreach_ssa_src
- agx_foreach_ssa_src_rev
- agx_foreach_successor
# radv

View File

@ -639,16 +639,30 @@ agx_start_block(agx_context *ctx)
#define agx_foreach_src(ins, v) for (unsigned v = 0; v < ins->nr_srcs; ++v)
#define agx_foreach_src_rev(ins, v) \
for (signed v = ins->nr_srcs - 1; v >= 0; --v)
#define agx_foreach_dest(ins, v) for (unsigned v = 0; v < ins->nr_dests; ++v)
#define agx_foreach_dest_rev(ins, v) \
for (signed v = ins->nr_dests - 1; v >= 0; --v)
#define agx_foreach_ssa_src(ins, v) \
agx_foreach_src(ins, v) \
if (ins->src[v].type == AGX_INDEX_NORMAL)
#define agx_foreach_ssa_src_rev(ins, v) \
agx_foreach_src_rev(ins, v) \
if (ins->src[v].type == AGX_INDEX_NORMAL)
#define agx_foreach_ssa_dest(ins, v) \
agx_foreach_dest(ins, v) \
if (ins->dest[v].type == AGX_INDEX_NORMAL)
#define agx_foreach_ssa_dest_rev(ins, v) \
agx_foreach_dest_rev(ins, v) \
if (ins->dest[v].type == AGX_INDEX_NORMAL)
/* Phis only come at the start (after else instructions) so we stop as soon as
* we hit a non-phi
*/
@ -660,6 +674,14 @@ agx_start_block(agx_context *ctx)
break; \
else
#define agx_foreach_phi_in_block_safe(block, v) \
agx_foreach_instr_in_block_safe(block, v) \
if (v->op == AGX_OPCODE_ELSE_ICMP || v->op == AGX_OPCODE_ELSE_FCMP) \
continue; \
else if (v->op != AGX_OPCODE_PHI) \
break; \
else
/*
* Find the index of a predecessor, used as the implicit order of phi sources.
*/