[Mesa-dev] [PATCH 0/6] nir: Make the nir_foreach helpers consistent

Jason Ekstrand jason at jlekstrand.net
Wed Apr 27 03:41:44 UTC 2016


I think things started out consistent when we first merged NIR since there
weren't a lot of helpers.  Over time, however, more nir_foreach helpers
have been added and they haven't had a consistent argument order.  This has
been annoying me for a while ("Which way does this one work again?") and
this little series fixes that problem once and for all.

With this series, all of the macros are of the form

nir_foreach_foo(foo, container)

which matches "for (x : container)" in C++11 or Java and "for x in
container" from python, shell, etc.  I think exec_list from the glsl
compiler also tries to follow this convention.

This series applies on top of Connor's series to rework nir_foreach_block

Jason Ekstrand (6):
  nir: Switch the arguments to nir_foreach_instr
  nir: Switch the arguments to nir_foreach_phi_src
  nir: Switch the arguments to nir_foreach_parallel_copy_entry
  nir: Switch the arguments to nir_foreach_function
  nir: Switch the arguments to nir_foreach_use and friends
  nir: Switch the arguments to nir_foreach_def

 src/compiler/nir/nir.c                             | 18 ++++++------
 src/compiler/nir/nir.h                             | 34 +++++++++++-----------
 src/compiler/nir/nir_algebraic.py                  |  4 +--
 src/compiler/nir/nir_clone.c                       |  4 +--
 src/compiler/nir/nir_control_flow.c                | 16 +++++-----
 src/compiler/nir/nir_dominance.c                   |  8 ++---
 src/compiler/nir/nir_from_ssa.c                    | 22 +++++++-------
 src/compiler/nir/nir_gather_info.c                 |  2 +-
 src/compiler/nir/nir_gs_count_vertices.c           |  4 +--
 src/compiler/nir/nir_inline_functions.c            |  8 ++---
 src/compiler/nir/nir_instr_set.c                   |  6 ++--
 src/compiler/nir/nir_liveness.c                    | 10 +++----
 src/compiler/nir/nir_lower_alu_to_scalar.c         |  4 +--
 src/compiler/nir/nir_lower_atomics.c               |  4 +--
 src/compiler/nir/nir_lower_clip.c                  |  8 ++---
 src/compiler/nir/nir_lower_double_packing.c        |  4 +--
 src/compiler/nir/nir_lower_global_vars_to_local.c  |  4 +--
 src/compiler/nir/nir_lower_gs_intrinsics.c         |  4 +--
 src/compiler/nir/nir_lower_idiv.c                  |  4 +--
 src/compiler/nir/nir_lower_indirect_derefs.c       |  4 +--
 src/compiler/nir/nir_lower_io.c                    |  4 +--
 src/compiler/nir/nir_lower_load_const_to_scalar.c  |  4 +--
 src/compiler/nir/nir_lower_locals_to_regs.c        |  4 +--
 .../nir/nir_lower_outputs_to_temporaries.c         |  4 +--
 src/compiler/nir/nir_lower_phis_to_scalar.c        | 10 +++----
 src/compiler/nir/nir_lower_returns.c               |  2 +-
 src/compiler/nir/nir_lower_samplers.c              |  4 +--
 src/compiler/nir/nir_lower_system_values.c         |  4 +--
 src/compiler/nir/nir_lower_tex.c                   |  4 +--
 src/compiler/nir/nir_lower_to_source_mods.c        |  8 ++---
 src/compiler/nir/nir_lower_two_sided_color.c       |  4 +--
 src/compiler/nir/nir_lower_var_copies.c            |  4 +--
 src/compiler/nir/nir_lower_vars_to_ssa.c           |  6 ++--
 src/compiler/nir/nir_lower_vec_to_movs.c           |  6 ++--
 src/compiler/nir/nir_metadata.c                    |  4 +--
 src/compiler/nir/nir_move_vec_src_uses_to_dest.c   |  6 ++--
 src/compiler/nir/nir_normalize_cubemap_coords.c    |  4 +--
 src/compiler/nir/nir_opt_constant_folding.c        |  4 +--
 src/compiler/nir/nir_opt_copy_propagate.c          |  4 +--
 src/compiler/nir/nir_opt_cse.c                     |  6 ++--
 src/compiler/nir/nir_opt_dce.c                     |  6 ++--
 src/compiler/nir/nir_opt_dead_cf.c                 | 10 +++----
 src/compiler/nir/nir_opt_gcm.c                     | 12 ++++----
 src/compiler/nir/nir_opt_global_to_local.c         |  6 ++--
 src/compiler/nir/nir_opt_peephole_select.c         | 14 ++++-----
 src/compiler/nir/nir_opt_remove_phis.c             |  6 ++--
 src/compiler/nir/nir_opt_undef.c                   |  4 +--
 src/compiler/nir/nir_print.c                       |  6 ++--
 src/compiler/nir/nir_remove_dead_variables.c       |  6 ++--
 src/compiler/nir/nir_repair_ssa.c                  |  8 ++---
 src/compiler/nir/nir_split_var_copies.c            |  4 +--
 src/compiler/nir/nir_sweep.c                       |  2 +-
 src/compiler/nir/nir_to_ssa.c                      | 12 ++++----
 src/compiler/nir/nir_validate.c                    | 18 ++++++------
 .../drivers/freedreno/ir3/ir3_compiler_nir.c       |  4 +--
 .../drivers/freedreno/ir3/ir3_nir_lower_if_else.c  | 12 ++++----
 src/gallium/drivers/vc4/vc4_nir_lower_blend.c      |  4 +--
 src/gallium/drivers/vc4/vc4_nir_lower_io.c         |  4 +--
 src/gallium/drivers/vc4/vc4_nir_lower_txf_ms.c     |  4 +--
 src/gallium/drivers/vc4/vc4_program.c              |  8 ++---
 src/intel/vulkan/anv_nir_apply_dynamic_offsets.c   |  4 +--
 src/intel/vulkan/anv_nir_apply_pipeline_layout.c   |  8 ++---
 src/intel/vulkan/anv_nir_lower_push_constants.c    |  4 +--
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp           |  8 ++---
 src/mesa/drivers/dri/i965/brw_nir.c                | 20 ++++++-------
 .../dri/i965/brw_nir_analyze_boolean_resolves.c    |  4 +--
 .../dri/i965/brw_nir_attribute_workarounds.c       |  4 +--
 .../drivers/dri/i965/brw_nir_opt_peephole_ffma.c   |  6 ++--
 src/mesa/drivers/dri/i965/brw_vec4_nir.cpp         |  8 ++---
 69 files changed, 242 insertions(+), 242 deletions(-)

-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list