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

@@ -169,8 +169,7 @@ lower_kernel_intrinsics(nir_shader *nir)
unsigned kernel_arg_start = sizeof(struct brw_kernel_sysvals);
nir->num_uniforms += kernel_arg_start;
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

@@ -277,8 +277,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
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_safe(instr, block) {
@@ -441,8 +440,7 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map)
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) {
remap_patch_urb_offsets(block, &b, vue_map,
nir->info.tess._primitive_mode);
@@ -597,8 +595,7 @@ brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue_map,
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) {
remap_patch_urb_offsets(block, &b, vue_map, tes_primitive_mode);
}

View File

@@ -167,8 +167,7 @@ brw_nir_lower_alpha_to_coverage(nir_shader *shader,
&sample_mask_write->instr);
}
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
/* Combine dither_mask and the gl_SampleMask value */
b.cursor = nir_before_instr(&sample_mask_write->instr);

View File

@@ -55,8 +55,7 @@ lower_any_hit_for_intersection(nir_shader *any_hit)
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);
@@ -157,8 +156,7 @@ brw_nir_lower_intersection_shader(nir_shader *intersection,
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

@@ -50,8 +50,7 @@ lower_rt_intrinsics_impl(nir_function_impl *impl,
{
bool progress = false;
nir_builder build;
nir_builder_init(&build, impl);
nir_builder build = nir_builder_create(impl);
nir_builder *b = &build;
b->cursor = nir_before_block(nir_start_block(b->impl));

View File

@@ -72,8 +72,7 @@ brw_nir_lower_shader_returns(nir_shader *shader)
if (shader->info.stage != MESA_SHADER_RAYGEN)
shader->scratch_size += BRW_BTD_STACK_CALLEE_DATA_SIZE;
nir_builder b;
nir_builder_init(&b, impl);
nir_builder b = nir_builder_create(impl);
set_foreach(impl->end_block->predecessors, block_entry) {
struct nir_block *block = (void *)block_entry->key;

View File

@@ -78,8 +78,7 @@ lower_rt_io_derefs(nir_shader *shader)
*/
assert(num_shader_call_vars <= 1);
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 *call_data_addr = NULL;
@@ -272,8 +271,7 @@ lower_ray_walk_intrinsics(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);
bool progress = false;
nir_foreach_block_safe(block, impl) {

View File

@@ -111,8 +111,7 @@ brw_nir_apply_tcs_quads_workaround(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);
/* emit_quads_workaround() inserts an if statement into each block,
* which splits it in two. This changes the set of predecessors of