void
lima_nir_duplicate_load_consts(nir_shader *shader)
{
- nir_foreach_function(function, shader) {
- if (function->impl) {
- lima_nir_duplicate_load_consts_impl(shader, function->impl);
- }
+ nir_foreach_function_impl(impl, shader) {
+ lima_nir_duplicate_load_consts_impl(shader, impl);
}
}
void
lima_nir_duplicate_load_uniforms(nir_shader *shader)
{
- nir_foreach_function(function, shader) {
- if (function->impl) {
- lima_nir_duplicate_intrinsic_impl(shader, function->impl, nir_intrinsic_load_uniform);
- }
+ nir_foreach_function_impl(impl, shader) {
+ lima_nir_duplicate_intrinsic_impl(shader, impl, nir_intrinsic_load_uniform);
}
}
void
lima_nir_duplicate_load_inputs(nir_shader *shader)
{
- nir_foreach_function(function, shader) {
- if (function->impl) {
- lima_nir_duplicate_intrinsic_impl(shader, function->impl, nir_intrinsic_load_input);
- }
+ nir_foreach_function_impl(impl, shader) {
+ lima_nir_duplicate_intrinsic_impl(shader, impl, nir_intrinsic_load_input);
}
}
void
lima_nir_lower_uniform_to_scalar(nir_shader *shader)
{
- nir_foreach_function(function, shader) {
- if (function->impl) {
- nir_builder b = nir_builder_create(function->impl);
+ nir_foreach_function_impl(impl, shader) {
+ nir_builder b = nir_builder_create(impl);
- nir_foreach_block(block, function->impl) {
- nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_intrinsic)
- continue;
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr_safe(instr, block) {
+ if (instr->type != nir_instr_type_intrinsic)
+ continue;
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+ nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- if (intr->intrinsic != nir_intrinsic_load_uniform)
- continue;
+ if (intr->intrinsic != nir_intrinsic_load_uniform)
+ continue;
- lower_load_uniform_to_scalar(&b, intr);
- }
+ lower_load_uniform_to_scalar(&b, intr);
}
}
}
{
bool progress = false;
- nir_foreach_function(function, shader) {
- if (function->impl) {
- nir_builder b = nir_builder_create(function->impl);
-
- nir_foreach_block_reverse(block, function->impl) {
- nir_foreach_instr_reverse_safe(instr, block) {
- if (instr->type == nir_instr_type_load_const) {
- replace_load_const(&b, nir_instr_as_load_const(instr));
- progress = true;
- } else if (instr->type == nir_instr_type_intrinsic) {
- progress |= replace_intrinsic(&b, nir_instr_as_intrinsic(instr));
- }
+ nir_foreach_function_impl(impl, shader) {
+ nir_builder b = nir_builder_create(impl);
+
+ nir_foreach_block_reverse(block, impl) {
+ nir_foreach_instr_reverse_safe(instr, block) {
+ if (instr->type == nir_instr_type_load_const) {
+ replace_load_const(&b, nir_instr_as_load_const(instr));
+ progress = true;
+ } else if (instr->type == nir_instr_type_intrinsic) {
+ progress |= replace_intrinsic(&b, nir_instr_as_intrinsic(instr));
}
}
}
comp->dual_source_blend = nir->info.fs.color_is_dual_source;
/* 1st pass: create ppir blocks */
- nir_foreach_function(function, nir) {
- if (!function->impl)
- continue;
-
- nir_foreach_block(nblock, function->impl) {
+ nir_foreach_function_impl(impl, nir) {
+ nir_foreach_block(nblock, impl) {
ppir_block *block = ppir_block_create(comp);
if (!block)
return false;
}
/* 2nd pass: populate successors */
- nir_foreach_function(function, nir) {
- if (!function->impl)
- continue;
-
- nir_foreach_block(nblock, function->impl) {
+ nir_foreach_function_impl(impl, nir) {
+ nir_foreach_block(nblock, impl) {
ppir_block *block = ppir_get_block(comp, nblock);
assert(block);