From b64da56b1a8d6149ff30ba00824cc13807f326bc Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 15 Aug 2023 12:05:54 -0500 Subject: [PATCH] nir: s/nir_instr_ssa_def/nir_instr_def/ Generated by sed: sed -i -e 's/nir_instr_ssa_def/nir_instr_def/g' src/**/*.h src/**/*.c src/**/*.cpp Suggested-by: Alyssa Rosenzweig Part-of: --- src/amd/common/ac_nir_opt_outputs.c | 2 +- src/amd/vulkan/radv_rt_shader.c | 2 +- src/asahi/compiler/agx_nir_opt_preamble.c | 2 +- src/compiler/nir/nir.c | 4 ++-- src/compiler/nir/nir.h | 2 +- src/compiler/nir/nir_group_loads.c | 2 +- src/compiler/nir/nir_lower_image.c | 2 +- src/compiler/nir/nir_lower_shader_calls.c | 22 +++++++++++----------- src/compiler/nir/nir_opt_move.c | 2 +- src/compiler/nir/nir_opt_preamble.c | 14 +++++++------- src/compiler/nir/nir_opt_sink.c | 2 +- src/compiler/nir/nir_search.c | 2 +- src/gallium/drivers/d3d12/d3d12_nir_passes.c | 2 +- src/microsoft/clc/clc_compiler.c | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/amd/common/ac_nir_opt_outputs.c b/src/amd/common/ac_nir_opt_outputs.c index b622a1b..b7aea68 100644 --- a/src/amd/common/ac_nir_opt_outputs.c +++ b/src/amd/common/ac_nir_opt_outputs.c @@ -196,7 +196,7 @@ static bool ac_eliminate_duplicated_output(struct ac_out_info *outputs, sem.no_sysval_output = 1; /* Write just one component. */ - prev_chan->store_intr = nir_store_output(b, nir_instr_ssa_def(cur_chan->value), + prev_chan->store_intr = nir_store_output(b, nir_instr_def(cur_chan->value), nir_imm_int(b, 0), .base = prev->base, .component = i % 4, diff --git a/src/amd/vulkan/radv_rt_shader.c b/src/amd/vulkan/radv_rt_shader.c index 62345b5..0ee0b5a 100644 --- a/src/amd/vulkan/radv_rt_shader.c +++ b/src/amd/vulkan/radv_rt_shader.c @@ -716,7 +716,7 @@ lower_hit_attribs(nir_shader *shader, nir_variable **hit_attribs, uint32_t workg ret = nir_load_var(&b, hit_attribs[nir_intrinsic_base(intrin)]); else ret = nir_load_shared(&b, 1, 32, offset, .base = 0, .align_mul = 4); - nir_def_rewrite_uses(nir_instr_ssa_def(instr), ret); + nir_def_rewrite_uses(nir_instr_def(instr), ret); } else { if (hit_attribs) nir_store_var(&b, hit_attribs[nir_intrinsic_base(intrin)], intrin->src->ssa, 0x1); diff --git a/src/asahi/compiler/agx_nir_opt_preamble.c b/src/asahi/compiler/agx_nir_opt_preamble.c index 5d6f633..cf765ed 100644 --- a/src/asahi/compiler/agx_nir_opt_preamble.c +++ b/src/asahi/compiler/agx_nir_opt_preamble.c @@ -76,7 +76,7 @@ rewrite_cost(nir_def *def, const void *data) static bool avoid_instr(const nir_instr *instr, const void *data) { - const nir_def *def = nir_instr_ssa_def((nir_instr *)instr); + const nir_def *def = nir_instr_def((nir_instr *)instr); /* Do not move bindless handles, since we need those to retain their constant * base index. diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 8d1a409..6854e7f 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -1286,7 +1286,7 @@ nir_instr_free_and_dce(nir_instr *instr) /*@}*/ nir_def * -nir_instr_ssa_def(nir_instr *instr) +nir_instr_def(nir_instr *instr) { switch (instr->type) { case nir_instr_type_alu: @@ -2038,7 +2038,7 @@ nir_function_impl_lower_instructions(nir_function_impl *impl, continue; } - nir_def *old_def = nir_instr_ssa_def(instr); + nir_def *old_def = nir_instr_def(instr); struct list_head old_uses; if (old_def != NULL) { /* We're about to ask the callback to generate a replacement for instr. diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 9814a83..264e4cc 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4349,7 +4349,7 @@ nir_cursor nir_instr_free_and_dce(nir_instr *instr); /** @} */ -nir_def *nir_instr_ssa_def(nir_instr *instr); +nir_def *nir_instr_def(nir_instr *instr); typedef bool (*nir_foreach_def_cb)(nir_def *def, void *state); typedef bool (*nir_foreach_src_cb)(nir_src *src, void *state); diff --git a/src/compiler/nir/nir_group_loads.c b/src/compiler/nir/nir_group_loads.c index b6bac0c..aad2b4c 100644 --- a/src/compiler/nir/nir_group_loads.c +++ b/src/compiler/nir/nir_group_loads.c @@ -193,7 +193,7 @@ group_loads(nir_instr *first, nir_instr *last) if (!can_move(instr, first->pass_flags)) continue; - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (def) { bool all_uses_after_last = true; diff --git a/src/compiler/nir/nir_lower_image.c b/src/compiler/nir/nir_lower_image.c index 3a2aa26..1d68030 100644 --- a/src/compiler/nir/nir_lower_image.c +++ b/src/compiler/nir/nir_lower_image.c @@ -44,7 +44,7 @@ lower_cube_size(nir_builder *b, nir_intrinsic_instr *intrin) nir_intrinsic_set_image_array(_2darray_size, true); nir_builder_instr_insert(b, &_2darray_size->instr); - nir_def *size = nir_instr_ssa_def(&_2darray_size->instr); + nir_def *size = nir_instr_def(&_2darray_size->instr); nir_scalar comps[NIR_MAX_VEC_COMPONENTS] = { 0 }; unsigned coord_comps = intrin->def.num_components; for (unsigned c = 0; c < coord_comps; c++) { diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c index 21ea866..bb7d137 100644 --- a/src/compiler/nir/nir_lower_shader_calls.c +++ b/src/compiler/nir/nir_lower_shader_calls.c @@ -283,7 +283,7 @@ can_remat_chain_ssa_def(nir_def *def, struct sized_bitset *remat, struct util_dy memcpy(potential_remat.set, remat->set, BITSET_WORDS(remat->size) * sizeof(BITSET_WORD)); util_dynarray_foreach(buf, nir_instr *, instr_ptr) { - nir_def *instr_ssa_def = nir_instr_ssa_def(*instr_ptr); + nir_def *instr_ssa_def = nir_instr_def(*instr_ptr); /* If already in the potential rematerializable, nothing to do. */ if (BITSET_TEST(potential_remat.set, instr_ssa_def->index)) @@ -313,7 +313,7 @@ remat_ssa_def(nir_builder *b, nir_def *def, struct hash_table *remap_table) { nir_instr *clone = nir_instr_clone_deep(b->shader, def->parent_instr, remap_table); nir_builder_instr_insert(b, clone); - return nir_instr_ssa_def(clone); + return nir_instr_def(clone); } static nir_def * @@ -324,7 +324,7 @@ remat_chain_ssa_def(nir_builder *b, struct util_dynarray *buf, nir_def *last_def = NULL; util_dynarray_foreach(buf, nir_instr *, instr_ptr) { - nir_def *instr_ssa_def = nir_instr_ssa_def(*instr_ptr); + nir_def *instr_ssa_def = nir_instr_def(*instr_ptr); unsigned ssa_index = instr_ssa_def->index; if (fill_defs[ssa_index] != NULL && @@ -522,7 +522,7 @@ spill_ssa_defs_and_lower_shader_calls(nir_shader *shader, uint32_t num_calls, nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (def == NULL) continue; @@ -559,7 +559,7 @@ spill_ssa_defs_and_lower_shader_calls(nir_shader *shader, uint32_t num_calls, unsigned max_scratch_size = shader->scratch_size; nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (def != NULL) { if (can_remat_ssa_def(def, &trivial_remat)) { add_ssa_def_to_bitset(def, &trivial_remat); @@ -735,7 +735,7 @@ spill_ssa_defs_and_lower_shader_calls(nir_shader *shader, uint32_t num_calls, */ nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (def != NULL) { struct nir_phi_builder_value *pbv = get_phi_builder_value_for_def(def, &pbv_arr); @@ -1044,7 +1044,7 @@ flatten_resume_if_ladder(nir_builder *b, nir_instr_insert(b->cursor, instr); b->cursor = nir_after_instr(instr); - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); BITSET_SET(remat->set, def->index); } } @@ -1342,7 +1342,7 @@ lower_stack_instr_to_scratch(struct nir_builder *b, nir_instr *instr, void *data switch (stack->intrinsic) { case nir_intrinsic_load_stack: { b->cursor = nir_instr_remove(instr); - nir_def *data, *old_data = nir_instr_ssa_def(instr); + nir_def *data, *old_data = nir_instr_def(instr); if (state->address_format == nir_address_format_64bit_global) { nir_def *addr = nir_iadd_imm(b, @@ -1484,7 +1484,7 @@ nir_opt_trim_stack_values(nir_shader *shader) const unsigned value_id = nir_intrinsic_value_id(intrin); const unsigned mask = - nir_def_components_read(nir_instr_ssa_def(instr)); + nir_def_components_read(nir_instr_def(instr)); add_use_mask(value_id_to_mask, value_id, mask); } } @@ -1555,7 +1555,7 @@ nir_opt_trim_stack_values(nir_shader *shader) u_foreach_bit(idx, read_mask) swiz_map[idx] = swiz_count++; - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); nir_foreach_use_safe(use_src, def) { if (use_src->parent_instr->type == nir_instr_type_alu) { @@ -1652,7 +1652,7 @@ nir_opt_sort_and_pack_stack(nir_shader *shader, continue; const unsigned value_id = nir_intrinsic_value_id(intrin); - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); assert(_mesa_hash_table_u64_search(value_id_to_item, value_id) == NULL); diff --git a/src/compiler/nir/nir_opt_move.c b/src/compiler/nir/nir_opt_move.c index 7fbb986..8503943 100644 --- a/src/compiler/nir/nir_opt_move.c +++ b/src/compiler/nir/nir_opt_move.c @@ -75,7 +75,7 @@ nir_opt_move_block(nir_block *block, nir_move_options options) continue; /* Check all users in this block which is the first */ - const nir_def *def = nir_instr_ssa_def(instr); + const nir_def *def = nir_instr_def(instr); nir_instr *first_user = instr == if_cond_instr ? NULL : last_instr; nir_foreach_use(use, def) { nir_instr *parent = use->parent_instr; diff --git a/src/compiler/nir/nir_opt_preamble.c b/src/compiler/nir/nir_opt_preamble.c index 8bf3f27..79bc28e 100644 --- a/src/compiler/nir/nir_opt_preamble.c +++ b/src/compiler/nir/nir_opt_preamble.c @@ -355,7 +355,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, /* Step 1: Calculate can_move */ nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (!def) continue; @@ -381,7 +381,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, unsigned num_candidates = 0; nir_foreach_block_reverse(block, impl) { nir_foreach_instr_reverse(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (!def) continue; @@ -394,7 +394,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, state->candidate = false; state->must_stay = false; nir_foreach_use(use, def) { - nir_def *use_def = nir_instr_ssa_def(use->parent_instr); + nir_def *use_def = nir_instr_def(use->parent_instr); if (!use_def || !ctx.states[use_def->index].can_move || ctx.states[use_def->index].must_stay) { if (is_candidate) @@ -441,7 +441,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, */ nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (!def) continue; @@ -527,7 +527,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, nir_foreach_block(block, impl) { nir_foreach_instr(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (!def) continue; @@ -560,7 +560,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, } if (state->replace) { - nir_def *clone_def = nir_instr_ssa_def(clone); + nir_def *clone_def = nir_instr_def(clone); nir_store_preamble(b, clone_def, .base = state->offset); } } @@ -571,7 +571,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options, nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); if (!def) continue; diff --git a/src/compiler/nir/nir_opt_sink.c b/src/compiler/nir/nir_opt_sink.c index db9a3c2..5b6164e 100644 --- a/src/compiler/nir/nir_opt_sink.c +++ b/src/compiler/nir/nir_opt_sink.c @@ -211,7 +211,7 @@ nir_opt_sink(nir_shader *shader, nir_move_options options) if (!nir_can_move_instr(instr, options)) continue; - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); bool sink_out_of_loops = instr->type != nir_instr_type_intrinsic || diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c index bc4bcbd..49e6108 100644 --- a/src/compiler/nir/nir_search.c +++ b/src/compiler/nir/nir_search.c @@ -619,7 +619,7 @@ add_uses_to_worklist(nir_instr *instr, struct util_dynarray *states, const struct per_op_table *pass_op_table) { - nir_def *def = nir_instr_ssa_def(instr); + nir_def *def = nir_instr_def(instr); nir_foreach_use_safe(use_src, def) { if (nir_algebraic_automaton(use_src->parent_instr, states, pass_op_table)) diff --git a/src/gallium/drivers/d3d12/d3d12_nir_passes.c b/src/gallium/drivers/d3d12/d3d12_nir_passes.c index 27c32b6..4a88b5f 100644 --- a/src/gallium/drivers/d3d12/d3d12_nir_passes.c +++ b/src/gallium/drivers/d3d12/d3d12_nir_passes.c @@ -124,7 +124,7 @@ lower_pos_read(nir_builder *b, struct nir_instr *instr, b->cursor = nir_after_instr(instr); - nir_def *pos = nir_instr_ssa_def(instr); + nir_def *pos = nir_instr_def(instr); nir_def *depth = nir_channel(b, pos, 2); assert(depth_transform_var); diff --git a/src/microsoft/clc/clc_compiler.c b/src/microsoft/clc/clc_compiler.c index 9cfc2c7..93920ed 100644 --- a/src/microsoft/clc/clc_compiler.c +++ b/src/microsoft/clc/clc_compiler.c @@ -304,7 +304,7 @@ clc_lower_64bit_semantics(nir_shader *nir) continue; } - if (nir_instr_ssa_def(instr)->bit_size != 64) + if (nir_instr_def(instr)->bit_size != 64) continue; intrinsic->def.bit_size = 32; -- 2.7.4