From 815efcdf7e2b291532b0e08ba4144ff01f21b418 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 26 Jun 2023 10:42:29 -0400 Subject: [PATCH] nir: Use nir_builder_create perl -p0e 's/nir_builder ([^;]*);\s*nir_builder_init\(&\1, /nir_builder \1 = nir_builder_create(/g' -i $(git grep -l nir_builder_init) Signed-off-by: Alyssa Rosenzweig Reviewed-by: Konstantin Seurer Part-of: --- src/amd/common/ac_nir.c | 3 +-- src/amd/common/ac_nir_lower_ngg.c | 3 +-- src/amd/common/ac_nir_opt_outputs.c | 3 +-- src/amd/vulkan/nir/radv_nir_export_multiview.c | 3 +-- src/amd/vulkan/nir/radv_nir_lower_abi.c | 3 +-- .../vulkan/nir/radv_nir_lower_fs_intrinsics.c | 3 +-- .../nir/radv_nir_lower_intrinsics_early.c | 4 +--- .../nir/radv_nir_lower_poly_line_smooth.c | 3 +-- .../radv_nir_lower_primitive_shading_rate.c | 3 +-- .../vulkan/nir/radv_nir_lower_ray_queries.c | 3 +-- src/amd/vulkan/nir/radv_nir_lower_view_index.c | 3 +-- .../nir/radv_nir_lower_viewport_to_zero.c | 3 +-- src/amd/vulkan/radv_rt_shader.c | 18 ++++++------------ .../compiler/agx_nir_lower_discard_zs_emit.c | 3 +-- src/asahi/compiler/agx_nir_lower_sample_mask.c | 3 +-- src/asahi/lib/agx_nir_lower_alpha.c | 6 ++---- src/asahi/lib/agx_nir_lower_msaa.c | 3 +-- src/broadcom/compiler/v3d_nir_lower_io.c | 3 +-- .../compiler/v3d_nir_lower_line_smooth.c | 8 ++------ .../compiler/v3d_nir_lower_logic_ops.c | 3 +-- src/broadcom/compiler/vir.c | 3 +-- src/compiler/clc/nir_lower_libclc.c | 3 +-- src/compiler/glsl/gl_nir_lower_buffers.c | 3 +-- src/compiler/glsl/gl_nir_lower_xfb_varying.c | 3 +-- .../glsl/gl_nir_opt_dead_builtin_varyings.c | 3 +-- src/compiler/nir/nir.c | 3 +-- src/compiler/nir/nir_builder.h | 3 +-- src/compiler/nir/nir_deref.c | 3 +-- src/compiler/nir/nir_from_ssa.c | 3 +-- src/compiler/nir/nir_inline_functions.c | 3 +-- src/compiler/nir/nir_inline_uniforms.c | 3 +-- src/compiler/nir/nir_linking_helpers.c | 9 +++------ src/compiler/nir/nir_lower_alpha_test.c | 3 +-- .../nir/nir_lower_array_deref_of_vec.c | 3 +-- src/compiler/nir/nir_lower_atomics_to_ssbo.c | 3 +-- src/compiler/nir/nir_lower_bit_size.c | 3 +-- src/compiler/nir/nir_lower_bitmap.c | 4 +--- src/compiler/nir/nir_lower_cl_images.c | 3 +-- src/compiler/nir/nir_lower_clip.c | 4 +--- .../nir/nir_lower_const_arrays_to_uniforms.c | 3 +-- .../nir/nir_lower_continue_constructs.c | 3 +-- src/compiler/nir/nir_lower_convert_alu_types.c | 6 ++---- src/compiler/nir/nir_lower_flrp.c | 3 +-- src/compiler/nir/nir_lower_goto_ifs.c | 3 +-- src/compiler/nir/nir_lower_gs_intrinsics.c | 3 +-- src/compiler/nir/nir_lower_indirect_derefs.c | 3 +-- src/compiler/nir/nir_lower_int_to_float.c | 3 +-- src/compiler/nir/nir_lower_io.c | 9 +++------ .../nir/nir_lower_io_arrays_to_elements.c | 6 ++---- src/compiler/nir/nir_lower_io_to_temporaries.c | 6 ++---- src/compiler/nir/nir_lower_io_to_vector.c | 6 ++---- .../nir/nir_lower_is_helper_invocation.c | 3 +-- .../nir/nir_lower_load_const_to_scalar.c | 3 +-- src/compiler/nir/nir_lower_mediump.c | 12 ++++-------- src/compiler/nir/nir_lower_memcpy.c | 3 +-- src/compiler/nir/nir_lower_multiview.c | 3 +-- .../nir/nir_lower_non_uniform_access.c | 3 +-- src/compiler/nir/nir_lower_patch_vertices.c | 3 +-- src/compiler/nir/nir_lower_scratch.c | 3 +-- src/compiler/nir/nir_lower_shader_calls.c | 18 ++++++------------ src/compiler/nir/nir_lower_ssbo.c | 3 +-- src/compiler/nir/nir_lower_task_shader.c | 6 ++---- src/compiler/nir/nir_lower_tex.c | 3 +-- src/compiler/nir/nir_lower_texcoord_replace.c | 4 +--- .../nir/nir_lower_variable_initializers.c | 6 ++---- src/compiler/nir/nir_lower_vars_to_ssa.c | 6 ++---- src/compiler/nir/nir_opt_copy_prop_vars.c | 3 +-- src/compiler/nir/nir_opt_copy_propagate.c | 3 +-- src/compiler/nir/nir_opt_find_array_copies.c | 3 +-- src/compiler/nir/nir_opt_if.c | 3 +-- src/compiler/nir/nir_opt_intrinsics.c | 3 +-- src/compiler/nir/nir_opt_large_constants.c | 3 +-- .../nir/nir_opt_load_store_vectorize.c | 6 ++---- src/compiler/nir/nir_opt_loop_unroll.c | 3 +-- src/compiler/nir/nir_opt_memcpy.c | 3 +-- src/compiler/nir/nir_opt_peephole_select.c | 3 +-- src/compiler/nir/nir_opt_phi_precision.c | 3 +-- src/compiler/nir/nir_opt_remove_phis.c | 6 ++---- src/compiler/nir/nir_opt_shrink_stores.c | 3 +-- src/compiler/nir/nir_opt_shrink_vectors.c | 3 +-- src/compiler/nir/nir_opt_uniform_atomics.c | 3 +-- src/compiler/nir/nir_opt_vectorize.c | 3 +-- src/compiler/nir/nir_search.c | 3 +-- src/compiler/nir/nir_split_vars.c | 12 ++++-------- src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c | 3 +-- src/freedreno/ir3/ir3_nir_lower_io_offsets.c | 3 +-- src/freedreno/ir3/ir3_nir_lower_tess.c | 15 +++++---------- src/freedreno/vulkan/tu_nir_lower_multiview.cc | 3 +-- src/gallium/auxiliary/nir/tgsi_to_nir.c | 3 +-- src/gallium/drivers/asahi/agx_streamout.c | 3 +-- src/gallium/drivers/crocus/crocus_program.c | 12 ++++-------- .../drivers/d3d12/d3d12_lower_point_sprite.c | 3 +-- src/gallium/drivers/d3d12/d3d12_nir_passes.c | 18 ++++++------------ .../drivers/etnaviv/etnaviv_compiler_nir.c | 6 ++---- src/gallium/drivers/etnaviv/etnaviv_nir.c | 6 ++---- src/gallium/drivers/iris/iris_program.c | 9 +++------ .../lima/ir/lima_nir_duplicate_consts.c | 3 +-- .../lima/ir/lima_nir_duplicate_intrinsic.c | 3 +-- .../lima/ir/lima_nir_lower_uniform_to_scalar.c | 3 +-- .../drivers/lima/ir/lima_nir_split_loads.c | 3 +-- src/gallium/drivers/r600/sfn/sfn_nir.cpp | 6 ++---- .../drivers/r600/sfn/sfn_nir_lower_64bit.cpp | 6 ++---- .../sfn/sfn_nir_lower_fs_out_to_vector.cpp | 3 +-- .../drivers/r600/sfn/sfn_nir_lower_tess_io.cpp | 3 +-- .../drivers/r600/sfn/sfn_nir_lower_tex.cpp | 6 ++---- .../r600/sfn/sfn_nir_vectorize_vs_inputs.c | 3 +-- .../drivers/radeonsi/si_nir_lower_abi.c | 3 +-- .../drivers/radeonsi/si_nir_lower_vs_inputs.c | 3 +-- src/gallium/drivers/radeonsi/si_shader.c | 3 +-- src/gallium/drivers/vc4/vc4_nir_lower_blend.c | 6 ++---- src/gallium/drivers/vc4/vc4_nir_lower_io.c | 3 +-- src/gallium/drivers/zink/zink_compiler.c | 9 +++------ .../frontends/lavapipe/lvp_inline_uniforms.c | 3 +-- .../lavapipe/lvp_lower_input_attachments.c | 3 +-- src/imagination/rogue/nir/rogue_nir_lower_io.c | 4 +--- src/intel/compiler/brw_kernel.c | 3 +-- src/intel/compiler/brw_nir.c | 9 +++------ .../compiler/brw_nir_lower_alpha_to_coverage.c | 3 +-- .../brw_nir_lower_intersection_shader.c | 6 ++---- .../compiler/brw_nir_lower_rt_intrinsics.c | 3 +-- .../compiler/brw_nir_lower_shader_calls.c | 3 +-- src/intel/compiler/brw_nir_rt.c | 6 ++---- src/intel/compiler/brw_nir_tcs_workarounds.c | 3 +-- src/intel/vulkan/anv_mesh_perprim_wa.c | 6 ++---- src/intel/vulkan/anv_nir_lower_multiview.c | 3 +-- src/mesa/state_tracker/st_nir_lower_fog.c | 3 +-- .../st_nir_lower_position_invariant.c | 3 +-- .../state_tracker/st_nir_lower_tex_src_plane.c | 3 +-- src/microsoft/clc/clc_compiler.c | 12 ++++-------- src/microsoft/clc/clc_nir.c | 9 +++------ src/microsoft/compiler/dxil_nir.c | 18 ++++++------------ src/microsoft/compiler/dxil_nir_tess.c | 3 +-- src/microsoft/spirv_to_dxil/dxil_spirv_nir.c | 3 +-- src/panfrost/midgard/nir_fuse_io_16.c | 6 ++---- src/panfrost/util/pan_lower_writeout.c | 6 ++---- 135 files changed, 205 insertions(+), 417 deletions(-) diff --git a/src/amd/common/ac_nir.c b/src/amd/common/ac_nir.c index e7fea23a502..53ace03a092 100644 --- a/src/amd/common/ac_nir.c +++ b/src/amd/common/ac_nir.c @@ -700,8 +700,7 @@ ac_nir_lower_legacy_vs(nir_shader *nir, nir_function_impl *impl = nir_shader_get_entrypoint(nir); nir_metadata preserved = nir_metadata_block_index | nir_metadata_dominance; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_cf_list(&impl->body); nir_alu_type output_types_16bit_lo[16][4]; diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index cdc01a51554..e7e2a660f40 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -869,8 +869,7 @@ cleanup_culling_shader_after_dce(nir_shader *shader, bool uses_tes_patch_id = false; bool progress = false; - nir_builder b; - nir_builder_init(&b, function_impl); + nir_builder b = nir_builder_create(function_impl); nir_foreach_block_reverse_safe(block, function_impl) { nir_foreach_instr_reverse_safe(instr, block) { diff --git a/src/amd/common/ac_nir_opt_outputs.c b/src/amd/common/ac_nir_opt_outputs.c index 5f0d396ee0a..aa4b4f592c9 100644 --- a/src/amd/common/ac_nir_opt_outputs.c +++ b/src/amd/common/ac_nir_opt_outputs.c @@ -291,8 +291,7 @@ bool ac_nir_optimize_outputs(nir_shader *nir, bool sprite_tex_disallowed, unsigned i; bool progress = false; - struct nir_builder b; - nir_builder_init(&b, impl); + struct nir_builder b = nir_builder_create(impl); /* Optimize outputs. */ BITSET_FOREACH_SET(i, outputs_optimized, NUM_TOTAL_VARYING_SLOTS) { diff --git a/src/amd/vulkan/nir/radv_nir_export_multiview.c b/src/amd/vulkan/nir/radv_nir_export_multiview.c index ab3dd01efc3..5b0d8e61b9f 100644 --- a/src/amd/vulkan/nir/radv_nir_export_multiview.c +++ b/src/amd/vulkan/nir/radv_nir_export_multiview.c @@ -47,8 +47,7 @@ radv_nir_export_multiview(nir_shader *nir) nir_function_impl *impl = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* This pass is not suitable for mesh shaders, because it can't know the mapping between API mesh * shader invocations and output primitives. Needs to be handled in ac_nir_lower_ngg. diff --git a/src/amd/vulkan/nir/radv_nir_lower_abi.c b/src/amd/vulkan/nir/radv_nir_lower_abi.c index c394b98f3ee..dcddeb8b9a5 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_abi.c +++ b/src/amd/vulkan/nir/radv_nir_lower_abi.c @@ -519,8 +519,7 @@ radv_nir_lower_abi(nir_shader *shader, enum amd_gfx_level gfx_level, const struc if (shader->info.stage == MESA_SHADER_GEOMETRY && !info->is_ngg) { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); u_foreach_bit (i, shader->info.gs.active_stream_mask) diff --git a/src/amd/vulkan/nir/radv_nir_lower_fs_intrinsics.c b/src/amd/vulkan/nir/radv_nir_lower_fs_intrinsics.c index 170c5b3ebba..3202f77c9be 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_fs_intrinsics.c +++ b/src/amd/vulkan/nir/radv_nir_lower_fs_intrinsics.c @@ -37,8 +37,7 @@ radv_nir_lower_fs_intrinsics(nir_shader *nir, const struct radv_pipeline_stage * nir_function_impl *impl = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr_safe (instr, block) { diff --git a/src/amd/vulkan/nir/radv_nir_lower_intrinsics_early.c b/src/amd/vulkan/nir/radv_nir_lower_intrinsics_early.c index 51b9d928976..df066927508 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_intrinsics_early.c +++ b/src/amd/vulkan/nir/radv_nir_lower_intrinsics_early.c @@ -33,9 +33,7 @@ radv_nir_lower_intrinsics_early(nir_shader *nir, const struct radv_pipeline_key { nir_function_impl *entry = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - - nir_builder_init(&b, entry); + nir_builder b = nir_builder_create(entry); nir_foreach_block (block, entry) { nir_foreach_instr_safe (instr, block) { diff --git a/src/amd/vulkan/nir/radv_nir_lower_poly_line_smooth.c b/src/amd/vulkan/nir/radv_nir_lower_poly_line_smooth.c index ab58fe4a194..48ebaa6b9db 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_poly_line_smooth.c +++ b/src/amd/vulkan/nir/radv_nir_lower_poly_line_smooth.c @@ -34,8 +34,7 @@ radv_should_lower_poly_line_smooth(nir_shader *nir, const struct radv_pipeline_k if (!key->ps.line_smooth_enabled && !key->dynamic_line_rast_mode) return false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr (instr, block) { diff --git a/src/amd/vulkan/nir/radv_nir_lower_primitive_shading_rate.c b/src/amd/vulkan/nir/radv_nir_lower_primitive_shading_rate.c index b137345dc71..6930480958e 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_primitive_shading_rate.c +++ b/src/amd/vulkan/nir/radv_nir_lower_primitive_shading_rate.c @@ -31,8 +31,7 @@ radv_nir_lower_primitive_shading_rate(nir_shader *nir, enum amd_gfx_level gfx_le nir_function_impl *impl = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* Iterate in reverse order since there should be only one deref store to PRIMITIVE_SHADING_RATE * after lower_io_to_temporaries for vertex shaders. diff --git a/src/amd/vulkan/nir/radv_nir_lower_ray_queries.c b/src/amd/vulkan/nir/radv_nir_lower_ray_queries.c index d3938cf0e59..d336dbc5c61 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_ray_queries.c +++ b/src/amd/vulkan/nir/radv_nir_lower_ray_queries.c @@ -641,8 +641,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device if (!function->impl) continue; - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); nir_foreach_variable_in_list (var, &function->impl->locals) { if (!var->data.ray_query) diff --git a/src/amd/vulkan/nir/radv_nir_lower_view_index.c b/src/amd/vulkan/nir/radv_nir_lower_view_index.c index baf28fcd7a5..b0ff02adebb 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_view_index.c +++ b/src/amd/vulkan/nir/radv_nir_lower_view_index.c @@ -54,8 +54,7 @@ radv_nir_lower_view_index(nir_shader *nir, bool per_primitive) { bool progress = false; nir_function_impl *entry = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, entry); + nir_builder b = nir_builder_create(entry); nir_variable *layer = NULL; nir_foreach_block (block, entry) { diff --git a/src/amd/vulkan/nir/radv_nir_lower_viewport_to_zero.c b/src/amd/vulkan/nir/radv_nir_lower_viewport_to_zero.c index 4cc1ed3f8de..3e17f390967 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_viewport_to_zero.c +++ b/src/amd/vulkan/nir/radv_nir_lower_viewport_to_zero.c @@ -33,8 +33,7 @@ radv_nir_lower_viewport_to_zero(nir_shader *nir) nir_function_impl *impl = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* There should be only one deref load for VIEWPORT after lower_io_to_temporaries. */ nir_foreach_block (block, impl) { diff --git a/src/amd/vulkan/radv_rt_shader.c b/src/amd/vulkan/radv_rt_shader.c index 4304b9ff8cf..1b67e95f499 100644 --- a/src/amd/vulkan/radv_rt_shader.c +++ b/src/amd/vulkan/radv_rt_shader.c @@ -42,8 +42,7 @@ lower_rt_derefs(nir_shader *shader) bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); nir_ssa_def *arg_offset = nir_load_rt_arg_scratch_offset_amd(&b); @@ -276,8 +275,7 @@ load_sbt_entry(nir_builder *b, const struct rt_variables *vars, nir_ssa_def *idx static void lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned call_idx_base) { - nir_builder b_shader; - nir_builder_init(&b_shader, nir_shader_get_entrypoint(shader)); + nir_builder b_shader = nir_builder_create(nir_shader_get_entrypoint(shader)); nir_foreach_block (block, nir_shader_get_entrypoint(shader)) { nir_foreach_instr_safe (instr, block) { @@ -692,8 +690,7 @@ lower_hit_attribs(nir_shader *shader, nir_variable **hit_attribs, uint32_t workg nir_foreach_variable_with_modes (attrib, shader, nir_var_ray_hit_attrib) attrib->data.mode = nir_var_shader_temp; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr_safe (instr, block) { @@ -826,8 +823,7 @@ radv_parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreat if (shader->info.stage == MESA_SHADER_RAYGEN || shader->info.stage == MESA_SHADER_CLOSEST_HIT || shader->info.stage == MESA_SHADER_CALLABLE || shader->info.stage == MESA_SHADER_MISS) { nir_block *last_block = nir_impl_last_block(nir_shader_get_entrypoint(shader)); - nir_builder b_inner; - nir_builder_init(&b_inner, nir_shader_get_entrypoint(shader)); + nir_builder b_inner = nir_builder_create(nir_shader_get_entrypoint(shader)); b_inner.cursor = nir_after_block(last_block); nir_rt_return_amd(&b_inner); } @@ -883,8 +879,7 @@ lower_any_hit_for_intersection(nir_shader *any_hit) impl->function->params = ralloc_array(any_hit, nir_parameter, ARRAY_SIZE(params)); memcpy(impl->function->params, params, sizeof(params)); - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); nir_builder *b = &build; b->cursor = nir_before_cf_list(&impl->body); @@ -1003,8 +998,7 @@ nir_lower_intersection_shader(nir_shader *intersection, nir_shader *any_hit) nir_function_impl *impl = nir_shader_get_entrypoint(intersection); - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); nir_builder *b = &build; b->cursor = nir_before_cf_list(&impl->body); diff --git a/src/asahi/compiler/agx_nir_lower_discard_zs_emit.c b/src/asahi/compiler/agx_nir_lower_discard_zs_emit.c index 4199bc2f693..ed94bdc6c3c 100644 --- a/src/asahi/compiler/agx_nir_lower_discard_zs_emit.c +++ b/src/asahi/compiler/agx_nir_lower_discard_zs_emit.c @@ -31,8 +31,7 @@ lower_zs_emit(nir_function_impl *impl, nir_block *block) sem.location != FRAG_RESULT_STENCIL) continue; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_instr(instr); nir_ssa_def *value = intr->src[0].ssa; diff --git a/src/asahi/compiler/agx_nir_lower_sample_mask.c b/src/asahi/compiler/agx_nir_lower_sample_mask.c index 48a4b52039d..44c768ddec9 100644 --- a/src/asahi/compiler/agx_nir_lower_sample_mask.c +++ b/src/asahi/compiler/agx_nir_lower_sample_mask.c @@ -155,8 +155,7 @@ agx_nir_lower_sample_mask(nir_shader *shader, unsigned nr_samples) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_block *block = nir_impl_last_block(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block(block); nir_foreach_instr(instr, block) { diff --git a/src/asahi/lib/agx_nir_lower_alpha.c b/src/asahi/lib/agx_nir_lower_alpha.c index e7ac67a3941..2eca8cd37b4 100644 --- a/src/asahi/lib/agx_nir_lower_alpha.c +++ b/src/asahi/lib/agx_nir_lower_alpha.c @@ -20,8 +20,7 @@ agx_nir_lower_alpha_to_coverage(nir_shader *shader, uint8_t nr_samples) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_block *block = nir_impl_last_block(impl); - nir_builder _b; - nir_builder_init(&_b, impl); + nir_builder _b = nir_builder_create(impl); nir_builder *b = &_b; /* The store is probably at the end of the block, so search in reverse. */ @@ -86,8 +85,7 @@ agx_nir_lower_alpha_to_one(nir_shader *shader) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_block *block = nir_impl_last_block(impl); - nir_builder _b; - nir_builder_init(&_b, impl); + nir_builder _b = nir_builder_create(impl); nir_builder *b = &_b; nir_foreach_instr(instr, block) { diff --git a/src/asahi/lib/agx_nir_lower_msaa.c b/src/asahi/lib/agx_nir_lower_msaa.c index 8333791cc70..2c60915e826 100644 --- a/src/asahi/lib/agx_nir_lower_msaa.c +++ b/src/asahi/lib/agx_nir_lower_msaa.c @@ -67,8 +67,7 @@ agx_nir_wrap_per_sample_loop(nir_shader *shader, uint8_t nr_samples) nir_after_block(nir_impl_last_block(impl))); /* Create a builder for the wrapped function */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block(nir_start_block(impl)); nir_variable *i = diff --git a/src/broadcom/compiler/v3d_nir_lower_io.c b/src/broadcom/compiler/v3d_nir_lower_io.c index a093a46e97e..16099b6bc66 100644 --- a/src/broadcom/compiler/v3d_nir_lower_io.c +++ b/src/broadcom/compiler/v3d_nir_lower_io.c @@ -717,8 +717,7 @@ v3d_nir_lower_io(nir_shader *s, struct v3d_compile *c) nir_foreach_function(function, s) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); if (c->s->info.stage == MESA_SHADER_GEOMETRY) emit_gs_prolog(c, &b, function->impl, &state); diff --git a/src/broadcom/compiler/v3d_nir_lower_line_smooth.c b/src/broadcom/compiler/v3d_nir_lower_line_smooth.c index 6b2bb78e974..ecfcfbc4ff3 100644 --- a/src/broadcom/compiler/v3d_nir_lower_line_smooth.c +++ b/src/broadcom/compiler/v3d_nir_lower_line_smooth.c @@ -60,9 +60,7 @@ lower_line_smooth_func(struct lower_line_smooth_state *state, { bool progress = false; - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -90,9 +88,7 @@ static void initialise_coverage_var(struct lower_line_smooth_state *state, nir_function_impl *impl) { - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); diff --git a/src/broadcom/compiler/v3d_nir_lower_logic_ops.c b/src/broadcom/compiler/v3d_nir_lower_logic_ops.c index 77befebfc2c..9b45808bc1e 100644 --- a/src/broadcom/compiler/v3d_nir_lower_logic_ops.c +++ b/src/broadcom/compiler/v3d_nir_lower_logic_ops.c @@ -388,8 +388,7 @@ v3d_nir_lower_logic_ops_block(nir_block *block, struct v3d_compile *c) nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_instr(&intr->instr); v3d_nir_lower_logic_op_instr(c, &b, intr, rt); diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index e9d197a25aa..5fbbc363400 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -1508,8 +1508,7 @@ v3d_nir_lower_subgroup_intrinsics(nir_shader *s, struct v3d_compile *c) bool progress = false; nir_foreach_function(function, s) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) progress |= lower_subgroup_intrinsics(c, block, &b); diff --git a/src/compiler/clc/nir_lower_libclc.c b/src/compiler/clc/nir_lower_libclc.c index ffbee9298c1..0fa8e024da8 100644 --- a/src/compiler/clc/nir_lower_libclc.c +++ b/src/compiler/clc/nir_lower_libclc.c @@ -73,8 +73,7 @@ nir_lower_libclc_impl(nir_function_impl *impl, const nir_shader *clc_shader, struct hash_table *copy_vars) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block_safe(block, impl) { diff --git a/src/compiler/glsl/gl_nir_lower_buffers.c b/src/compiler/glsl/gl_nir_lower_buffers.c index 12a2aebb858..b90ab46c318 100644 --- a/src/compiler/glsl/gl_nir_lower_buffers.c +++ b/src/compiler/glsl/gl_nir_lower_buffers.c @@ -164,8 +164,7 @@ lower_buffer_interface_derefs_impl(nir_function_impl *impl, { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* this must be a separate loop before the main pass in order to ensure that * access info is fully propagated prior to the info being lost during rewrites diff --git a/src/compiler/glsl/gl_nir_lower_xfb_varying.c b/src/compiler/glsl/gl_nir_lower_xfb_varying.c index 5dfa8238876..30df6d1d05d 100644 --- a/src/compiler/glsl/gl_nir_lower_xfb_varying.c +++ b/src/compiler/glsl/gl_nir_lower_xfb_varying.c @@ -155,8 +155,7 @@ gl_nir_lower_xfb_varying(nir_shader *shader, const char *old_var_name, { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); nir_deref_instr *deref = NULL; diff --git a/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c b/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c index 3d6991b38b8..f2cda28245b 100644 --- a/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c +++ b/src/compiler/glsl/gl_nir_opt_dead_builtin_varyings.c @@ -403,8 +403,7 @@ replace_varyings(const struct gl_constants *consts, } nir_function_impl *impl = nir_shader_get_entrypoint(shader->Program->nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* assert that functions have been inlined before packing is called */ nir_foreach_function(f, shader->Program->nir) { diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 1210d80bd39..b2b89ec4f60 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -2331,8 +2331,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl, nir_lower_instr_cb lower, void *cb_data) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_metadata preserved = nir_metadata_block_index | nir_metadata_dominance; diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index b71d1400c4c..d9a4aa42842 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -88,8 +88,7 @@ nir_shader_instructions_pass(nir_shader *shader, continue; bool func_progress = false; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block_safe(block, function->impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index 2d968de107d..95f9a38e51f 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -1432,8 +1432,7 @@ nir_opt_deref_impl(nir_function_impl *impl) { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 7c663ac8512..0207d72a0f5 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -986,8 +986,7 @@ place_phi_read(nir_builder *b, nir_register *reg, bool nir_lower_phis_to_regs_block(nir_block *block) { - nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&block->cf_node)); + nir_builder b = nir_builder_create(nir_cf_node_get_function(&block->cf_node)); struct set *visited_blocks = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index 7187c4cc2e5..c4db1a6a271 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -177,8 +177,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined) if (_mesa_set_search(inlined, impl)) return false; /* Already inlined */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block_safe(block, impl) { diff --git a/src/compiler/nir/nir_inline_uniforms.c b/src/compiler/nir/nir_inline_uniforms.c index 09270a36da8..d2a450daadc 100644 --- a/src/compiler/nir/nir_inline_uniforms.c +++ b/src/compiler/nir/nir_inline_uniforms.c @@ -394,8 +394,7 @@ nir_inline_uniforms(nir_shader *shader, unsigned num_uniforms, nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index a257ea3b094..550ba415c04 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++ b/src/compiler/nir/nir_linking_helpers.c @@ -1049,8 +1049,7 @@ replace_varying_input_by_constant_load(nir_shader *shader, { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_variable *out_var = nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0])); @@ -1101,8 +1100,7 @@ replace_duplicate_input(nir_shader *shader, nir_variable *input_var, nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_variable *dup_out_var = nir_deref_instr_get_variable(nir_src_as_deref(dup_store_intr->src[0])); @@ -1237,8 +1235,7 @@ replace_varying_input_by_uniform_load(nir_shader *shader, { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_variable *out_var = nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0])); diff --git a/src/compiler/nir/nir_lower_alpha_test.c b/src/compiler/nir/nir_lower_alpha_test.c index 750810f15af..c78e114f3ce 100644 --- a/src/compiler/nir/nir_lower_alpha_test.c +++ b/src/compiler/nir/nir_lower_alpha_test.c @@ -45,8 +45,7 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func, nir_foreach_function(function, shader) { nir_function_impl *impl = function->impl; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_lower_array_deref_of_vec.c b/src/compiler/nir/nir_lower_array_deref_of_vec.c index 62c4d2bc40f..01320dbdbcb 100644 --- a/src/compiler/nir/nir_lower_array_deref_of_vec.c +++ b/src/compiler/nir/nir_lower_array_deref_of_vec.c @@ -65,8 +65,7 @@ nir_lower_array_deref_of_vec_impl(nir_function_impl *impl, { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c index b15d077f7e0..585a8e2c67c 100644 --- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c +++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c @@ -188,8 +188,7 @@ nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned offset_align_state) nir_foreach_function(function, shader) { if (function->impl) { - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) diff --git a/src/compiler/nir/nir_lower_bit_size.c b/src/compiler/nir/nir_lower_bit_size.c index 9d81bb35091..33ced86584e 100644 --- a/src/compiler/nir/nir_lower_bit_size.c +++ b/src/compiler/nir/nir_lower_bit_size.c @@ -242,8 +242,7 @@ lower_impl(nir_function_impl *impl, nir_lower_bit_size_callback callback, void *callback_data) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c index 81d764a73d3..d717410e032 100644 --- a/src/compiler/nir/nir_lower_bitmap.c +++ b/src/compiler/nir/nir_lower_bitmap.c @@ -103,9 +103,7 @@ static void lower_bitmap_impl(nir_function_impl *impl, const nir_lower_bitmap_options *options) { - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); lower_bitmap(impl->function->shader, &b, options); diff --git a/src/compiler/nir/nir_lower_cl_images.c b/src/compiler/nir/nir_lower_cl_images.c index d084d984230..5806b101982 100644 --- a/src/compiler/nir/nir_lower_cl_images.c +++ b/src/compiler/nir/nir_lower_cl_images.c @@ -156,8 +156,7 @@ nir_lower_cl_images(nir_shader *shader, bool lower_image_derefs, bool lower_samp if (num_samplers) BITSET_SET_RANGE(shader->info.samplers_used, 0, num_samplers - 1); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* don't need any lowering if we can keep the derefs */ if (!lower_image_derefs && !lower_sampler_derefs) { diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index ce50e9721a8..e189dc80d45 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -430,9 +430,7 @@ lower_clip_fs(nir_function_impl *impl, unsigned ucp_enables, nir_variable **in, bool use_clipdist_array) { nir_ssa_def *clipdist[MAX_CLIP_PLANES]; - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); if (!use_clipdist_array) { diff --git a/src/compiler/nir/nir_lower_const_arrays_to_uniforms.c b/src/compiler/nir/nir_lower_const_arrays_to_uniforms.c index 72dc706ded5..3313ba56ff7 100644 --- a/src/compiler/nir/nir_lower_const_arrays_to_uniforms.c +++ b/src/compiler/nir/nir_lower_const_arrays_to_uniforms.c @@ -359,8 +359,7 @@ nir_lower_const_arrays_to_uniforms(nir_shader *shader, } /* Finally rewrite its uses */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_continue_constructs.c b/src/compiler/nir/nir_lower_continue_constructs.c index ad569646b7f..4561d9911a7 100644 --- a/src/compiler/nir/nir_lower_continue_constructs.c +++ b/src/compiler/nir/nir_lower_continue_constructs.c @@ -136,8 +136,7 @@ visit_cf_list(nir_builder *b, struct exec_list *list, bool *repair_ssa) static bool lower_continue_constructs_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool repair_ssa = false; bool progress = visit_cf_list(&b, &impl->body, &repair_ssa); diff --git a/src/compiler/nir/nir_lower_convert_alu_types.c b/src/compiler/nir/nir_lower_convert_alu_types.c index 1a5f0d614a3..f08c4927333 100644 --- a/src/compiler/nir/nir_lower_convert_alu_types.c +++ b/src/compiler/nir/nir_lower_convert_alu_types.c @@ -72,8 +72,7 @@ opt_simplify_convert_alu_types_impl(nir_function_impl *impl) bool progress = false; bool lowered_instr = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -124,8 +123,7 @@ lower_convert_alu_types_impl(nir_function_impl *impl, { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_flrp.c b/src/compiler/nir/nir_lower_flrp.c index 9c13619462f..35dde897554 100644 --- a/src/compiler/nir/nir_lower_flrp.c +++ b/src/compiler/nir/nir_lower_flrp.c @@ -599,8 +599,7 @@ lower_flrp_impl(nir_function_impl *impl, unsigned lowering_mask, bool always_precise) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_goto_ifs.c b/src/compiler/nir/nir_lower_goto_ifs.c index 0e6902e9ded..7b4b55a0216 100644 --- a/src/compiler/nir/nir_lower_goto_ifs.c +++ b/src/compiler/nir/nir_lower_goto_ifs.c @@ -944,8 +944,7 @@ nir_lower_goto_ifs_impl(nir_function_impl *impl) /* From this point on, it's structured */ impl->structured = true; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); void *mem_ctx = ralloc_context(b.shader); diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c index 4a2ab0e965e..5f07c907e6a 100644 --- a/src/compiler/nir/nir_lower_gs_intrinsics.c +++ b/src/compiler/nir/nir_lower_gs_intrinsics.c @@ -394,8 +394,7 @@ nir_lower_gs_intrinsics(nir_shader *shader, nir_lower_gs_intrinsics_flags option if (!a_block_needs_set_vertex_and_primitive_count(impl->end_block, per_stream)) return false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); state.builder = &b; b.cursor = nir_before_cf_list(&impl->body); diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c index a0b496514f0..0f933086971 100644 --- a/src/compiler/nir/nir_lower_indirect_derefs.c +++ b/src/compiler/nir/nir_lower_indirect_derefs.c @@ -191,8 +191,7 @@ static bool lower_indirects_impl(nir_function_impl *impl, nir_variable_mode modes, const struct set *vars, uint32_t max_lower_array_len) { - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); bool progress = false; nir_foreach_block_safe(block, impl) { diff --git a/src/compiler/nir/nir_lower_int_to_float.c b/src/compiler/nir/nir_lower_int_to_float.c index cd45db0d465..7175f038fc7 100644 --- a/src/compiler/nir/nir_lower_int_to_float.c +++ b/src/compiler/nir/nir_lower_int_to_float.c @@ -206,8 +206,7 @@ nir_lower_int_to_float_impl(nir_function_impl *impl) bool progress = false; BITSET_WORD *float_types = NULL, *int_types = NULL; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_index_ssa_defs(impl); float_types = calloc(BITSET_WORDS(impl->ssa_alloc), diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 9e6e021e3c4..f25feff2dc3 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -2194,8 +2194,7 @@ nir_lower_explicit_io_impl(nir_function_impl *impl, nir_variable_mode modes, { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* Walk in reverse order so that we can see the full deref chain when we * lower the access operations. We lower them assuming that the derefs @@ -2877,8 +2876,7 @@ nir_io_add_const_offset_to_base(nir_shader *nir, nir_variable_mode modes) nir_foreach_function(f, nir) { if (f->impl) { bool impl_progress = false; - nir_builder b; - nir_builder_init(&b, f->impl); + nir_builder b = nir_builder_create(f->impl); nir_foreach_block(block, f->impl) { impl_progress |= add_const_offset_to_base_block(block, &b, modes); } @@ -2899,8 +2897,7 @@ nir_lower_color_inputs(nir_shader *nir) nir_function_impl *impl = nir_shader_get_entrypoint(nir); bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr_safe (instr, block) { diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c index 9599924681a..66a2bc1b60f 100644 --- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c +++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c @@ -230,8 +230,7 @@ create_indirects_mask(nir_shader *shader, { nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -277,8 +276,7 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask, { nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c b/src/compiler/nir/nir_lower_io_to_temporaries.c index 181cb77e730..d98e129cc54 100644 --- a/src/compiler/nir/nir_lower_io_to_temporaries.c +++ b/src/compiler/nir/nir_lower_io_to_temporaries.c @@ -78,8 +78,7 @@ emit_copies(nir_builder *b, struct exec_list *dest_vars, static void emit_output_copies_impl(struct lower_io_state *state, nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); if (state->shader->info.stage == MESA_SHADER_GEOMETRY) { /* For geometry shaders, we have to emit the output copies right @@ -277,8 +276,7 @@ static void emit_input_copies_impl(struct lower_io_state *state, nir_function_impl *impl) { if (impl == state->entrypoint) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); emit_copies(&b, &state->old_inputs, &state->new_inputs); if (state->shader->info.stage == MESA_SHADER_FRAGMENT) diff --git a/src/compiler/nir/nir_lower_io_to_vector.c b/src/compiler/nir/nir_lower_io_to_vector.c index 879381e109a..b14b49325ee 100644 --- a/src/compiler/nir/nir_lower_io_to_vector.c +++ b/src/compiler/nir/nir_lower_io_to_vector.c @@ -411,8 +411,7 @@ nir_lower_io_to_vector_impl(nir_function_impl *impl, nir_variable_mode modes) { assert(!(modes & ~(nir_var_shader_in | nir_var_shader_out))); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_metadata_require(impl, nir_metadata_dominance); @@ -627,8 +626,7 @@ static bool nir_vectorize_tess_levels_impl(nir_function_impl *impl) { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_is_helper_invocation.c b/src/compiler/nir/nir_lower_is_helper_invocation.c index 224d2ff62d0..1a03b502695 100644 --- a/src/compiler/nir/nir_lower_is_helper_invocation.c +++ b/src/compiler/nir/nir_lower_is_helper_invocation.c @@ -106,8 +106,7 @@ nir_lower_is_helper_invocation(nir_shader *shader) nir_function_impl *entrypoint = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, entrypoint); + nir_builder b = nir_builder_create(entrypoint); b.cursor = nir_before_cf_list(&entrypoint->body); nir_variable *is_helper = nir_local_variable_create(entrypoint, diff --git a/src/compiler/nir/nir_lower_load_const_to_scalar.c b/src/compiler/nir/nir_lower_load_const_to_scalar.c index 4331b8058cf..18dfb73adb4 100644 --- a/src/compiler/nir/nir_lower_load_const_to_scalar.c +++ b/src/compiler/nir/nir_lower_load_const_to_scalar.c @@ -41,8 +41,7 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower) if (lower->def.num_components == 1) return false; - nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&lower->instr.block->cf_node)); + nir_builder b = nir_builder_create(nir_cf_node_get_function(&lower->instr.block->cf_node)); b.cursor = nir_before_instr(&lower->instr); /* Emit the individual loads. */ diff --git a/src/compiler/nir/nir_lower_mediump.c b/src/compiler/nir/nir_lower_mediump.c index 168698c9f7d..692d5310309 100644 --- a/src/compiler/nir/nir_lower_mediump.c +++ b/src/compiler/nir/nir_lower_mediump.c @@ -154,8 +154,7 @@ nir_lower_mediump_io(nir_shader *nir, nir_variable_mode modes, nir_function_impl *impl = nir_shader_get_entrypoint(nir); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe (block, impl) { nir_foreach_instr_safe (instr, block) { @@ -287,8 +286,7 @@ nir_force_mediump_io(nir_shader *nir, nir_variable_mode modes, nir_function_impl *impl = nir_shader_get_entrypoint(nir); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe (block, impl) { nir_foreach_instr_safe (instr, block) { @@ -422,8 +420,7 @@ nir_lower_mediump_vars_impl(nir_function_impl *impl, nir_variable_mode modes, if (!any_lowered) return false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -661,8 +658,7 @@ nir_legalize_16bit_sampler_srcs(nir_shader *nir, nir_function_impl *impl = nir_shader_get_entrypoint(nir); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe (block, impl) { nir_foreach_instr_safe (instr, block) { diff --git a/src/compiler/nir/nir_lower_memcpy.c b/src/compiler/nir/nir_lower_memcpy.c index 03503ad262a..038764bb4f7 100644 --- a/src/compiler/nir/nir_lower_memcpy.c +++ b/src/compiler/nir/nir_lower_memcpy.c @@ -88,8 +88,7 @@ memcpy_store_deref_elem_imm(nir_builder *b, nir_deref_instr *parent, static bool lower_memcpy_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool found_const_memcpy = false, found_non_const_memcpy = false; diff --git a/src/compiler/nir/nir_lower_multiview.c b/src/compiler/nir/nir_lower_multiview.c index 4a6227c38f1..4ff6fc23ff4 100644 --- a/src/compiler/nir/nir_lower_multiview.c +++ b/src/compiler/nir/nir_lower_multiview.c @@ -203,8 +203,7 @@ nir_lower_multiview(nir_shader *shader, uint32_t view_mask) nir_cf_list body; nir_cf_list_extract(&body, &entrypoint->body); - nir_builder b; - nir_builder_init(&b, entrypoint); + nir_builder b = nir_builder_create(entrypoint); b.cursor = nir_after_cf_list(&entrypoint->body); /* Loop Index will go from 0 to view_count. */ diff --git a/src/compiler/nir/nir_lower_non_uniform_access.c b/src/compiler/nir/nir_lower_non_uniform_access.c index 4ab29cd98fc..231a9868a13 100644 --- a/src/compiler/nir/nir_lower_non_uniform_access.c +++ b/src/compiler/nir/nir_lower_non_uniform_access.c @@ -204,8 +204,7 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl, { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_patch_vertices.c b/src/compiler/nir/nir_lower_patch_vertices.c index b01edd96db2..f56da84f02f 100644 --- a/src/compiler/nir/nir_lower_patch_vertices.c +++ b/src/compiler/nir/nir_lower_patch_vertices.c @@ -65,8 +65,7 @@ nir_lower_patch_vertices(nir_shader *nir, nir_foreach_function(function, nir) { if (function->impl) { nir_foreach_block(block, function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) { nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); diff --git a/src/compiler/nir/nir_lower_scratch.c b/src/compiler/nir/nir_lower_scratch.c index 24d83f17a4f..f449f226c2b 100644 --- a/src/compiler/nir/nir_lower_scratch.c +++ b/src/compiler/nir/nir_lower_scratch.c @@ -183,8 +183,7 @@ nir_lower_vars_to_scratch(nir_shader *shader, if (!function->impl) continue; - nir_builder build; - nir_builder_init(&build, function->impl); + nir_builder build = nir_builder_create(function->impl); bool impl_progress = false; nir_foreach_block(block, function->impl) { diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c index c12a964eb55..533a1e47ce6 100644 --- a/src/compiler/nir/nir_lower_shader_calls.c +++ b/src/compiler/nir/nir_lower_shader_calls.c @@ -855,8 +855,7 @@ duplicate_loop_bodies(nir_function_impl *impl, nir_instr *resume_instr) resume_reg->num_components = 1; resume_reg->bit_size = 1; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* Initialize resume to true */ b.cursor = nir_before_cf_list(&impl->body); @@ -1103,8 +1102,7 @@ flatten_resume_if_ladder(nir_builder *b, /* We want to place anything re-materialized from inside the loop * at the top of the resume half of the loop. */ - nir_builder bl; - nir_builder_init(&bl, b->impl); + nir_builder bl = nir_builder_create(b->impl); bl.cursor = nir_before_cf_list(&_if->then_list); ASSERTED bool found = @@ -1275,8 +1273,7 @@ lower_resume(nir_shader *shader, int call_idx) /* Create a nop instruction to use as a cursor as we extract and re-insert * stuff into the CFG. */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); ASSERTED bool found = flatten_resume_if_ladder(&b, &impl->cf_node, &impl->body, @@ -1298,8 +1295,7 @@ replace_resume_with_halt(nir_shader *shader, nir_instr *keep) { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -1521,8 +1517,7 @@ nir_opt_trim_stack_values(nir_shader *shader) continue; } - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_instr(instr); nir_ssa_def *value = nir_channels(&b, intrin->src[0].ssa, read_mask); @@ -1975,8 +1970,7 @@ nir_lower_shader_calls(nir_shader *shader, { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); int num_calls = 0; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_lower_ssbo.c b/src/compiler/nir/nir_lower_ssbo.c index d46e4d8e693..2e4b79371b8 100644 --- a/src/compiler/nir/nir_lower_ssbo.c +++ b/src/compiler/nir/nir_lower_ssbo.c @@ -158,8 +158,7 @@ nir_lower_ssbo(nir_shader *shader) nir_foreach_function(function, shader) { nir_function_impl *impl = function->impl; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c index af209ff5e08..e43c803bf0f 100644 --- a/src/compiler/nir/nir_lower_task_shader.c +++ b/src/compiler/nir/nir_lower_task_shader.c @@ -140,8 +140,7 @@ nir_lower_nv_task_count(nir_shader *shader) nir_metadata_none, &state); nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); append_launch_mesh_workgroups_to_nv_task(&builder, &state); nir_metadata_preserve(impl, nir_metadata_none); @@ -434,8 +433,7 @@ nir_lower_task_shader(nir_shader *shader, return false; nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); if (shader->info.outputs_written & BITFIELD64_BIT(VARYING_SLOT_TASK_COUNT)) { /* NV_mesh_shader: diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 7b09e749cf6..b310abd2430 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -1620,8 +1620,7 @@ nir_lower_tex_impl(nir_function_impl *impl, const struct nir_shader_compiler_options *compiler_options) { bool progress = false; - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); nir_foreach_block(block, impl) { progress |= nir_lower_tex_block(block, &builder, options, compiler_options); diff --git a/src/compiler/nir/nir_lower_texcoord_replace.c b/src/compiler/nir/nir_lower_texcoord_replace.c index 1b3cebe7991..9dd6a905e9b 100644 --- a/src/compiler/nir/nir_lower_texcoord_replace.c +++ b/src/compiler/nir/nir_lower_texcoord_replace.c @@ -63,9 +63,7 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl, bool point_coord_is_sysval, bool yinvert) { - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); nir_ssa_def *new_coord; diff --git a/src/compiler/nir/nir_lower_variable_initializers.c b/src/compiler/nir/nir_lower_variable_initializers.c index d0e273ebd6e..ae23f22460d 100644 --- a/src/compiler/nir/nir_lower_variable_initializers.c +++ b/src/compiler/nir/nir_lower_variable_initializers.c @@ -108,8 +108,7 @@ nir_lower_variable_initializers(nir_shader *shader, nir_variable_mode modes) bool impl_progress = false; - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); if ((modes & ~nir_var_function_temp) && function->is_entrypoint) { impl_progress |= lower_const_initializer(&builder, @@ -150,8 +149,7 @@ nir_zero_initialize_shared_memory(nir_shader *shader, assert(chunk_size > 0); assert(chunk_size % 4 == 0); - nir_builder b; - nir_builder_init(&b, nir_shader_get_entrypoint(shader)); + nir_builder b = nir_builder_create(nir_shader_get_entrypoint(shader)); b.cursor = nir_before_cf_list(&b.impl->body); assert(!shader->info.workgroup_size_variable); diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 4987d33d88f..56e846657ec 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++ b/src/compiler/nir/nir_lower_vars_to_ssa.c @@ -535,8 +535,7 @@ lower_copies_to_load_store(struct deref_node *node, if (!node->copies) return; - nir_builder b; - nir_builder_init(&b, state->impl); + nir_builder b = nir_builder_create(state->impl); set_foreach(node->copies, copy_entry) { nir_intrinsic_instr *copy = (void *)copy_entry->key; @@ -572,8 +571,7 @@ lower_copies_to_load_store(struct deref_node *node, static bool rename_variables(struct lower_variables_state *state) { - nir_builder b; - nir_builder_init(&b, state->impl); + nir_builder b = nir_builder_create(state->impl); nir_foreach_block(block, state->impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index 3e79e210cd5..2f4fec07b59 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -1368,8 +1368,7 @@ copy_prop_vars_cf_node(struct copy_prop_var_state *state, case nir_cf_node_block: { nir_block *block = nir_cf_node_as_block(cf_node); - nir_builder b; - nir_builder_init(&b, state->impl); + nir_builder b = nir_builder_create(state->impl); copy_prop_vars_block(state, &b, block, copies); break; } diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c index 6fc294657d1..eac952acc29 100644 --- a/src/compiler/nir/nir_opt_copy_propagate.c +++ b/src/compiler/nir/nir_opt_copy_propagate.c @@ -62,8 +62,7 @@ rewrite_to_vec(nir_function_impl *impl, nir_alu_instr *mov, nir_alu_instr *vec) if (mov->op != nir_op_mov) return false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_instr(&mov->instr); unsigned num_comp = mov->dest.dest.ssa.num_components; diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c index 86ab25b9560..28626a2fb39 100644 --- a/src/compiler/nir/nir_opt_find_array_copies.c +++ b/src/compiler/nir/nir_opt_find_array_copies.c @@ -632,8 +632,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block, static bool opt_find_array_copies_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c index 67116451007..381f0e09026 100644 --- a/src/compiler/nir/nir_opt_if.c +++ b/src/compiler/nir/nir_opt_if.c @@ -1680,8 +1680,7 @@ nir_opt_if(nir_shader *shader, nir_opt_if_options options) if (function->impl == NULL) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_metadata_require(function->impl, nir_metadata_block_index | nir_metadata_dominance); diff --git a/src/compiler/nir/nir_opt_intrinsics.c b/src/compiler/nir/nir_opt_intrinsics.c index 0c5b33991ac..e4ed2b74177 100644 --- a/src/compiler/nir/nir_opt_intrinsics.c +++ b/src/compiler/nir/nir_opt_intrinsics.c @@ -169,8 +169,7 @@ static bool opt_intrinsics_impl(nir_function_impl *impl, const struct nir_shader_compiler_options *options) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c index 08002b28002..eae4363acd0 100644 --- a/src/compiler/nir/nir_opt_large_constants.c +++ b/src/compiler/nir/nir_opt_large_constants.c @@ -338,8 +338,7 @@ nir_opt_large_constants(nir_shader *shader, } } - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_opt_load_store_vectorize.c b/src/compiler/nir/nir_opt_load_store_vectorize.c index 9e239e8e2ca..7a477836eb3 100644 --- a/src/compiler/nir/nir_opt_load_store_vectorize.c +++ b/src/compiler/nir/nir_opt_load_store_vectorize.c @@ -1127,8 +1127,7 @@ try_vectorize(nir_function_impl *impl, struct vectorize_ctx *ctx, unsigned new_num_components = new_size / new_bit_size; /* vectorize the loads/stores */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); if (first->is_store) vectorize_stores(&b, ctx, low, high, first, second, @@ -1179,8 +1178,7 @@ try_vectorize_shared2(nir_function_impl *impl, struct vectorize_ctx *ctx, } /* vectorize the accesses */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_instr(first->is_store ? second->instr : first->instr); diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index e907cb41cf4..f70d997f2cd 100644 --- a/src/compiler/nir/nir_opt_loop_unroll.c +++ b/src/compiler/nir/nir_opt_loop_unroll.c @@ -662,8 +662,7 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop, nir_cf_reinsert(lp_header, nir_after_block(nir_loop_last_block(loop))); nir_cf_reinsert(lp_body, nir_after_block(nir_loop_last_block(loop))); - nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&loop->cf_node)); + nir_builder b = nir_builder_create(nir_cf_node_get_function(&loop->cf_node)); nir_foreach_block_in_cf_node(block, &loop->cf_node) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_opt_memcpy.c b/src/compiler/nir/nir_opt_memcpy.c index d984c131e28..fed7940502a 100644 --- a/src/compiler/nir/nir_opt_memcpy.c +++ b/src/compiler/nir/nir_opt_memcpy.c @@ -233,8 +233,7 @@ opt_memcpy_impl(nir_function_impl *impl) { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); struct set *complex_vars = _mesa_pointer_set_create(NULL); diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index 5ec9a54df72..9e64f02c23b 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -348,8 +348,7 @@ nir_opt_collapse_if(nir_if *if_stmt, nir_shader *shader, unsigned limit, } /* combine the conditions */ - struct nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&if_stmt->cf_node)->function->impl); + struct nir_builder b = nir_builder_create(nir_cf_node_get_function(&if_stmt->cf_node)->function->impl); b.cursor = nir_before_cf_node(&if_stmt->cf_node); nir_ssa_def *cond = nir_iand(&b, if_stmt->condition.ssa, parent_if->condition.ssa); diff --git a/src/compiler/nir/nir_opt_phi_precision.c b/src/compiler/nir/nir_opt_phi_precision.c index 10aa245faf1..dba1059ce21 100644 --- a/src/compiler/nir/nir_opt_phi_precision.c +++ b/src/compiler/nir/nir_opt_phi_precision.c @@ -462,8 +462,7 @@ nir_opt_phi_precision(nir_shader *shader) if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block (block, function->impl) { nir_foreach_phi_safe (phi, block) diff --git a/src/compiler/nir/nir_opt_remove_phis.c b/src/compiler/nir/nir_opt_remove_phis.c index 4e7e75fc86d..5452dc5e6b6 100644 --- a/src/compiler/nir/nir_opt_remove_phis.c +++ b/src/compiler/nir/nir_opt_remove_phis.c @@ -139,8 +139,7 @@ remove_phis_block(nir_block *block, nir_builder *b) bool nir_opt_remove_phis_block(nir_block *block) { - nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&block->cf_node)); + nir_builder b = nir_builder_create(nir_cf_node_get_function(&block->cf_node)); return remove_phis_block(block, &b); } @@ -148,8 +147,7 @@ static bool nir_opt_remove_phis_impl(nir_function_impl *impl) { bool progress = false; - nir_builder bld; - nir_builder_init(&bld, impl); + nir_builder bld = nir_builder_create(impl); nir_metadata_require(impl, nir_metadata_dominance); diff --git a/src/compiler/nir/nir_opt_shrink_stores.c b/src/compiler/nir/nir_opt_shrink_stores.c index 58135b84a17..0f80ea783ad 100644 --- a/src/compiler/nir/nir_opt_shrink_stores.c +++ b/src/compiler/nir/nir_opt_shrink_stores.c @@ -104,8 +104,7 @@ nir_opt_shrink_stores(nir_shader *shader, bool shrink_image_store) if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr(instr, block) { diff --git a/src/compiler/nir/nir_opt_shrink_vectors.c b/src/compiler/nir/nir_opt_shrink_vectors.c index 80481989184..385614e1ab1 100644 --- a/src/compiler/nir/nir_opt_shrink_vectors.c +++ b/src/compiler/nir/nir_opt_shrink_vectors.c @@ -483,8 +483,7 @@ nir_opt_shrink_vectors(nir_shader *shader) if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block_reverse(block, function->impl) { nir_foreach_instr_reverse(instr, block) { diff --git a/src/compiler/nir/nir_opt_uniform_atomics.c b/src/compiler/nir/nir_opt_uniform_atomics.c index d8e713ca731..d6c5f05ba42 100644 --- a/src/compiler/nir/nir_opt_uniform_atomics.c +++ b/src/compiler/nir/nir_opt_uniform_atomics.c @@ -298,8 +298,7 @@ static bool opt_uniform_atomics(nir_function_impl *impl) { bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.update_divergence = true; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_opt_vectorize.c b/src/compiler/nir/nir_opt_vectorize.c index fc37e3845e9..fdc4fcce1de 100644 --- a/src/compiler/nir/nir_opt_vectorize.c +++ b/src/compiler/nir/nir_opt_vectorize.c @@ -201,8 +201,7 @@ instr_try_combine(struct set *instr_set, nir_instr *instr1, nir_instr *instr2) if (total_components > instr1->pass_flags) return NULL; - nir_builder b; - nir_builder_init(&b, nir_cf_node_get_function(&instr1->block->cf_node)); + nir_builder b = nir_builder_create(nir_cf_node_get_function(&instr1->block->cf_node)); b.cursor = nir_after_instr(instr1); nir_alu_instr *new_alu = nir_alu_instr_create(b.shader, alu1->op); diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index 897fcecea7f..5a32057c17a 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -879,8 +879,7 @@ nir_algebraic_impl(nir_function_impl *impl, { bool progress = false; - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); /* Note: it's important here that we're allocating a zeroed array, since * state 0 is the default state, which means we don't have to visit diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c index 0d242e87c33..a8739bf84c8 100644 --- a/src/compiler/nir/nir_split_vars.c +++ b/src/compiler/nir/nir_split_vars.c @@ -236,8 +236,7 @@ split_struct_derefs_impl(nir_function_impl *impl, nir_variable_mode modes, void *mem_ctx) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -744,8 +743,7 @@ split_array_copies_impl(nir_function_impl *impl, nir_variable_mode modes, void *mem_ctx) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -789,8 +787,7 @@ split_array_access_impl(nir_function_impl *impl, nir_variable_mode modes, void *mem_ctx) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -1500,8 +1497,7 @@ shrink_vec_var_access_impl(nir_function_impl *impl, struct hash_table *var_usage_map, nir_variable_mode modes) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c index 5d6ff1045a0..24196c22665 100644 --- a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c +++ b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c @@ -483,8 +483,7 @@ ir3_nir_lower_ubo_loads(nir_shader *nir, struct ir3_shader_variant *v) nir_metadata_preserve(function->impl, nir_metadata_all); continue; } - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); nir_foreach_block (block, function->impl) { nir_foreach_instr_safe (instr, block) { if (!instr_is_load_ubo(instr)) diff --git a/src/freedreno/ir3/ir3_nir_lower_io_offsets.c b/src/freedreno/ir3/ir3_nir_lower_io_offsets.c index 75caf6bd57b..74b7ef8a08d 100644 --- a/src/freedreno/ir3/ir3_nir_lower_io_offsets.c +++ b/src/freedreno/ir3/ir3_nir_lower_io_offsets.c @@ -300,8 +300,7 @@ static bool lower_io_offsets_func(nir_function_impl *impl) { void *mem_ctx = ralloc_parent(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block_safe (block, impl) { diff --git a/src/freedreno/ir3/ir3_nir_lower_tess.c b/src/freedreno/ir3/ir3_nir_lower_tess.c index 94730d8e2ca..f7a87ced59b 100644 --- a/src/freedreno/ir3/ir3_nir_lower_tess.c +++ b/src/freedreno/ir3/ir3_nir_lower_tess.c @@ -302,8 +302,7 @@ ir3_nir_lower_to_explicit_output(nir_shader *shader, nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); if (v->type == MESA_SHADER_VERTEX && topology != IR3_TESS_NONE) @@ -378,8 +377,7 @@ ir3_nir_lower_to_explicit_input(nir_shader *shader, nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); if (shader->info.stage == MESA_SHADER_GEOMETRY) @@ -683,8 +681,7 @@ ir3_nir_lower_tess_ctrl(nir_shader *shader, struct ir3_shader_variant *v, nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); state.header = nir_load_tcs_header_ir3(&b); @@ -837,8 +834,7 @@ ir3_nir_lower_tess_eval(nir_shader *shader, struct ir3_shader_variant *v, nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block_safe (block, impl) lower_tess_eval_block(block, &b, &state); @@ -947,8 +943,7 @@ ir3_nir_lower_gs(nir_shader *shader) nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); state.header = nir_load_gs_header_ir3(&b); diff --git a/src/freedreno/vulkan/tu_nir_lower_multiview.cc b/src/freedreno/vulkan/tu_nir_lower_multiview.cc index 81374431f82..e0d9ff44239 100644 --- a/src/freedreno/vulkan/tu_nir_lower_multiview.cc +++ b/src/freedreno/vulkan/tu_nir_lower_multiview.cc @@ -27,8 +27,7 @@ lower_multiview_mask(nir_shader *nir, uint32_t *mask) return false; } - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); uint32_t old_mask = *mask; *mask = BIT(util_logbase2(old_mask) + 1) - 1; diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c index 920a3461d8d..6f0d3efbdc9 100644 --- a/src/gallium/auxiliary/nir/tgsi_to_nir.c +++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c @@ -2573,8 +2573,7 @@ lower_clipdistance_to_array(nir_shader *nir) bool func_progress = false; if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); b.cursor = nir_before_block(nir_start_block(function->impl)); /* create a new deref for the arrayed clipdistance variable at the start of the function */ nir_deref_instr *clipdist_deref = nir_build_deref_var(&b, dist0); diff --git a/src/gallium/drivers/asahi/agx_streamout.c b/src/gallium/drivers/asahi/agx_streamout.c index 87110841e3c..6bb2cd49d0d 100644 --- a/src/gallium/drivers/asahi/agx_streamout.c +++ b/src/gallium/drivers/asahi/agx_streamout.c @@ -344,8 +344,7 @@ insert_overflow_check(nir_shader *nir, struct agx_xfb_key *key) nir_after_block(nir_impl_last_block(impl))); /* Get a builder for the (now empty) shader */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block(nir_start_block(impl)); /* Rebuild the shader as diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index d9cea484fdd..c3aa7baabd6 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -279,8 +279,7 @@ crocus_lower_storage_image_derefs(nir_shader *nir) { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -451,8 +450,7 @@ crocus_setup_uniforms(ASSERTED const struct intel_device_info *devinfo, nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); nir_ssa_def *temp_ubo_name = nir_ssa_undef(&b, 1, 32); @@ -969,8 +967,7 @@ crocus_setup_binding_table(const struct intel_device_info *devinfo, * to change those, as we haven't set any of the *_start entries in brw * binding_table. */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr (instr, block) { @@ -1148,8 +1145,7 @@ crocus_lower_default_edgeflags(struct nir_shader *nir) { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_cf_list(&b.impl->body); nir_variable *var = nir_variable_create(nir, nir_var_shader_out, diff --git a/src/gallium/drivers/d3d12/d3d12_lower_point_sprite.c b/src/gallium/drivers/d3d12/d3d12_lower_point_sprite.c index 83f557872d2..b3f9693a0ec 100644 --- a/src/gallium/drivers/d3d12/d3d12_lower_point_sprite.c +++ b/src/gallium/drivers/d3d12/d3d12_lower_point_sprite.c @@ -287,8 +287,7 @@ d3d12_lower_point_sprite(nir_shader *shader, nir_foreach_function(function, shader) { if (function->impl) { - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index f04c5ce1604..b606dd8f627 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -94,8 +94,7 @@ d3d12_lower_yflip(nir_shader *nir) nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -152,8 +151,7 @@ d3d12_lower_depth_range(nir_shader *nir) nir_variable *depth_transform = NULL; nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -249,8 +247,7 @@ d3d12_lower_uint_cast(nir_shader *nir, bool is_signed) nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -419,8 +416,7 @@ d3d12_nir_invert_depth(nir_shader *shader, unsigned viewport_mask, bool clip_hal struct invert_depth_state state = { viewport_mask, clip_halfz }; nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -541,8 +537,7 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader) nir_foreach_function(function, nir) { if (function->impl) { - nir_builder builder; - nir_builder_init(&builder, function->impl); + nir_builder builder = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type == nir_instr_type_intrinsic) @@ -1017,8 +1012,7 @@ d3d12_write_0_to_new_varying(nir_shader *s, nir_variable *var) if (!func->impl) continue; - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { b.cursor = nir_before_block(block); diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index b8294f118f3..936c655f7e7 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -748,8 +748,7 @@ lower_alu(struct etna_compile *c, nir_alu_instr *alu) { const nir_op_info *info = &nir_op_infos[alu->op]; - nir_builder b; - nir_builder_init(&b, c->impl); + nir_builder b = nir_builder_create(c->impl); b.cursor = nir_before_instr(&alu->instr); switch (alu->op) { @@ -898,8 +897,7 @@ emit_shader(struct etna_compile *c, unsigned *num_temps, unsigned *num_consts) bool have_indirect_uniform = false; unsigned indirect_max = 0; - nir_builder b; - nir_builder_init(&b, c->impl); + nir_builder b = nir_builder_create(c->impl); /* convert non-dynamic uniform loads to constants, etc */ nir_foreach_block(block, c->impl) { diff --git a/src/gallium/drivers/etnaviv/etnaviv_nir.c b/src/gallium/drivers/etnaviv/etnaviv_nir.c index 8acb6fd26f7..224849b9bb4 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_nir.c @@ -33,8 +33,7 @@ void etna_lower_io(nir_shader *shader, struct etna_shader_variant *v) { nir_foreach_function(function, shader) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -151,8 +150,7 @@ etna_lower_alu_impl(nir_function_impl *impl, bool has_new_transcendentals) { nir_shader *shader = impl->function->shader; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* in a seperate loop so we can apply the multiple-uniform logic to the new fmul */ nir_foreach_block(block, impl) { diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 1a6d4888f09..95e225c72ee 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -262,8 +262,7 @@ iris_lower_storage_image_derefs(nir_shader *nir) { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { @@ -469,8 +468,7 @@ iris_setup_uniforms(ASSERTED const struct intel_device_info *devinfo, nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); nir_ssa_def *temp_ubo_name = nir_ssa_undef(&b, 1, 32); @@ -1036,8 +1034,7 @@ iris_setup_binding_table(const struct intel_device_info *devinfo, * to change those, as we haven't set any of the *_start entries in brw * binding_table. */ - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr (instr, block) { diff --git a/src/gallium/drivers/lima/ir/lima_nir_duplicate_consts.c b/src/gallium/drivers/lima/ir/lima_nir_duplicate_consts.c index 0eeab6b6ad0..f303ad022ed 100644 --- a/src/gallium/drivers/lima/ir/lima_nir_duplicate_consts.c +++ b/src/gallium/drivers/lima/ir/lima_nir_duplicate_consts.c @@ -87,8 +87,7 @@ lima_nir_duplicate_load_const(nir_builder *b, nir_load_const_instr *load) static void lima_nir_duplicate_load_consts_impl(nir_shader *shader, nir_function_impl *impl) { - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { diff --git a/src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c b/src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c index 3c0dba02920..2d55b9f368d 100644 --- a/src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c +++ b/src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c @@ -103,8 +103,7 @@ static void lima_nir_duplicate_intrinsic_impl(nir_shader *shader, nir_function_impl *impl, nir_intrinsic_op op) { - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { diff --git a/src/gallium/drivers/lima/ir/lima_nir_lower_uniform_to_scalar.c b/src/gallium/drivers/lima/ir/lima_nir_lower_uniform_to_scalar.c index c0089270339..fd6183d08d6 100644 --- a/src/gallium/drivers/lima/ir/lima_nir_lower_uniform_to_scalar.c +++ b/src/gallium/drivers/lima/ir/lima_nir_lower_uniform_to_scalar.c @@ -61,8 +61,7 @@ lima_nir_lower_uniform_to_scalar(nir_shader *shader) { nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/gallium/drivers/lima/ir/lima_nir_split_loads.c b/src/gallium/drivers/lima/ir/lima_nir_split_loads.c index 2d9f7de662f..b66546170a6 100644 --- a/src/gallium/drivers/lima/ir/lima_nir_split_loads.c +++ b/src/gallium/drivers/lima/ir/lima_nir_split_loads.c @@ -128,8 +128,7 @@ lima_nir_split_loads(nir_shader *shader) nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block_reverse(block, function->impl) { nir_foreach_instr_reverse_safe(instr, block) { diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index bd8ed554a5f..e1f9499eed6 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -115,8 +115,7 @@ r600_lower_scratch_addresses(nir_shader *shader) bool progress = false; nir_foreach_function(function, shader) { - nir_builder build; - nir_builder_init(&build, function->impl); + nir_builder build = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { @@ -506,8 +505,7 @@ r600_get_natural_size_align_bytes(const struct glsl_type *type, static bool r600_lower_shared_io_impl(nir_function *func) { - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); bool progress = false; nir_foreach_block(block, func->impl) diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp index 81f4e128f49..1b581010e1f 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp @@ -1067,8 +1067,7 @@ r600_nir_64_to_vec2(nir_shader *sh) nir_foreach_function(function, sh) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { @@ -1231,8 +1230,7 @@ StoreMerger::combine_one_slot(vector& stores) { nir_ssa_def *srcs[4] = {nullptr}; - nir_builder b; - nir_builder_init(&b, nir_shader_get_entrypoint(sh)); + nir_builder b = nir_builder_create(nir_shader_get_entrypoint(sh)); auto last_store = *stores.rbegin(); b.cursor = nir_before_instr(&last_store->instr); diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp index 6bc3bdee14b..7c92c4d0cbd 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp @@ -148,8 +148,7 @@ NirLowerIOToVector::NirLowerIOToVector(int base_slot): bool NirLowerIOToVector::run(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_metadata_require(impl, nir_metadata_dominance); create_new_io_vars(impl->function->shader); diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp index 68dc657d1b5..052c3df36b8 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tess_io.cpp @@ -482,8 +482,7 @@ r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type) nir_foreach_function(function, shader) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp index b9229752402..80720d3c9b9 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_tex.cpp @@ -82,8 +82,7 @@ lower_coord_shift_unnormalized(nir_builder *b, nir_tex_instr *tex) static bool r600_nir_lower_int_tg4_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block(block, impl) @@ -201,8 +200,7 @@ lower_txl_txf_array_or_cube(nir_builder *b, nir_tex_instr *tex) static bool r600_nir_lower_txl_txf_array_or_cube_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block(block, impl) diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c b/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c index 0917c3d8211..ca6143874d3 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c +++ b/src/gallium/drivers/r600/sfn/sfn_nir_vectorize_vs_inputs.c @@ -428,8 +428,7 @@ r600_create_new_io_vars(nir_shader *shader, static bool r600_vectorize_io_impl(nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_metadata_require(impl, nir_metadata_dominance); diff --git a/src/gallium/drivers/radeonsi/si_nir_lower_abi.c b/src/gallium/drivers/radeonsi/si_nir_lower_abi.c index 73d654a3df8..4cc5247373d 100644 --- a/src/gallium/drivers/radeonsi/si_nir_lower_abi.c +++ b/src/gallium/drivers/radeonsi/si_nir_lower_abi.c @@ -771,8 +771,7 @@ bool si_nir_lower_abi(nir_shader *nir, struct si_shader *shader, struct si_shade nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); preload_reusable_variables(&b, &state); diff --git a/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c b/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c index f747ba69d97..7ff68008f07 100644 --- a/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c +++ b/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c @@ -89,8 +89,7 @@ get_vertex_index_for_all_inputs(nir_shader *nir, struct lower_vs_inputs_state *s { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder builder; - nir_builder_init(&builder, impl); + nir_builder builder = nir_builder_create(impl); nir_builder *b = &builder; b->cursor = nir_before_cf_list(&impl->body); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index fc8ba78c3a9..99427650603 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1539,8 +1539,7 @@ static bool si_nir_kill_outputs(nir_shader *nir, const union si_shader_key *key) bool progress = false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c index bd18b7ef5e2..31958106f18 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_blend.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_blend.c @@ -595,8 +595,7 @@ vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c) nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_instr(&intr->instr); vc4_nir_lower_blend_instr(c, &b, intr); } @@ -623,8 +622,7 @@ vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c) */ if (c->fs_key->sample_coverage && !c->fs_key->sample_alpha_to_coverage) { nir_function_impl *impl = nir_shader_get_entrypoint(s); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block(nir_impl_last_block(impl)); vc4_nir_store_sample_mask(c, &b, nir_load_sample_mask_in(&b)); diff --git a/src/gallium/drivers/vc4/vc4_nir_lower_io.c b/src/gallium/drivers/vc4/vc4_nir_lower_io.c index 7a506f26682..11ce541415d 100644 --- a/src/gallium/drivers/vc4/vc4_nir_lower_io.c +++ b/src/gallium/drivers/vc4/vc4_nir_lower_io.c @@ -357,8 +357,7 @@ vc4_nir_lower_io_instr(struct vc4_compile *c, nir_builder *b, static bool vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 5b476f9166b..97470fac402 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -2819,8 +2819,7 @@ lower_64bit_vars_function(nir_shader *shader, nir_function *function, nir_variab bool func_progress = false; if (!function->impl) return false; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { switch (instr->type) { @@ -3101,8 +3100,7 @@ split_blocks(nir_shader *nir) bool func_progress = false; if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { switch (instr->type) { @@ -5226,8 +5224,7 @@ zink_shader_tcs_create(struct zink_screen *screen, nir_shader *tes, unsigned ver fn->is_entrypoint = true; nir_function_impl *impl = nir_function_impl_create(fn); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_block(nir_start_block(impl)); nir_ssa_def *invocation_id = nir_load_invocation_id(&b); diff --git a/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c b/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c index 08e74a254a3..6d3ca9c2ce5 100644 --- a/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c +++ b/src/gallium/frontends/lavapipe/lvp_inline_uniforms.c @@ -181,8 +181,7 @@ lvp_inline_uniforms(nir_shader *nir, const struct lvp_shader *shader, const uint nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) diff --git a/src/gallium/frontends/lavapipe/lvp_lower_input_attachments.c b/src/gallium/frontends/lavapipe/lvp_lower_input_attachments.c index b1e7cd60ec4..42c7040bd38 100644 --- a/src/gallium/frontends/lavapipe/lvp_lower_input_attachments.c +++ b/src/gallium/frontends/lavapipe/lvp_lower_input_attachments.c @@ -60,8 +60,7 @@ try_lower_input_load(nir_function_impl *impl, nir_intrinsic_instr *load, image_dim != GLSL_SAMPLER_DIM_SUBPASS_MS) return false; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_instr(&load->instr); nir_ssa_def *frag_coord = use_fragcoord_sysval ? nir_load_frag_coord(&b) diff --git a/src/imagination/rogue/nir/rogue_nir_lower_io.c b/src/imagination/rogue/nir/rogue_nir_lower_io.c index 407992abbe8..f6089e9a1ee 100644 --- a/src/imagination/rogue/nir/rogue_nir_lower_io.c +++ b/src/imagination/rogue/nir/rogue_nir_lower_io.c @@ -111,9 +111,7 @@ static bool lower_intrinsic(nir_builder *b, nir_intrinsic_instr *instr) static bool lower_impl(nir_function_impl *impl) { bool progress = false; - nir_builder b; - - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block (block, impl) { nir_foreach_instr_safe (instr, block) { diff --git a/src/intel/compiler/brw_kernel.c b/src/intel/compiler/brw_kernel.c index 13e8bee0827..2d09b48aec0 100644 --- a/src/intel/compiler/brw_kernel.c +++ b/src/intel/compiler/brw_kernel.c @@ -169,8 +169,7 @@ lower_kernel_intrinsics(nir_shader *nir) unsigned kernel_arg_start = sizeof(struct brw_kernel_sysvals); nir->num_uniforms += kernel_arg_start; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index a711dcbfba9..71298f7e4be 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -277,8 +277,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir, if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -441,8 +440,7 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map) nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { remap_patch_urb_offsets(block, &b, vue_map, nir->info.tess._primitive_mode); @@ -597,8 +595,7 @@ brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map, nir_foreach_function(function, nir) { if (function->impl) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { remap_patch_urb_offsets(block, &b, vue_map, tes_primitive_mode); } diff --git a/src/intel/compiler/brw_nir_lower_alpha_to_coverage.c b/src/intel/compiler/brw_nir_lower_alpha_to_coverage.c index 55020616fd5..62256299cb3 100644 --- a/src/intel/compiler/brw_nir_lower_alpha_to_coverage.c +++ b/src/intel/compiler/brw_nir_lower_alpha_to_coverage.c @@ -167,8 +167,7 @@ brw_nir_lower_alpha_to_coverage(nir_shader *shader, &sample_mask_write->instr); } - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* Combine dither_mask and the gl_SampleMask value */ b.cursor = nir_before_instr(&sample_mask_write->instr); diff --git a/src/intel/compiler/brw_nir_lower_intersection_shader.c b/src/intel/compiler/brw_nir_lower_intersection_shader.c index 89e393c9f46..af6b011bf7d 100644 --- a/src/intel/compiler/brw_nir_lower_intersection_shader.c +++ b/src/intel/compiler/brw_nir_lower_intersection_shader.c @@ -55,8 +55,7 @@ lower_any_hit_for_intersection(nir_shader *any_hit) ralloc_array(any_hit, nir_parameter, ARRAY_SIZE(params)); memcpy(impl->function->params, params, sizeof(params)); - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); nir_builder *b = &build; b->cursor = nir_before_cf_list(&impl->body); @@ -157,8 +156,7 @@ brw_nir_lower_intersection_shader(nir_shader *intersection, nir_function_impl *impl = nir_shader_get_entrypoint(intersection); - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); nir_builder *b = &build; b->cursor = nir_before_cf_list(&impl->body); diff --git a/src/intel/compiler/brw_nir_lower_rt_intrinsics.c b/src/intel/compiler/brw_nir_lower_rt_intrinsics.c index aad14cf445d..b4d8b1e931f 100644 --- a/src/intel/compiler/brw_nir_lower_rt_intrinsics.c +++ b/src/intel/compiler/brw_nir_lower_rt_intrinsics.c @@ -50,8 +50,7 @@ lower_rt_intrinsics_impl(nir_function_impl *impl, { bool progress = false; - nir_builder build; - nir_builder_init(&build, impl); + nir_builder build = nir_builder_create(impl); nir_builder *b = &build; b->cursor = nir_before_block(nir_start_block(b->impl)); diff --git a/src/intel/compiler/brw_nir_lower_shader_calls.c b/src/intel/compiler/brw_nir_lower_shader_calls.c index 9faccb6c415..7e7fac037b4 100644 --- a/src/intel/compiler/brw_nir_lower_shader_calls.c +++ b/src/intel/compiler/brw_nir_lower_shader_calls.c @@ -72,8 +72,7 @@ brw_nir_lower_shader_returns(nir_shader *shader) if (shader->info.stage != MESA_SHADER_RAYGEN) shader->scratch_size += BRW_BTD_STACK_CALLEE_DATA_SIZE; - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); set_foreach(impl->end_block->predecessors, block_entry) { struct nir_block *block = (void *)block_entry->key; diff --git a/src/intel/compiler/brw_nir_rt.c b/src/intel/compiler/brw_nir_rt.c index 62315233682..f1c70bdfcb8 100644 --- a/src/intel/compiler/brw_nir_rt.c +++ b/src/intel/compiler/brw_nir_rt.c @@ -78,8 +78,7 @@ lower_rt_io_derefs(nir_shader *shader) */ assert(num_shader_call_vars <= 1); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); nir_ssa_def *call_data_addr = NULL; @@ -272,8 +271,7 @@ lower_ray_walk_intrinsics(nir_shader *shader, nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block_safe(block, impl) { diff --git a/src/intel/compiler/brw_nir_tcs_workarounds.c b/src/intel/compiler/brw_nir_tcs_workarounds.c index acdecdf9beb..4073bf617a3 100644 --- a/src/intel/compiler/brw_nir_tcs_workarounds.c +++ b/src/intel/compiler/brw_nir_tcs_workarounds.c @@ -111,8 +111,7 @@ brw_nir_apply_tcs_quads_workaround(nir_shader *nir) nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); /* emit_quads_workaround() inserts an if statement into each block, * which splits it in two. This changes the set of predecessors of diff --git a/src/intel/vulkan/anv_mesh_perprim_wa.c b/src/intel/vulkan/anv_mesh_perprim_wa.c index f8cb4a76bbe..057ed91fdd9 100644 --- a/src/intel/vulkan/anv_mesh_perprim_wa.c +++ b/src/intel/vulkan/anv_mesh_perprim_wa.c @@ -153,8 +153,7 @@ anv_mesh_convert_attrs_prim_to_vert(struct nir_shader *nir, num_mesh_vertices_per_primitive(nir->info.mesh.primitive_type); nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_cf_list(&impl->body); /* wait for all subgroups to finish */ @@ -495,8 +494,7 @@ anv_frag_convert_attrs_prim_to_vert(struct nir_shader *nir, nir_deref_instr *new_derefs[VARYING_SLOT_MAX] = {NULL, }; nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_before_cf_list(&impl->body); nir_foreach_shader_in_variable_safe(var, nir) { diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c index cb5ce761d5d..46a3a2cfe05 100644 --- a/src/intel/vulkan/anv_nir_lower_multiview.c +++ b/src/intel/vulkan/anv_nir_lower_multiview.c @@ -204,8 +204,7 @@ anv_nir_lower_multiview(nir_shader *shader, uint32_t view_mask, bool progress = nir_lower_multiview(shader, view_mask); if (progress) { - nir_builder b; - nir_builder_init(&b, entrypoint); + nir_builder b = nir_builder_create(entrypoint); b.cursor = nir_before_cf_list(&entrypoint->body); /* Fill Layer ID with zero. Replication will use that as base to diff --git a/src/mesa/state_tracker/st_nir_lower_fog.c b/src/mesa/state_tracker/st_nir_lower_fog.c index 918f828199b..f35140cfc53 100644 --- a/src/mesa/state_tracker/st_nir_lower_fog.c +++ b/src/mesa/state_tracker/st_nir_lower_fog.c @@ -128,8 +128,7 @@ st_nir_lower_fog(nir_shader *s, enum gl_fog_mode fog_mode, struct gl_program_par return false; } - nir_builder b; - nir_builder_init(&b, nir_shader_get_entrypoint(s)); + nir_builder b = nir_builder_create(nir_shader_get_entrypoint(s)); b.cursor = nir_after_block(nir_impl_last_block(b.impl)); /* Note: while ARB_fragment_program plus ARB_draw_buffers allows an array diff --git a/src/mesa/state_tracker/st_nir_lower_position_invariant.c b/src/mesa/state_tracker/st_nir_lower_position_invariant.c index dd8568f90bb..d183e2e3242 100644 --- a/src/mesa/state_tracker/st_nir_lower_position_invariant.c +++ b/src/mesa/state_tracker/st_nir_lower_position_invariant.c @@ -20,8 +20,7 @@ bool st_nir_lower_position_invariant(struct nir_shader *s, bool aos, struct gl_program_parameter_list *paramList) { - nir_builder b; - nir_builder_init(&b, nir_shader_get_entrypoint(s)); + nir_builder b = nir_builder_create(nir_shader_get_entrypoint(s)); b.cursor = nir_before_block(nir_start_block(b.impl)); nir_ssa_def *mvp[4]; diff --git a/src/mesa/state_tracker/st_nir_lower_tex_src_plane.c b/src/mesa/state_tracker/st_nir_lower_tex_src_plane.c index b2715005259..80b0e7fb2be 100644 --- a/src/mesa/state_tracker/st_nir_lower_tex_src_plane.c +++ b/src/mesa/state_tracker/st_nir_lower_tex_src_plane.c @@ -167,8 +167,7 @@ lower_tex_src_plane_block(nir_builder *b, lower_tex_src_state *state, nir_block static void lower_tex_src_plane_impl(lower_tex_src_state *state, nir_function_impl *impl) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); nir_foreach_block(block, impl) { lower_tex_src_plane_block(&b, state, block); diff --git a/src/microsoft/clc/clc_compiler.c b/src/microsoft/clc/clc_compiler.c index 5831c0afe5c..6801724da29 100644 --- a/src/microsoft/clc/clc_compiler.c +++ b/src/microsoft/clc/clc_compiler.c @@ -263,8 +263,7 @@ clc_lower_images(nir_shader *nir, struct clc_image_lower_context *context) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -285,8 +284,7 @@ static void clc_lower_64bit_semantics(nir_shader *nir) { nir_foreach_function(func, nir) { - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -332,8 +330,7 @@ clc_lower_nonnormalized_samplers(nir_shader *nir, continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -459,8 +456,7 @@ clc_lower_constant_to_ssbo(nir_shader *nir, assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr(instr, block) { diff --git a/src/microsoft/clc/clc_nir.c b/src/microsoft/clc/clc_nir.c index fc8937ab73d..e6096463989 100644 --- a/src/microsoft/clc/clc_nir.c +++ b/src/microsoft/clc/clc_nir.c @@ -109,8 +109,7 @@ clc_nir_lower_system_values(nir_shader *nir, nir_variable *var) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -193,8 +192,7 @@ clc_nir_lower_kernel_input_loads(nir_shader *nir, nir_variable *var) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -233,8 +231,7 @@ clc_lower_printf_base(nir_shader *nir, unsigned uav_id) nir_variable *printf_var = NULL; nir_ssa_def *printf_deref = NULL; nir_foreach_function(func, nir) { - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); b.cursor = nir_before_instr(nir_block_first_instr(nir_start_block(func->impl))); bool progress = false; diff --git a/src/microsoft/compiler/dxil_nir.c b/src/microsoft/compiler/dxil_nir.c index 6a74f7cbce6..19443675773 100644 --- a/src/microsoft/compiler/dxil_nir.c +++ b/src/microsoft/compiler/dxil_nir.c @@ -258,8 +258,7 @@ dxil_nir_lower_constant_to_temp(nir_shader *nir) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_deref) @@ -667,8 +666,7 @@ dxil_nir_lower_loads_stores_to_dxil(nir_shader *nir, if (!func->impl) continue; - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_variable *scratch_var = NULL; if (nir->scratch_size) { @@ -750,8 +748,7 @@ dxil_nir_lower_deref_ssbo(nir_shader *nir) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -815,8 +812,7 @@ dxil_nir_opt_alu_deref_srcs(nir_shader *nir) continue; assert(func->impl); - nir_builder b; - nir_builder_init(&b, func->impl); + nir_builder b = nir_builder_create(func->impl); nir_foreach_block(block, func->impl) { nir_foreach_instr_safe(instr, block) { @@ -866,8 +862,7 @@ cast_phi(nir_builder *b, nir_phi_instr *phi, unsigned new_bit_size) static bool upcast_phi_impl(nir_function_impl *impl, unsigned min_bit_size) { - nir_builder b; - nir_builder_init(&b, impl); + nir_builder b = nir_builder_create(impl); bool progress = false; nir_foreach_block_reverse(block, impl) { @@ -2094,8 +2089,7 @@ dxil_nir_split_unaligned_loads_stores(nir_shader *shader, nir_variable_mode mode if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/microsoft/compiler/dxil_nir_tess.c b/src/microsoft/compiler/dxil_nir_tess.c index e9a6d2033a5..29a36542763 100644 --- a/src/microsoft/compiler/dxil_nir_tess.c +++ b/src/microsoft/compiler/dxil_nir_tess.c @@ -218,8 +218,7 @@ dxil_nir_split_tess_ctrl(nir_shader *nir, nir_function **patch_const_func) * First, sink load_invocation_id so that it's present on both sides of barriers. * Each use gets a unique load of the invocation ID. */ - nir_builder b; - nir_builder_init(&b, patch_const_func_impl); + nir_builder b = nir_builder_create(patch_const_func_impl); nir_foreach_block(block, patch_const_func_impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) diff --git a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c index 5d2d998001c..4c41425f3f9 100644 --- a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c +++ b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c @@ -897,8 +897,7 @@ lower_view_index_to_rt_layer(nir_shader *nir) nir_metadata_loop_analysis, var); } else { nir_function_impl *func = nir_shader_get_entrypoint(nir); - nir_builder b; - nir_builder_init(&b, func); + nir_builder b = nir_builder_create(func); b.cursor = nir_after_block(nir_impl_last_block(func)); add_layer_write(&b, NULL, var); } diff --git a/src/panfrost/midgard/nir_fuse_io_16.c b/src/panfrost/midgard/nir_fuse_io_16.c index 5fe4761f969..37eb51ce77d 100644 --- a/src/panfrost/midgard/nir_fuse_io_16.c +++ b/src/panfrost/midgard/nir_fuse_io_16.c @@ -53,8 +53,7 @@ nir_fuse_io_16(nir_shader *shader) if (!function->impl) continue; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); nir_foreach_block(block, function->impl) { nir_foreach_instr_safe(instr, block) { @@ -87,8 +86,7 @@ nir_fuse_io_16(nir_shader *shader) intr->dest.ssa.bit_size = 16; - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); b.cursor = nir_after_instr(instr); /* The f2f32(f2fmp(x)) will cancel by opt_algebraic */ diff --git a/src/panfrost/util/pan_lower_writeout.c b/src/panfrost/util/pan_lower_writeout.c index bbd4a1f01d9..83d565e4af1 100644 --- a/src/panfrost/util/pan_lower_writeout.c +++ b/src/panfrost/util/pan_lower_writeout.c @@ -154,8 +154,7 @@ pan_nir_lower_zs_store(nir_shader *nir) assert(nir_src_is_const(intr->src[1]) && "no indirect outputs"); - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); b.cursor = nir_after_block_before_jump(instr->block); /* Trying to write depth twice results in the @@ -173,8 +172,7 @@ pan_nir_lower_zs_store(nir_shader *nir) /* Insert a store to the depth RT (0xff) if needed */ if (!replaced) { - nir_builder b; - nir_builder_init(&b, function->impl); + nir_builder b = nir_builder_create(function->impl); b.cursor = nir_after_block_before_jump(common_block); pan_nir_emit_combined_store(&b, NULL, writeout, stores);