diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 175e9de30bf..2c76c929fc3 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -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; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 92ffa3be96a..572157e014d 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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, diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c index 781620c7ad3..e657724b48b 100644 --- a/src/compiler/nir/nir_control_flow.c +++ b/src/compiler/nir/nir_control_flow.c @@ -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); } } diff --git a/src/compiler/nir/nir_divergence_analysis.c b/src/compiler/nir/nir_divergence_analysis.c index 265a2e62bbb..fbb04a80a77 100644 --- a/src/compiler/nir/nir_divergence_analysis.c +++ b/src/compiler/nir/nir_divergence_analysis.c @@ -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); diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 6420baf0dc8..09a4861e8fb 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa.c @@ -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. diff --git a/src/compiler/nir/nir_liveness.c b/src/compiler/nir/nir_liveness.c index a7155349586..221c143da1a 100644 --- a/src/compiler/nir/nir_liveness.c +++ b/src/compiler/nir/nir_liveness.c @@ -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) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 23aca2637ca..c31c964b47c 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -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; diff --git a/src/compiler/nir/nir_lower_bool_to_bitsize.c b/src/compiler/nir/nir_lower_bool_to_bitsize.c index aebf1c8cfbf..7e6cb9f231f 100644 --- a/src/compiler/nir/nir_lower_bool_to_bitsize.c +++ b/src/compiler/nir/nir_lower_bool_to_bitsize.c @@ -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; } } diff --git a/src/compiler/nir/nir_lower_bool_to_float.c b/src/compiler/nir/nir_lower_bool_to_float.c index caabd73581a..69923f065a4 100644 --- a/src/compiler/nir/nir_lower_bool_to_float.c +++ b/src/compiler/nir/nir_lower_bool_to_float.c @@ -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; } } diff --git a/src/compiler/nir/nir_lower_bool_to_int32.c b/src/compiler/nir/nir_lower_bool_to_int32.c index a9581f82512..c72996a3404 100644 --- a/src/compiler/nir/nir_lower_bool_to_int32.c +++ b/src/compiler/nir/nir_lower_bool_to_int32.c @@ -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; } } diff --git a/src/compiler/nir/nir_lower_int_to_float.c b/src/compiler/nir/nir_lower_int_to_float.c index 1058eab2135..41406e2bce3 100644 --- a/src/compiler/nir/nir_lower_int_to_float.c +++ b/src/compiler/nir/nir_lower_int_to_float.c @@ -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; } } diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index ed615428639..7a1a0c4b16e 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -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; } } diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index c142f6021b2..85a35acbb18 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -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; } diff --git a/src/compiler/nir/nir_repair_ssa.c b/src/compiler/nir/nir_repair_ssa.c index 10b025d81cb..4f3cc9c5831 100644 --- a/src/compiler/nir/nir_repair_ssa.c +++ b/src/compiler/nir/nir_repair_ssa.c @@ -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); } } diff --git a/src/compiler/nir/nir_schedule.c b/src/compiler/nir/nir_schedule.c index 8a00d03981a..24545239104 100644 --- a/src/compiler/nir/nir_schedule.c +++ b/src/compiler/nir/nir_schedule.c @@ -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 diff --git a/src/compiler/nir/nir_to_lcssa.c b/src/compiler/nir/nir_to_lcssa.c index a1ee3c26b02..6159789f624 100644 --- a/src/compiler/nir/nir_to_lcssa.c +++ b/src/compiler/nir/nir_to_lcssa.c @@ -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); diff --git a/src/compiler/nir/nir_trivialize_registers.c b/src/compiler/nir/nir_trivialize_registers.c index c18d323dc61..dc6526c3d2b 100644 --- a/src/compiler/nir/nir_trivialize_registers.c +++ b/src/compiler/nir/nir_trivialize_registers.c @@ -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); diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 65106d61751..4bca4056e57 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -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); } } } diff --git a/src/compiler/nir/tests/core_tests.cpp b/src/compiler/nir/tests/core_tests.cpp index 6344531c5ea..27a8395b8c2 100644 --- a/src/compiler/nir/tests/core_tests.cpp +++ b/src/compiler/nir/tests/core_tests.cpp @@ -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; } diff --git a/src/imagination/rogue/rogue_compile.c b/src/imagination/rogue/rogue_compile.c index 3908e8735e4..81655fc1bbe 100644 --- a/src/imagination/rogue/rogue_compile.c +++ b/src/imagination/rogue/rogue_compile.c @@ -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;