nir: Use getters for nir_src::parent_*
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 14 Aug 2023 13:58:47 +0000 (09:58 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 10 Oct 2023 08:58:05 +0000 (04:58 -0400)
commitc39896b17b48178fdf89400ce209c22a61f583db
tree1d4364d2f1b0fd8aac67d4d147098749bb53e0fc
parentad619da3bc77ab4b749c69b0f97b8ba53e86904b
nir: Use getters for nir_src::parent_*

First, we need to give the parent_instr field a unique name to be able to
replace with a helper.  We have parent_instr fields for both nir_src and
nir_def, so let's rename nir_src::parent_instr in preparation for rework.

This was done with a combination of sed and manual fix-ups.

Then we use semantic patches plus manual fixups:

    @@
    expression s;
    @@

    -s->renamed_parent_instr
    +nir_src_parent_instr(s)

    @@
    expression s;
    @@

    -s.renamed_parent_instr
    +nir_src_parent_instr(&s)

    @@
    expression s;
    @@

    -s->parent_if
    +nir_src_parent_if(s)

    @@
    expression s;
    @@

    -s.renamed_parent_if
    +nir_src_parent_if(&s)

    @@
    expression s;
    @@

    -s->is_if
    +nir_src_is_if(s)

    @@
    expression s;
    @@

    -s.is_if
    +nir_src_is_if(&s)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24671>
60 files changed:
src/amd/compiler/aco_instruction_selection_setup.cpp
src/asahi/compiler/agx_nir_opt_preamble.c
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_deref.c
src/compiler/nir/nir_from_ssa.c
src/compiler/nir/nir_group_loads.c
src/compiler/nir/nir_legacy.c
src/compiler/nir/nir_loop_analyze.c
src/compiler/nir/nir_lower_flrp.c
src/compiler/nir/nir_lower_mediump.c
src/compiler/nir/nir_lower_reg_intrinsics_to_ssa.c
src/compiler/nir/nir_lower_scratch.c
src/compiler/nir/nir_lower_shader_calls.c
src/compiler/nir/nir_lower_vec_to_regs.c
src/compiler/nir/nir_move_vec_src_uses_to_dest.c
src/compiler/nir/nir_opt_comparison_pre.c
src/compiler/nir/nir_opt_copy_propagate.c
src/compiler/nir/nir_opt_dead_cf.c
src/compiler/nir/nir_opt_gcm.c
src/compiler/nir/nir_opt_if.c
src/compiler/nir/nir_opt_intrinsics.c
src/compiler/nir/nir_opt_move.c
src/compiler/nir/nir_opt_peephole_select.c
src/compiler/nir/nir_opt_phi_precision.c
src/compiler/nir/nir_opt_preamble.c
src/compiler/nir/nir_opt_reassociate_bfi.c
src/compiler/nir/nir_opt_rematerialize_compares.c
src/compiler/nir/nir_opt_shrink_vectors.c
src/compiler/nir/nir_opt_sink.c
src/compiler/nir/nir_opt_undef.c
src/compiler/nir/nir_opt_vectorize.c
src/compiler/nir/nir_range_analysis.c
src/compiler/nir/nir_remove_dead_variables.c
src/compiler/nir/nir_repair_ssa.c
src/compiler/nir/nir_schedule.c
src/compiler/nir/nir_search.c
src/compiler/nir/nir_search_helpers.h
src/compiler/nir/nir_to_lcssa.c
src/compiler/nir/nir_trivialize_registers.c
src/compiler/nir/nir_validate.c
src/freedreno/ir3/ir3_nir_opt_preamble.c
src/gallium/auxiliary/nir/nir_to_tgsi.c
src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h
src/gallium/drivers/lima/ir/gp/nir.c
src/gallium/drivers/lima/ir/lima_nir_duplicate_consts.c
src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c
src/gallium/drivers/lima/ir/lima_nir_split_loads.c
src/gallium/drivers/r300/compiler/nir_to_rc.c
src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
src/gallium/frontends/lavapipe/lvp_lower_exec_graph.c
src/intel/compiler/brw_fs.cpp
src/intel/compiler/brw_nir_lower_non_uniform_resource_intel.c
src/intel/compiler/brw_nir_opt_peephole_ffma.c
src/microsoft/clc/clc_compiler.c
src/microsoft/compiler/dxil_nir.c
src/microsoft/compiler/nir_to_dxil.c
src/panfrost/midgard/nir_fuse_io_16.c