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
}
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;
}
/*@}*/
-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:
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);
}
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;
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,
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);
}
}
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);
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);
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);
}
* 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.
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);
}
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)
.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;
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
}
}
}
- 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;
}
}
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
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;
}
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);
}
}
* 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.
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;
{
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) {
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
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)
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);
*/
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);
} 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);
}
}
}
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;
}
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;