From: Alyssa Rosenzweig Date: Mon, 28 Aug 2023 17:56:53 +0000 (-0400) Subject: treewide: Use nir_before/after_impl in easy cases X-Git-Tag: upstream/23.3.3~2690 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25cc04c59b4cca37b5bc667129dab7e2db7b61e2;p=platform%2Fupstream%2Fmesa.git treewide: Use nir_before/after_impl in easy cases These open-code the same idiom as the helper. Via Coccinelle patch: @@ expression func_impl; @@ -nir_before_cf_list(&func_impl->body) +nir_before_impl(func_impl) @@ expression func_impl; @@ -nir_after_cf_list(&func_impl->body) +nir_after_impl(func_impl) Signed-off-by: Alyssa Rosenzweig Acked-by: Faith Ekstrand Reviewed-by: Kenneth Graunke Part-of: --- diff --git a/src/amd/common/ac_nir.c b/src/amd/common/ac_nir.c index 17c76d8..40607d0 100644 --- a/src/amd/common/ac_nir.c +++ b/src/amd/common/ac_nir.c @@ -790,7 +790,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_at(nir_after_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_after_impl(impl)); nir_alu_type output_types_16bit_lo[16][4]; nir_alu_type output_types_16bit_hi[16][4]; @@ -1170,7 +1170,7 @@ ac_nir_lower_legacy_gs(nir_shader *nir, nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder builder = nir_builder_at(nir_after_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_after_impl(impl)); nir_builder *b = &builder; /* Emit shader query for mix use legacy/NGG GS */ diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index 1ba5517..86f3a0b 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -1502,7 +1502,7 @@ add_deferred_attribute_culling(nir_builder *b, nir_cf_list *original_extracted_c /* Remove all non-position outputs, and put the position output into the variable. */ nir_metadata_preserve(impl, nir_metadata_none); remove_culling_shader_outputs(b->shader, s); - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); nir_def *lds_scratch_base = nir_load_lds_ngg_scratch_base_amd(b); @@ -2367,8 +2367,9 @@ ac_nir_lower_ngg_nogs(nir_shader *shader, const ac_nir_lower_ngg_options *option } nir_cf_list extracted; - nir_cf_extract(&extracted, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body)); - b->cursor = nir_before_cf_list(&impl->body); + nir_cf_extract(&extracted, nir_before_impl(impl), + nir_after_impl(impl)); + b->cursor = nir_before_impl(impl); ngg_nogs_init_vertex_indices_vars(b, impl, &state); @@ -2402,7 +2403,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader, const ac_nir_lower_ngg_options *option nir_store_var(b, prim_exp_arg_var, emit_ngg_nogs_prim_exp_arg(b, &state), 0x1u); } else { add_deferred_attribute_culling(b, &extracted, &state); - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); if (state.early_prim_export) emit_ngg_nogs_prim_export(b, &state, nir_load_var(b, state.prim_exp_arg_var)); @@ -2487,13 +2488,13 @@ ac_nir_lower_ngg_nogs(nir_shader *shader, const ac_nir_lower_ngg_options *option ngg_nogs_store_xfb_outputs_to_lds(b, &state); - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); ngg_nogs_build_streamout(b, &state); } /* Take care of late primitive export */ if (!state.early_prim_export) { - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); emit_ngg_nogs_prim_export(b, &state, nir_load_var(b, prim_exp_arg_var)); } @@ -2522,7 +2523,7 @@ ac_nir_lower_ngg_nogs(nir_shader *shader, const ac_nir_lower_ngg_options *option b->cursor = nir_after_cf_node(&if_es_thread->cf_node); create_vertex_param_phis(b, num_outputs, outputs); - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); if (!num_es_threads) num_es_threads = nir_load_merged_wave_info_amd(b); @@ -3051,7 +3052,7 @@ ngg_gs_export_vertices(nir_builder *b, nir_def *max_num_out_vtx, nir_def *tid_in s->outputs_16bit_hi); if (num_outputs) { - b->cursor = nir_after_cf_list(&s->impl->body); + b->cursor = nir_after_impl(s->impl); create_vertex_param_phis(b, num_outputs, outputs); export_vertex_params_gfx11(b, tid_in_tg, max_num_out_vtx, num_outputs, outputs, @@ -3432,9 +3433,10 @@ ac_nir_lower_ngg_gs(nir_shader *shader, const ac_nir_lower_ngg_options *options) /* Extract the full control flow. It is going to be wrapped in an if statement. */ nir_cf_list extracted; - nir_cf_extract(&extracted, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body)); + nir_cf_extract(&extracted, nir_before_impl(impl), + nir_after_impl(impl)); - nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &builder; /* This is to avoid the & */ /* Workgroup barrier: wait for ES threads */ @@ -3476,7 +3478,7 @@ ac_nir_lower_ngg_gs(nir_shader *shader, const ac_nir_lower_ngg_options *options) state.vertex_count, state.primitive_count); - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); /* Emit the finale sequence */ ngg_gs_finale(b, &state); @@ -4076,7 +4078,7 @@ ms_emit_legacy_workgroup_index(nir_builder *b, lower_ngg_ms_state *s) if (!BITSET_TEST(b->shader->info.system_values_read, SYSTEM_VALUE_WORKGROUP_INDEX)) return; - b->cursor = nir_before_cf_list(&b->impl->body); + b->cursor = nir_before_impl(b->impl); /* Legacy fast launch mode (FAST_LAUNCH=1): * @@ -4485,8 +4487,9 @@ handle_smaller_ms_api_workgroup(nir_builder *b, /* Extract the full control flow of the shader. */ nir_cf_list extracted; - nir_cf_extract(&extracted, nir_before_cf_list(&b->impl->body), nir_after_cf_list(&b->impl->body)); - b->cursor = nir_before_cf_list(&b->impl->body); + nir_cf_extract(&extracted, nir_before_impl(b->impl), + nir_after_cf_list(&b->impl->body)); + b->cursor = nir_before_impl(b->impl); /* Wrap the shader in an if to ensure that only the necessary amount of lanes run it. */ nir_def *invocation_index = nir_load_local_invocation_index(b); @@ -4759,7 +4762,7 @@ ac_nir_lower_ngg_ms(nir_shader *shader, state.primitive_count_var = nir_local_variable_create(impl, glsl_uint_type(), "primitive_count_var"); - nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &builder; /* This is to avoid the & */ handle_smaller_ms_api_workgroup(b, &state); diff --git a/src/amd/common/ac_nir_lower_ps.c b/src/amd/common/ac_nir_lower_ps.c index 5949312..dc34594 100644 --- a/src/amd/common/ac_nir_lower_ps.c +++ b/src/amd/common/ac_nir_lower_ps.c @@ -751,7 +751,7 @@ emit_ps_null_export(nir_builder *b, lower_ps_state *s) static void export_ps_outputs(nir_builder *b, lower_ps_state *s) { - b->cursor = nir_after_cf_list(&b->impl->body); + b->cursor = nir_after_impl(b->impl); emit_ps_color_clamp_and_alpha_test(b, s); diff --git a/src/amd/common/ac_nir_lower_tess_io_to_mem.c b/src/amd/common/ac_nir_lower_tess_io_to_mem.c index a323c98..566b895 100644 --- a/src/amd/common/ac_nir_lower_tess_io_to_mem.c +++ b/src/amd/common/ac_nir_lower_tess_io_to_mem.c @@ -777,7 +777,7 @@ reconstruct_tess_factor_outputs(nir_shader *shader, lower_tess_io_state *st) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_builder builder = nir_builder_create(impl); nir_builder *b = &builder; - b->cursor = nir_after_cf_list(&impl->body); + b->cursor = nir_after_impl(impl); if (st->tcs_tess_level_outer_mask) { nir_def *val = nir_load_var(b, st->tcs_tess_level_outer); diff --git a/src/amd/vulkan/nir/radv_nir_lower_abi.c b/src/amd/vulkan/nir/radv_nir_lower_abi.c index 732ff89..857e476 100644 --- a/src/amd/vulkan/nir/radv_nir_lower_abi.c +++ b/src/amd/vulkan/nir/radv_nir_lower_abi.c @@ -549,7 +549,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); u_foreach_bit (i, shader->info.gs.active_stream_mask) state.gsvs_ring[i] = load_gsvs_ring(&b, &state, i); diff --git a/src/amd/vulkan/radv_rt_shader.c b/src/amd/vulkan/radv_rt_shader.c index cc92bee..f72ec68 100644 --- a/src/amd/vulkan/radv_rt_shader.c +++ b/src/amd/vulkan/radv_rt_shader.c @@ -42,7 +42,7 @@ lower_rt_derefs(nir_shader *shader) bool progress = false; - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_def *arg_offset = nir_load_rt_arg_scratch_offset_amd(&b); @@ -857,7 +857,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_at(nir_before_cf_list(&impl->body)); + nir_builder build = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &build; nir_def *commit_ptr = nir_load_param(b, 0); @@ -977,7 +977,7 @@ nir_lower_intersection_shader(nir_shader *intersection, nir_shader *any_hit) nir_builder build = nir_builder_create(impl); nir_builder *b = &build; - b->cursor = nir_before_cf_list(&impl->body); + b->cursor = nir_before_impl(impl); nir_variable *commit = nir_local_variable_create(impl, glsl_bool_type(), "ray_commit"); nir_store_var(b, commit, nir_imm_false(b), 0x1); @@ -1536,10 +1536,10 @@ radv_nir_lower_rt_abi(nir_shader *shader, const VkRayTracingPipelineCreateInfoKH NIR_PASS(_, shader, nir_lower_returns); nir_cf_list list; - nir_cf_extract(&list, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body)); + nir_cf_extract(&list, nir_before_impl(impl), nir_after_impl(impl)); /* initialize variables */ - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_def *traversal_addr = ac_nir_load_arg(&b, &args->ac, args->ac.rt.traversal_shader_addr); nir_store_var(&b, vars.traversal_addr, nir_pack_64_2x32(&b, traversal_addr), 1); @@ -1587,7 +1587,7 @@ radv_nir_lower_rt_abi(nir_shader *shader, const VkRayTracingPipelineCreateInfoKH nir_pop_if(&b, shader_guard); /* select next shader */ - b.cursor = nir_after_cf_list(&impl->body); + b.cursor = nir_after_impl(impl); shader_addr = nir_load_var(&b, vars.shader_addr); nir_def *next = select_next_shader(&b, shader_addr, info->wave_size); diff --git a/src/asahi/compiler/agx_nir_lower_frag_sidefx.c b/src/asahi/compiler/agx_nir_lower_frag_sidefx.c index 1aaa9ab..6202ca0 100644 --- a/src/asahi/compiler/agx_nir_lower_frag_sidefx.c +++ b/src/asahi/compiler/agx_nir_lower_frag_sidefx.c @@ -72,7 +72,7 @@ agx_nir_lower_frag_sidefx(nir_shader *s) if (s->info.fs.early_fragment_tests) { assert(!writes_zs && "incompatible"); nir_function_impl *impl = nir_shader_get_entrypoint(s); - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_sample_mask_agx(&b, nir_imm_intN_t(&b, ALL_SAMPLES, 16), nir_imm_intN_t(&b, ALL_SAMPLES, 16)); return true; diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index e2e19a9..7ce9ce1 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -926,7 +926,7 @@ gl_nir_add_point_size(nir_shader *nir) } } if (!found) { - b.cursor = nir_before_cf_list(&impl->body); + b.cursor = nir_before_impl(impl); nir_deref_instr *deref = nir_build_deref_var(&b, psiz); nir_store_deref(&b, deref, nir_imm_float(&b, 1.0), BITFIELD_BIT(0)); } diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 377a61e..95eabed 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -811,7 +811,7 @@ nir_visitor::visit(ir_function_signature *ir) this->is_global = false; - b = nir_builder_at(nir_after_cf_list(&impl->body)); + b = nir_builder_at(nir_after_impl(impl)); unsigned i = (ir->return_type != glsl_type::void_type) ? 1 : 0; diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 4e2b0b2..e7ddeed 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -2024,7 +2024,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl, nir_metadata_dominance; bool progress = false; - nir_cursor iter = nir_before_cf_list(&impl->body); + nir_cursor iter = nir_before_impl(impl); nir_instr *instr; while ((instr = cursor_next_instr(iter)) != NULL) { if (filter && !filter(instr, cb_data)) { diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 54c812f..0dcbbdf 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -229,7 +229,7 @@ nir_undef(nir_builder *build, unsigned num_components, unsigned bit_size) if (!undef) return NULL; - nir_instr_insert(nir_before_cf_list(&build->impl->body), &undef->instr); + nir_instr_insert(nir_before_impl(build->impl), &undef->instr); if (build->update_divergence) nir_update_instr_divergence(build->shader, &undef->instr); @@ -1751,7 +1751,7 @@ nir_decl_reg(nir_builder *b, unsigned num_components, unsigned bit_size, nir_intrinsic_set_divergent(decl, true); nir_def_init(&decl->instr, &decl->def, 1, 32); - nir_instr_insert(nir_before_cf_list(&b->impl->body), &decl->instr); + nir_instr_insert(nir_before_impl(b->impl), &decl->instr); return &decl->def; } diff --git a/src/compiler/nir/nir_lower_alpha_test.c b/src/compiler/nir/nir_lower_alpha_test.c index f70c1f7..f4e9ef0 100644 --- a/src/compiler/nir/nir_lower_alpha_test.c +++ b/src/compiler/nir/nir_lower_alpha_test.c @@ -44,7 +44,7 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func, assert(shader->info.stage == MESA_SHADER_FRAGMENT); nir_foreach_function_impl(impl, shader) { - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_lower_bitmap.c b/src/compiler/nir/nir_lower_bitmap.c index a70e981..e05ac8a 100644 --- a/src/compiler/nir/nir_lower_bitmap.c +++ b/src/compiler/nir/nir_lower_bitmap.c @@ -102,7 +102,7 @@ static void lower_bitmap_impl(nir_function_impl *impl, const nir_lower_bitmap_options *options) { - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); lower_bitmap(impl->function->shader, &b, options); diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c index 7f73d35..c8362d4 100644 --- a/src/compiler/nir/nir_lower_clip.c +++ b/src/compiler/nir/nir_lower_clip.c @@ -335,7 +335,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables, bool use_vars, * users of this pass don't support sub-routines. */ assert(impl->end_block->predecessors->entries == 1); - b.cursor = nir_after_cf_list(&impl->body); + b.cursor = nir_after_impl(impl); /* find clipvertex/position outputs */ if (!find_clipvertex_and_position_outputs(shader, &clipvertex, &position)) @@ -425,7 +425,7 @@ lower_clip_fs(nir_function_impl *impl, unsigned ucp_enables, nir_variable **in, bool use_clipdist_array) { nir_def *clipdist[MAX_CLIP_PLANES]; - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); if (!use_clipdist_array) { if (ucp_enables & 0x0f) diff --git a/src/compiler/nir/nir_lower_goto_ifs.c b/src/compiler/nir/nir_lower_goto_ifs.c index 8125b50..c61e4b0 100644 --- a/src/compiler/nir/nir_lower_goto_ifs.c +++ b/src/compiler/nir/nir_lower_goto_ifs.c @@ -929,8 +929,8 @@ nir_lower_goto_ifs_impl(nir_function_impl *impl) nir_lower_phis_to_regs_block(block); nir_cf_list cf_list; - nir_cf_extract(&cf_list, nir_before_cf_list(&impl->body), - nir_after_cf_list(&impl->body)); + nir_cf_extract(&cf_list, nir_before_impl(impl), + nir_after_impl(impl)); /* From this point on, it's structured */ impl->structured = true; diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c index 5dd9e419..b03f1b8 100644 --- a/src/compiler/nir/nir_lower_gs_intrinsics.c +++ b/src/compiler/nir/nir_lower_gs_intrinsics.c @@ -395,7 +395,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); state.builder = &b; for (unsigned i = 0; i < NIR_MAX_XFB_STREAMS; i++) { diff --git a/src/compiler/nir/nir_lower_is_helper_invocation.c b/src/compiler/nir/nir_lower_is_helper_invocation.c index 00aa88e..666371f 100644 --- a/src/compiler/nir/nir_lower_is_helper_invocation.c +++ b/src/compiler/nir/nir_lower_is_helper_invocation.c @@ -100,7 +100,7 @@ nir_lower_is_helper_invocation(nir_shader *shader) nir_function_impl *entrypoint = nir_shader_get_entrypoint(shader); - nir_builder b = nir_builder_at(nir_before_cf_list(&entrypoint->body)); + nir_builder b = nir_builder_at(nir_before_impl(entrypoint)); nir_variable *is_helper = nir_local_variable_create(entrypoint, glsl_bool_type(), diff --git a/src/compiler/nir/nir_lower_multiview.c b/src/compiler/nir/nir_lower_multiview.c index bdeec0b..144c662 100644 --- a/src/compiler/nir/nir_lower_multiview.c +++ b/src/compiler/nir/nir_lower_multiview.c @@ -203,7 +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_at(nir_after_cf_list(&entrypoint->body)); + nir_builder b = nir_builder_at(nir_after_impl(entrypoint)); /* Loop Index will go from 0 to view_count. */ nir_variable *loop_index_var = diff --git a/src/compiler/nir/nir_lower_passthrough_edgeflags.c b/src/compiler/nir/nir_lower_passthrough_edgeflags.c index 3ba490b..c178ea6 100644 --- a/src/compiler/nir/nir_lower_passthrough_edgeflags.c +++ b/src/compiler/nir/nir_lower_passthrough_edgeflags.c @@ -32,7 +32,7 @@ lower_impl(nir_function_impl *impl) nir_variable *in, *out; nir_def *def; - b = nir_builder_at(nir_before_cf_list(&impl->body)); + b = nir_builder_at(nir_before_impl(impl)); /* The edge flag is the last input in st/mesa. This code is also called by * i965 which calls it before any input locations are assigned. diff --git a/src/compiler/nir/nir_lower_point_size_mov.c b/src/compiler/nir/nir_lower_point_size_mov.c index 56a280f..eb7b40b 100644 --- a/src/compiler/nir/nir_lower_point_size_mov.c +++ b/src/compiler/nir/nir_lower_point_size_mov.c @@ -56,7 +56,7 @@ lower_impl(nir_function_impl *impl, } if (!out) { - b.cursor = nir_before_cf_list(&impl->body); + b.cursor = nir_before_impl(impl); nir_def *load = nir_load_var(&b, in); load = nir_fclamp(&b, nir_channel(&b, load, 0), nir_channel(&b, load, 1), nir_channel(&b, load, 2)); nir_store_var(&b, new_out, load, 0x1); @@ -80,7 +80,7 @@ lower_impl(nir_function_impl *impl, } } if (!found) { - b.cursor = nir_before_cf_list(&impl->body); + b.cursor = nir_before_impl(impl); nir_def *load = nir_load_var(&b, in); load = nir_fclamp(&b, nir_channel(&b, load, 0), nir_channel(&b, load, 1), nir_channel(&b, load, 2)); nir_store_var(&b, new_out, load, 0x1); diff --git a/src/compiler/nir/nir_lower_returns.c b/src/compiler/nir/nir_lower_returns.c index 1ab4cc3..d363d9a 100644 --- a/src/compiler/nir/nir_lower_returns.c +++ b/src/compiler/nir/nir_lower_returns.c @@ -209,7 +209,7 @@ lower_returns_in_block(nir_block *block, struct lower_returns_state *state) nir_local_variable_create(b->impl, glsl_bool_type(), "return"); /* Initialize the variable to 0 */ - b->cursor = nir_before_cf_list(&b->impl->body); + b->cursor = nir_before_impl(b->impl); nir_store_var(b, state->return_flag, nir_imm_false(b), 1); } diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c index c09e6e7..a0f8ce4 100644 --- a/src/compiler/nir/nir_lower_shader_calls.c +++ b/src/compiler/nir/nir_lower_shader_calls.c @@ -47,7 +47,7 @@ move_system_values_to_top(nir_shader *shader) case nir_intrinsic_load_shader_record_ptr: case nir_intrinsic_load_btd_local_arg_addr_intel: nir_instr_remove(instr); - nir_instr_insert(nir_before_cf_list(&impl->body), instr); + nir_instr_insert(nir_before_impl(impl), instr); progress = true; break; @@ -1193,7 +1193,7 @@ found_resume: if (!resume_node) { /* We want the resume to be the first "interesting" instruction */ nir_instr_remove(resume_instr); - nir_instr_insert(nir_before_cf_list(&b->impl->body), resume_instr); + nir_instr_insert(nir_before_impl(b->impl), resume_instr); } /* We've copied everything interesting out of this CF list to before the @@ -1283,7 +1283,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); ASSERTED bool found = flatten_resume_if_ladder(&b, &impl->cf_node, &impl->body, true, resume_instr, &remat); diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c index 5a09b3d..ed757d7 100644 --- a/src/compiler/nir/nir_lower_task_shader.c +++ b/src/compiler/nir/nir_lower_task_shader.c @@ -85,7 +85,7 @@ append_launch_mesh_workgroups_to_nv_task(nir_builder *b, * This ensures that 0 mesh workgroups are launched when the * shader doesn't write the TASK_COUNT output. */ - b->cursor = nir_before_cf_list(&b->impl->body); + b->cursor = nir_before_impl(b->impl); nir_def *zero = nir_imm_int(b, 0); nir_store_shared(b, zero, zero, .base = s->task_count_shared_addr); diff --git a/src/compiler/nir/nir_lower_texcoord_replace.c b/src/compiler/nir/nir_lower_texcoord_replace.c index e4f29ba..2bbc617 100644 --- a/src/compiler/nir/nir_lower_texcoord_replace.c +++ b/src/compiler/nir/nir_lower_texcoord_replace.c @@ -63,7 +63,7 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl, bool point_coord_is_sysval, bool yinvert) { - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_def *new_coord; if (point_coord_is_sysval) { diff --git a/src/compiler/nir/nir_lower_variable_initializers.c b/src/compiler/nir/nir_lower_variable_initializers.c index 7d12502..57cf6aa 100644 --- a/src/compiler/nir/nir_lower_variable_initializers.c +++ b/src/compiler/nir/nir_lower_variable_initializers.c @@ -59,7 +59,7 @@ lower_const_initializer(struct nir_builder *b, struct exec_list *var_list, { bool progress = false; - b->cursor = nir_before_cf_list(&b->impl->body); + b->cursor = nir_before_impl(b->impl); nir_foreach_variable_in_list(var, var_list) { if (!(var->data.mode & modes)) @@ -145,7 +145,7 @@ nir_zero_initialize_shared_memory(nir_shader *shader, assert(chunk_size % 4 == 0); nir_function_impl *impl = nir_shader_get_entrypoint(shader); - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); assert(!shader->info.workgroup_size_variable); const unsigned local_count = shader->info.workgroup_size[0] * diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index bcf2273..0b1e782 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -743,7 +743,7 @@ gcm_replace_def_with_undef(nir_def *def, void *void_state) nir_undef_instr *undef = nir_undef_instr_create(state->impl->function->shader, def->num_components, def->bit_size); - nir_instr_insert(nir_before_cf_list(&state->impl->body), &undef->instr); + nir_instr_insert(nir_before_impl(state->impl), &undef->instr); nir_def_rewrite_uses(def, &undef->def); return true; diff --git a/src/compiler/nir/nir_opt_preamble.c b/src/compiler/nir/nir_opt_preamble.c index d06ba81..eea3bce 100644 --- a/src/compiler/nir/nir_opt_preamble.c +++ b/src/compiler/nir/nir_opt_preamble.c @@ -520,7 +520,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, _mesa_pointer_hash_table_create(NULL); nir_function_impl *preamble = nir_shader_get_preamble(impl->function->shader); - nir_builder preamble_builder = nir_builder_at(nir_before_cf_list(&preamble->body)); + nir_builder preamble_builder = nir_builder_at(nir_before_impl(preamble)); nir_builder *b = &preamble_builder; nir_foreach_block(block, impl) { diff --git a/src/compiler/nir/nir_phi_builder.c b/src/compiler/nir/nir_phi_builder.c index 98980a4..088cc22 100644 --- a/src/compiler/nir/nir_phi_builder.c +++ b/src/compiler/nir/nir_phi_builder.c @@ -209,7 +209,7 @@ nir_phi_builder_value_get_block_def(struct nir_phi_builder_value *val, nir_undef_instr_create(val->builder->shader, val->num_components, val->bit_size); - nir_instr_insert(nir_before_cf_list(&val->builder->impl->body), + nir_instr_insert(nir_before_impl(val->builder->impl), &undef->instr); def = &undef->def; } else if (he->data == NEEDS_PHI) { diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index a49527a..341091f 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -6696,7 +6696,7 @@ vtn_emit_kernel_entry_point_wrapper(struct vtn_builder *b, nir_function *main_entry_point = nir_function_create(b->shader, func_name); nir_function_impl *impl = nir_function_impl_create(main_entry_point); - b->nb = nir_builder_at(nir_after_cf_list(&impl->body)); + b->nb = nir_builder_at(nir_after_impl(impl)); b->func_param_idx = 0; nir_call_instr *call = nir_call_instr_create(b->nb.shader, entry_point); diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 541fbc2..072065f 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -225,7 +225,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, * directly in our OpFunctionParameter handler. */ nir_function_impl *impl = nir_function_impl_create(func); - b->nb = nir_builder_at(nir_before_cf_list(&impl->body)); + b->nb = nir_builder_at(nir_before_impl(impl)); b->nb.exact = b->exact; b->func_param_idx = 0; @@ -626,7 +626,7 @@ vtn_function_emit(struct vtn_builder *b, struct vtn_function *func, } nir_function_impl *impl = func->nir_func->impl; - b->nb = nir_builder_at(nir_after_cf_list(&impl->body)); + b->nb = nir_builder_at(nir_after_impl(impl)); b->func = func; b->nb.exact = b->exact; b->phi_table = _mesa_pointer_hash_table_create(b); diff --git a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c index 42007dc..f94afb0 100644 --- a/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c +++ b/src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c @@ -347,7 +347,7 @@ copy_ubo_to_uniform(nir_shader *nir, const struct ir3_const_state *const_state) return false; nir_function_impl *preamble = nir_shader_get_preamble(nir); - nir_builder _b = nir_builder_at(nir_after_cf_list(&preamble->body)); + nir_builder _b = nir_builder_at(nir_after_impl(preamble)); nir_builder *b = &_b; for (unsigned i = 0; i < state->num_enabled; i++) { diff --git a/src/freedreno/ir3/ir3_nir_lower_tess.c b/src/freedreno/ir3/ir3_nir_lower_tess.c index 0f3c13c..1a53070 100644 --- a/src/freedreno/ir3/ir3_nir_lower_tess.c +++ b/src/freedreno/ir3/ir3_nir_lower_tess.c @@ -301,7 +301,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); if (v->type == MESA_SHADER_VERTEX && topology != IR3_TESS_NONE) state.header = nir_load_tcs_header_ir3(&b); @@ -375,7 +375,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); if (shader->info.stage == MESA_SHADER_GEOMETRY) state.header = nir_load_gs_header_ir3(&b); @@ -678,13 +678,13 @@ 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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); state.header = nir_load_tcs_header_ir3(&b); /* If required, store gl_PrimitiveID. */ if (v->key.tcs_store_primid) { - b.cursor = nir_after_cf_list(&impl->body); + b.cursor = nir_after_impl(impl); nir_store_output(&b, nir_load_primitive_id(&b), nir_imm_int(&b, 0), .io_semantics = { @@ -692,7 +692,7 @@ ir3_nir_lower_tess_ctrl(nir_shader *shader, struct ir3_shader_variant *v, .num_slots = 1 }); - b.cursor = nir_before_cf_list(&impl->body); + b.cursor = nir_before_impl(impl); } nir_foreach_block_safe (block, impl) @@ -706,10 +706,10 @@ ir3_nir_lower_tess_ctrl(nir_shader *shader, struct ir3_shader_variant *v, */ nir_cf_list body; - nir_cf_extract(&body, nir_before_cf_list(&impl->body), - nir_after_cf_list(&impl->body)); + nir_cf_extract(&body, nir_before_impl(impl), + nir_after_impl(impl)); - b.cursor = nir_after_cf_list(&impl->body); + b.cursor = nir_after_impl(impl); /* Re-emit the header, since the old one got moved into the if branch */ state.header = nir_load_tcs_header_ir3(&b); @@ -868,7 +868,7 @@ lower_mixed_streams(nir_shader *nir) nir_builder b = nir_builder_create(entrypoint); u_foreach_bit (stream, stream_mask) { - b.cursor = nir_after_cf_list(&entrypoint->body); + b.cursor = nir_after_impl(entrypoint); /* Inserting the cloned body invalidates any cursor not using an * instruction, so we need to emit this to keep track of where the new @@ -906,7 +906,7 @@ lower_mixed_streams(nir_shader *nir) * different streams. Our lowering means that redundant calls to * EndStreamPrimitive are safe and should be optimized out. */ - b.cursor = nir_after_cf_list(&entrypoint->body); + b.cursor = nir_after_impl(entrypoint); nir_end_primitive(&b, .stream_id = stream); } @@ -1015,7 +1015,7 @@ ir3_nir_lower_gs(nir_shader *shader) nir_function_impl *impl = nir_shader_get_entrypoint(shader); assert(impl); - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); state.header = nir_load_gs_header_ir3(&b); @@ -1062,7 +1062,7 @@ ir3_nir_lower_gs(nir_shader *shader) nir_local_variable_create(impl, glsl_uint_type(), "emitted_vertex"); /* Initialize to 0. */ - b.cursor = nir_before_cf_list(&impl->body); + b.cursor = nir_before_impl(impl); nir_store_var(&b, state.vertex_count_var, nir_imm_int(&b, 0), 0x1); nir_store_var(&b, state.emitted_vertex_var, nir_imm_int(&b, 0), 0x1); nir_store_var(&b, state.vertex_flags_out, nir_imm_int(&b, 4), 0x1); diff --git a/src/freedreno/ir3/ir3_nir_opt_preamble.c b/src/freedreno/ir3/ir3_nir_opt_preamble.c index d774f5f..35b12cc 100644 --- a/src/freedreno/ir3/ir3_nir_opt_preamble.c +++ b/src/freedreno/ir3/ir3_nir_opt_preamble.c @@ -395,7 +395,7 @@ ir3_nir_lower_preamble(nir_shader *nir, struct ir3_shader_variant *v) * ... */ - b->cursor = nir_before_cf_list(&main->body); + b->cursor = nir_before_impl(main); nir_if *outer_if = nir_push_if(b, nir_preamble_start_ir3(b, 1)); { diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index 8d0713c..6977a9b 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -1140,7 +1140,7 @@ crocus_lower_default_edgeflags(struct nir_shader *nir) { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder b = nir_builder_at(nir_after_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_after_impl(impl)); nir_variable *var = nir_variable_create(nir, nir_var_shader_out, glsl_float_type(), diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index 4a8e399..0e95eb0 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -584,7 +584,7 @@ d3d12_add_missing_dual_src_target(struct nir_shader *s, assert(missing_mask != 0); nir_builder b; nir_function_impl *impl = nir_shader_get_entrypoint(s); - b = nir_builder_at(nir_before_cf_list(&impl->body)); + b = nir_builder_at(nir_before_impl(impl)); nir_def *zero = nir_imm_zero(&b, 4, 32); for (unsigned i = 0; i < 2; ++i) { diff --git a/src/gallium/drivers/radeonsi/si_nir_lower_abi.c b/src/gallium/drivers/radeonsi/si_nir_lower_abi.c index 9564610..233f1c4 100644 --- a/src/gallium/drivers/radeonsi/si_nir_lower_abi.c +++ b/src/gallium/drivers/radeonsi/si_nir_lower_abi.c @@ -297,7 +297,7 @@ static void preload_reusable_variables(nir_builder *b, struct lower_abi_state *s const struct si_shader_selector *sel = s->shader->selector; const union si_shader_key *key = &s->shader->key; - b->cursor = nir_before_cf_list(&b->impl->body); + b->cursor = nir_before_impl(b->impl); if (sel->screen->info.gfx_level <= GFX8 && sel->stage <= MESA_SHADER_GEOMETRY && (key->ge.as_es || sel->stage == MESA_SHADER_GEOMETRY)) { 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 b4a3369..82bd8a0 100644 --- a/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c +++ b/src/gallium/drivers/radeonsi/si_nir_lower_vs_inputs.c @@ -89,7 +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_at(nir_before_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &builder; const struct si_shader_selector *sel = s->shader->selector; diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 89221a0..2772537 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1998,7 +1998,7 @@ static void si_nir_lower_ps_color_input(nir_shader *nir, struct si_shader *shade { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &builder; const struct si_shader_selector *sel = shader->selector; @@ -2079,7 +2079,7 @@ static void si_nir_emit_polygon_stipple(nir_shader *nir, struct si_shader_args * { nir_function_impl *impl = nir_shader_get_entrypoint(nir); - nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder builder = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &builder; /* Load the buffer descriptor. */ diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index fab15ab..616ead5 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -507,7 +507,7 @@ lower_pv_mode_gs(nir_shader *shader, unsigned prim) memset(state.varyings, 0, sizeof(state.varyings)); nir_function_impl *entry = nir_shader_get_entrypoint(shader); - b = nir_builder_at(nir_before_cf_list(&entry->body)); + b = nir_builder_at(nir_before_impl(entry)); state.primitive_vert_count = lower_pv_mode_vertices_for_prim(shader->info.gs.output_primitive); @@ -657,7 +657,7 @@ lower_line_stipple_gs(nir_shader *shader, bool line_rectangular) state.line_rectangular = line_rectangular; // initialize pos_counter and stipple_counter nir_function_impl *entry = nir_shader_get_entrypoint(shader); - b = nir_builder_at(nir_before_cf_list(&entry->body)); + b = nir_builder_at(nir_before_impl(entry)); nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1); nir_store_var(&b, state.stipple_counter, nir_imm_float(&b, 0), 1); @@ -670,7 +670,7 @@ lower_line_stipple_fs(nir_shader *shader) { nir_builder b; nir_function_impl *entry = nir_shader_get_entrypoint(shader); - b = nir_builder_at(nir_after_cf_list(&entry->body)); + b = nir_builder_at(nir_after_impl(entry)); // create stipple counter nir_variable *stipple = nir_variable_create(shader, nir_var_shader_in, @@ -978,7 +978,7 @@ lower_line_smooth_gs(nir_shader *shader) // initialize pos_counter nir_function_impl *entry = nir_shader_get_entrypoint(shader); - b = nir_builder_at(nir_before_cf_list(&entry->body)); + b = nir_builder_at(nir_before_impl(entry)); nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1); shader->info.gs.vertices_out = 8 * shader->info.gs.vertices_out; @@ -1011,7 +1011,7 @@ lower_line_smooth_fs(nir_shader *shader, bool lower_stipple) // initialize stipple_pattern nir_function_impl *entry = nir_shader_get_entrypoint(shader); - b = nir_builder_at(nir_before_cf_list(&entry->body)); + b = nir_builder_at(nir_before_impl(entry)); nir_def *pattern = nir_load_push_constant_zink(&b, 1, 32, nir_imm_int(&b, ZINK_GFX_PUSHCONST_LINE_STIPPLE_PATTERN)); nir_store_var(&b, stipple_pattern, pattern, 1); @@ -2459,7 +2459,7 @@ clamp_layer_output(nir_shader *vs, nir_shader *fs, unsigned *next_location) } else { nir_builder b; nir_function_impl *impl = nir_shader_get_entrypoint(vs); - b = nir_builder_at(nir_after_cf_list(&impl->body)); + b = nir_builder_at(nir_after_impl(impl)); assert(impl->end_block->predecessors->entries == 1); clamp_layer_output_emit(&b, &state); nir_metadata_preserve(impl, nir_metadata_dominance); diff --git a/src/intel/compiler/brw_kernel.c b/src/intel/compiler/brw_kernel.c index 8d00b2a..6da1d08 100644 --- a/src/intel/compiler/brw_kernel.c +++ b/src/intel/compiler/brw_kernel.c @@ -60,7 +60,7 @@ static nir_builder builder_init_new_impl(nir_function *func) { nir_function_impl *impl = nir_function_impl_create(func); - return nir_builder_at(nir_before_cf_list(&impl->body)); + return nir_builder_at(nir_before_impl(impl)); } static void diff --git a/src/intel/compiler/brw_nir_lower_intersection_shader.c b/src/intel/compiler/brw_nir_lower_intersection_shader.c index d4586aa..da80c03 100644 --- a/src/intel/compiler/brw_nir_lower_intersection_shader.c +++ b/src/intel/compiler/brw_nir_lower_intersection_shader.c @@ -55,7 +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_at(nir_before_cf_list(&impl->body)); + nir_builder build = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &build; nir_def *commit_ptr = nir_load_param(b, 0); @@ -154,7 +154,7 @@ brw_nir_lower_intersection_shader(nir_shader *intersection, nir_function_impl *impl = nir_shader_get_entrypoint(intersection); - nir_builder build = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder build = nir_builder_at(nir_before_impl(impl)); nir_builder *b = &build; nir_def *t_addr = brw_nir_rt_mem_hit_addr(b, false /* committed */); diff --git a/src/intel/compiler/brw_nir_rt.c b/src/intel/compiler/brw_nir_rt.c index bc067ad..6956e2d 100644 --- a/src/intel/compiler/brw_nir_rt.c +++ b/src/intel/compiler/brw_nir_rt.c @@ -75,7 +75,7 @@ lower_rt_io_derefs(nir_shader *shader) */ assert(num_shader_call_vars <= 1); - nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_def *call_data_addr = NULL; if (num_shader_call_vars > 0) { diff --git a/src/intel/vulkan/anv_mesh_perprim_wa.c b/src/intel/vulkan/anv_mesh_perprim_wa.c index fc4f731..5f6da43 100644 --- a/src/intel/vulkan/anv_mesh_perprim_wa.c +++ b/src/intel/vulkan/anv_mesh_perprim_wa.c @@ -153,7 +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_at(nir_after_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_after_impl(impl)); /* wait for all subgroups to finish */ nir_barrier(&b, SCOPE_WORKGROUP); @@ -473,7 +473,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_at(nir_before_cf_list(&impl->body)); + nir_builder b = nir_builder_at(nir_before_impl(impl)); nir_foreach_shader_in_variable_safe(var, nir) { gl_varying_slot location = var->data.location; diff --git a/src/intel/vulkan/anv_nir_lower_multiview.c b/src/intel/vulkan/anv_nir_lower_multiview.c index e858d6d..30858dd 100644 --- a/src/intel/vulkan/anv_nir_lower_multiview.c +++ b/src/intel/vulkan/anv_nir_lower_multiview.c @@ -204,7 +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_at(nir_before_cf_list(&entrypoint->body)); + nir_builder b = nir_builder_at(nir_before_impl(entrypoint)); /* Fill Layer ID with zero. Replication will use that as base to * apply the RTAI offsets. diff --git a/src/microsoft/compiler/dxil_nir_tess.c b/src/microsoft/compiler/dxil_nir_tess.c index a3a635a..a7c5553 100644 --- a/src/microsoft/compiler/dxil_nir_tess.c +++ b/src/microsoft/compiler/dxil_nir_tess.c @@ -247,7 +247,7 @@ dxil_nir_split_tess_ctrl(nir_shader *nir, nir_function **patch_const_func) case nir_intrinsic_load_invocation_id: { if (!loop_var) { loop_var = nir_local_variable_create(patch_const_func_impl, glsl_int_type(), "PatchConstInvocId"); - b.cursor = nir_before_cf_list(&patch_const_func_impl->body); + b.cursor = nir_before_impl(patch_const_func_impl); loop_var_deref = nir_build_deref_var(&b, loop_var); } if (!state.loop) {