nir: Switch the arguments to nir_foreach_use and friends
[mesa.git] / src / compiler / nir / nir_opt_peephole_select.c
index d783f7b6195b2d1d3990522ac8afa1639e9f1eeb..7fcc71ea9d7645e590bdb13f50f69a943c6e9a27 100644 (file)
@@ -50,7 +50,7 @@
 static bool
 block_check_for_allowed_instrs(nir_block *block)
 {
-   nir_foreach_instr(block, instr) {
+   nir_foreach_instr(instr, block) {
       switch (instr->type) {
       case nir_instr_type_intrinsic: {
          nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
@@ -108,7 +108,7 @@ block_check_for_allowed_instrs(nir_block *block)
             return false;
 
          /* The only uses of this definition must be phi's in the successor */
-         nir_foreach_use(&mov->dest.dest.ssa, use) {
+         nir_foreach_use(use, &mov->dest.dest.ssa) {
             if (use->parent_instr->type != nir_instr_type_phi ||
                 use->parent_instr->block != block->successors[0])
                return false;
@@ -171,19 +171,19 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx)
     * block before.  We have already guaranteed that this is safe by
     * calling block_check_for_allowed_instrs()
     */
-   nir_foreach_instr_safe(then_block, instr) {
+   nir_foreach_instr_safe(instr, then_block) {
       exec_node_remove(&instr->node);
       instr->block = prev_block;
       exec_list_push_tail(&prev_block->instr_list, &instr->node);
    }
 
-   nir_foreach_instr_safe(else_block, instr) {
+   nir_foreach_instr_safe(instr, else_block) {
       exec_node_remove(&instr->node);
       instr->block = prev_block;
       exec_list_push_tail(&prev_block->instr_list, &instr->node);
    }
 
-   nir_foreach_instr_safe(block, instr) {
+   nir_foreach_instr_safe(instr, block) {
       if (instr->type != nir_instr_type_phi)
          break;
 
@@ -194,7 +194,7 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx)
       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);
 
@@ -239,7 +239,7 @@ nir_opt_peephole_select(nir_shader *shader)
 {
    bool progress = false;
 
-   nir_foreach_function(shader, function) {
+   nir_foreach_function(function, shader) {
       if (function->impl)
          progress |= nir_opt_peephole_select_impl(function->impl);
    }