sfn: Convert to use nir_foreach_function_impl

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23960>
This commit is contained in:
Yonggang Luo
2023-06-30 02:52:15 +08:00
parent 8410468d23
commit 2b64f29f0f
6 changed files with 25 additions and 34 deletions
+8 -8
View File
@@ -113,11 +113,11 @@ bool
r600_lower_scratch_addresses(nir_shader *shader)
{
bool progress = false;
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
nir_builder build = nir_builder_create(function->impl);
nir_builder build = nir_builder_create(impl);
nir_foreach_block(block, function->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr(instr, block)
{
@@ -503,12 +503,12 @@ r600_get_natural_size_align_bytes(const struct glsl_type *type,
}
static bool
r600_lower_shared_io_impl(nir_function *func)
r600_lower_shared_io_impl(nir_function_impl *impl)
{
nir_builder b = nir_builder_create(func->impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block(block, func->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr_safe(instr, block)
{
@@ -586,9 +586,9 @@ static bool
r600_lower_shared_io(nir_shader *nir)
{
bool progress = false;
nir_foreach_function(function, nir)
nir_foreach_function_impl(impl, nir)
{
if (function->impl && r600_lower_shared_io_impl(function))
if (r600_lower_shared_io_impl(impl))
progress = true;
}
return progress;
@@ -1064,10 +1064,9 @@ bool
r600_nir_64_to_vec2(nir_shader *sh)
{
vector<nir_instr *> intr64bit;
nir_foreach_function(function, sh)
nir_foreach_function_impl(impl, sh)
{
if (function->impl) {
nir_foreach_block(block, function->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr_safe(instr, block)
{
@@ -1101,7 +1100,6 @@ r600_nir_64_to_vec2(nir_shader *sh)
}
}
}
}
}
bool result = Lower64BitToVec2().run(sh);
@@ -1181,10 +1179,9 @@ void
StoreMerger::collect_stores()
{
unsigned vertex = 0;
nir_foreach_function(function, sh)
nir_foreach_function_impl(impl, sh)
{
if (function->impl) {
nir_foreach_block(block, function->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr_safe(instr, block)
{
@@ -1205,7 +1202,6 @@ StoreMerger::collect_stores()
m_stores[index].push_back(ir);
}
}
}
}
}
@@ -128,10 +128,8 @@ r600_lower_fs_out_to_vector(nir_shader *shader)
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
bool progress = false;
nir_foreach_function(function, shader)
{
if (function->impl)
progress |= processor.run(function->impl);
nir_foreach_function_impl(impl, shader) {
progress |= processor.run(impl);
}
return progress;
}
@@ -479,12 +479,11 @@ bool
r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type)
{
bool progress = false;
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
if (function->impl) {
nir_builder b = nir_builder_create(function->impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, function->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr_safe(instr, block)
{
@@ -495,7 +494,6 @@ r600_lower_tess_io(nir_shader *shader, enum mesa_prim prim_type)
progress |= r600_lower_tess_io_impl(&b, instr, prim_type);
}
}
}
}
return progress;
}
@@ -517,9 +515,9 @@ r600_append_tcs_TF_emission(nir_shader *shader, enum mesa_prim prim_type)
if (shader->info.stage != MESA_SHADER_TESS_CTRL)
return false;
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
nir_foreach_block(block, function->impl)
nir_foreach_block(block, impl)
{
nir_foreach_instr_safe(instr, block)
{
@@ -134,9 +134,9 @@ r600_nir_lower_int_tg4(nir_shader *shader)
}
if (need_lowering) {
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
if (function->impl && r600_nir_lower_int_tg4_impl(function->impl))
if (r600_nir_lower_int_tg4_impl(impl))
progress = true;
}
}
@@ -224,9 +224,9 @@ bool
r600_nir_lower_txl_txf_array_or_cube(nir_shader *shader)
{
bool progress = false;
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
if (function->impl && r600_nir_lower_txl_txf_array_or_cube_impl(function->impl))
if (r600_nir_lower_txl_txf_array_or_cube_impl(impl))
progress = true;
}
return progress;
@@ -459,10 +459,9 @@ r600_vectorize_vs_inputs(nir_shader *shader)
if (shader->info.stage != MESA_SHADER_VERTEX)
return false;
nir_foreach_function(function, shader)
nir_foreach_function_impl(impl, shader)
{
if (function->impl)
progress |= r600_vectorize_io_impl(function->impl);
progress |= r600_vectorize_io_impl(impl);
}
return progress;