{
unsigned barycentric_interp_modes = 0;
- nir_foreach_function(f, shader) {
- if (!f->impl)
- continue;
-
- nir_foreach_block(block, f->impl) {
+ nir_foreach_function_impl(impl, shader) {
+ nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;
{
bool progress = false;
- nir_foreach_function(f, nir) {
- if (!f->impl)
- continue;
-
- nir_block *top = nir_start_block(f->impl);
+ nir_foreach_function_impl(impl, nir) {
+ nir_block *top = nir_start_block(impl);
nir_cursor cursor = nir_before_instr(nir_block_first_instr(top));
bool impl_progress = false;
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_all);
}
if (INTEL_DEBUG(DEBUG_CS)) {
/* Re-index SSA defs so we print more sensible numbers. */
- nir_foreach_function(function, nir) {
- if (function->impl)
- nir_index_ssa_defs(function->impl);
+ nir_foreach_function_impl(impl, nir) {
+ nir_index_ssa_defs(impl);
}
fprintf(stderr, "NIR (from SPIR-V) for kernel\n");
if (INTEL_DEBUG(DEBUG_CS)) {
/* Re-index SSA defs so we print more sensible numbers. */
- nir_foreach_function(function, nir) {
- if (function->impl)
- nir_index_ssa_defs(function->impl);
+ nir_foreach_function_impl(impl, nir) {
+ nir_index_ssa_defs(impl);
}
fprintf(stderr, "NIR (before I/O lowering) for kernel\n");
assert(type->without_array()->is_vector());
assert(type->without_array()->vector_elements == state->vertices_per_primitive);
- nir_foreach_function(function, nir) {
- if (!function->impl)
- continue;
-
- nir_foreach_block(block, function->impl) {
+ nir_foreach_function_impl(impl, nir) {
+ nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;
const unsigned num_inputs = util_bitcount64(nir->info.inputs_read);
- nir_foreach_function(function, nir) {
- if (!function->impl)
- continue;
-
- nir_builder b = nir_builder_create(function->impl);
+ nir_foreach_function_impl(impl, nir) {
+ nir_builder b = nir_builder_create(impl);
- nir_foreach_block(block, function->impl) {
+ nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
- nir_foreach_function(function, nir) {
- if (!function->impl)
- continue;
-
- nir_foreach_block(block, function->impl) {
+ nir_foreach_function_impl(impl, nir) {
+ nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;
nir_io_add_const_offset_to_base(nir, nir_var_shader_in);
- nir_foreach_function(function, nir) {
- if (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);
- }
+ nir_foreach_function_impl(impl, nir) {
+ nir_builder b = nir_builder_create(impl);
+ nir_foreach_block(block, impl) {
+ remap_patch_urb_offsets(block, &b, vue_map,
+ nir->info.tess._primitive_mode);
}
}
}
nir_io_add_const_offset_to_base(nir, nir_var_shader_out);
- nir_foreach_function(function, nir) {
- if (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);
- }
+ nir_foreach_function_impl(impl, nir) {
+ nir_builder b = nir_builder_create(impl);
+ nir_foreach_block(block, impl) {
+ remap_patch_urb_offsets(block, &b, vue_map, tes_primitive_mode);
}
}
}
static bool
nir_shader_has_local_variables(const nir_shader *nir)
{
- nir_foreach_function(func, nir) {
- if (func->impl && !exec_list_is_empty(&func->impl->locals))
+ nir_foreach_function_impl(impl, nir) {
+ if (!exec_list_is_empty(&impl->locals))
return true;
}
if (unlikely(debug_enabled)) {
/* Re-index SSA defs so we print more sensible numbers. */
- nir_foreach_function(function, nir) {
- if (function->impl)
- nir_index_ssa_defs(function->impl);
+ nir_foreach_function_impl(impl, nir) {
+ nir_index_ssa_defs(impl);
}
fprintf(stderr, "NIR (SSA form) for %s shader:\n",
void
brw_nir_analyze_boolean_resolves(nir_shader *shader)
{
- nir_foreach_function(function, shader) {
- if (function->impl)
- analyze_boolean_resolves_impl(function->impl);
+ nir_foreach_function_impl(impl, shader) {
+ analyze_boolean_resolves_impl(impl);
}
}
}
/* Walk the IR, recording how many times each UBO block/offset is used. */
- nir_foreach_function(function, nir) {
- if (function->impl) {
- nir_foreach_block(block, function->impl) {
- analyze_ubos_block(&state, block);
- }
+ nir_foreach_function_impl(impl, nir) {
+ nir_foreach_block(block, impl) {
+ analyze_ubos_block(&state, block);
}
}
}
}
- nir_foreach_function(function, nir) {
- if (function->impl) {
- state.impl = function->impl;
- lower_cs_intrinsics_convert_impl(&state);
- }
+ nir_foreach_function_impl(impl, nir) {
+ state.impl = impl;
+ lower_cs_intrinsics_convert_impl(&state);
}
return state.progress;
brw_nir_lower_rt_intrinsics(nir_shader *nir,
const struct intel_device_info *devinfo)
{
- nir_foreach_function(function, nir) {
- if (function->impl)
- lower_rt_intrinsics_impl(function->impl, devinfo);
+ nir_foreach_function_impl(impl, nir) {
+ lower_rt_intrinsics_impl(impl, devinfo);
}
}
UNUSED static bool
no_load_scratch_base_ptr_intrinsic(nir_shader *shader)
{
- nir_foreach_function(func, shader) {
- if (!func->impl)
- continue;
-
- nir_foreach_block(block, func->impl) {
+ nir_foreach_function_impl(impl, shader) {
+ nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;