These open-code the same idiom as the helper.
Via Coccinelle patch:
@@
expression func_impl;
@@
-nir_before_cf_list(&func_impl->body)
+nir_before_impl(func_impl)
@@
expression func_impl;
@@
-nir_after_cf_list(&func_impl->body)
+nir_after_impl(func_impl)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24910>
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_metadata preserved = nir_metadata_block_index | nir_metadata_dominance;
- nir_builder b = nir_builder_at(nir_after_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
nir_alu_type output_types_16bit_lo[16][4];
nir_alu_type output_types_16bit_hi[16][4];
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder builder = nir_builder_at(nir_after_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_after_impl(impl));
nir_builder *b = &builder;
/* Emit shader query for mix use legacy/NGG GS */
/* Remove all non-position outputs, and put the position output into the variable. */
nir_metadata_preserve(impl, nir_metadata_none);
remove_culling_shader_outputs(b->shader, s);
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
nir_def *lds_scratch_base = nir_load_lds_ngg_scratch_base_amd(b);
}
nir_cf_list extracted;
- nir_cf_extract(&extracted, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body));
- b->cursor = nir_before_cf_list(&impl->body);
+ nir_cf_extract(&extracted, nir_before_impl(impl),
+ nir_after_impl(impl));
+ b->cursor = nir_before_impl(impl);
ngg_nogs_init_vertex_indices_vars(b, impl, &state);
nir_store_var(b, prim_exp_arg_var, emit_ngg_nogs_prim_exp_arg(b, &state), 0x1u);
} else {
add_deferred_attribute_culling(b, &extracted, &state);
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
if (state.early_prim_export)
emit_ngg_nogs_prim_export(b, &state, nir_load_var(b, state.prim_exp_arg_var));
ngg_nogs_store_xfb_outputs_to_lds(b, &state);
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
ngg_nogs_build_streamout(b, &state);
}
/* Take care of late primitive export */
if (!state.early_prim_export) {
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
emit_ngg_nogs_prim_export(b, &state, nir_load_var(b, prim_exp_arg_var));
}
b->cursor = nir_after_cf_node(&if_es_thread->cf_node);
create_vertex_param_phis(b, num_outputs, outputs);
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
if (!num_es_threads)
num_es_threads = nir_load_merged_wave_info_amd(b);
s->outputs_16bit_hi);
if (num_outputs) {
- b->cursor = nir_after_cf_list(&s->impl->body);
+ b->cursor = nir_after_impl(s->impl);
create_vertex_param_phis(b, num_outputs, outputs);
export_vertex_params_gfx11(b, tid_in_tg, max_num_out_vtx, num_outputs, outputs,
/* Extract the full control flow. It is going to be wrapped in an if statement. */
nir_cf_list extracted;
- nir_cf_extract(&extracted, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body));
+ nir_cf_extract(&extracted, nir_before_impl(impl),
+ nir_after_impl(impl));
- nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &builder; /* This is to avoid the & */
/* Workgroup barrier: wait for ES threads */
state.vertex_count,
state.primitive_count);
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
/* Emit the finale sequence */
ngg_gs_finale(b, &state);
if (!BITSET_TEST(b->shader->info.system_values_read, SYSTEM_VALUE_WORKGROUP_INDEX))
return;
- b->cursor = nir_before_cf_list(&b->impl->body);
+ b->cursor = nir_before_impl(b->impl);
/* Legacy fast launch mode (FAST_LAUNCH=1):
*
/* Extract the full control flow of the shader. */
nir_cf_list extracted;
- nir_cf_extract(&extracted, nir_before_cf_list(&b->impl->body), nir_after_cf_list(&b->impl->body));
- b->cursor = nir_before_cf_list(&b->impl->body);
+ nir_cf_extract(&extracted, nir_before_impl(b->impl),
+ nir_after_cf_list(&b->impl->body));
+ b->cursor = nir_before_impl(b->impl);
/* Wrap the shader in an if to ensure that only the necessary amount of lanes run it. */
nir_def *invocation_index = nir_load_local_invocation_index(b);
state.primitive_count_var =
nir_local_variable_create(impl, glsl_uint_type(), "primitive_count_var");
- nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &builder; /* This is to avoid the & */
handle_smaller_ms_api_workgroup(b, &state);
static void
export_ps_outputs(nir_builder *b, lower_ps_state *s)
{
- b->cursor = nir_after_cf_list(&b->impl->body);
+ b->cursor = nir_after_impl(b->impl);
emit_ps_color_clamp_and_alpha_test(b, s);
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder builder = nir_builder_create(impl);
nir_builder *b = &builder;
- b->cursor = nir_after_cf_list(&impl->body);
+ b->cursor = nir_after_impl(impl);
if (st->tcs_tess_level_outer_mask) {
nir_def *val = nir_load_var(b, st->tcs_tess_level_outer);
if (shader->info.stage == MESA_SHADER_GEOMETRY && !info->is_ngg) {
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
u_foreach_bit (i, shader->info.gs.active_stream_mask)
state.gsvs_ring[i] = load_gsvs_ring(&b, &state, i);
bool progress = false;
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *arg_offset = nir_load_rt_arg_scratch_offset_amd(&b);
impl->function->params = ralloc_array(any_hit, nir_parameter, ARRAY_SIZE(params));
memcpy(impl->function->params, params, sizeof(params));
- nir_builder build = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder build = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &build;
nir_def *commit_ptr = nir_load_param(b, 0);
nir_builder build = nir_builder_create(impl);
nir_builder *b = &build;
- b->cursor = nir_before_cf_list(&impl->body);
+ b->cursor = nir_before_impl(impl);
nir_variable *commit = nir_local_variable_create(impl, glsl_bool_type(), "ray_commit");
nir_store_var(b, commit, nir_imm_false(b), 0x1);
NIR_PASS(_, shader, nir_lower_returns);
nir_cf_list list;
- nir_cf_extract(&list, nir_before_cf_list(&impl->body), nir_after_cf_list(&impl->body));
+ nir_cf_extract(&list, nir_before_impl(impl), nir_after_impl(impl));
/* initialize variables */
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *traversal_addr = ac_nir_load_arg(&b, &args->ac, args->ac.rt.traversal_shader_addr);
nir_store_var(&b, vars.traversal_addr, nir_pack_64_2x32(&b, traversal_addr), 1);
nir_pop_if(&b, shader_guard);
/* select next shader */
- b.cursor = nir_after_cf_list(&impl->body);
+ b.cursor = nir_after_impl(impl);
shader_addr = nir_load_var(&b, vars.shader_addr);
nir_def *next = select_next_shader(&b, shader_addr, info->wave_size);
if (s->info.fs.early_fragment_tests) {
assert(!writes_zs && "incompatible");
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_sample_mask_agx(&b, nir_imm_intN_t(&b, ALL_SAMPLES, 16),
nir_imm_intN_t(&b, ALL_SAMPLES, 16));
return true;
}
}
if (!found) {
- b.cursor = nir_before_cf_list(&impl->body);
+ b.cursor = nir_before_impl(impl);
nir_deref_instr *deref = nir_build_deref_var(&b, psiz);
nir_store_deref(&b, deref, nir_imm_float(&b, 1.0), BITFIELD_BIT(0));
}
this->is_global = false;
- b = nir_builder_at(nir_after_cf_list(&impl->body));
+ b = nir_builder_at(nir_after_impl(impl));
unsigned i = (ir->return_type != glsl_type::void_type) ? 1 : 0;
nir_metadata_dominance;
bool progress = false;
- nir_cursor iter = nir_before_cf_list(&impl->body);
+ nir_cursor iter = nir_before_impl(impl);
nir_instr *instr;
while ((instr = cursor_next_instr(iter)) != NULL) {
if (filter && !filter(instr, cb_data)) {
if (!undef)
return NULL;
- nir_instr_insert(nir_before_cf_list(&build->impl->body), &undef->instr);
+ nir_instr_insert(nir_before_impl(build->impl), &undef->instr);
if (build->update_divergence)
nir_update_instr_divergence(build->shader, &undef->instr);
nir_intrinsic_set_divergent(decl, true);
nir_def_init(&decl->instr, &decl->def, 1, 32);
- nir_instr_insert(nir_before_cf_list(&b->impl->body), &decl->instr);
+ nir_instr_insert(nir_before_impl(b->impl), &decl->instr);
return &decl->def;
}
assert(shader->info.stage == MESA_SHADER_FRAGMENT);
nir_foreach_function_impl(impl, shader) {
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
lower_bitmap_impl(nir_function_impl *impl,
const nir_lower_bitmap_options *options)
{
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
lower_bitmap(impl->function->shader, &b, options);
* users of this pass don't support sub-routines.
*/
assert(impl->end_block->predecessors->entries == 1);
- b.cursor = nir_after_cf_list(&impl->body);
+ b.cursor = nir_after_impl(impl);
/* find clipvertex/position outputs */
if (!find_clipvertex_and_position_outputs(shader, &clipvertex, &position))
nir_variable **in, bool use_clipdist_array)
{
nir_def *clipdist[MAX_CLIP_PLANES];
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
if (!use_clipdist_array) {
if (ucp_enables & 0x0f)
nir_lower_phis_to_regs_block(block);
nir_cf_list cf_list;
- nir_cf_extract(&cf_list, nir_before_cf_list(&impl->body),
- nir_after_cf_list(&impl->body));
+ nir_cf_extract(&cf_list, nir_before_impl(impl),
+ nir_after_impl(impl));
/* From this point on, it's structured */
impl->structured = true;
if (!a_block_needs_set_vertex_and_primitive_count(impl->end_block, per_stream))
return false;
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
state.builder = &b;
for (unsigned i = 0; i < NIR_MAX_XFB_STREAMS; i++) {
nir_function_impl *entrypoint = nir_shader_get_entrypoint(shader);
- nir_builder b = nir_builder_at(nir_before_cf_list(&entrypoint->body));
+ nir_builder b = nir_builder_at(nir_before_impl(entrypoint));
nir_variable *is_helper = nir_local_variable_create(entrypoint,
glsl_bool_type(),
nir_cf_list body;
nir_cf_list_extract(&body, &entrypoint->body);
- nir_builder b = nir_builder_at(nir_after_cf_list(&entrypoint->body));
+ nir_builder b = nir_builder_at(nir_after_impl(entrypoint));
/* Loop Index will go from 0 to view_count. */
nir_variable *loop_index_var =
nir_variable *in, *out;
nir_def *def;
- b = nir_builder_at(nir_before_cf_list(&impl->body));
+ b = nir_builder_at(nir_before_impl(impl));
/* The edge flag is the last input in st/mesa. This code is also called by
* i965 which calls it before any input locations are assigned.
}
if (!out) {
- b.cursor = nir_before_cf_list(&impl->body);
+ b.cursor = nir_before_impl(impl);
nir_def *load = nir_load_var(&b, in);
load = nir_fclamp(&b, nir_channel(&b, load, 0), nir_channel(&b, load, 1), nir_channel(&b, load, 2));
nir_store_var(&b, new_out, load, 0x1);
}
}
if (!found) {
- b.cursor = nir_before_cf_list(&impl->body);
+ b.cursor = nir_before_impl(impl);
nir_def *load = nir_load_var(&b, in);
load = nir_fclamp(&b, nir_channel(&b, load, 0), nir_channel(&b, load, 1), nir_channel(&b, load, 2));
nir_store_var(&b, new_out, load, 0x1);
nir_local_variable_create(b->impl, glsl_bool_type(), "return");
/* Initialize the variable to 0 */
- b->cursor = nir_before_cf_list(&b->impl->body);
+ b->cursor = nir_before_impl(b->impl);
nir_store_var(b, state->return_flag, nir_imm_false(b), 1);
}
case nir_intrinsic_load_shader_record_ptr:
case nir_intrinsic_load_btd_local_arg_addr_intel:
nir_instr_remove(instr);
- nir_instr_insert(nir_before_cf_list(&impl->body), instr);
+ nir_instr_insert(nir_before_impl(impl), instr);
progress = true;
break;
if (!resume_node) {
/* We want the resume to be the first "interesting" instruction */
nir_instr_remove(resume_instr);
- nir_instr_insert(nir_before_cf_list(&b->impl->body), resume_instr);
+ nir_instr_insert(nir_before_impl(b->impl), resume_instr);
}
/* We've copied everything interesting out of this CF list to before the
/* Create a nop instruction to use as a cursor as we extract and re-insert
* stuff into the CFG.
*/
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
ASSERTED bool found =
flatten_resume_if_ladder(&b, &impl->cf_node, &impl->body,
true, resume_instr, &remat);
* This ensures that 0 mesh workgroups are launched when the
* shader doesn't write the TASK_COUNT output.
*/
- b->cursor = nir_before_cf_list(&b->impl->body);
+ b->cursor = nir_before_impl(b->impl);
nir_def *zero = nir_imm_int(b, 0);
nir_store_shared(b, zero, zero, .base = s->task_count_shared_addr);
bool point_coord_is_sysval,
bool yinvert)
{
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *new_coord;
if (point_coord_is_sysval) {
{
bool progress = false;
- b->cursor = nir_before_cf_list(&b->impl->body);
+ b->cursor = nir_before_impl(b->impl);
nir_foreach_variable_in_list(var, var_list) {
if (!(var->data.mode & modes))
assert(chunk_size % 4 == 0);
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
assert(!shader->info.workgroup_size_variable);
const unsigned local_count = shader->info.workgroup_size[0] *
nir_undef_instr *undef =
nir_undef_instr_create(state->impl->function->shader,
def->num_components, def->bit_size);
- nir_instr_insert(nir_before_cf_list(&state->impl->body), &undef->instr);
+ nir_instr_insert(nir_before_impl(state->impl), &undef->instr);
nir_def_rewrite_uses(def, &undef->def);
return true;
_mesa_pointer_hash_table_create(NULL);
nir_function_impl *preamble =
nir_shader_get_preamble(impl->function->shader);
- nir_builder preamble_builder = nir_builder_at(nir_before_cf_list(&preamble->body));
+ nir_builder preamble_builder = nir_builder_at(nir_before_impl(preamble));
nir_builder *b = &preamble_builder;
nir_foreach_block(block, impl) {
nir_undef_instr_create(val->builder->shader,
val->num_components,
val->bit_size);
- nir_instr_insert(nir_before_cf_list(&val->builder->impl->body),
+ nir_instr_insert(nir_before_impl(val->builder->impl),
&undef->instr);
def = &undef->def;
} else if (he->data == NEEDS_PHI) {
nir_function *main_entry_point = nir_function_create(b->shader, func_name);
nir_function_impl *impl = nir_function_impl_create(main_entry_point);
- b->nb = nir_builder_at(nir_after_cf_list(&impl->body));
+ b->nb = nir_builder_at(nir_after_impl(impl));
b->func_param_idx = 0;
nir_call_instr *call = nir_call_instr_create(b->nb.shader, entry_point);
* directly in our OpFunctionParameter handler.
*/
nir_function_impl *impl = nir_function_impl_create(func);
- b->nb = nir_builder_at(nir_before_cf_list(&impl->body));
+ b->nb = nir_builder_at(nir_before_impl(impl));
b->nb.exact = b->exact;
b->func_param_idx = 0;
}
nir_function_impl *impl = func->nir_func->impl;
- b->nb = nir_builder_at(nir_after_cf_list(&impl->body));
+ b->nb = nir_builder_at(nir_after_impl(impl));
b->func = func;
b->nb.exact = b->exact;
b->phi_table = _mesa_pointer_hash_table_create(b);
return false;
nir_function_impl *preamble = nir_shader_get_preamble(nir);
- nir_builder _b = nir_builder_at(nir_after_cf_list(&preamble->body));
+ nir_builder _b = nir_builder_at(nir_after_impl(preamble));
nir_builder *b = &_b;
for (unsigned i = 0; i < state->num_enabled; i++) {
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
if (v->type == MESA_SHADER_VERTEX && topology != IR3_TESS_NONE)
state.header = nir_load_tcs_header_ir3(&b);
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
if (shader->info.stage == MESA_SHADER_GEOMETRY)
state.header = nir_load_gs_header_ir3(&b);
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
state.header = nir_load_tcs_header_ir3(&b);
/* If required, store gl_PrimitiveID. */
if (v->key.tcs_store_primid) {
- b.cursor = nir_after_cf_list(&impl->body);
+ b.cursor = nir_after_impl(impl);
nir_store_output(&b, nir_load_primitive_id(&b), nir_imm_int(&b, 0),
.io_semantics = {
.num_slots = 1
});
- b.cursor = nir_before_cf_list(&impl->body);
+ b.cursor = nir_before_impl(impl);
}
nir_foreach_block_safe (block, impl)
*/
nir_cf_list body;
- nir_cf_extract(&body, nir_before_cf_list(&impl->body),
- nir_after_cf_list(&impl->body));
+ nir_cf_extract(&body, nir_before_impl(impl),
+ nir_after_impl(impl));
- b.cursor = nir_after_cf_list(&impl->body);
+ b.cursor = nir_after_impl(impl);
/* Re-emit the header, since the old one got moved into the if branch */
state.header = nir_load_tcs_header_ir3(&b);
nir_builder b = nir_builder_create(entrypoint);
u_foreach_bit (stream, stream_mask) {
- b.cursor = nir_after_cf_list(&entrypoint->body);
+ b.cursor = nir_after_impl(entrypoint);
/* Inserting the cloned body invalidates any cursor not using an
* instruction, so we need to emit this to keep track of where the new
* different streams. Our lowering means that redundant calls to
* EndStreamPrimitive are safe and should be optimized out.
*/
- b.cursor = nir_after_cf_list(&entrypoint->body);
+ b.cursor = nir_after_impl(entrypoint);
nir_end_primitive(&b, .stream_id = stream);
}
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
state.header = nir_load_gs_header_ir3(&b);
nir_local_variable_create(impl, glsl_uint_type(), "emitted_vertex");
/* Initialize to 0. */
- b.cursor = nir_before_cf_list(&impl->body);
+ b.cursor = nir_before_impl(impl);
nir_store_var(&b, state.vertex_count_var, nir_imm_int(&b, 0), 0x1);
nir_store_var(&b, state.emitted_vertex_var, nir_imm_int(&b, 0), 0x1);
nir_store_var(&b, state.vertex_flags_out, nir_imm_int(&b, 4), 0x1);
* ...
*/
- b->cursor = nir_before_cf_list(&main->body);
+ b->cursor = nir_before_impl(main);
nir_if *outer_if = nir_push_if(b, nir_preamble_start_ir3(b, 1));
{
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_after_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
nir_variable *var = nir_variable_create(nir, nir_var_shader_out,
glsl_float_type(),
assert(missing_mask != 0);
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(s);
- b = nir_builder_at(nir_before_cf_list(&impl->body));
+ b = nir_builder_at(nir_before_impl(impl));
nir_def *zero = nir_imm_zero(&b, 4, 32);
for (unsigned i = 0; i < 2; ++i) {
const struct si_shader_selector *sel = s->shader->selector;
const union si_shader_key *key = &s->shader->key;
- b->cursor = nir_before_cf_list(&b->impl->body);
+ b->cursor = nir_before_impl(b->impl);
if (sel->screen->info.gfx_level <= GFX8 && sel->stage <= MESA_SHADER_GEOMETRY &&
(key->ge.as_es || sel->stage == MESA_SHADER_GEOMETRY)) {
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &builder;
const struct si_shader_selector *sel = s->shader->selector;
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &builder;
const struct si_shader_selector *sel = shader->selector;
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder builder = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder builder = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &builder;
/* Load the buffer descriptor. */
memset(state.varyings, 0, sizeof(state.varyings));
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- b = nir_builder_at(nir_before_cf_list(&entry->body));
+ b = nir_builder_at(nir_before_impl(entry));
state.primitive_vert_count =
lower_pv_mode_vertices_for_prim(shader->info.gs.output_primitive);
state.line_rectangular = line_rectangular;
// initialize pos_counter and stipple_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- b = nir_builder_at(nir_before_cf_list(&entry->body));
+ b = nir_builder_at(nir_before_impl(entry));
nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1);
nir_store_var(&b, state.stipple_counter, nir_imm_float(&b, 0), 1);
{
nir_builder b;
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- b = nir_builder_at(nir_after_cf_list(&entry->body));
+ b = nir_builder_at(nir_after_impl(entry));
// create stipple counter
nir_variable *stipple = nir_variable_create(shader, nir_var_shader_in,
// initialize pos_counter
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- b = nir_builder_at(nir_before_cf_list(&entry->body));
+ b = nir_builder_at(nir_before_impl(entry));
nir_store_var(&b, state.pos_counter, nir_imm_int(&b, 0), 1);
shader->info.gs.vertices_out = 8 * shader->info.gs.vertices_out;
// initialize stipple_pattern
nir_function_impl *entry = nir_shader_get_entrypoint(shader);
- b = nir_builder_at(nir_before_cf_list(&entry->body));
+ b = nir_builder_at(nir_before_impl(entry));
nir_def *pattern = nir_load_push_constant_zink(&b, 1, 32,
nir_imm_int(&b, ZINK_GFX_PUSHCONST_LINE_STIPPLE_PATTERN));
nir_store_var(&b, stipple_pattern, pattern, 1);
} else {
nir_builder b;
nir_function_impl *impl = nir_shader_get_entrypoint(vs);
- b = nir_builder_at(nir_after_cf_list(&impl->body));
+ b = nir_builder_at(nir_after_impl(impl));
assert(impl->end_block->predecessors->entries == 1);
clamp_layer_output_emit(&b, &state);
nir_metadata_preserve(impl, nir_metadata_dominance);
builder_init_new_impl(nir_function *func)
{
nir_function_impl *impl = nir_function_impl_create(func);
- return nir_builder_at(nir_before_cf_list(&impl->body));
+ return nir_builder_at(nir_before_impl(impl));
}
static void
ralloc_array(any_hit, nir_parameter, ARRAY_SIZE(params));
memcpy(impl->function->params, params, sizeof(params));
- nir_builder build = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder build = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &build;
nir_def *commit_ptr = nir_load_param(b, 0);
nir_function_impl *impl = nir_shader_get_entrypoint(intersection);
- nir_builder build = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder build = nir_builder_at(nir_before_impl(impl));
nir_builder *b = &build;
nir_def *t_addr = brw_nir_rt_mem_hit_addr(b, false /* committed */);
*/
assert(num_shader_call_vars <= 1);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_def *call_data_addr = NULL;
if (num_shader_call_vars > 0) {
num_mesh_vertices_per_primitive(nir->info.mesh.primitive_type);
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_after_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_after_impl(impl));
/* wait for all subgroups to finish */
nir_barrier(&b, SCOPE_WORKGROUP);
nir_deref_instr *new_derefs[VARYING_SLOT_MAX] = {NULL, };
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
- nir_builder b = nir_builder_at(nir_before_cf_list(&impl->body));
+ nir_builder b = nir_builder_at(nir_before_impl(impl));
nir_foreach_shader_in_variable_safe(var, nir) {
gl_varying_slot location = var->data.location;
bool progress = nir_lower_multiview(shader, view_mask);
if (progress) {
- nir_builder b = nir_builder_at(nir_before_cf_list(&entrypoint->body));
+ nir_builder b = nir_builder_at(nir_before_impl(entrypoint));
/* Fill Layer ID with zero. Replication will use that as base to
* apply the RTAI offsets.
case nir_intrinsic_load_invocation_id: {
if (!loop_var) {
loop_var = nir_local_variable_create(patch_const_func_impl, glsl_int_type(), "PatchConstInvocId");
- b.cursor = nir_before_cf_list(&patch_const_func_impl->body);
+ b.cursor = nir_before_impl(patch_const_func_impl);
loop_var_deref = nir_build_deref_var(&b, loop_var);
}
if (!state.loop) {