intel/compiler: Switch to use nir_foreach_function_impl
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23920>
This commit is contained in:
@@ -7150,11 +7150,8 @@ brw_compute_barycentric_interp_modes(const struct intel_device_info *devinfo,
|
|||||||
{
|
{
|
||||||
unsigned barycentric_interp_modes = 0;
|
unsigned barycentric_interp_modes = 0;
|
||||||
|
|
||||||
nir_foreach_function(f, shader) {
|
nir_foreach_function_impl(impl, shader) {
|
||||||
if (!f->impl)
|
nir_foreach_block(block, impl) {
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_foreach_block(block, f->impl) {
|
|
||||||
nir_foreach_instr(instr, block) {
|
nir_foreach_instr(instr, block) {
|
||||||
if (instr->type != nir_instr_type_intrinsic)
|
if (instr->type != nir_instr_type_intrinsic)
|
||||||
continue;
|
continue;
|
||||||
@@ -7255,11 +7252,8 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
|
|||||||
{
|
{
|
||||||
bool progress = false;
|
bool progress = false;
|
||||||
|
|
||||||
nir_foreach_function(f, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (!f->impl)
|
nir_block *top = nir_start_block(impl);
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_block *top = nir_start_block(f->impl);
|
|
||||||
nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
|
nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
|
||||||
bool impl_progress = false;
|
bool impl_progress = false;
|
||||||
|
|
||||||
@@ -7300,7 +7294,7 @@ brw_nir_move_interpolation_to_top(nir_shader *nir)
|
|||||||
|
|
||||||
progress = progress || impl_progress;
|
progress = progress || impl_progress;
|
||||||
|
|
||||||
nir_metadata_preserve(f->impl, impl_progress ? (nir_metadata_block_index |
|
nir_metadata_preserve(impl, impl_progress ? (nir_metadata_block_index |
|
||||||
nir_metadata_dominance)
|
nir_metadata_dominance)
|
||||||
: nir_metadata_all);
|
: nir_metadata_all);
|
||||||
}
|
}
|
||||||
|
@@ -312,9 +312,8 @@ brw_kernel_from_spirv(struct brw_compiler *compiler,
|
|||||||
|
|
||||||
if (INTEL_DEBUG(DEBUG_CS)) {
|
if (INTEL_DEBUG(DEBUG_CS)) {
|
||||||
/* Re-index SSA defs so we print more sensible numbers. */
|
/* Re-index SSA defs so we print more sensible numbers. */
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl)
|
nir_index_ssa_defs(impl);
|
||||||
nir_index_ssa_defs(function->impl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "NIR (from SPIR-V) for kernel\n");
|
fprintf(stderr, "NIR (from SPIR-V) for kernel\n");
|
||||||
@@ -413,9 +412,8 @@ brw_kernel_from_spirv(struct brw_compiler *compiler,
|
|||||||
|
|
||||||
if (INTEL_DEBUG(DEBUG_CS)) {
|
if (INTEL_DEBUG(DEBUG_CS)) {
|
||||||
/* Re-index SSA defs so we print more sensible numbers. */
|
/* Re-index SSA defs so we print more sensible numbers. */
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl)
|
nir_index_ssa_defs(impl);
|
||||||
nir_index_ssa_defs(function->impl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "NIR (before I/O lowering) for kernel\n");
|
fprintf(stderr, "NIR (before I/O lowering) for kernel\n");
|
||||||
|
@@ -820,11 +820,8 @@ brw_can_pack_primitive_indices(nir_shader *nir, struct index_packing_state *stat
|
|||||||
assert(type->without_array()->is_vector());
|
assert(type->without_array()->is_vector());
|
||||||
assert(type->without_array()->vector_elements == state->vertices_per_primitive);
|
assert(type->without_array()->vector_elements == state->vertices_per_primitive);
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (!function->impl)
|
nir_foreach_block(block, impl) {
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_foreach_block(block, function->impl) {
|
|
||||||
nir_foreach_instr(instr, block) {
|
nir_foreach_instr(instr, block) {
|
||||||
if (instr->type != nir_instr_type_intrinsic)
|
if (instr->type != nir_instr_type_intrinsic)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -273,13 +273,10 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
|
|||||||
|
|
||||||
const unsigned num_inputs = util_bitcount64(nir->info.inputs_read);
|
const unsigned num_inputs = util_bitcount64(nir->info.inputs_read);
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (!function->impl)
|
nir_builder b = nir_builder_create(impl);
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_builder b = nir_builder_create(function->impl);
|
nir_foreach_block(block, impl) {
|
||||||
|
|
||||||
nir_foreach_block(block, function->impl) {
|
|
||||||
nir_foreach_instr_safe(instr, block) {
|
nir_foreach_instr_safe(instr, block) {
|
||||||
if (instr->type != nir_instr_type_intrinsic)
|
if (instr->type != nir_instr_type_intrinsic)
|
||||||
continue;
|
continue;
|
||||||
@@ -387,11 +384,8 @@ brw_nir_lower_vue_inputs(nir_shader *nir,
|
|||||||
|
|
||||||
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
|
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (!function->impl)
|
nir_foreach_block(block, impl) {
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_foreach_block(block, function->impl) {
|
|
||||||
nir_foreach_instr(instr, block) {
|
nir_foreach_instr(instr, block) {
|
||||||
if (instr->type != nir_instr_type_intrinsic)
|
if (instr->type != nir_instr_type_intrinsic)
|
||||||
continue;
|
continue;
|
||||||
@@ -438,13 +432,11 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map)
|
|||||||
|
|
||||||
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
|
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl) {
|
nir_builder b = nir_builder_create(impl);
|
||||||
nir_builder b = nir_builder_create(function->impl);
|
nir_foreach_block(block, impl) {
|
||||||
nir_foreach_block(block, function->impl) {
|
remap_patch_urb_offsets(block, &b, vue_map,
|
||||||
remap_patch_urb_offsets(block, &b, vue_map,
|
nir->info.tess._primitive_mode);
|
||||||
nir->info.tess._primitive_mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,12 +585,10 @@ brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map,
|
|||||||
|
|
||||||
nir_io_add_const_offset_to_base(nir, nir_var_shader_out);
|
nir_io_add_const_offset_to_base(nir, nir_var_shader_out);
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl) {
|
nir_builder b = nir_builder_create(impl);
|
||||||
nir_builder b = nir_builder_create(function->impl);
|
nir_foreach_block(block, impl) {
|
||||||
nir_foreach_block(block, function->impl) {
|
remap_patch_urb_offsets(block, &b, vue_map, tes_primitive_mode);
|
||||||
remap_patch_urb_offsets(block, &b, vue_map, tes_primitive_mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1528,8 +1518,8 @@ brw_vectorize_lower_mem_access(nir_shader *nir,
|
|||||||
static bool
|
static bool
|
||||||
nir_shader_has_local_variables(const nir_shader *nir)
|
nir_shader_has_local_variables(const nir_shader *nir)
|
||||||
{
|
{
|
||||||
nir_foreach_function(func, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (func->impl && !exec_list_is_empty(&func->impl->locals))
|
if (!exec_list_is_empty(&impl->locals))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1702,9 +1692,8 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler,
|
|||||||
|
|
||||||
if (unlikely(debug_enabled)) {
|
if (unlikely(debug_enabled)) {
|
||||||
/* Re-index SSA defs so we print more sensible numbers. */
|
/* Re-index SSA defs so we print more sensible numbers. */
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl)
|
nir_index_ssa_defs(impl);
|
||||||
nir_index_ssa_defs(function->impl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "NIR (SSA form) for %s shader:\n",
|
fprintf(stderr, "NIR (SSA form) for %s shader:\n",
|
||||||
|
@@ -267,8 +267,7 @@ analyze_boolean_resolves_impl(nir_function_impl *impl)
|
|||||||
void
|
void
|
||||||
brw_nir_analyze_boolean_resolves(nir_shader *shader)
|
brw_nir_analyze_boolean_resolves(nir_shader *shader)
|
||||||
{
|
{
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function_impl(impl, shader) {
|
||||||
if (function->impl)
|
analyze_boolean_resolves_impl(impl);
|
||||||
analyze_boolean_resolves_impl(function->impl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -218,11 +218,9 @@ brw_nir_analyze_ubo_ranges(const struct brw_compiler *compiler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Walk the IR, recording how many times each UBO block/offset is used. */
|
/* Walk the IR, recording how many times each UBO block/offset is used. */
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl) {
|
nir_foreach_block(block, impl) {
|
||||||
nir_foreach_block(block, function->impl) {
|
analyze_ubos_block(&state, block);
|
||||||
analyze_ubos_block(&state, block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -311,11 +311,9 @@ brw_nir_lower_cs_intrinsics(nir_shader *nir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl) {
|
state.impl = impl;
|
||||||
state.impl = function->impl;
|
lower_cs_intrinsics_convert_impl(&state);
|
||||||
lower_cs_intrinsics_convert_impl(&state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.progress;
|
return state.progress;
|
||||||
|
@@ -382,8 +382,7 @@ void
|
|||||||
brw_nir_lower_rt_intrinsics(nir_shader *nir,
|
brw_nir_lower_rt_intrinsics(nir_shader *nir,
|
||||||
const struct intel_device_info *devinfo)
|
const struct intel_device_info *devinfo)
|
||||||
{
|
{
|
||||||
nir_foreach_function(function, nir) {
|
nir_foreach_function_impl(impl, nir) {
|
||||||
if (function->impl)
|
lower_rt_intrinsics_impl(impl, devinfo);
|
||||||
lower_rt_intrinsics_impl(function->impl, devinfo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,11 +28,8 @@
|
|||||||
UNUSED static bool
|
UNUSED static bool
|
||||||
no_load_scratch_base_ptr_intrinsic(nir_shader *shader)
|
no_load_scratch_base_ptr_intrinsic(nir_shader *shader)
|
||||||
{
|
{
|
||||||
nir_foreach_function(func, shader) {
|
nir_foreach_function_impl(impl, shader) {
|
||||||
if (!func->impl)
|
nir_foreach_block(block, impl) {
|
||||||
continue;
|
|
||||||
|
|
||||||
nir_foreach_block(block, func->impl) {
|
|
||||||
nir_foreach_instr(instr, block) {
|
nir_foreach_instr(instr, block) {
|
||||||
if (instr->type != nir_instr_type_intrinsic)
|
if (instr->type != nir_instr_type_intrinsic)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user