static bool
visit_phi_src(nir_phi_instr *instr, nir_foreach_src_cb cb, void *state)
{
- nir_foreach_phi_src(instr, src) {
+ nir_foreach_phi_src(src, instr) {
if (!visit_src(&src->src, cb, state))
return false;
}
nir_src src;
} nir_phi_src;
-#define nir_foreach_phi_src(phi, entry) \
- foreach_list_typed(nir_phi_src, entry, node, &(phi)->srcs)
-#define nir_foreach_phi_src_safe(phi, entry) \
- foreach_list_typed_safe(nir_phi_src, entry, node, &(phi)->srcs)
+#define nir_foreach_phi_src(phi_src, phi) \
+ foreach_list_typed(nir_phi_src, phi_src, node, &(phi)->srcs)
+#define nir_foreach_phi_src_safe(phi_src, phi) \
+ foreach_list_typed_safe(nir_phi_src, phi_src, node, &(phi)->srcs)
typedef struct {
nir_instr instr;
break;
nir_phi_instr *phi = nir_instr_as_phi(instr);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
if (src->pred == old_pred) {
src->pred = new_pred;
break;
break;
nir_phi_instr *phi = nir_instr_as_phi(instr);
- nir_foreach_phi_src_safe(phi, src) {
+ nir_foreach_phi_src_safe(src, phi) {
if (src->pred == pred) {
list_del(&src->src.use_link);
exec_node_remove(&src->node);
nir_phi_instr *phi = nir_instr_as_phi(instr);
assert(phi->dest.is_ssa);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
nir_parallel_copy_instr *pcopy =
get_parallel_copy_at_end_of_block(src->pred);
assert(pcopy);
assert(phi->dest.is_ssa);
merge_node *dest_node = get_merge_node(&phi->dest.ssa, state);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
assert(src->src.is_ssa);
merge_node *src_node = get_merge_node(src->src.ssa, state);
if (src_node->set != dest_node->set)
unsigned num_preds = instr->instr.block->predecessors->entries;
NIR_VLA(nir_phi_src *, srcs, num_preds);
unsigned i = 0;
- nir_foreach_phi_src(instr, src) {
+ nir_foreach_phi_src(src, instr) {
srcs[i++] = src;
}
if (phi1->instr.block != phi2->instr.block)
return false;
- nir_foreach_phi_src(phi1, src1) {
- nir_foreach_phi_src(phi2, src2) {
+ nir_foreach_phi_src(src1, phi1) {
+ nir_foreach_phi_src(src2, phi2) {
if (src1->pred == src2->pred) {
if (!nir_srcs_equal(src1->src, src2->src))
return false;
break;
nir_phi_instr *phi = nir_instr_as_phi(instr);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
if (src->pred == pred) {
set_src_live(&src->src, live);
break;
bool scalarizable = true;
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
scalarizable = is_phi_src_scalarizable(src, state);
if (!scalarizable)
break;
vec->src[i].src = nir_src_for_ssa(&new_phi->dest.ssa);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
/* We need to insert a mov to grab the i'th component of src */
nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx,
nir_op_imov);
nir_phi_instr *phi = nir_instr_as_phi(instr);
nir_ssa_def *def = NULL;
- nir_foreach_phi_src(phi, phi_src) {
+ nir_foreach_phi_src(phi_src, phi) {
if (phi_src->pred != last_block)
continue;
if (use_instr->type == nir_instr_type_phi) {
nir_phi_instr *phi = nir_instr_as_phi(use_instr);
- nir_foreach_phi_src(phi, phi_src) {
+ nir_foreach_phi_src(phi_src, phi) {
if (phi_src->src.ssa == def)
lca = nir_dominance_lca(lca, phi_src->pred);
}
memset(sel->src[0].swizzle, 0, sizeof sel->src[0].swizzle);
assert(exec_list_length(&phi->srcs) == 2);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
assert(src->pred == then_block || src->pred == else_block);
assert(src->src.is_ssa);
nir_ssa_def *def = NULL;
bool srcs_same = true;
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
assert(src->src.is_ssa);
/* For phi nodes at the beginning of loops, we may encounter some
FILE *fp = state->fp;
print_dest(&instr->dest, state);
fprintf(fp, " = phi ");
- nir_foreach_phi_src(instr, src) {
+ nir_foreach_phi_src(src, instr) {
if (&src->node != exec_list_get_head(&instr->srcs))
fprintf(fp, ", ");
state->parent_instr = instr;
- nir_foreach_phi_src(phi_instr, src) {
+ nir_foreach_phi_src(src, phi_instr) {
if (src->pred == pred) {
rewrite_use(&src->src, state);
break;
assert(instr->dest.is_ssa);
exec_list_validate(&instr->srcs);
- nir_foreach_phi_src(instr, src) {
+ nir_foreach_phi_src(src, instr) {
if (src->pred == pred) {
assert(src->src.is_ssa);
assert(src->src.ssa->num_components ==
memset(sel->src[0].swizzle, 0, sizeof sel->src[0].swizzle);
assert(exec_list_length(&phi->srcs) == 2);
- nir_foreach_phi_src(phi, src) {
+ nir_foreach_phi_src(src, phi) {
assert(src->pred == then_block || src->pred == else_block);
assert(src->src.is_ssa);