return func;
}
-#define nir_foreach_function(shader, func) \
+#define nir_foreach_function(func, shader) \
foreach_list_typed(nir_function, func, node, &(shader)->functions)
nir_shader *nir_shader_create(void *mem_ctx,
condition_flags[${index}] = ${condition};
% endfor
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= ${pass_name}_impl(function->impl, condition_flags);
}
* functions of other functions and we don't know what order the functions
* will have in the list.
*/
- nir_foreach_function(s, fxn) {
+ nir_foreach_function(fxn, s) {
nir_function *nfxn = remap_global(&state, fxn);
nfxn->impl = clone_function_impl(&state, fxn->impl);
nfxn->impl->function = nfxn;
void
nir_calc_dominance(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_calc_dominance_impl(function->impl);
}
void
nir_dump_dom_tree(nir_shader *shader, FILE *fp)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_dump_dom_tree_impl(function->impl, fp);
}
void
nir_dump_dom_frontier(nir_shader *shader, FILE *fp)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_dump_dom_frontier_impl(function->impl, fp);
}
void
nir_dump_cfg(nir_shader *shader, FILE *fp)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_dump_cfg_impl(function->impl, fp);
}
void
nir_convert_from_ssa(nir_shader *shader, bool phi_webs_only)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_convert_from_ssa_impl(function->impl, phi_webs_only);
}
{
int count = -1;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
_mesa_key_pointer_equal);
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = inline_function_impl(function->impl, inlined) || progress;
}
void
nir_lower_alu_to_scalar(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_alu_to_scalar_impl(function->impl);
}
nir_lower_atomics(nir_shader *shader,
const struct gl_shader_program *shader_program)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
find_output(nir_shader *shader, unsigned drvloc)
{
nir_ssa_def *def = NULL;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block_reverse(block, function->impl) {
nir_ssa_def *new_def = find_output_in_block(block, drvloc);
out[1] =
create_clipdist_var(shader, ++maxloc, true, VARYING_SLOT_CLIP_DIST1);
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!strcmp(function->name, "main"))
lower_clip_vs(function->impl, ucp_enables, cv, out);
}
create_clipdist_var(shader, ++maxloc, false,
VARYING_SLOT_CLIP_DIST1);
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!strcmp(function->name, "main"))
lower_clip_fs(function->impl, ucp_enables, in);
}
void
nir_lower_doubles(nir_shader *shader, nir_lower_doubles_options options)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
lower_doubles_impl(function->impl, options);
}
void
nir_lower_double_pack(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
lower_double_pack_impl(function->impl);
}
_mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl)
mark_global_var_uses_block(block, function->impl, var_func_table);
exec_list_push_tail(&shader->globals, &var->node);
state.vertex_count_var = var;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
void
nir_lower_idiv(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
convert_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = lower_indirects_impl(function->impl, modes) || progress;
}
nir_lower_io(nir_shader *shader, nir_variable_mode modes,
int (*type_size)(const struct glsl_type *))
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_io_impl(function->impl, modes, type_size);
}
void
nir_lower_load_const_to_scalar(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_load_const_to_scalar_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = nir_lower_locals_to_regs_impl(function->impl) || progress;
}
exec_list_push_tail(&shader->outputs, &output->node);
}
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl == NULL)
continue;
void
nir_lower_phis_to_scalar(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
lower_phis_to_scalar_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = nir_lower_returns_impl(function->impl) || progress;
}
nir_lower_samplers(nir_shader *shader,
const struct gl_shader_program *shader_program)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
lower_impl(function->impl, shader_program, shader->stage);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = convert_impl(function->impl) || progress;
}
state.options = options;
state.progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_tex_impl(function->impl, &state);
}
void
nir_lower_to_source_mods(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_lower_to_source_mods_block(block);
if (setup_inputs(&state) != 0)
return;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_two_sided_color_impl(function->impl, &state);
}
void
nir_lower_var_copies(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
lower_var_copies_impl(function->impl);
}
void
nir_lower_vars_to_ssa(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_lower_vars_to_ssa_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = nir_lower_vec_to_movs_impl(function->impl) || progress;
}
void
nir_metadata_set_validation_flag(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
function->impl->valid_metadata |= nir_metadata_not_properly_reset;
}
void
nir_metadata_check_validation_flag(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
assert(!(function->impl->valid_metadata &
nir_metadata_not_properly_reset));
void
nir_move_vec_src_uses_to_dest(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_move_vec_src_uses_to_dest_impl(shader, function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = normalize_cubemap_coords_impl(function->impl) || progress;
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_opt_constant_folding_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl && nir_copy_prop_impl(function->impl))
progress = true;
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_opt_cse_impl(function->impl);
}
nir_opt_dce(nir_shader *shader)
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl && nir_opt_dce_impl(function->impl))
progress = true;
}
{
bool progress = false;
- nir_foreach_function(shader, function)
+ nir_foreach_function(function, shader)
if (function->impl)
progress |= opt_dead_cf_impl(function->impl);
void
nir_opt_gcm(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
opt_gcm_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= nir_opt_peephole_select_impl(function->impl);
}
{
bool progress = false;
- nir_foreach_function(shader, function)
+ nir_foreach_function(function, shader)
if (function->impl)
progress = remove_phis_impl(function->impl) || progress;
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
static void
add_var_use_shader(nir_shader *shader, struct set *live)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_foreach_instr(instr, block) {
progress = remove_dead_vars(&shader->system_values, live) || progress;
if (modes & nir_var_local) {
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl) {
if (remove_dead_vars(&function->impl->locals, live)) {
nir_metadata_preserve(function->impl, nir_metadata_block_index |
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = nir_repair_ssa_impl(function->impl) || progress;
}
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress = split_var_copies_impl(function->impl) || progress;
}
void
nir_convert_to_ssa(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
nir_convert_to_ssa_impl(function->impl);
}
nir_function_impl *fxn = NULL;
/* Find the main function: */
- nir_foreach_function(ctx->s, function) {
+ nir_foreach_function(function, ctx->s) {
compile_assert(ctx, strcmp(function->name, "main") == 0);
compile_assert(ctx, function->impl);
fxn = function->impl;
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= lower_if_else_impl(function->impl);
}
void
vc4_nir_lower_blend(nir_shader *s, struct vc4_compile *c)
{
- nir_foreach_function(s, function) {
+ nir_foreach_function(function, s) {
if (function->impl) {
nir_foreach_block_call(function->impl,
vc4_nir_lower_blend_block, c);
void
vc4_nir_lower_io(nir_shader *s, struct vc4_compile *c)
{
- nir_foreach_function(s, function) {
+ nir_foreach_function(function, s) {
if (function->impl)
vc4_nir_lower_io_impl(c, function->impl);
}
void
vc4_nir_lower_txf_ms(nir_shader *s, struct vc4_compile *c)
{
- nir_foreach_function(s, function) {
+ nir_foreach_function(function, s) {
if (function->impl)
vc4_nir_lower_txf_ms_impl(c, function->impl);
}
ntq_setup_registers(c, &c->s->registers);
/* Find the main function and emit the body. */
- nir_foreach_function(c->s, function) {
+ nir_foreach_function(function, c->s) {
assert(strcmp(function->name, "main") == 0);
assert(function->impl);
ntq_emit_impl(c, function->impl);
count_nir_instrs(nir_shader *nir)
{
int count = 0;
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (!function->impl)
continue;
nir_foreach_block_call(function->impl, count_nir_instrs_in_block, &count);
if (!layout || !layout->stage[shader->stage].has_dynamic_offsets)
return;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
state.set[s].image_offsets = rzalloc_array(mem_ctx, uint8_t, count);
}
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
}
}
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
void
anv_nir_lower_push_constants(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
nir_emit_system_values();
/* get the main function and emit it */
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
assert(strcmp(function->name, "main") == 0);
assert(function->impl);
nir_emit_impl(function->impl);
nir_system_values[i] = fs_reg();
}
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
assert(strcmp(function->name, "main") == 0);
assert(function->impl);
nir_foreach_block(block, function->impl) {
static void
add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode)
{
- nir_foreach_function(nir, f) {
+ nir_foreach_function(f, nir) {
if (f->impl) {
nir_builder b;
nir_builder_init(&b, f->impl);
*/
GLbitfield64 inputs_read = nir->info.inputs_read;
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
remap_vs_attrs(block, inputs_read);
add_const_offset_to_base(nir, nir_var_shader_in);
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
remap_inputs_with_vue_map(block, vue_map);
add_const_offset_to_base(nir, nir_var_shader_in);
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
add_const_offset_to_base(nir, nir_var_shader_out);
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
if (unlikely(debug_enabled)) {
/* Re-index SSA defs so we print more sensible numbers. */
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
if (function->impl)
nir_index_ssa_defs(function->impl);
}
void
brw_nir_analyze_boolean_resolves(nir_shader *shader)
{
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
analyze_boolean_resolves_impl(function->impl);
}
.wa_flags = attrib_wa_flags,
};
- nir_foreach_function(shader, func) {
+ nir_foreach_function(func, shader) {
if (!func->impl)
continue;
{
bool progress = false;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (function->impl)
progress |= brw_nir_opt_peephole_ffma_impl(function->impl);
}
nir_setup_system_values();
/* get the main function and emit it */
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
assert(strcmp(function->name, "main") == 0);
assert(function->impl);
nir_emit_impl(function->impl);
nir_system_values[i] = dst_reg();
}
- nir_foreach_function(nir, function) {
+ nir_foreach_function(function, nir) {
assert(strcmp(function->name, "main") == 0);
assert(function->impl);
nir_foreach_block(block, function->impl) {