nir: Use nir_builder_create

perl -p0e 's/nir_builder ([^;]*);\s*nir_builder_init\(&\1, /nir_builder \1 = nir_builder_create(/g' -i $(git grep -l nir_builder_init)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23860>
This commit is contained in:
Alyssa Rosenzweig
2023-06-26 10:42:29 -04:00
committed by Marge Bot
parent e5410f9b00
commit 815efcdf7e
135 changed files with 205 additions and 417 deletions

View File

@@ -700,8 +700,7 @@ ac_nir_lower_legacy_vs(nir_shader *nir,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_metadata preserved = nir_metadata_block_index | nir_metadata_dominance;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_cf_list(&impl->body);
nir_alu_type output_types_16bit_lo[16][4];

View File

@@ -869,8 +869,7 @@ cleanup_culling_shader_after_dce(nir_shader *shader,
bool uses_tes_patch_id = false;
bool progress = false;
nir_builder b;
nir_builder_init(&b, function_impl);
nir_builder b = nir_builder_create(function_impl);
nir_foreach_block_reverse_safe(block, function_impl) {
nir_foreach_instr_reverse_safe(instr, block) {

View File

@@ -291,8 +291,7 @@ bool ac_nir_optimize_outputs(nir_shader *nir, bool sprite_tex_disallowed,
unsigned i;
bool progress = false;
struct nir_builder b;
nir_builder_init(&b, impl);
struct nir_builder b = nir_builder_create(impl);
/* Optimize outputs. */
BITSET_FOREACH_SET(i, outputs_optimized, NUM_TOTAL_VARYING_SLOTS) {

View File

@@ -47,8 +47,7 @@ radv_nir_export_multiview(nir_shader *nir)
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* This pass is not suitable for mesh shaders, because it can't know the mapping between API mesh
* shader invocations and output primitives. Needs to be handled in ac_nir_lower_ngg.

View File

@@ -519,8 +519,7 @@ radv_nir_lower_abi(nir_shader *shader, enum amd_gfx_level gfx_level, const struc
if (shader->info.stage == MESA_SHADER_GEOMETRY && !info->is_ngg) {
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
u_foreach_bit (i, shader->info.gs.active_stream_mask)

View File

@@ -37,8 +37,7 @@ radv_nir_lower_fs_intrinsics(nir_shader *nir, const struct radv_pipeline_stage *
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) {

View File

@@ -33,9 +33,7 @@ radv_nir_lower_intrinsics_early(nir_shader *nir, const struct radv_pipeline_key
{
nir_function_impl *entry = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, entry);
nir_builder b = nir_builder_create(entry);
nir_foreach_block (block, entry) {
nir_foreach_instr_safe (instr, block) {

View File

@@ -34,8 +34,7 @@ radv_should_lower_poly_line_smooth(nir_shader *nir, const struct radv_pipeline_k
if (!key->ps.line_smooth_enabled && !key->dynamic_line_rast_mode)
return false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr (instr, block) {

View File

@@ -31,8 +31,7 @@ radv_nir_lower_primitive_shading_rate(nir_shader *nir, enum amd_gfx_level gfx_le
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* Iterate in reverse order since there should be only one deref store to PRIMITIVE_SHADING_RATE
* after lower_io_to_temporaries for vertex shaders.

View File

@@ -641,8 +641,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device
if (!function->impl)
continue;
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
nir_foreach_variable_in_list (var, &function->impl->locals) {
if (!var->data.ray_query)

View File

@@ -54,8 +54,7 @@ radv_nir_lower_view_index(nir_shader *nir, bool per_primitive)
{
bool progress = false;
nir_function_impl *entry = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, entry);
nir_builder b = nir_builder_create(entry);
nir_variable *layer = NULL;
nir_foreach_block (block, entry) {

View File

@@ -33,8 +33,7 @@ radv_nir_lower_viewport_to_zero(nir_shader *nir)
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* There should be only one deref load for VIEWPORT after lower_io_to_temporaries. */
nir_foreach_block (block, impl) {

View File

@@ -42,8 +42,7 @@ lower_rt_derefs(nir_shader *shader)
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
nir_ssa_def *arg_offset = nir_load_rt_arg_scratch_offset_amd(&b);
@@ -276,8 +275,7 @@ load_sbt_entry(nir_builder *b, const struct rt_variables *vars, nir_ssa_def *idx
static void
lower_rt_instructions(nir_shader *shader, struct rt_variables *vars, unsigned call_idx_base)
{
nir_builder b_shader;
nir_builder_init(&b_shader, nir_shader_get_entrypoint(shader));
nir_builder b_shader = nir_builder_create(nir_shader_get_entrypoint(shader));
nir_foreach_block (block, nir_shader_get_entrypoint(shader)) {
nir_foreach_instr_safe (instr, block) {
@@ -692,8 +690,7 @@ lower_hit_attribs(nir_shader *shader, nir_variable **hit_attribs, uint32_t workg
nir_foreach_variable_with_modes (attrib, shader, nir_var_ray_hit_attrib)
attrib->data.mode = nir_var_shader_temp;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) {
@@ -826,8 +823,7 @@ radv_parse_rt_stage(struct radv_device *device, const VkPipelineShaderStageCreat
if (shader->info.stage == MESA_SHADER_RAYGEN || shader->info.stage == MESA_SHADER_CLOSEST_HIT ||
shader->info.stage == MESA_SHADER_CALLABLE || shader->info.stage == MESA_SHADER_MISS) {
nir_block *last_block = nir_impl_last_block(nir_shader_get_entrypoint(shader));
nir_builder b_inner;
nir_builder_init(&b_inner, nir_shader_get_entrypoint(shader));
nir_builder b_inner = nir_builder_create(nir_shader_get_entrypoint(shader));
b_inner.cursor = nir_after_block(last_block);
nir_rt_return_amd(&b_inner);
}
@@ -883,8 +879,7 @@ lower_any_hit_for_intersection(nir_shader *any_hit)
impl->function->params = ralloc_array(any_hit, nir_parameter, ARRAY_SIZE(params));
memcpy(impl->function->params, params, sizeof(params));
nir_builder build;
nir_builder_init(&build, impl);
nir_builder build = nir_builder_create(impl);
nir_builder *b = &build;
b->cursor = nir_before_cf_list(&impl->body);
@@ -1003,8 +998,7 @@ nir_lower_intersection_shader(nir_shader *intersection, nir_shader *any_hit)
nir_function_impl *impl = nir_shader_get_entrypoint(intersection);
nir_builder build;
nir_builder_init(&build, impl);
nir_builder build = nir_builder_create(impl);
nir_builder *b = &build;
b->cursor = nir_before_cf_list(&impl->body);

View File

@@ -31,8 +31,7 @@ lower_zs_emit(nir_function_impl *impl, nir_block *block)
sem.location != FRAG_RESULT_STENCIL)
continue;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_instr(instr);
nir_ssa_def *value = intr->src[0].ssa;

View File

@@ -155,8 +155,7 @@ agx_nir_lower_sample_mask(nir_shader *shader, unsigned nr_samples)
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_block *block = nir_impl_last_block(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_block(block);
nir_foreach_instr(instr, block) {

View File

@@ -20,8 +20,7 @@ agx_nir_lower_alpha_to_coverage(nir_shader *shader, uint8_t nr_samples)
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_block *block = nir_impl_last_block(impl);
nir_builder _b;
nir_builder_init(&_b, impl);
nir_builder _b = nir_builder_create(impl);
nir_builder *b = &_b;
/* The store is probably at the end of the block, so search in reverse. */
@@ -86,8 +85,7 @@ agx_nir_lower_alpha_to_one(nir_shader *shader)
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_block *block = nir_impl_last_block(impl);
nir_builder _b;
nir_builder_init(&_b, impl);
nir_builder _b = nir_builder_create(impl);
nir_builder *b = &_b;
nir_foreach_instr(instr, block) {

View File

@@ -67,8 +67,7 @@ agx_nir_wrap_per_sample_loop(nir_shader *shader, uint8_t nr_samples)
nir_after_block(nir_impl_last_block(impl)));
/* Create a builder for the wrapped function */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_block(nir_start_block(impl));
nir_variable *i =

View File

@@ -717,8 +717,7 @@ v3d_nir_lower_io(nir_shader *s, struct v3d_compile *c)
nir_foreach_function(function, s) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
if (c->s->info.stage == MESA_SHADER_GEOMETRY)
emit_gs_prolog(c, &b, function->impl, &state);

View File

@@ -60,9 +60,7 @@ lower_line_smooth_func(struct lower_line_smooth_state *state,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -90,9 +88,7 @@ static void
initialise_coverage_var(struct lower_line_smooth_state *state,
nir_function_impl *impl)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));

View File

@@ -388,8 +388,7 @@ v3d_nir_lower_logic_ops_block(nir_block *block, struct v3d_compile *c)
nir_function_impl *impl =
nir_cf_node_get_function(&block->cf_node);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_instr(&intr->instr);
v3d_nir_lower_logic_op_instr(c, &b, intr, rt);

View File

@@ -1508,8 +1508,7 @@ v3d_nir_lower_subgroup_intrinsics(nir_shader *s, struct v3d_compile *c)
bool progress = false;
nir_foreach_function(function, s) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl)
progress |= lower_subgroup_intrinsics(c, block, &b);

View File

@@ -73,8 +73,7 @@ nir_lower_libclc_impl(nir_function_impl *impl,
const nir_shader *clc_shader,
struct hash_table *copy_vars)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block_safe(block, impl) {

View File

@@ -164,8 +164,7 @@ lower_buffer_interface_derefs_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* this must be a separate loop before the main pass in order to ensure that
* access info is fully propagated prior to the info being lost during rewrites

View File

@@ -155,8 +155,7 @@ gl_nir_lower_xfb_varying(nir_shader *shader, const char *old_var_name,
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
nir_deref_instr *deref = NULL;

View File

@@ -403,8 +403,7 @@ replace_varyings(const struct gl_constants *consts,
}
nir_function_impl *impl = nir_shader_get_entrypoint(shader->Program->nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* assert that functions have been inlined before packing is called */
nir_foreach_function(f, shader->Program->nir) {

View File

@@ -2331,8 +2331,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl,
nir_lower_instr_cb lower,
void *cb_data)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_metadata preserved = nir_metadata_block_index |
nir_metadata_dominance;

View File

@@ -88,8 +88,7 @@ nir_shader_instructions_pass(nir_shader *shader,
continue;
bool func_progress = false;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block_safe(block, function->impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -1432,8 +1432,7 @@ nir_opt_deref_impl(nir_function_impl *impl)
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -986,8 +986,7 @@ place_phi_read(nir_builder *b, nir_register *reg,
bool
nir_lower_phis_to_regs_block(nir_block *block)
{
nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&block->cf_node));
nir_builder b = nir_builder_create(nir_cf_node_get_function(&block->cf_node));
struct set *visited_blocks = _mesa_set_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);

View File

@@ -177,8 +177,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined)
if (_mesa_set_search(inlined, impl))
return false; /* Already inlined */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block_safe(block, impl) {

View File

@@ -394,8 +394,7 @@ nir_inline_uniforms(nir_shader *shader, unsigned num_uniforms,
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)

View File

@@ -1049,8 +1049,7 @@ replace_varying_input_by_constant_load(nir_shader *shader,
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_variable *out_var =
nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0]));
@@ -1101,8 +1100,7 @@ replace_duplicate_input(nir_shader *shader, nir_variable *input_var,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_variable *dup_out_var =
nir_deref_instr_get_variable(nir_src_as_deref(dup_store_intr->src[0]));
@@ -1237,8 +1235,7 @@ replace_varying_input_by_uniform_load(nir_shader *shader,
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_variable *out_var =
nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0]));

View File

@@ -45,8 +45,7 @@ nir_lower_alpha_test(nir_shader *shader, enum compare_func func,
nir_foreach_function(function, shader) {
nir_function_impl *impl = function->impl;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
nir_foreach_block(block, impl) {

View File

@@ -65,8 +65,7 @@ nir_lower_array_deref_of_vec_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -188,8 +188,7 @@ nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned offset_align_state)
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_intrinsic)

View File

@@ -242,8 +242,7 @@ lower_impl(nir_function_impl *impl,
nir_lower_bit_size_callback callback,
void *callback_data)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block(block, impl) {

View File

@@ -103,9 +103,7 @@ static void
lower_bitmap_impl(nir_function_impl *impl,
const nir_lower_bitmap_options *options)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
lower_bitmap(impl->function->shader, &b, options);

View File

@@ -156,8 +156,7 @@ nir_lower_cl_images(nir_shader *shader, bool lower_image_derefs, bool lower_samp
if (num_samplers)
BITSET_SET_RANGE(shader->info.samplers_used, 0, num_samplers - 1);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* don't need any lowering if we can keep the derefs */
if (!lower_image_derefs && !lower_sampler_derefs) {

View File

@@ -430,9 +430,7 @@ lower_clip_fs(nir_function_impl *impl, unsigned ucp_enables,
nir_variable **in, bool use_clipdist_array)
{
nir_ssa_def *clipdist[MAX_CLIP_PLANES];
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
if (!use_clipdist_array) {

View File

@@ -359,8 +359,7 @@ nir_lower_const_arrays_to_uniforms(nir_shader *shader,
}
/* Finally rewrite its uses */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -136,8 +136,7 @@ visit_cf_list(nir_builder *b, struct exec_list *list, bool *repair_ssa)
static bool
lower_continue_constructs_impl(nir_function_impl *impl)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool repair_ssa = false;
bool progress = visit_cf_list(&b, &impl->body, &repair_ssa);

View File

@@ -72,8 +72,7 @@ opt_simplify_convert_alu_types_impl(nir_function_impl *impl)
bool progress = false;
bool lowered_instr = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -124,8 +123,7 @@ lower_convert_alu_types_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -599,8 +599,7 @@ lower_flrp_impl(nir_function_impl *impl,
unsigned lowering_mask,
bool always_precise)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -944,8 +944,7 @@ nir_lower_goto_ifs_impl(nir_function_impl *impl)
/* From this point on, it's structured */
impl->structured = true;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
void *mem_ctx = ralloc_context(b.shader);

View File

@@ -394,8 +394,7 @@ nir_lower_gs_intrinsics(nir_shader *shader, nir_lower_gs_intrinsics_flags option
if (!a_block_needs_set_vertex_and_primitive_count(impl->end_block, per_stream))
return false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
state.builder = &b;
b.cursor = nir_before_cf_list(&impl->body);

View File

@@ -191,8 +191,7 @@ static bool
lower_indirects_impl(nir_function_impl *impl, nir_variable_mode modes,
const struct set *vars, uint32_t max_lower_array_len)
{
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
bool progress = false;
nir_foreach_block_safe(block, impl) {

View File

@@ -206,8 +206,7 @@ nir_lower_int_to_float_impl(nir_function_impl *impl)
bool progress = false;
BITSET_WORD *float_types = NULL, *int_types = NULL;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_index_ssa_defs(impl);
float_types = calloc(BITSET_WORDS(impl->ssa_alloc),

View File

@@ -2194,8 +2194,7 @@ nir_lower_explicit_io_impl(nir_function_impl *impl, nir_variable_mode modes,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* Walk in reverse order so that we can see the full deref chain when we
* lower the access operations. We lower them assuming that the derefs
@@ -2877,8 +2876,7 @@ nir_io_add_const_offset_to_base(nir_shader *nir, nir_variable_mode modes)
nir_foreach_function(f, nir) {
if (f->impl) {
bool impl_progress = false;
nir_builder b;
nir_builder_init(&b, f->impl);
nir_builder b = nir_builder_create(f->impl);
nir_foreach_block(block, f->impl) {
impl_progress |= add_const_offset_to_base_block(block, &b, modes);
}
@@ -2899,8 +2897,7 @@ nir_lower_color_inputs(nir_shader *nir)
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr_safe (instr, block) {

View File

@@ -230,8 +230,7 @@ create_indirects_mask(nir_shader *shader,
{
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -277,8 +276,7 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
{
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -78,8 +78,7 @@ emit_copies(nir_builder *b, struct exec_list *dest_vars,
static void
emit_output_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
if (state->shader->info.stage == MESA_SHADER_GEOMETRY) {
/* For geometry shaders, we have to emit the output copies right
@@ -277,8 +276,7 @@ static void
emit_input_copies_impl(struct lower_io_state *state, nir_function_impl *impl)
{
if (impl == state->entrypoint) {
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
emit_copies(&b, &state->old_inputs, &state->new_inputs);
if (state->shader->info.stage == MESA_SHADER_FRAGMENT)

View File

@@ -411,8 +411,7 @@ nir_lower_io_to_vector_impl(nir_function_impl *impl, nir_variable_mode modes)
{
assert(!(modes & ~(nir_var_shader_in | nir_var_shader_out)));
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_metadata_require(impl, nir_metadata_dominance);
@@ -627,8 +626,7 @@ static bool
nir_vectorize_tess_levels_impl(nir_function_impl *impl)
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -106,8 +106,7 @@ nir_lower_is_helper_invocation(nir_shader *shader)
nir_function_impl *entrypoint = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, entrypoint);
nir_builder b = nir_builder_create(entrypoint);
b.cursor = nir_before_cf_list(&entrypoint->body);
nir_variable *is_helper = nir_local_variable_create(entrypoint,

View File

@@ -41,8 +41,7 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower)
if (lower->def.num_components == 1)
return false;
nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&lower->instr.block->cf_node));
nir_builder b = nir_builder_create(nir_cf_node_get_function(&lower->instr.block->cf_node));
b.cursor = nir_before_instr(&lower->instr);
/* Emit the individual loads. */

View File

@@ -154,8 +154,7 @@ nir_lower_mediump_io(nir_shader *nir, nir_variable_mode modes,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe (block, impl) {
nir_foreach_instr_safe (instr, block) {
@@ -287,8 +286,7 @@ nir_force_mediump_io(nir_shader *nir, nir_variable_mode modes,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe (block, impl) {
nir_foreach_instr_safe (instr, block) {
@@ -422,8 +420,7 @@ nir_lower_mediump_vars_impl(nir_function_impl *impl, nir_variable_mode modes,
if (!any_lowered)
return false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -661,8 +658,7 @@ nir_legalize_16bit_sampler_srcs(nir_shader *nir,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe (block, impl) {
nir_foreach_instr_safe (instr, block) {

View File

@@ -88,8 +88,7 @@ memcpy_store_deref_elem_imm(nir_builder *b, nir_deref_instr *parent,
static bool
lower_memcpy_impl(nir_function_impl *impl)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool found_const_memcpy = false, found_non_const_memcpy = false;

View File

@@ -203,8 +203,7 @@ nir_lower_multiview(nir_shader *shader, uint32_t view_mask)
nir_cf_list body;
nir_cf_list_extract(&body, &entrypoint->body);
nir_builder b;
nir_builder_init(&b, entrypoint);
nir_builder b = nir_builder_create(entrypoint);
b.cursor = nir_after_cf_list(&entrypoint->body);
/* Loop Index will go from 0 to view_count. */

View File

@@ -204,8 +204,7 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -65,8 +65,7 @@ nir_lower_patch_vertices(nir_shader *nir,
nir_foreach_function(function, nir) {
if (function->impl) {
nir_foreach_block(block, function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_intrinsic) {
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);

View File

@@ -183,8 +183,7 @@ nir_lower_vars_to_scratch(nir_shader *shader,
if (!function->impl)
continue;
nir_builder build;
nir_builder_init(&build, function->impl);
nir_builder build = nir_builder_create(function->impl);
bool impl_progress = false;
nir_foreach_block(block, function->impl) {

View File

@@ -855,8 +855,7 @@ duplicate_loop_bodies(nir_function_impl *impl, nir_instr *resume_instr)
resume_reg->num_components = 1;
resume_reg->bit_size = 1;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* Initialize resume to true */
b.cursor = nir_before_cf_list(&impl->body);
@@ -1103,8 +1102,7 @@ flatten_resume_if_ladder(nir_builder *b,
/* We want to place anything re-materialized from inside the loop
* at the top of the resume half of the loop.
*/
nir_builder bl;
nir_builder_init(&bl, b->impl);
nir_builder bl = nir_builder_create(b->impl);
bl.cursor = nir_before_cf_list(&_if->then_list);
ASSERTED bool found =
@@ -1275,8 +1273,7 @@ lower_resume(nir_shader *shader, int call_idx)
/* Create a nop instruction to use as a cursor as we extract and re-insert
* stuff into the CFG.
*/
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
ASSERTED bool found =
flatten_resume_if_ladder(&b, &impl->cf_node, &impl->body,
@@ -1298,8 +1295,7 @@ replace_resume_with_halt(nir_shader *shader, nir_instr *keep)
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -1521,8 +1517,7 @@ nir_opt_trim_stack_values(nir_shader *shader)
continue;
}
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_instr(instr);
nir_ssa_def *value = nir_channels(&b, intrin->src[0].ssa, read_mask);
@@ -1975,8 +1970,7 @@ nir_lower_shader_calls(nir_shader *shader,
{
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
int num_calls = 0;
nir_foreach_block(block, impl) {

View File

@@ -158,8 +158,7 @@ nir_lower_ssbo(nir_shader *shader)
nir_foreach_function(function, shader) {
nir_function_impl *impl = function->impl;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -140,8 +140,7 @@ nir_lower_nv_task_count(nir_shader *shader)
nir_metadata_none, &state);
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
append_launch_mesh_workgroups_to_nv_task(&builder, &state);
nir_metadata_preserve(impl, nir_metadata_none);
@@ -434,8 +433,7 @@ nir_lower_task_shader(nir_shader *shader,
return false;
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
if (shader->info.outputs_written & BITFIELD64_BIT(VARYING_SLOT_TASK_COUNT)) {
/* NV_mesh_shader:

View File

@@ -1620,8 +1620,7 @@ nir_lower_tex_impl(nir_function_impl *impl,
const struct nir_shader_compiler_options *compiler_options)
{
bool progress = false;
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
nir_foreach_block(block, impl) {
progress |= nir_lower_tex_block(block, &builder, options, compiler_options);

View File

@@ -63,9 +63,7 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl,
bool point_coord_is_sysval,
bool yinvert)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
nir_ssa_def *new_coord;

View File

@@ -108,8 +108,7 @@ nir_lower_variable_initializers(nir_shader *shader, nir_variable_mode modes)
bool impl_progress = false;
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
if ((modes & ~nir_var_function_temp) && function->is_entrypoint) {
impl_progress |= lower_const_initializer(&builder,
@@ -150,8 +149,7 @@ nir_zero_initialize_shared_memory(nir_shader *shader,
assert(chunk_size > 0);
assert(chunk_size % 4 == 0);
nir_builder b;
nir_builder_init(&b, nir_shader_get_entrypoint(shader));
nir_builder b = nir_builder_create(nir_shader_get_entrypoint(shader));
b.cursor = nir_before_cf_list(&b.impl->body);
assert(!shader->info.workgroup_size_variable);

View File

@@ -535,8 +535,7 @@ lower_copies_to_load_store(struct deref_node *node,
if (!node->copies)
return;
nir_builder b;
nir_builder_init(&b, state->impl);
nir_builder b = nir_builder_create(state->impl);
set_foreach(node->copies, copy_entry) {
nir_intrinsic_instr *copy = (void *)copy_entry->key;
@@ -572,8 +571,7 @@ lower_copies_to_load_store(struct deref_node *node,
static bool
rename_variables(struct lower_variables_state *state)
{
nir_builder b;
nir_builder_init(&b, state->impl);
nir_builder b = nir_builder_create(state->impl);
nir_foreach_block(block, state->impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -1368,8 +1368,7 @@ copy_prop_vars_cf_node(struct copy_prop_var_state *state,
case nir_cf_node_block: {
nir_block *block = nir_cf_node_as_block(cf_node);
nir_builder b;
nir_builder_init(&b, state->impl);
nir_builder b = nir_builder_create(state->impl);
copy_prop_vars_block(state, &b, block, copies);
break;
}

View File

@@ -62,8 +62,7 @@ rewrite_to_vec(nir_function_impl *impl, nir_alu_instr *mov, nir_alu_instr *vec)
if (mov->op != nir_op_mov)
return false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_instr(&mov->instr);
unsigned num_comp = mov->dest.dest.ssa.num_components;

View File

@@ -632,8 +632,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
static bool
opt_find_array_copies_impl(nir_function_impl *impl)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;

View File

@@ -1680,8 +1680,7 @@ nir_opt_if(nir_shader *shader, nir_opt_if_options options)
if (function->impl == NULL)
continue;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_metadata_require(function->impl, nir_metadata_block_index |
nir_metadata_dominance);

View File

@@ -169,8 +169,7 @@ static bool
opt_intrinsics_impl(nir_function_impl *impl,
const struct nir_shader_compiler_options *options)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block(block, impl) {

View File

@@ -338,8 +338,7 @@ nir_opt_large_constants(nir_shader *shader,
}
}
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -1127,8 +1127,7 @@ try_vectorize(nir_function_impl *impl, struct vectorize_ctx *ctx,
unsigned new_num_components = new_size / new_bit_size;
/* vectorize the loads/stores */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
if (first->is_store)
vectorize_stores(&b, ctx, low, high, first, second,
@@ -1179,8 +1178,7 @@ try_vectorize_shared2(nir_function_impl *impl, struct vectorize_ctx *ctx,
}
/* vectorize the accesses */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_instr(first->is_store ? second->instr : first->instr);

View File

@@ -662,8 +662,7 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop,
nir_cf_reinsert(lp_header, nir_after_block(nir_loop_last_block(loop)));
nir_cf_reinsert(lp_body, nir_after_block(nir_loop_last_block(loop)));
nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&loop->cf_node));
nir_builder b = nir_builder_create(nir_cf_node_get_function(&loop->cf_node));
nir_foreach_block_in_cf_node(block, &loop->cf_node) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -233,8 +233,7 @@ opt_memcpy_impl(nir_function_impl *impl)
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
struct set *complex_vars = _mesa_pointer_set_create(NULL);

View File

@@ -348,8 +348,7 @@ nir_opt_collapse_if(nir_if *if_stmt, nir_shader *shader, unsigned limit,
}
/* combine the conditions */
struct nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&if_stmt->cf_node)->function->impl);
struct nir_builder b = nir_builder_create(nir_cf_node_get_function(&if_stmt->cf_node)->function->impl);
b.cursor = nir_before_cf_node(&if_stmt->cf_node);
nir_ssa_def *cond = nir_iand(&b, if_stmt->condition.ssa,
parent_if->condition.ssa);

View File

@@ -462,8 +462,7 @@ nir_opt_phi_precision(nir_shader *shader)
if (!function->impl)
continue;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block (block, function->impl) {
nir_foreach_phi_safe (phi, block)

View File

@@ -139,8 +139,7 @@ remove_phis_block(nir_block *block, nir_builder *b)
bool
nir_opt_remove_phis_block(nir_block *block)
{
nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&block->cf_node));
nir_builder b = nir_builder_create(nir_cf_node_get_function(&block->cf_node));
return remove_phis_block(block, &b);
}
@@ -148,8 +147,7 @@ static bool
nir_opt_remove_phis_impl(nir_function_impl *impl)
{
bool progress = false;
nir_builder bld;
nir_builder_init(&bld, impl);
nir_builder bld = nir_builder_create(impl);
nir_metadata_require(impl, nir_metadata_dominance);

View File

@@ -104,8 +104,7 @@ nir_opt_shrink_stores(nir_shader *shader, bool shrink_image_store)
if (!function->impl)
continue;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr(instr, block) {

View File

@@ -483,8 +483,7 @@ nir_opt_shrink_vectors(nir_shader *shader)
if (!function->impl)
continue;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block_reverse(block, function->impl) {
nir_foreach_instr_reverse(instr, block) {

View File

@@ -298,8 +298,7 @@ static bool
opt_uniform_atomics(nir_function_impl *impl)
{
bool progress = false;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.update_divergence = true;
nir_foreach_block(block, impl) {

View File

@@ -201,8 +201,7 @@ instr_try_combine(struct set *instr_set, nir_instr *instr1, nir_instr *instr2)
if (total_components > instr1->pass_flags)
return NULL;
nir_builder b;
nir_builder_init(&b, nir_cf_node_get_function(&instr1->block->cf_node));
nir_builder b = nir_builder_create(nir_cf_node_get_function(&instr1->block->cf_node));
b.cursor = nir_after_instr(instr1);
nir_alu_instr *new_alu = nir_alu_instr_create(b.shader, alu1->op);

View File

@@ -879,8 +879,7 @@ nir_algebraic_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder build;
nir_builder_init(&build, impl);
nir_builder build = nir_builder_create(impl);
/* Note: it's important here that we're allocating a zeroed array, since
* state 0 is the default state, which means we don't have to visit

View File

@@ -236,8 +236,7 @@ split_struct_derefs_impl(nir_function_impl *impl,
nir_variable_mode modes,
void *mem_ctx)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -744,8 +743,7 @@ split_array_copies_impl(nir_function_impl *impl,
nir_variable_mode modes,
void *mem_ctx)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -789,8 +787,7 @@ split_array_access_impl(nir_function_impl *impl,
nir_variable_mode modes,
void *mem_ctx)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -1500,8 +1497,7 @@ shrink_vec_var_access_impl(nir_function_impl *impl,
struct hash_table *var_usage_map,
nir_variable_mode modes)
{
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -483,8 +483,7 @@ ir3_nir_lower_ubo_loads(nir_shader *nir, struct ir3_shader_variant *v)
nir_metadata_preserve(function->impl, nir_metadata_all);
continue;
}
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
nir_foreach_block (block, function->impl) {
nir_foreach_instr_safe (instr, block) {
if (!instr_is_load_ubo(instr))

View File

@@ -300,8 +300,7 @@ static bool
lower_io_offsets_func(nir_function_impl *impl)
{
void *mem_ctx = ralloc_parent(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
bool progress = false;
nir_foreach_block_safe (block, impl) {

View File

@@ -302,8 +302,7 @@ ir3_nir_lower_to_explicit_output(nir_shader *shader,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
if (v->type == MESA_SHADER_VERTEX && topology != IR3_TESS_NONE)
@@ -378,8 +377,7 @@ ir3_nir_lower_to_explicit_input(nir_shader *shader,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
if (shader->info.stage == MESA_SHADER_GEOMETRY)
@@ -683,8 +681,7 @@ ir3_nir_lower_tess_ctrl(nir_shader *shader, struct ir3_shader_variant *v,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
state.header = nir_load_tcs_header_ir3(&b);
@@ -837,8 +834,7 @@ ir3_nir_lower_tess_eval(nir_shader *shader, struct ir3_shader_variant *v,
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block_safe (block, impl)
lower_tess_eval_block(block, &b, &state);
@@ -947,8 +943,7 @@ ir3_nir_lower_gs(nir_shader *shader)
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
assert(impl);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_cf_list(&impl->body);
state.header = nir_load_gs_header_ir3(&b);

View File

@@ -27,8 +27,7 @@ lower_multiview_mask(nir_shader *nir, uint32_t *mask)
return false;
}
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
uint32_t old_mask = *mask;
*mask = BIT(util_logbase2(old_mask) + 1) - 1;

View File

@@ -2573,8 +2573,7 @@ lower_clipdistance_to_array(nir_shader *nir)
bool func_progress = false;
if (!function->impl)
continue;
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
b.cursor = nir_before_block(nir_start_block(function->impl));
/* create a new deref for the arrayed clipdistance variable at the start of the function */
nir_deref_instr *clipdist_deref = nir_build_deref_var(&b, dist0);

View File

@@ -344,8 +344,7 @@ insert_overflow_check(nir_shader *nir, struct agx_xfb_key *key)
nir_after_block(nir_impl_last_block(impl)));
/* Get a builder for the (now empty) shader */
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_block(nir_start_block(impl));
/* Rebuild the shader as

View File

@@ -279,8 +279,7 @@ crocus_lower_storage_image_derefs(nir_shader *nir)
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -451,8 +450,7 @@ crocus_setup_uniforms(ASSERTED const struct intel_device_info *devinfo,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
nir_ssa_def *temp_ubo_name = nir_ssa_undef(&b, 1, 32);
@@ -969,8 +967,7 @@ crocus_setup_binding_table(const struct intel_device_info *devinfo,
* to change those, as we haven't set any of the *_start entries in brw
* binding_table.
*/
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr (instr, block) {
@@ -1148,8 +1145,7 @@ crocus_lower_default_edgeflags(struct nir_shader *nir)
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_after_cf_list(&b.impl->body);
nir_variable *var = nir_variable_create(nir, nir_var_shader_out,

View File

@@ -287,8 +287,7 @@ d3d12_lower_point_sprite(nir_shader *shader,
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_intrinsic)

View File

@@ -94,8 +94,7 @@ d3d12_lower_yflip(nir_shader *nir)
nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -152,8 +151,7 @@ d3d12_lower_depth_range(nir_shader *nir)
nir_variable *depth_transform = NULL;
nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -249,8 +247,7 @@ d3d12_lower_uint_cast(nir_shader *nir, bool is_signed)
nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -419,8 +416,7 @@ d3d12_nir_invert_depth(nir_shader *shader, unsigned viewport_mask, bool clip_hal
struct invert_depth_state state = { viewport_mask, clip_halfz };
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -541,8 +537,7 @@ d3d12_lower_state_vars(nir_shader *nir, struct d3d12_shader *shader)
nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder builder;
nir_builder_init(&builder, function->impl);
nir_builder builder = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
if (instr->type == nir_instr_type_intrinsic)
@@ -1017,8 +1012,7 @@ d3d12_write_0_to_new_varying(nir_shader *s, nir_variable *var)
if (!func->impl)
continue;
nir_builder b;
nir_builder_init(&b, func->impl);
nir_builder b = nir_builder_create(func->impl);
nir_foreach_block(block, func->impl) {
b.cursor = nir_before_block(block);

View File

@@ -748,8 +748,7 @@ lower_alu(struct etna_compile *c, nir_alu_instr *alu)
{
const nir_op_info *info = &nir_op_infos[alu->op];
nir_builder b;
nir_builder_init(&b, c->impl);
nir_builder b = nir_builder_create(c->impl);
b.cursor = nir_before_instr(&alu->instr);
switch (alu->op) {
@@ -898,8 +897,7 @@ emit_shader(struct etna_compile *c, unsigned *num_temps, unsigned *num_consts)
bool have_indirect_uniform = false;
unsigned indirect_max = 0;
nir_builder b;
nir_builder_init(&b, c->impl);
nir_builder b = nir_builder_create(c->impl);
/* convert non-dynamic uniform loads to constants, etc */
nir_foreach_block(block, c->impl) {

View File

@@ -33,8 +33,7 @@ void
etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
{
nir_foreach_function(function, shader) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {
@@ -151,8 +150,7 @@ etna_lower_alu_impl(nir_function_impl *impl, bool has_new_transcendentals)
{
nir_shader *shader = impl->function->shader;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* in a seperate loop so we can apply the multiple-uniform logic to the new fmul */
nir_foreach_block(block, impl) {

View File

@@ -262,8 +262,7 @@ iris_lower_storage_image_derefs(nir_shader *nir)
{
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
@@ -469,8 +468,7 @@ iris_setup_uniforms(ASSERTED const struct intel_device_info *devinfo,
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
b.cursor = nir_before_block(nir_start_block(impl));
nir_ssa_def *temp_ubo_name = nir_ssa_undef(&b, 1, 32);
@@ -1036,8 +1034,7 @@ iris_setup_binding_table(const struct intel_device_info *devinfo,
* to change those, as we haven't set any of the *_start entries in brw
* binding_table.
*/
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
nir_foreach_block (block, impl) {
nir_foreach_instr (instr, block) {

View File

@@ -87,8 +87,7 @@ lima_nir_duplicate_load_const(nir_builder *b, nir_load_const_instr *load)
static void
lima_nir_duplicate_load_consts_impl(nir_shader *shader, nir_function_impl *impl)
{
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {

View File

@@ -103,8 +103,7 @@ static void
lima_nir_duplicate_intrinsic_impl(nir_shader *shader, nir_function_impl *impl,
nir_intrinsic_op op)
{
nir_builder builder;
nir_builder_init(&builder, impl);
nir_builder builder = nir_builder_create(impl);
nir_foreach_block(block, impl) {
nir_foreach_instr(instr, block) {

View File

@@ -61,8 +61,7 @@ lima_nir_lower_uniform_to_scalar(nir_shader *shader)
{
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block(block, function->impl) {
nir_foreach_instr_safe(instr, block) {

View File

@@ -128,8 +128,7 @@ lima_nir_split_loads(nir_shader *shader)
nir_foreach_function(function, shader) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
nir_builder b = nir_builder_create(function->impl);
nir_foreach_block_reverse(block, function->impl) {
nir_foreach_instr_reverse_safe(instr, block) {

Some files were not shown because too many files have changed in this diff Show More