nir: nir_foreach_ssa_def() -> nir_foreach_def()
s/nir_foreach_ssa_def/nir_foreach_def/g followed by ninja -C _build clang-format and a little hand clean-up in nir.c. Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658>
This commit is contained in:

committed by
Marge Bot

parent
0ec7b8455e
commit
6203750d78
@@ -1056,7 +1056,7 @@ static void
|
||||
add_defs_uses(nir_instr *instr)
|
||||
{
|
||||
nir_foreach_src(instr, add_use_cb, instr);
|
||||
nir_foreach_ssa_def(instr, add_ssa_def_cb, instr);
|
||||
nir_foreach_def(instr, add_ssa_def_cb, instr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1220,7 +1220,7 @@ nir_instr_free_and_dce_is_live(nir_instr *instr)
|
||||
}
|
||||
|
||||
bool live = false;
|
||||
nir_foreach_ssa_def(instr, nir_instr_free_and_dce_live_cb, &live);
|
||||
nir_foreach_def(instr, nir_instr_free_and_dce_live_cb, &live);
|
||||
return live;
|
||||
}
|
||||
|
||||
@@ -1285,21 +1285,21 @@ nir_instr_free_and_dce(nir_instr *instr)
|
||||
|
||||
/*@}*/
|
||||
|
||||
struct foreach_ssa_def_state {
|
||||
nir_foreach_ssa_def_cb cb;
|
||||
struct foreach_def_state {
|
||||
nir_foreach_def_cb cb;
|
||||
void *client_state;
|
||||
};
|
||||
|
||||
static inline bool
|
||||
nir_def_visitor(nir_dest *dest, void *void_state)
|
||||
{
|
||||
struct foreach_ssa_def_state *state = void_state;
|
||||
struct foreach_def_state *state = void_state;
|
||||
|
||||
return state->cb(&dest->ssa, state->client_state);
|
||||
}
|
||||
|
||||
bool
|
||||
nir_foreach_ssa_def(nir_instr *instr, nir_foreach_ssa_def_cb cb, void *state)
|
||||
nir_foreach_def(nir_instr *instr, nir_foreach_def_cb cb, void *state)
|
||||
{
|
||||
switch (instr->type) {
|
||||
case nir_instr_type_alu:
|
||||
@@ -1308,7 +1308,7 @@ nir_foreach_ssa_def(nir_instr *instr, nir_foreach_ssa_def_cb cb, void *state)
|
||||
case nir_instr_type_intrinsic:
|
||||
case nir_instr_type_phi:
|
||||
case nir_instr_type_parallel_copy: {
|
||||
struct foreach_ssa_def_state foreach_state = { cb, state };
|
||||
struct foreach_def_state foreach_state = { cb, state };
|
||||
return nir_foreach_dest(instr, nir_def_visitor, &foreach_state);
|
||||
}
|
||||
|
||||
@@ -1964,7 +1964,7 @@ nir_index_ssa_defs(nir_function_impl *impl)
|
||||
|
||||
nir_foreach_block_unstructured(block, impl) {
|
||||
nir_foreach_instr(instr, block)
|
||||
nir_foreach_ssa_def(instr, index_ssa_def_cb, &index);
|
||||
nir_foreach_def(instr, index_ssa_def_cb, &index);
|
||||
}
|
||||
|
||||
impl->ssa_alloc = index;
|
||||
|
@@ -4387,11 +4387,11 @@ nir_cursor nir_instr_free_and_dce(nir_instr *instr);
|
||||
|
||||
nir_def *nir_instr_ssa_def(nir_instr *instr);
|
||||
|
||||
typedef bool (*nir_foreach_ssa_def_cb)(nir_def *def, void *state);
|
||||
typedef bool (*nir_foreach_def_cb)(nir_def *def, void *state);
|
||||
typedef bool (*nir_foreach_dest_cb)(nir_dest *dest, void *state);
|
||||
typedef bool (*nir_foreach_src_cb)(nir_src *src, void *state);
|
||||
bool nir_foreach_ssa_def(nir_instr *instr, nir_foreach_ssa_def_cb cb,
|
||||
void *state);
|
||||
bool nir_foreach_def(nir_instr *instr, nir_foreach_def_cb cb,
|
||||
void *state);
|
||||
static inline bool nir_foreach_dest(nir_instr *instr, nir_foreach_dest_cb cb, void *state);
|
||||
static inline bool nir_foreach_src(nir_instr *instr, nir_foreach_src_cb cb, void *state);
|
||||
bool nir_foreach_phi_src_leaving_block(nir_block *instr,
|
||||
|
@@ -668,7 +668,7 @@ cleanup_cf_node(nir_cf_node *node, nir_function_impl *impl)
|
||||
if (jump->type == nir_jump_goto_if)
|
||||
nir_instr_rewrite_src(instr, &jump->condition, NIR_SRC_INIT);
|
||||
} else {
|
||||
nir_foreach_ssa_def(instr, replace_ssa_def_uses, impl);
|
||||
nir_foreach_def(instr, replace_ssa_def_uses, impl);
|
||||
nir_instr_remove(instr);
|
||||
}
|
||||
}
|
||||
|
@@ -815,7 +815,7 @@ visit_block(nir_block *block, struct divergence_state *state)
|
||||
continue;
|
||||
|
||||
if (state->first_visit)
|
||||
nir_foreach_ssa_def(instr, set_ssa_def_not_divergent, NULL);
|
||||
nir_foreach_def(instr, set_ssa_def_not_divergent, NULL);
|
||||
|
||||
if (instr->type == nir_instr_type_jump)
|
||||
has_changed |= visit_jump(nir_instr_as_jump(instr), state);
|
||||
@@ -1062,7 +1062,7 @@ nir_divergence_analysis(nir_shader *shader)
|
||||
bool
|
||||
nir_update_instr_divergence(nir_shader *shader, nir_instr *instr)
|
||||
{
|
||||
nir_foreach_ssa_def(instr, set_ssa_def_not_divergent, NULL);
|
||||
nir_foreach_def(instr, set_ssa_def_not_divergent, NULL);
|
||||
|
||||
if (instr->type == nir_instr_type_phi) {
|
||||
nir_cf_node *prev = nir_cf_node_prev(&instr->block->cf_node);
|
||||
|
@@ -735,7 +735,7 @@ resolve_registers_impl(nir_function_impl *impl, struct from_ssa_state *state)
|
||||
|
||||
default:
|
||||
state->builder.cursor = nir_after_instr(instr);
|
||||
nir_foreach_ssa_def(instr, rewrite_ssa_def, state);
|
||||
nir_foreach_def(instr, rewrite_ssa_def, state);
|
||||
state->builder.cursor = nir_before_instr(instr);
|
||||
nir_foreach_src(instr, rewrite_src, state);
|
||||
}
|
||||
@@ -1256,7 +1256,7 @@ nir_lower_ssa_defs_to_regs_block(nir_block *block)
|
||||
* infinite recursion, we don't want to lower any newly placed
|
||||
* load_reg instructions to yet anoter load/store_reg.
|
||||
*/
|
||||
} else if (nir_foreach_ssa_def(instr, ssa_def_is_local_to_block, NULL)) {
|
||||
} else if (nir_foreach_def(instr, ssa_def_is_local_to_block, NULL)) {
|
||||
/* If the SSA def produced by this instruction is only in the block
|
||||
* in which it is defined and is not used by ifs or phis, then we
|
||||
* don't have a reason to convert it to a register.
|
||||
|
@@ -176,7 +176,7 @@ nir_live_ssa_defs_impl(nir_function_impl *impl)
|
||||
if (instr->type == nir_instr_type_phi)
|
||||
break;
|
||||
|
||||
nir_foreach_ssa_def(instr, set_ssa_def_dead, block->live_in);
|
||||
nir_foreach_def(instr, set_ssa_def_dead, block->live_in);
|
||||
nir_foreach_src(instr, set_src_live, block->live_in);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ nir_get_live_ssa_defs(nir_cursor cursor, void *mem_ctx)
|
||||
if (instr->type == nir_instr_type_phi)
|
||||
break;
|
||||
|
||||
nir_foreach_ssa_def(instr, set_ssa_def_dead, live);
|
||||
nir_foreach_def(instr, set_ssa_def_dead, live);
|
||||
nir_foreach_src(instr, set_src_live, live);
|
||||
|
||||
if (cursor.option == nir_cursor_before_instr && instr == cursor.instr)
|
||||
|
@@ -250,7 +250,7 @@ init_loop_block(nir_block *block, loop_info_state *state,
|
||||
.state = state };
|
||||
|
||||
nir_foreach_instr(instr, block) {
|
||||
nir_foreach_ssa_def(instr, init_loop_def, &init_state);
|
||||
nir_foreach_def(instr, init_loop_def, &init_state);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -398,7 +398,7 @@ nir_lower_bool_to_bitsize_instr(nir_builder *b,
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_intrinsic: {
|
||||
bool progress = false;
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
nir_foreach_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ nir_lower_bool_to_bitsize_instr(nir_builder *b,
|
||||
return lower_tex_instr(nir_instr_as_tex(instr));
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
nir_foreach_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -239,7 +239,7 @@ nir_lower_bool_to_float_instr(nir_builder *b,
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_phi: {
|
||||
bool progress = false;
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
nir_foreach_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ nir_lower_bool_to_float_instr(nir_builder *b,
|
||||
return lower_tex_instr(nir_instr_as_tex(instr));
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
nir_foreach_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -199,7 +199,7 @@ nir_lower_bool_to_int32_instr(UNUSED nir_builder *b,
|
||||
case nir_instr_type_ssa_undef:
|
||||
case nir_instr_type_phi: {
|
||||
bool progress = false;
|
||||
nir_foreach_ssa_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
nir_foreach_def(instr, rewrite_1bit_ssa_def_to_32bit, &progress);
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ nir_lower_bool_to_int32_instr(UNUSED nir_builder *b,
|
||||
return lower_tex_instr(nir_instr_as_tex(instr));
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
nir_foreach_def(instr, assert_ssa_def_is_not_1bit, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -292,7 +292,7 @@ nir_lower_int_to_float_impl(nir_function_impl *impl)
|
||||
break;
|
||||
|
||||
default:
|
||||
nir_foreach_ssa_def(instr, assert_ssa_def_is_not_int, (void *)int_types);
|
||||
nir_foreach_def(instr, assert_ssa_def_is_not_int, (void *)int_types);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -262,7 +262,7 @@ node_is_dead(nir_cf_node *node)
|
||||
}
|
||||
}
|
||||
|
||||
if (!nir_foreach_ssa_def(instr, def_only_used_in_cf_node, node))
|
||||
if (!nir_foreach_def(instr, def_only_used_in_cf_node, node))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -729,7 +729,7 @@ gcm_schedule_late_instr(nir_instr *instr, struct gcm_state *state)
|
||||
instr->pass_flags & GCM_INSTR_PINNED)
|
||||
return;
|
||||
|
||||
nir_foreach_ssa_def(instr, gcm_schedule_late_def, state);
|
||||
nir_foreach_def(instr, gcm_schedule_late_def, state);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -769,7 +769,7 @@ gcm_place_instr(nir_instr *instr, struct gcm_state *state)
|
||||
instr->pass_flags |= GCM_INSTR_PLACED;
|
||||
|
||||
if (instr->block == NULL) {
|
||||
nir_foreach_ssa_def(instr, gcm_replace_def_with_undef, state);
|
||||
nir_foreach_def(instr, gcm_replace_def_with_undef, state);
|
||||
nir_instr_remove(instr);
|
||||
return;
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ nir_repair_ssa_impl(nir_function_impl *impl)
|
||||
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr_safe(instr, block) {
|
||||
nir_foreach_ssa_def(instr, repair_ssa_def, &state);
|
||||
nir_foreach_def(instr, repair_ssa_def, &state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -437,7 +437,7 @@ nir_schedule_calculate_deps(nir_deps_state *state, nir_schedule_node *n)
|
||||
* depend on the def.
|
||||
*/
|
||||
if (state->dir == F)
|
||||
nir_foreach_ssa_def(instr, nir_schedule_ssa_deps, state);
|
||||
nir_foreach_def(instr, nir_schedule_ssa_deps, state);
|
||||
|
||||
/* Make sure any other instructions keep their positions relative to
|
||||
* jumps.
|
||||
@@ -622,7 +622,7 @@ nir_schedule_regs_freed(nir_schedule_scoreboard *scoreboard, nir_schedule_node *
|
||||
|
||||
if (!nir_schedule_regs_freed_reg_intrin(n->instr, &state)) {
|
||||
nir_foreach_src(n->instr, nir_schedule_regs_freed_src_cb, &state);
|
||||
nir_foreach_ssa_def(n->instr, nir_schedule_regs_freed_def_cb, &state);
|
||||
nir_foreach_def(n->instr, nir_schedule_regs_freed_def_cb, &state);
|
||||
}
|
||||
|
||||
return state.regs_freed;
|
||||
@@ -1009,7 +1009,7 @@ nir_schedule_mark_node_scheduled(nir_schedule_scoreboard *scoreboard,
|
||||
{
|
||||
if (!nir_schedule_mark_reg_intrin_scheduled(n->instr, scoreboard)) {
|
||||
nir_foreach_src(n->instr, nir_schedule_mark_src_scheduled, scoreboard);
|
||||
nir_foreach_ssa_def(n->instr, nir_schedule_mark_def_scheduled, scoreboard);
|
||||
nir_foreach_def(n->instr, nir_schedule_mark_def_scheduled, scoreboard);
|
||||
}
|
||||
|
||||
util_dynarray_foreach(&n->dag.edges, struct dag_edge, edge) {
|
||||
@@ -1204,8 +1204,8 @@ nir_schedule_get_scoreboard(nir_shader *shader,
|
||||
nir_foreach_function_impl(impl, shader) {
|
||||
nir_foreach_block(block, impl) {
|
||||
nir_foreach_instr(instr, block) {
|
||||
nir_foreach_ssa_def(instr, nir_schedule_ssa_def_init_scoreboard,
|
||||
scoreboard);
|
||||
nir_foreach_def(instr, nir_schedule_ssa_def_init_scoreboard,
|
||||
scoreboard);
|
||||
}
|
||||
|
||||
/* XXX: We're ignoring if uses, which may prioritize scheduling other
|
||||
|
@@ -342,7 +342,7 @@ convert_to_lcssa(nir_cf_node *cf_node, lcssa_state *state)
|
||||
|
||||
nir_foreach_block_in_cf_node(block, cf_node) {
|
||||
nir_foreach_instr(instr, block) {
|
||||
nir_foreach_ssa_def(instr, convert_loop_exit_for_ssa, state);
|
||||
nir_foreach_def(instr, convert_loop_exit_for_ssa, state);
|
||||
|
||||
/* for outer loops, invariant instructions can be variant */
|
||||
if (state->skip_invariants && instr->pass_flags == invariant)
|
||||
@@ -383,7 +383,7 @@ nir_convert_loop_to_lcssa(nir_loop *loop)
|
||||
|
||||
nir_foreach_block_in_cf_node(block, &loop->cf_node) {
|
||||
nir_foreach_instr(instr, block)
|
||||
nir_foreach_ssa_def(instr, convert_loop_exit_for_ssa, state);
|
||||
nir_foreach_def(instr, convert_loop_exit_for_ssa, state);
|
||||
}
|
||||
|
||||
ralloc_free(state);
|
||||
|
@@ -386,7 +386,7 @@ trivialize_stores(nir_function_impl *impl, nir_block *block)
|
||||
*/
|
||||
|
||||
nir_foreach_instr_reverse_safe(instr, block) {
|
||||
nir_foreach_ssa_def(instr, clear_def, possibly_trivial_stores);
|
||||
nir_foreach_def(instr, clear_def, possibly_trivial_stores);
|
||||
|
||||
if (instr->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
|
@@ -1485,7 +1485,7 @@ validate_ssa_dominance(nir_function_impl *impl, validate_state *state)
|
||||
} else {
|
||||
nir_foreach_src(instr, validate_src_dominance, state);
|
||||
}
|
||||
nir_foreach_ssa_def(instr, validate_ssa_def_dominance, state);
|
||||
nir_foreach_def(instr, validate_ssa_def_dominance, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ nir_core_test::shader_contains_def(nir_def *def)
|
||||
struct contains_def_state state = {
|
||||
def, false
|
||||
};
|
||||
nir_foreach_ssa_def(instr, contains_def_cb, &state);
|
||||
nir_foreach_def(instr, contains_def_cb, &state);
|
||||
if (state.found)
|
||||
return true;
|
||||
}
|
||||
|
@@ -777,7 +777,7 @@ rogue_shader *rogue_nir_to_rogue(rogue_build_ctx *ctx, const nir_shader *nir)
|
||||
if (load_const->def.num_components > 1)
|
||||
continue;
|
||||
}
|
||||
nir_foreach_ssa_def(instr, ssa_def_cb, shader);
|
||||
nir_foreach_def(instr, ssa_def_cb, shader);
|
||||
}
|
||||
}
|
||||
++shader->ctx->next_ssa_idx;
|
||||
|
Reference in New Issue
Block a user