mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
nir: rename nir_src_parent_instr to nir_src_use_instr
sed -i "s/nir_src_parent_instr/nir_src_use_instr/" `find ./ -type f` sed -i "s/nir_src_parent_if/nir_src_use_if/" `find ./ -type f` sed -i "s/nir_src_set_parent/nir_src_set_use/" `find ./ -type f` There are two kinds of "parent" in relation to a src/def: - the instruction where the def or src's def is defined - the instruction which the src is a part of and where the def is used Clarify that the parent here is where the src's def is used, not where it's defined. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Mel Henning <mhenning@darkrefraction.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Acked-by: Ian Romanick <ian.d.romanick@intel.com> Acked-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41344>
This commit is contained in:
parent
e33489420c
commit
ec59b59b97
88 changed files with 272 additions and 272 deletions
|
|
@ -550,9 +550,9 @@ gather_info(nir_builder *b, nir_intrinsic_instr *intr, void *state)
|
|||
case nir_intrinsic_load_frag_coord:
|
||||
assert(intr->def.bit_size == 32);
|
||||
nir_foreach_use(use, &intr->def) {
|
||||
if (nir_src_parent_instr(use)->type == nir_instr_type_alu &&
|
||||
if (nir_src_use_instr(use)->type == nir_instr_type_alu &&
|
||||
nir_src_components_read(use) & 0x3) {
|
||||
switch (nir_instr_as_alu(nir_src_parent_instr(use))->op) {
|
||||
switch (nir_instr_as_alu(nir_src_use_instr(use))->op) {
|
||||
case nir_op_f2i8:
|
||||
case nir_op_f2i16:
|
||||
case nir_op_f2i32:
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ bool
|
|||
only_used_by_cross_lane_instrs(nir_def* ssa, bool follow_phis = true)
|
||||
{
|
||||
nir_foreach_use (src, ssa) {
|
||||
switch (nir_src_parent_instr(src)->type) {
|
||||
switch (nir_src_use_instr(src)->type) {
|
||||
case nir_instr_type_alu: {
|
||||
nir_alu_instr* alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr* alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
if (alu->op != nir_op_unpack_64_2x32_split_x && alu->op != nir_op_unpack_64_2x32_split_y)
|
||||
return false;
|
||||
if (!only_used_by_cross_lane_instrs(&alu->def, follow_phis))
|
||||
|
|
@ -33,7 +33,7 @@ only_used_by_cross_lane_instrs(nir_def* ssa, bool follow_phis = true)
|
|||
continue;
|
||||
}
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr* intrin = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr* intrin = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
if (intrin->intrinsic != nir_intrinsic_read_invocation &&
|
||||
intrin->intrinsic != nir_intrinsic_read_first_invocation &&
|
||||
intrin->intrinsic != nir_intrinsic_lane_permute_16_amd)
|
||||
|
|
@ -46,7 +46,7 @@ only_used_by_cross_lane_instrs(nir_def* ssa, bool follow_phis = true)
|
|||
if (!follow_phis)
|
||||
return false;
|
||||
|
||||
nir_phi_instr* phi = nir_instr_as_phi(nir_src_parent_instr(src));
|
||||
nir_phi_instr* phi = nir_instr_as_phi(nir_src_use_instr(src));
|
||||
if (!only_used_by_cross_lane_instrs(&phi->def, false))
|
||||
return false;
|
||||
|
||||
|
|
@ -269,9 +269,9 @@ skip_uniformize_merge_phi(nir_def* ssa, unsigned depth)
|
|||
return false;
|
||||
|
||||
nir_foreach_use (src, ssa) {
|
||||
switch (nir_src_parent_instr(src)->type) {
|
||||
switch (nir_src_use_instr(src)->type) {
|
||||
case nir_instr_type_alu: {
|
||||
nir_alu_instr* alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr* alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
if (alu->def.divergent)
|
||||
break;
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ skip_uniformize_merge_phi(nir_def* ssa, unsigned depth)
|
|||
break;
|
||||
}
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr* intrin = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr* intrin = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
unsigned src_idx = src - intrin->src;
|
||||
/* nir_intrinsic_lane_permute_16_amd is only safe because we don't use divergence analysis
|
||||
* for it's instruction selection. We use that intrinsic for NGG culling. All others are
|
||||
|
|
@ -321,7 +321,7 @@ skip_uniformize_merge_phi(nir_def* ssa, unsigned depth)
|
|||
return false;
|
||||
}
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr* phi = nir_instr_as_phi(nir_src_parent_instr(src));
|
||||
nir_phi_instr* phi = nir_instr_as_phi(nir_src_use_instr(src));
|
||||
if (phi->def.divergent || skip_uniformize_merge_phi(&phi->def, depth + 1))
|
||||
break;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ static void
|
|||
rewrite_return_param_uses(nir_def *def, unsigned param_idx, struct lower_param_info *param_defs)
|
||||
{
|
||||
nir_foreach_use_safe (use, def) {
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
|
||||
if (use_instr->type == nir_instr_type_deref) {
|
||||
assert(nir_instr_as_deref(use_instr)->deref_type == nir_deref_type_cast);
|
||||
|
|
|
|||
|
|
@ -273,9 +273,9 @@ get_singluar_user_bcsel(nir_def *def, unsigned *src_idx)
|
|||
|
||||
nir_alu_instr *bcsel = NULL;
|
||||
nir_foreach_use_including_if_safe (src, def) {
|
||||
if (nir_src_is_if(src) || nir_src_parent_instr(src)->type != nir_instr_type_alu)
|
||||
if (nir_src_is_if(src) || nir_src_use_instr(src)->type != nir_instr_type_alu)
|
||||
return NULL;
|
||||
bcsel = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
bcsel = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
if (bcsel->op != nir_op_bcsel || bcsel->def.num_components != 1)
|
||||
return NULL;
|
||||
*src_idx = list_entry(src, nir_alu_src, src) - bcsel->src;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static bool
|
|||
radv_arg_def_is_unused(nir_def *def)
|
||||
{
|
||||
nir_foreach_use (use, def) {
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
if (use_instr->type == nir_instr_type_call)
|
||||
continue;
|
||||
if (use_instr->type == nir_instr_type_phi) {
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ lower_rt_deref_var(nir_shader *shader, nir_function_impl *impl, nir_instr *instr
|
|||
if (nir_src_is_if(use))
|
||||
continue;
|
||||
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ lower(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
return false;
|
||||
|
||||
nir_src *use = list_first_entry(&intr->def.uses, nir_src, use_link);
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ all_uses_float(nir_def *def)
|
|||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ rewrite_cost(nir_def *def, const void *data)
|
|||
{
|
||||
bool mov_needed = false, vectorizable = true;
|
||||
nir_foreach_use(use, def) {
|
||||
nir_instr *parent_instr = nir_src_parent_instr(use);
|
||||
nir_instr *parent_instr = nir_src_use_instr(use);
|
||||
if (parent_instr->type == nir_instr_type_tex) {
|
||||
/* TODO: Maybe check the source index, but biases can be uniform */
|
||||
break;
|
||||
|
|
@ -358,7 +358,7 @@ lower_preamble(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
* byte offset (first source), not the sampler index.
|
||||
*/
|
||||
nir_foreach_use_safe(use, &intr->def) {
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
nir_intrinsic_instr *pintr = nir_instr_as_intrinsic(parent);
|
||||
|
|
@ -393,7 +393,7 @@ lower_preamble(nir_builder *b, nir_intrinsic_instr *intr, void *data)
|
|||
}
|
||||
|
||||
nir_foreach_use_safe(use, &intr->def) {
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
|
||||
if (parent->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *pintr = nir_instr_as_intrinsic(parent);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ replace_tex_src(nir_tex_src *dst, nir_tex_src_type src_type, nir_def *src_def,
|
|||
nir_instr *src_parent)
|
||||
{
|
||||
*dst = nir_tex_src_for_ssa(src_type, src_def);
|
||||
nir_src_set_parent_instr(&dst->src, src_parent);
|
||||
nir_src_set_use_instr(&dst->src, src_parent);
|
||||
list_addtail(&dst->src.use_link, &dst->src.ssa->uses);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ nir_phi_instr_add_src(nir_phi_instr *instr, nir_block *pred, nir_def *src)
|
|||
nir_phi_src, 1);
|
||||
phi_src->pred = pred;
|
||||
phi_src->src = nir_src_for_ssa(src);
|
||||
nir_src_set_parent_instr(&phi_src->src, &instr->instr);
|
||||
nir_src_set_use_instr(&phi_src->src, &instr->instr);
|
||||
exec_list_push_tail(&instr->srcs, &phi_src->node);
|
||||
|
||||
return phi_src;
|
||||
|
|
@ -1233,7 +1233,7 @@ add_use_cb(nir_src *src, void *state)
|
|||
{
|
||||
nir_instr *instr = state;
|
||||
|
||||
nir_src_set_parent_instr(src, instr);
|
||||
nir_src_set_use_instr(src, instr);
|
||||
list_addtail(&src->use_link, &src->ssa->uses);
|
||||
|
||||
return true;
|
||||
|
|
@ -1656,11 +1656,11 @@ nir_block *
|
|||
nir_src_get_block(nir_src *src)
|
||||
{
|
||||
if (nir_src_is_if(src))
|
||||
return nir_cf_node_cf_tree_prev(&nir_src_parent_if(src)->cf_node);
|
||||
else if (nir_src_parent_instr(src)->type == nir_instr_type_phi)
|
||||
return nir_cf_node_cf_tree_prev(&nir_src_use_if(src)->cf_node);
|
||||
else if (nir_src_use_instr(src)->type == nir_instr_type_phi)
|
||||
return list_entry(src, nir_phi_src, src)->pred;
|
||||
else
|
||||
return nir_src_parent_instr(src)->block;
|
||||
return nir_src_use_instr(src)->block;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1680,10 +1680,10 @@ src_add_all_uses(nir_src *src, nir_instr *parent_instr, nir_if *parent_if)
|
|||
return;
|
||||
|
||||
if (parent_instr) {
|
||||
nir_src_set_parent_instr(src, parent_instr);
|
||||
nir_src_set_use_instr(src, parent_instr);
|
||||
} else {
|
||||
assert(parent_if);
|
||||
nir_src_set_parent_if(src, parent_if);
|
||||
nir_src_set_use_if(src, parent_if);
|
||||
}
|
||||
|
||||
list_addtail(&src->use_link, &src->ssa->uses);
|
||||
|
|
@ -1706,7 +1706,7 @@ nir_instr_clear_src(nir_instr *instr, nir_src *src)
|
|||
void
|
||||
nir_instr_move_src(nir_instr *dest_instr, nir_src *dest, nir_src *src)
|
||||
{
|
||||
assert(!src_is_valid(dest) || nir_src_parent_instr(dest) == dest_instr);
|
||||
assert(!src_is_valid(dest) || nir_src_use_instr(dest) == dest_instr);
|
||||
|
||||
src_remove_all_uses(dest);
|
||||
src_remove_all_uses(src);
|
||||
|
|
@ -1810,13 +1810,13 @@ nir_def_rewrite_uses_after_instr(nir_def *def, nir_def *new_ssa,
|
|||
|
||||
nir_foreach_use_including_if_safe(use_src, def) {
|
||||
if (!nir_src_is_if(use_src)) {
|
||||
assert(nir_src_parent_instr(use_src) != nir_def_instr(def));
|
||||
assert(nir_src_use_instr(use_src) != nir_def_instr(def));
|
||||
|
||||
/* Since def already dominates all of its uses, the only way a use can
|
||||
* not be dominated by after_me is if it is between def and after_me in
|
||||
* the instruction list.
|
||||
*/
|
||||
if (is_instr_between(nir_def_instr(def), after_me, nir_src_parent_instr(use_src)))
|
||||
if (is_instr_between(nir_def_instr(def), after_me, nir_src_use_instr(use_src)))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1840,16 +1840,16 @@ get_store_value(nir_intrinsic_instr *intrin)
|
|||
nir_component_mask_t
|
||||
nir_src_components_read(const nir_src *src)
|
||||
{
|
||||
assert(nir_src_parent_instr(src));
|
||||
assert(nir_src_use_instr(src));
|
||||
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
nir_alu_src *alu_src = exec_node_data(nir_alu_src, src, src);
|
||||
int src_idx = alu_src - &alu->src[0];
|
||||
assert(src_idx >= 0 && src_idx < nir_op_infos[alu->op].num_inputs);
|
||||
return nir_alu_instr_src_read_mask(alu, src_idx);
|
||||
} else if (nir_src_parent_instr(src)->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
} else if (nir_src_use_instr(src)->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
if (nir_intrinsic_has_write_mask(intrin) && src->ssa == get_store_value(intrin))
|
||||
return nir_intrinsic_write_mask(intrin);
|
||||
else
|
||||
|
|
@ -1881,7 +1881,7 @@ nir_def_all_uses_are_fsat(const nir_def *def)
|
|||
if (nir_src_is_if(src))
|
||||
return false;
|
||||
|
||||
nir_instr *use = nir_src_parent_instr(src);
|
||||
nir_instr *use = nir_src_use_instr(src);
|
||||
if (use->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
@ -1899,7 +1899,7 @@ nir_def_all_uses_ignore_sign_bit(const nir_def *def)
|
|||
nir_foreach_use_including_if(use, def) {
|
||||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
nir_instr *instr = nir_src_parent_instr(use);
|
||||
nir_instr *instr = nir_src_use_instr(use);
|
||||
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ nir_src_is_if(const nir_src *src)
|
|||
}
|
||||
|
||||
static inline nir_instr *
|
||||
nir_src_parent_instr(const nir_src *src)
|
||||
nir_src_use_instr(const nir_src *src)
|
||||
{
|
||||
assert(!nir_src_is_if(src));
|
||||
|
||||
|
|
@ -1108,7 +1108,7 @@ nir_src_parent_instr(const nir_src *src)
|
|||
}
|
||||
|
||||
static inline nir_if *
|
||||
nir_src_parent_if(const nir_src *src)
|
||||
nir_src_use_if(const nir_src *src)
|
||||
{
|
||||
assert(nir_src_is_if(src));
|
||||
|
||||
|
|
@ -1117,7 +1117,7 @@ nir_src_parent_if(const nir_src *src)
|
|||
}
|
||||
|
||||
static inline void
|
||||
_nir_src_set_parent(nir_src *src, void *parent, bool is_if)
|
||||
_nir_src_set_use(nir_src *src, void *parent, bool is_if)
|
||||
{
|
||||
uintptr_t ptr = (uintptr_t) parent;
|
||||
assert((ptr & ~NIR_SRC_PARENT_MASK) == 0 && "pointer must be aligned");
|
||||
|
|
@ -1129,15 +1129,15 @@ _nir_src_set_parent(nir_src *src, void *parent, bool is_if)
|
|||
}
|
||||
|
||||
static inline void
|
||||
nir_src_set_parent_instr(nir_src *src, nir_instr *parent_instr)
|
||||
nir_src_set_use_instr(nir_src *src, nir_instr *parent_instr)
|
||||
{
|
||||
_nir_src_set_parent(src, parent_instr, false);
|
||||
_nir_src_set_use(src, parent_instr, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
nir_src_set_parent_if(nir_src *src, nir_if *parent_if)
|
||||
nir_src_set_use_if(nir_src *src, nir_if *parent_if)
|
||||
{
|
||||
_nir_src_set_parent(src, parent_if, true);
|
||||
_nir_src_set_use(src, parent_if, true);
|
||||
}
|
||||
|
||||
static inline nir_src
|
||||
|
|
@ -4544,11 +4544,11 @@ nir_before_src(nir_src *src)
|
|||
{
|
||||
if (nir_src_is_if(src)) {
|
||||
nir_block *prev_block =
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_parent_if(src)->cf_node));
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_use_if(src)->cf_node));
|
||||
return nir_after_block(prev_block);
|
||||
} else if (nir_src_parent_instr(src)->type == nir_instr_type_phi) {
|
||||
} else if (nir_src_use_instr(src)->type == nir_instr_type_phi) {
|
||||
#ifndef NDEBUG
|
||||
nir_phi_instr *cond_phi = nir_instr_as_phi(nir_src_parent_instr(src));
|
||||
nir_phi_instr *cond_phi = nir_instr_as_phi(nir_src_use_instr(src));
|
||||
bool found = false;
|
||||
nir_foreach_phi_src(phi_src, cond_phi) {
|
||||
if (phi_src->src.ssa == src->ssa) {
|
||||
|
|
@ -4564,7 +4564,7 @@ nir_before_src(nir_src *src)
|
|||
nir_phi_src *phi_src = list_entry(src, nir_phi_src, src);
|
||||
return nir_after_block_before_jump(phi_src->pred);
|
||||
} else {
|
||||
return nir_before_instr(nir_src_parent_instr(src));
|
||||
return nir_before_instr(nir_src_use_instr(src));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4775,7 +4775,7 @@ static inline void
|
|||
nir_src_rewrite(nir_src *src, nir_def *new_ssa)
|
||||
{
|
||||
assert(src->ssa);
|
||||
assert(nir_src_is_if(src) ? (nir_src_parent_if(src) != NULL) : (nir_src_parent_instr(src) != NULL));
|
||||
assert(nir_src_is_if(src) ? (nir_src_use_if(src) != NULL) : (nir_src_use_instr(src) != NULL));
|
||||
list_del(&src->use_link);
|
||||
src->ssa = new_ssa;
|
||||
list_addtail(&src->use_link, &new_ssa->uses);
|
||||
|
|
@ -7114,26 +7114,26 @@ nir_is_store_reg(nir_intrinsic_instr *intr)
|
|||
#define nir_foreach_reg_load(load, reg) \
|
||||
assert(reg->intrinsic == nir_intrinsic_decl_reg); \
|
||||
\
|
||||
nir_foreach_use(load, ®->def) \
|
||||
if (nir_is_load_reg(nir_instr_as_intrinsic(nir_src_parent_instr(load))))
|
||||
nir_foreach_use(load, ®->def) \
|
||||
if (nir_is_load_reg(nir_instr_as_intrinsic(nir_src_use_instr(load))))
|
||||
|
||||
#define nir_foreach_reg_load_safe(load, reg) \
|
||||
assert(reg->intrinsic == nir_intrinsic_decl_reg); \
|
||||
\
|
||||
nir_foreach_use_safe(load, ®->def) \
|
||||
if (nir_is_load_reg(nir_instr_as_intrinsic(nir_src_parent_instr(load))))
|
||||
if (nir_is_load_reg(nir_instr_as_intrinsic(nir_src_use_instr(load))))
|
||||
|
||||
#define nir_foreach_reg_store(store, reg) \
|
||||
assert(reg->intrinsic == nir_intrinsic_decl_reg); \
|
||||
\
|
||||
nir_foreach_use(store, ®->def) \
|
||||
if (nir_is_store_reg(nir_instr_as_intrinsic(nir_src_parent_instr(store))))
|
||||
nir_foreach_use(store, ®->def) \
|
||||
if (nir_is_store_reg(nir_instr_as_intrinsic(nir_src_use_instr(store))))
|
||||
|
||||
#define nir_foreach_reg_store_safe(store, reg) \
|
||||
assert(reg->intrinsic == nir_intrinsic_decl_reg); \
|
||||
\
|
||||
nir_foreach_use_safe(store, ®->def) \
|
||||
if (nir_is_store_reg(nir_instr_as_intrinsic(nir_src_parent_instr(store))))
|
||||
if (nir_is_store_reg(nir_instr_as_intrinsic(nir_src_use_instr(store))))
|
||||
|
||||
static inline nir_intrinsic_instr *
|
||||
nir_load_reg_for_def(const nir_def *def)
|
||||
|
|
@ -7161,7 +7161,7 @@ nir_store_reg_for_def(const nir_def *def)
|
|||
if (nir_src_is_if(src))
|
||||
return NULL;
|
||||
|
||||
nir_instr *parent = nir_src_parent_instr(src);
|
||||
nir_instr *parent = nir_src_use_instr(src);
|
||||
if (parent->type != nir_instr_type_intrinsic)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ nir_def_rewrite_uses_with_alu_src(nir_builder *build, nir_def *def,
|
|||
nir_def *mov = NULL;
|
||||
|
||||
nir_foreach_use_including_if_safe(use, def) {
|
||||
if (nir_src_is_if(use) || nir_src_parent_instr(use)->type != nir_instr_type_alu) {
|
||||
if (nir_src_is_if(use) || nir_src_use_instr(use)->type != nir_instr_type_alu) {
|
||||
if (!mov)
|
||||
mov = nir_mov_alu(build, src, num_components);
|
||||
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@ update_if_uses(nir_cf_node *node)
|
|||
return;
|
||||
|
||||
nir_if *if_stmt = nir_cf_node_as_if(node);
|
||||
nir_src_set_parent_if(&if_stmt->condition, if_stmt);
|
||||
nir_src_set_use_if(&if_stmt->condition, if_stmt);
|
||||
|
||||
list_addtail(&if_stmt->condition.use_link,
|
||||
&if_stmt->condition.ssa->uses);
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ nir_deref_instr_has_complex_use(nir_deref_instr *deref,
|
|||
if (nir_src_is_if(use_src))
|
||||
return true;
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use_src);
|
||||
nir_instr *use_instr = nir_src_use_instr(use_src);
|
||||
|
||||
switch (use_instr->type) {
|
||||
case nir_instr_type_deref: {
|
||||
|
|
@ -837,7 +837,7 @@ nir_rematerialize_deref_in_use_blocks(nir_deref_instr *instr)
|
|||
};
|
||||
|
||||
nir_foreach_use_safe(use, &instr->def) {
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->block == instr->instr.block)
|
||||
continue;
|
||||
|
||||
|
|
@ -890,10 +890,10 @@ static void
|
|||
nir_deref_instr_fixup_child_types(nir_deref_instr *parent)
|
||||
{
|
||||
nir_foreach_use(use, &parent->def) {
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_deref)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_deref)
|
||||
continue;
|
||||
|
||||
nir_deref_instr *child = nir_instr_as_deref(nir_src_parent_instr(use));
|
||||
nir_deref_instr *child = nir_instr_as_deref(nir_src_use_instr(use));
|
||||
switch (child->deref_type) {
|
||||
case nir_deref_type_var:
|
||||
UNREACHABLE("nir_deref_type_var cannot be a child");
|
||||
|
|
@ -1235,7 +1235,7 @@ opt_deref_cast(nir_builder *b, nir_deref_instr *cast)
|
|||
/* If this isn't a trivial array cast, we can't propagate into
|
||||
* ptr_as_array derefs.
|
||||
*/
|
||||
if (is_deref_ptr_as_array(nir_src_parent_instr(use_src)) &&
|
||||
if (is_deref_ptr_as_array(nir_src_use_instr(use_src)) &&
|
||||
!trivial_array_cast)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -1128,8 +1128,8 @@ ssa_def_is_local_to_block(nir_def *def, UNUSED void *state)
|
|||
nir_block *block = nir_def_block(def);
|
||||
nir_foreach_use_including_if(use_src, def) {
|
||||
if (nir_src_is_if(use_src) ||
|
||||
nir_src_parent_instr(use_src)->block != block ||
|
||||
nir_src_parent_instr(use_src)->type == nir_instr_type_phi) {
|
||||
nir_src_use_instr(use_src)->block != block ||
|
||||
nir_src_use_instr(use_src)->type == nir_instr_type_phi) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ fixup_cast_deref_mode(nir_deref_instr *deref)
|
|||
deref->modes ^= nir_var_function_temp;
|
||||
|
||||
nir_foreach_use(use, &deref->def) {
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_deref)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_deref)
|
||||
continue;
|
||||
|
||||
/* Recurse into children */
|
||||
fixup_cast_deref_mode(nir_instr_as_deref(nir_src_parent_instr(use)));
|
||||
fixup_cast_deref_mode(nir_instr_as_deref(nir_src_use_instr(use)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ accum_src_deps(nir_src *src, void *opaque)
|
|||
src_instr->type == nir_instr_type_undef)
|
||||
return true;
|
||||
|
||||
nir_instr *dst_instr = nir_src_parent_instr(src);
|
||||
nir_instr *dst_instr = nir_src_use_instr(src);
|
||||
accum_deps(data->instr_deps[dst_instr->index],
|
||||
data->instr_deps[src_instr->index], data->num_bitset_words);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ nir_legacy_float_mod_folds(nir_alu_instr *mod)
|
|||
if (nir_src_is_if(src))
|
||||
return false;
|
||||
|
||||
nir_instr *parent = nir_src_parent_instr(src);
|
||||
nir_instr *parent = nir_src_use_instr(src);
|
||||
if (parent->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
@ -196,15 +196,15 @@ chase_fsat(nir_def **def)
|
|||
return false;
|
||||
|
||||
nir_src *use = list_first_entry(&(*def)->uses, nir_src, use_link);
|
||||
if (nir_src_is_if(use) || nir_src_parent_instr(use)->type != nir_instr_type_alu)
|
||||
if (nir_src_is_if(use) || nir_src_use_instr(use)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *fsat = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *fsat = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
if (fsat->op != nir_op_fsat || !nir_legacy_fsat_folds(fsat))
|
||||
return false;
|
||||
|
||||
/* Otherwise, we're good */
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
*def = &alu->def;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ fuse_mods_with_registers(nir_builder *b, nir_instr *instr, void *fuse_fabs_)
|
|||
*/
|
||||
nir_foreach_use_including_if_safe(use, &alu->def) {
|
||||
assert(!nir_src_is_if(use));
|
||||
assert(nir_src_parent_instr(use)->type == nir_instr_type_alu);
|
||||
assert(nir_src_use_instr(use)->type == nir_instr_type_alu);
|
||||
nir_alu_src *alu_use = list_entry(use, nir_alu_src, src);
|
||||
nir_src_rewrite(&alu_use->src, &load->def);
|
||||
for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i)
|
||||
|
|
|
|||
|
|
@ -1213,7 +1213,7 @@ find_trip_count(loop_info_state *state, unsigned execution_mode,
|
|||
};
|
||||
|
||||
nir_alu_instr *step_alu =
|
||||
nir_instr_as_alu(nir_src_parent_instr(&lv->update_src->src));
|
||||
nir_instr_as_alu(nir_src_use_instr(&lv->update_src->src));
|
||||
|
||||
/* If the comparision is of unsigned type we don't necessarily need to
|
||||
* know the initial value to be able to calculate the max number of
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ get_similar_flrp_stats(nir_alu_instr *alu, struct similar_flrp_stats *st)
|
|||
|
||||
nir_foreach_use(other_use, alu->src[2].src.ssa) {
|
||||
/* Is the use also a flrp? */
|
||||
nir_instr *const other_instr = nir_src_parent_instr(other_use);
|
||||
nir_instr *const other_instr = nir_src_use_instr(other_use);
|
||||
if (other_instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ opt_16bit_destination(nir_def *ssa, nir_alu_type dest_type, unsigned exec_mode,
|
|||
nir_get_rounding_mode_from_float_controls(exec_mode, nir_type_float16);
|
||||
|
||||
nir_foreach_use(use, ssa) {
|
||||
nir_instr *instr = nir_src_parent_instr(use);
|
||||
nir_instr *instr = nir_src_use_instr(use);
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
@ -653,7 +653,7 @@ opt_16bit_destination(nir_def *ssa, nir_alu_type dest_type, unsigned exec_mode,
|
|||
|
||||
/* All uses are the same conversions. Replace them with mov. */
|
||||
nir_foreach_use(use, ssa) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
switch (alu->op) {
|
||||
case nir_op_f2f16_rtne:
|
||||
case nir_op_f2f16_rtz:
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ get_first_use(nir_def *def, void *state)
|
|||
{
|
||||
uint32_t *last_first_use = state;
|
||||
nir_foreach_use(use, def)
|
||||
*last_first_use = MIN2(*last_first_use, nir_src_parent_instr(use)->index);
|
||||
*last_first_use = MIN2(*last_first_use, nir_src_use_instr(use)->index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ add_non_uniform_instr(struct nu_state *state, struct nu_handle *handles,
|
|||
nir_src **srcs, uint32_t handle_count, bool group,
|
||||
enum nir_lower_non_uniform_access_type access_type)
|
||||
{
|
||||
nir_instr *instr = nir_src_parent_instr(srcs[0]);
|
||||
nir_instr *instr = nir_src_use_instr(srcs[0]);
|
||||
|
||||
struct nu_access_group_state *access_group = &state->access_groups[ffs(access_type) - 1];
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl,
|
|||
struct nu_handle_data data = *(struct nu_handle_data *)entry->data;
|
||||
|
||||
nir_src *first_src = util_dynarray_top_ptr(&data.srcs, struct nu_handle_src)->srcs[0];
|
||||
b.cursor = nir_after_instr(nir_src_parent_instr(first_src));
|
||||
b.cursor = nir_after_instr(nir_src_use_instr(first_src));
|
||||
|
||||
nir_push_loop(&b);
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl,
|
|||
for (uint32_t i = 0; i < key->handle_count; i++)
|
||||
nu_handle_rewrite(&b, &data.handles[i], src->srcs[i]);
|
||||
|
||||
nir_instr *instr = nir_src_parent_instr(src->srcs[0]);
|
||||
nir_instr *instr = nir_src_use_instr(src->srcs[0]);
|
||||
nir_instr_remove(instr);
|
||||
nir_builder_instr_insert(&b, instr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ setup_reg(nir_intrinsic_instr *decl, struct regs_to_ssa_state *state)
|
|||
memset(state->defs, 0, state->defs_words * sizeof(*state->defs));
|
||||
|
||||
nir_foreach_reg_store(store, decl)
|
||||
BITSET_SET(state->defs, nir_src_parent_instr(store)->block->index);
|
||||
BITSET_SET(state->defs, nir_src_use_instr(store)->block->index);
|
||||
|
||||
state->values[decl->def.index] =
|
||||
nir_phi_builder_add_value(state->phi_builder, num_components,
|
||||
|
|
|
|||
|
|
@ -74,15 +74,15 @@ static bool
|
|||
only_used_for_load_store(nir_deref_instr *deref)
|
||||
{
|
||||
nir_foreach_use(src, &deref->def) {
|
||||
if (!nir_src_parent_instr(src))
|
||||
if (!nir_src_use_instr(src))
|
||||
return false;
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_deref) {
|
||||
if (!only_used_for_load_store(nir_instr_as_deref(nir_src_parent_instr(src))))
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_deref) {
|
||||
if (!only_used_for_load_store(nir_instr_as_deref(nir_src_use_instr(src))))
|
||||
return false;
|
||||
} else if (nir_src_parent_instr(src)->type != nir_instr_type_intrinsic) {
|
||||
} else if (nir_src_use_instr(src)->type != nir_instr_type_intrinsic) {
|
||||
return false;
|
||||
} else {
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
if (intrin->intrinsic != nir_intrinsic_load_deref &&
|
||||
intrin->intrinsic != nir_intrinsic_store_deref)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -345,11 +345,11 @@ static bool
|
|||
rewrite_instr_src_from_phi_builder(nir_src *src, void *_pbv_arr)
|
||||
{
|
||||
nir_block *block;
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_phi) {
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_phi) {
|
||||
nir_phi_src *phi_src = exec_node_data(nir_phi_src, src, src);
|
||||
block = phi_src->pred;
|
||||
} else {
|
||||
block = nir_src_parent_instr(src)->block;
|
||||
block = nir_src_use_instr(src)->block;
|
||||
}
|
||||
|
||||
nir_def *new_def = get_phi_builder_def_for_src(src, _pbv_arr, block);
|
||||
|
|
@ -1522,16 +1522,16 @@ nir_opt_trim_stack_values(nir_shader *shader)
|
|||
nir_def *def = nir_instr_def(instr);
|
||||
|
||||
nir_foreach_use_safe(use_src, def) {
|
||||
if (nir_src_parent_instr(use_src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use_src));
|
||||
if (nir_src_use_instr(use_src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use_src));
|
||||
nir_alu_src *alu_src = exec_node_data(nir_alu_src, use_src, src);
|
||||
|
||||
unsigned count = alu->def.num_components;
|
||||
for (unsigned idx = 0; idx < count; ++idx)
|
||||
alu_src->swizzle[idx] = swiz_map[alu_src->swizzle[idx]];
|
||||
} else if (nir_src_parent_instr(use_src)->type == nir_instr_type_intrinsic) {
|
||||
} else if (nir_src_use_instr(use_src)->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *use_intrin =
|
||||
nir_instr_as_intrinsic(nir_src_parent_instr(use_src));
|
||||
nir_instr_as_intrinsic(nir_src_use_instr(use_src));
|
||||
assert(nir_intrinsic_has_write_mask(use_intrin));
|
||||
unsigned write_mask = nir_intrinsic_write_mask(use_intrin);
|
||||
unsigned new_write_mask = 0;
|
||||
|
|
@ -1731,7 +1731,7 @@ find_last_dominant_use_block(nir_function_impl *impl, nir_def *value)
|
|||
|
||||
nir_foreach_if_use(src, value) {
|
||||
nir_block *block_before_if =
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_parent_if(src)->cf_node));
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_use_if(src)->cf_node));
|
||||
if (!nir_block_dominates(block, block_before_if)) {
|
||||
fits = false;
|
||||
break;
|
||||
|
|
@ -1741,13 +1741,13 @@ find_last_dominant_use_block(nir_function_impl *impl, nir_def *value)
|
|||
continue;
|
||||
|
||||
nir_foreach_use(src, value) {
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_phi &&
|
||||
block == nir_src_parent_instr(src)->block) {
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_phi &&
|
||||
block == nir_src_use_instr(src)->block) {
|
||||
fits = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!nir_block_dominates(block, nir_src_parent_instr(src)->block)) {
|
||||
if (!nir_block_dominates(block, nir_src_use_instr(src)->block)) {
|
||||
fits = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ try_coalesce(nir_builder *b, nir_def *reg, nir_alu_instr *vec,
|
|||
if (nir_src_is_if(src))
|
||||
return 0;
|
||||
|
||||
if (nir_src_parent_instr(src) != &vec->instr)
|
||||
if (nir_src_use_instr(src) != &vec->instr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ move_vec_src_uses_to_dest_block(nir_block *block, bool skip_const_srcs)
|
|||
*/
|
||||
if (list_is_singular(&vec->def.uses)) {
|
||||
nir_src *src = list_first_entry(&vec->def.uses, nir_src, use_link);
|
||||
nir_instr *use_instr = nir_src_parent_instr(src);
|
||||
nir_instr *use_instr = nir_src_use_instr(src);
|
||||
if (use_instr->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(use_instr);
|
||||
if (intr->intrinsic == nir_intrinsic_store_output ||
|
||||
|
|
@ -122,18 +122,18 @@ move_vec_src_uses_to_dest_block(nir_block *block, bool skip_const_srcs)
|
|||
}
|
||||
|
||||
nir_foreach_use_safe(use, vec->src[i].src.ssa) {
|
||||
if (nir_src_parent_instr(use) == &vec->instr)
|
||||
if (nir_src_use_instr(use) == &vec->instr)
|
||||
continue;
|
||||
|
||||
/* We need to dominate the use if we are going to rewrite it */
|
||||
if (!ssa_def_dominates_instr(&vec->def, nir_src_parent_instr(use)))
|
||||
if (!ssa_def_dominates_instr(&vec->def, nir_src_use_instr(use)))
|
||||
continue;
|
||||
|
||||
/* For now, we'll just rewrite ALU instructions */
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
|
||||
/* Figure out which source we're actually looking at */
|
||||
nir_alu_src *use_alu_src = exec_node_data(nir_alu_src, use, src);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ rewrite_instr_src_from_phi_builder(nir_src *src, void *data)
|
|||
struct hash_table *phi_value_table = data;
|
||||
|
||||
if (nir_src_is_const(*src)) {
|
||||
nir_builder b = nir_builder_at(nir_before_instr(nir_src_parent_instr(src)));
|
||||
nir_builder b = nir_builder_at(nir_before_instr(nir_src_use_instr(src)));
|
||||
nir_src_rewrite(src, nir_build_imm(&b, src->ssa->num_components,
|
||||
src->ssa->bit_size,
|
||||
nir_src_as_const_value(*src)));
|
||||
|
|
@ -134,13 +134,13 @@ rewrite_instr_src_from_phi_builder(nir_src *src, void *data)
|
|||
if (!entry)
|
||||
return true;
|
||||
|
||||
nir_block *block = nir_src_parent_instr(src)->block;
|
||||
nir_block *block = nir_src_use_instr(src)->block;
|
||||
nir_def *new_def = nir_phi_builder_value_get_block_def(entry->data, block);
|
||||
|
||||
bool can_rewrite = true;
|
||||
if (nir_def_block(new_def) == block && new_def->index != UINT32_MAX)
|
||||
can_rewrite =
|
||||
!nir_instr_is_before(nir_src_parent_instr(src), nir_def_instr(new_def));
|
||||
!nir_instr_is_before(nir_src_use_instr(src), nir_def_instr(new_def));
|
||||
|
||||
if (can_rewrite)
|
||||
nir_src_rewrite(src, new_def);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ is_compatible_condition(const nir_alu_instr *instr)
|
|||
return true;
|
||||
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
|
||||
if (user_instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ static bool
|
|||
copy_propagate_alu(nir_alu_src *use_of_copy, nir_alu_instr *copy)
|
||||
{
|
||||
nir_def *new_use_src = NULL;
|
||||
nir_alu_instr *user = nir_instr_as_alu(nir_src_parent_instr(&use_of_copy->src));
|
||||
nir_alu_instr *user = nir_instr_as_alu(nir_src_use_instr(&use_of_copy->src));
|
||||
unsigned src_idx = use_of_copy - user->src;
|
||||
assert(src_idx < nir_op_infos[user->op].num_inputs);
|
||||
unsigned num_use_components = nir_ssa_alu_instr_src_components(user, src_idx);
|
||||
|
|
@ -154,7 +154,7 @@ copy_prop_instr(nir_instr *instr)
|
|||
bool progress = false;
|
||||
|
||||
nir_foreach_use_including_if_safe(src, ©->def) {
|
||||
if (!nir_src_is_if(src) && nir_src_parent_instr(src)->type == nir_instr_type_alu)
|
||||
if (!nir_src_is_if(src) && nir_src_use_instr(src)->type == nir_instr_type_alu)
|
||||
progress |= copy_propagate_alu(container_of(src, nir_alu_src, src), copy);
|
||||
else
|
||||
progress |= copy_propagate(src, copy);
|
||||
|
|
|
|||
|
|
@ -132,9 +132,9 @@ def_only_used_in_cf_node(nir_def *def, void *_node)
|
|||
nir_block *block;
|
||||
|
||||
if (nir_src_is_if(use))
|
||||
block = nir_cf_node_as_block(nir_cf_node_prev(&nir_src_parent_if(use)->cf_node));
|
||||
block = nir_cf_node_as_block(nir_cf_node_prev(&nir_src_use_if(use)->cf_node));
|
||||
else
|
||||
block = nir_src_parent_instr(use)->block;
|
||||
block = nir_src_use_instr(use)->block;
|
||||
|
||||
/* Note: Normally, the uses of a phi instruction are considered to be
|
||||
* used in the block that is the predecessor of the phi corresponding to
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ opt_frag_pos(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
|
|||
return false;
|
||||
}
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
|
@ -74,7 +74,7 @@ opt_frag_pos(nir_builder *b, nir_intrinsic_instr *intr, UNUSED void *data)
|
|||
|
||||
nir_src_rewrite(use, pixel_coord);
|
||||
|
||||
nir_alu_instr *use_instr = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *use_instr = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
|
||||
/* load_frag_coord is always positive, so we should never sign extend here. */
|
||||
bool needs_float = use_instr->op == nir_op_ffloor || use_instr->op == nir_op_ftrunc;
|
||||
|
|
|
|||
|
|
@ -624,7 +624,7 @@ gcm_schedule_late_def(nir_def *def, void *void_state)
|
|||
nir_block *lca = NULL;
|
||||
|
||||
nir_foreach_use(use_src, def) {
|
||||
nir_instr *use_instr = nir_src_parent_instr(use_src);
|
||||
nir_instr *use_instr = nir_src_use_instr(use_src);
|
||||
|
||||
gcm_schedule_late_instr(use_instr, state);
|
||||
|
||||
|
|
@ -648,7 +648,7 @@ gcm_schedule_late_def(nir_def *def, void *void_state)
|
|||
}
|
||||
|
||||
nir_foreach_if_use(use_src, def) {
|
||||
nir_if *if_stmt = nir_src_parent_if(use_src);
|
||||
nir_if *if_stmt = nir_src_use_if(use_src);
|
||||
|
||||
/* For if statements, we consider the block to be the one immediately
|
||||
* preceding the if CF node.
|
||||
|
|
|
|||
|
|
@ -197,9 +197,9 @@ group_loads(nir_instr *first, nir_instr *last, instr_info *infos)
|
|||
|
||||
if (def) {
|
||||
nir_foreach_use(use, def) {
|
||||
if (nir_src_parent_instr(use)->block == instr->block &&
|
||||
infos[nir_src_parent_instr(use)->index].instr_index <=
|
||||
infos[last->index].instr_index) {
|
||||
if (nir_src_use_instr(use)->block == instr->block &&
|
||||
infos[nir_src_use_instr(use)->index].instr_index <=
|
||||
infos[last->index].instr_index) {
|
||||
all_uses_after_last = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop, nir_opt_if_options options)
|
|||
continue;
|
||||
|
||||
nir_src *use = list_first_entry(&alu->def.uses, nir_src, use_link);
|
||||
if (nir_src_is_if(use) || !is_trivial_bcsel(nir_src_parent_instr(use), true))
|
||||
if (nir_src_is_if(use) || !is_trivial_bcsel(nir_src_use_instr(use), true))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -978,10 +978,10 @@ propagate_condition_eval(nir_builder *b, nir_if *nif, nir_src *use_src,
|
|||
static bool
|
||||
can_propagate_through_alu(nir_src *src, bool ignore_bcsel)
|
||||
{
|
||||
if (nir_src_parent_instr(src)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(src)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
switch (alu->op) {
|
||||
case nir_op_ior:
|
||||
case nir_op_iand:
|
||||
|
|
@ -1013,7 +1013,7 @@ evaluate_condition_use(nir_builder *b, nir_if *nif, nir_src *use_src,
|
|||
const bool ignore_bcsel = branch != either_branch;
|
||||
if (!nir_src_is_if(use_src) && can_propagate_through_alu(use_src,
|
||||
ignore_bcsel)) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use_src));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use_src));
|
||||
|
||||
nir_foreach_use_including_if_safe(alu_use, &alu->def) {
|
||||
progress |= propagate_condition_eval(b, nif, use_src, alu_use, alu,
|
||||
|
|
@ -1031,7 +1031,7 @@ opt_if_evaluate_condition_use(nir_builder *b, nir_if *nif)
|
|||
|
||||
/* Evaluate any uses of the if condition inside the if branches */
|
||||
nir_foreach_use_including_if_safe(use_src, nif->condition.ssa) {
|
||||
if (!(nir_src_is_if(use_src) && nir_src_parent_if(use_src) == nif))
|
||||
if (!(nir_src_is_if(use_src) && nir_src_use_if(use_src) == nif))
|
||||
progress |= evaluate_condition_use(b, nif, use_src, false, either_branch);
|
||||
}
|
||||
|
||||
|
|
@ -1052,7 +1052,7 @@ opt_if_evaluate_condition_use(nir_builder *b, nir_if *nif)
|
|||
* replace instances of x as well.
|
||||
*/
|
||||
nir_foreach_use_including_if_safe(use_src, alu->src[0].src.ssa) {
|
||||
if (nir_src_is_if(use_src) || nir_src_parent_instr(use_src) != &alu->instr)
|
||||
if (nir_src_is_if(use_src) || nir_src_use_instr(use_src) != &alu->instr)
|
||||
progress |= evaluate_condition_use(b, nif, use_src, true, either_branch);
|
||||
}
|
||||
|
||||
|
|
@ -1088,7 +1088,7 @@ opt_if_evaluate_condition_use(nir_builder *b, nir_if *nif)
|
|||
nir_src_num_components(alu_src->src[0].src) == 1) {
|
||||
nir_foreach_use_including_if_safe(use_src, alu_src->src[0].src.ssa) {
|
||||
if (nir_src_is_if(use_src) ||
|
||||
nir_src_parent_instr(use_src) != &alu_src->instr) {
|
||||
nir_src_use_instr(use_src) != &alu_src->instr) {
|
||||
progress |= evaluate_condition_use(b, nif, use_src,
|
||||
!invert, branch);
|
||||
}
|
||||
|
|
@ -1112,8 +1112,8 @@ rewrite_comp_uses_within_if(nir_builder *b, nir_if *nif, bool invert,
|
|||
|
||||
nir_def *new_ssa = NULL;
|
||||
nir_foreach_use_safe(use, scalar.def) {
|
||||
if (nir_src_parent_instr(use)->block->index < first->index ||
|
||||
nir_src_parent_instr(use)->block->index > last->index)
|
||||
if (nir_src_use_instr(use)->block->index < first->index ||
|
||||
nir_src_use_instr(use)->block->index > last->index)
|
||||
continue;
|
||||
|
||||
/* Only rewrite users which use only the new component. This is to avoid a
|
||||
|
|
|
|||
|
|
@ -290,10 +290,10 @@ try_opt_exclusive_scan_to_inclusive(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||
nir_op reduction_op = nir_intrinsic_reduction_op(intrin);
|
||||
|
||||
nir_foreach_use_including_if(src, &intrin->def) {
|
||||
if (nir_src_is_if(src) || nir_src_parent_instr(src)->type != nir_instr_type_alu)
|
||||
if (nir_src_is_if(src) || nir_src_use_instr(src)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
|
||||
if (alu->op != reduction_op)
|
||||
return false;
|
||||
|
|
@ -338,7 +338,7 @@ try_opt_exclusive_scan_to_inclusive(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||
|
||||
nir_foreach_use_including_if_safe(src, &intrin->def) {
|
||||
/* Remove alu. */
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
nir_def_replace(&alu->def, incl_scan);
|
||||
}
|
||||
|
||||
|
|
@ -653,8 +653,8 @@ opt_intrinsics_intrin(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||
|
||||
bool progress = false;
|
||||
nir_foreach_use_safe(use_src, &intrin->def) {
|
||||
if (nir_src_parent_instr(use_src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use_src));
|
||||
if (nir_src_use_instr(use_src)->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use_src));
|
||||
|
||||
if ((alu->op != nir_op_ieq && alu->op != nir_op_ine) || alu->def.num_components != 1)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -506,12 +506,12 @@ insert_phis_after_terminator_merge(nir_def *def, void *state)
|
|||
nir_foreach_use_including_if_safe(src, def) {
|
||||
/* Don't reprocess the phi we just added */
|
||||
if (!nir_src_is_if(src) && phi_instr &&
|
||||
nir_src_parent_instr(src) == &phi_instr->instr) {
|
||||
nir_src_use_instr(src) == &phi_instr->instr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nir_src_is_if(src) ||
|
||||
(!nir_src_is_if(src) && nir_src_parent_instr(src)->block != nir_def_block(def))) {
|
||||
(!nir_src_is_if(src) && nir_src_use_instr(src)->block != nir_def_block(def))) {
|
||||
if (!phi_created) {
|
||||
phi_instr = nir_phi_instr_create(m_state->shader);
|
||||
nir_def_init(&phi_instr->instr, &phi_instr->def, def->num_components,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ nir_opt_move_block(nir_block *block, nir_move_options options)
|
|||
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 = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->type == nir_instr_type_phi || parent->block != block)
|
||||
continue;
|
||||
if (!first_user || parent->index > first_user->index)
|
||||
|
|
|
|||
|
|
@ -286,8 +286,8 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count,
|
|||
/* The only uses of this definition must be phis in the successor */
|
||||
nir_foreach_use_including_if(use, &mov->def) {
|
||||
if (nir_src_is_if(use) ||
|
||||
nir_src_parent_instr(use)->type != nir_instr_type_phi ||
|
||||
nir_src_parent_instr(use)->block != block->successors[0])
|
||||
nir_src_use_instr(use)->type != nir_instr_type_phi ||
|
||||
nir_src_use_instr(use)->block != block->successors[0])
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -426,9 +426,9 @@ nir_opt_collapse_if(nir_if *if_stmt, nir_shader *shader,
|
|||
nir_phi_get_src_from_block(phi, nir_if_first_else_block(if_stmt));
|
||||
|
||||
nir_foreach_use(src, &phi->def) {
|
||||
assert(nir_src_parent_instr(src)->type == nir_instr_type_phi);
|
||||
assert(nir_src_use_instr(src)->type == nir_instr_type_phi);
|
||||
nir_phi_src *phi_src =
|
||||
nir_phi_get_src_from_block(nir_instr_as_phi(nir_src_parent_instr(src)),
|
||||
nir_phi_get_src_from_block(nir_instr_as_phi(nir_src_use_instr(src)),
|
||||
nir_if_first_else_block(parent_if));
|
||||
if (phi_src->src.ssa != else_src->src.ssa)
|
||||
return false;
|
||||
|
|
@ -452,7 +452,7 @@ nir_opt_collapse_if(nir_if *if_stmt, nir_shader *shader,
|
|||
nir_phi_get_src_from_block(phi, nir_if_first_else_block(if_stmt));
|
||||
nir_foreach_use_safe(src, &phi->def) {
|
||||
nir_phi_src *phi_src =
|
||||
nir_phi_get_src_from_block(nir_instr_as_phi(nir_src_parent_instr(src)),
|
||||
nir_phi_get_src_from_block(nir_instr_as_phi(nir_src_use_instr(src)),
|
||||
nir_if_first_else_block(parent_if));
|
||||
if (phi_src->src.ssa == else_src->src.ssa)
|
||||
nir_src_rewrite(&phi_src->src, &phi->def);
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ try_move_narrowing_dst(nir_builder *b, nir_phi_instr *phi)
|
|||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
|
||||
op = narrowing_conversion_op(nir_src_parent_instr(use), op);
|
||||
op = narrowing_conversion_op(nir_src_use_instr(use), op);
|
||||
|
||||
/* Not a (compatible) narrowing conversion: */
|
||||
if (op == INVALID_OP)
|
||||
|
|
@ -253,7 +253,7 @@ try_move_narrowing_dst(nir_builder *b, nir_phi_instr *phi)
|
|||
/* We've previously established that all the uses were alu
|
||||
* conversion ops. Turn them into movs instead.
|
||||
*/
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
alu->op = nir_op_mov;
|
||||
alu->fp_math_ctrl = nir_op_valid_fp_math_ctrl(alu->op, alu->fp_math_ctrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ phi_to_bool(nir_builder *b, nir_phi_instr *phi, void *unused)
|
|||
UNREACHABLE("invalid bool_type");
|
||||
|
||||
nir_foreach_use_safe(src, &phi->def) {
|
||||
if (nir_src_parent_instr(src) == &phi->instr ||
|
||||
nir_src_parent_instr(src) == nir_def_instr(res))
|
||||
if (nir_src_use_instr(src) == &phi->instr ||
|
||||
nir_src_use_instr(src) == nir_def_instr(res))
|
||||
continue;
|
||||
nir_src_rewrite(src, res);
|
||||
}
|
||||
|
|
@ -227,7 +227,7 @@ nir_opt_phi_to_bool(nir_shader *shader)
|
|||
if (instr->pass_flags != bool_types) {
|
||||
instr->pass_flags = bool_types;
|
||||
nir_foreach_use(use, nir_instr_def(instr))
|
||||
nir_instr_worklist_push_tail(&worklist, nir_src_parent_instr(use));
|
||||
nir_instr_worklist_push_tail(&worklist, nir_src_use_instr(use));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ nir_opt_preamble(nir_shader *shader, const nir_opt_preamble_options *options,
|
|||
if (nir_src_is_if(use)) {
|
||||
is_can_move_user = false;
|
||||
} else {
|
||||
nir_def *use_def = nir_instr_def(nir_src_parent_instr(use));
|
||||
nir_def *use_def = nir_instr_def(nir_src_use_instr(use));
|
||||
is_can_move_user = use_def != NULL &&
|
||||
ctx.states[use_def->index].can_move &&
|
||||
!ctx.states[use_def->index].must_stay;
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ nir_opt_reassociate_bfi_instr(nir_builder *b,
|
|||
nir_src *use = list_first_entry(&bfiCD0->def.uses,
|
||||
nir_src, use_link);
|
||||
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *bfiABx = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *bfiABx = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
if (bfiABx->op != nir_op_bfi || bfiABx->def.num_components != 1)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ static bool
|
|||
all_uses_are_bcsel(const nir_alu_instr *instr)
|
||||
{
|
||||
nir_foreach_use(use, &instr->def) {
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *const alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *const alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
if (alu->op != nir_op_bcsel &&
|
||||
alu->op != nir_op_b32csel)
|
||||
return false;
|
||||
|
|
@ -113,10 +113,10 @@ static bool
|
|||
all_uses_are_compare_with_zero(const nir_alu_instr *instr)
|
||||
{
|
||||
nir_foreach_use(use, &instr->def) {
|
||||
if (nir_src_parent_instr(use)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(use)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *const alu = nir_instr_as_alu(nir_src_parent_instr(use));
|
||||
nir_alu_instr *const alu = nir_instr_as_alu(nir_src_use_instr(use));
|
||||
if (!is_two_src_comparison(alu))
|
||||
return false;
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ nir_opt_rematerialize_compares_impl(nir_shader *shader, nir_function_impl *impl)
|
|||
*/
|
||||
nir_foreach_use_including_if_safe(use, &alu->def) {
|
||||
if (nir_src_is_if(use)) {
|
||||
nir_if *const if_stmt = nir_src_parent_if(use);
|
||||
nir_if *const if_stmt = nir_src_use_if(use);
|
||||
|
||||
nir_block *const prev_block =
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&if_stmt->cf_node));
|
||||
|
|
@ -178,7 +178,7 @@ nir_opt_rematerialize_compares_impl(nir_shader *shader, nir_function_impl *impl)
|
|||
nir_src_rewrite(&if_stmt->condition, &clone->def);
|
||||
progress = true;
|
||||
} else {
|
||||
nir_instr *const use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *const use_instr = nir_src_use_instr(use);
|
||||
|
||||
/* If the use is in the same block as the def, don't
|
||||
* rematerialize.
|
||||
|
|
@ -272,7 +272,7 @@ nir_opt_rematerialize_alu_impl(nir_shader *shader, nir_function_impl *impl)
|
|||
* block because CSE cannot be run after this pass.
|
||||
*/
|
||||
nir_foreach_use_safe(use, &alu->def) {
|
||||
nir_instr *const use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *const use_instr = nir_src_use_instr(use);
|
||||
|
||||
/* If the use is in the same block as the def, don't
|
||||
* rematerialize.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ reswizzle_alu_uses(nir_def *def, uint8_t *reswizzle)
|
|||
{
|
||||
nir_foreach_use(use_src, def) {
|
||||
/* all uses must be ALU instructions */
|
||||
assert(nir_src_parent_instr(use_src)->type == nir_instr_type_alu);
|
||||
assert(nir_src_use_instr(use_src)->type == nir_instr_type_alu);
|
||||
nir_alu_src *alu_src = (nir_alu_src *)use_src;
|
||||
|
||||
/* reswizzle ALU sources */
|
||||
|
|
@ -65,7 +65,7 @@ static bool
|
|||
is_only_used_by_alu(nir_def *def)
|
||||
{
|
||||
nir_foreach_use(use_src, def) {
|
||||
if (nir_src_parent_instr(use_src)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(use_src)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ shrink_dest_to_read_mask(nir_def *def, bool shrink_start)
|
|||
|
||||
/* don't remove any channels if used by an intrinsic */
|
||||
nir_foreach_use(use_src, def) {
|
||||
if (nir_src_parent_instr(use_src)->type == nir_instr_type_intrinsic)
|
||||
if (nir_src_use_instr(use_src)->type == nir_instr_type_intrinsic)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ opt_shrink_or_split_vector(nir_builder *b, nir_alu_instr *vec)
|
|||
|
||||
nir_foreach_use_including_if(src, &vec->def) {
|
||||
/* don't remove any channels if used by non-ALU */
|
||||
if (nir_src_is_if(src) || nir_src_parent_instr(src)->type != nir_instr_type_alu)
|
||||
if (nir_src_is_if(src) || nir_src_use_instr(src)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_component_mask_t read = nir_src_components_read(src);
|
||||
|
|
@ -500,10 +500,10 @@ opt_shrink_vectors_phi(nir_builder *b, nir_phi_instr *instr)
|
|||
/* Check the uses. */
|
||||
nir_component_mask_t mask = 0;
|
||||
nir_foreach_use(src, def) {
|
||||
if (nir_src_parent_instr(src)->type != nir_instr_type_alu)
|
||||
if (nir_src_use_instr(src)->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
|
||||
nir_alu_src *alu_src = exec_node_data(nir_alu_src, src, src);
|
||||
int src_idx = alu_src - &alu->src[0];
|
||||
|
|
@ -515,7 +515,7 @@ opt_shrink_vectors_phi(nir_builder *b, nir_phi_instr *instr)
|
|||
* This can happen in the case of loops.
|
||||
*/
|
||||
nir_foreach_use(alu_use_src, alu_def) {
|
||||
if (nir_src_parent_instr(alu_use_src) != &instr->instr) {
|
||||
if (nir_src_use_instr(alu_use_src) != &instr->instr) {
|
||||
mask |= src_read_mask;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ visit_undef_use(nir_src *src, struct visit_info *info)
|
|||
return;
|
||||
}
|
||||
|
||||
nir_instr *instr = nir_src_parent_instr(src);
|
||||
nir_instr *instr = nir_src_use_instr(src);
|
||||
|
||||
if (instr->type == nir_instr_type_alu) {
|
||||
/* Replacing undef with a constant is only beneficial with ALU
|
||||
|
|
|
|||
|
|
@ -2879,7 +2879,7 @@ get_single_use_as_alu(nir_def *def)
|
|||
return NULL;
|
||||
|
||||
nir_instr *instr =
|
||||
nir_src_parent_instr(list_first_entry(&def->uses, nir_src, use_link));
|
||||
nir_src_use_instr(list_first_entry(&def->uses, nir_src, use_link));
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -3900,7 +3900,7 @@ try_move_postdominator(struct linkage_info *linkage,
|
|||
*/
|
||||
nir_foreach_use_safe(src, nir_instr_def(load)) {
|
||||
if (nir_instr_dominates_use(postdom_state, postdom,
|
||||
nir_src_parent_instr(src))) {
|
||||
nir_src_use_instr(src))) {
|
||||
nir_src_rewrite(src, nir_undef(&linkage->consumer_builder,
|
||||
src->ssa->num_components,
|
||||
src->ssa->bit_size));
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ rewrite_uses(nir_builder *b, struct set *instr_set, nir_def *def1,
|
|||
{
|
||||
/* update all ALU uses */
|
||||
nir_foreach_use_safe(src, def1) {
|
||||
nir_instr *user_instr = nir_src_parent_instr(src);
|
||||
nir_instr *user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type == nir_instr_type_alu) {
|
||||
/* Check if user is found in the hashset */
|
||||
struct set_entry *entry = _mesa_set_search(instr_set, user_instr);
|
||||
|
|
@ -314,14 +314,14 @@ rewrite_uses(nir_builder *b, struct set *instr_set, nir_def *def1,
|
|||
}
|
||||
|
||||
nir_foreach_use_safe(src, def2) {
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_alu) {
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_alu) {
|
||||
/* For ALU instructions, rewrite the source directly to avoid a
|
||||
* round-trip through copy propagation.
|
||||
*/
|
||||
nir_src_rewrite(src, new_def);
|
||||
|
||||
nir_alu_src *alu_src = container_of(src, nir_alu_src, src);
|
||||
nir_alu_instr *use = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *use = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
unsigned components =
|
||||
nir_ssa_alu_instr_src_components(use, alu_src - use->src);
|
||||
for (unsigned i = 0; i < components; i++)
|
||||
|
|
|
|||
|
|
@ -2187,9 +2187,9 @@ ssa_def_bits_used(const nir_def *def, int recur)
|
|||
return all_bits;
|
||||
|
||||
nir_foreach_use(src, def) {
|
||||
switch (nir_src_parent_instr(src)->type) {
|
||||
switch (nir_src_use_instr(src)->type) {
|
||||
case nir_instr_type_alu: {
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(nir_src_parent_instr(src));
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(nir_src_use_instr(src));
|
||||
unsigned src_idx = container_of(src, nir_alu_src, src) - use_alu->src;
|
||||
|
||||
/* If a user of the value produces a vector result, return the
|
||||
|
|
@ -2357,7 +2357,7 @@ ssa_def_bits_used(const nir_def *def, int recur)
|
|||
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *use_intrin =
|
||||
nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
unsigned src_idx = src - use_intrin->src;
|
||||
|
||||
switch (use_intrin->intrinsic) {
|
||||
|
|
@ -2418,7 +2418,7 @@ ssa_def_bits_used(const nir_def *def, int recur)
|
|||
}
|
||||
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr *use_phi = nir_instr_as_phi(nir_src_parent_instr(src));
|
||||
nir_phi_instr *use_phi = nir_instr_as_phi(nir_src_use_instr(src));
|
||||
bits_used |= ssa_def_bits_used(&use_phi->def, recur);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@ static bool
|
|||
deref_used_for_not_store(nir_deref_instr *deref)
|
||||
{
|
||||
nir_foreach_use(src, &deref->def) {
|
||||
switch (nir_src_parent_instr(src)->type) {
|
||||
switch (nir_src_use_instr(src)->type) {
|
||||
case nir_instr_type_deref:
|
||||
if (deref_used_for_not_store(nir_instr_as_deref(nir_src_parent_instr(src))))
|
||||
if (deref_used_for_not_store(nir_instr_as_deref(nir_src_use_instr(src))))
|
||||
return true;
|
||||
break;
|
||||
|
||||
case nir_instr_type_intrinsic: {
|
||||
nir_intrinsic_instr *intrin =
|
||||
nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
/* The first source of copy and store intrinsics is the deref to
|
||||
* write. Don't record those.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ static nir_block *
|
|||
get_src_block(nir_src *src)
|
||||
{
|
||||
if (nir_src_is_if(src)) {
|
||||
return nir_cf_node_as_block(nir_cf_node_prev(&nir_src_parent_if(src)->cf_node));
|
||||
} else if (nir_src_parent_instr(src)->type == nir_instr_type_phi) {
|
||||
return nir_cf_node_as_block(nir_cf_node_prev(&nir_src_use_if(src)->cf_node));
|
||||
} else if (nir_src_use_instr(src)->type == nir_instr_type_phi) {
|
||||
return exec_node_data(nir_phi_src, src, src)->pred;
|
||||
} else {
|
||||
return nir_src_parent_instr(src)->block;
|
||||
return nir_src_use_instr(src)->block;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ repair_ssa_def(nir_def *def, void *void_state)
|
|||
*/
|
||||
if (!nir_src_is_if(src) &&
|
||||
nir_def_is_deref(def) &&
|
||||
nir_src_parent_instr(src)->type == nir_instr_type_deref &&
|
||||
nir_instr_as_deref(nir_src_parent_instr(src))->deref_type != nir_deref_type_cast) {
|
||||
nir_src_use_instr(src)->type == nir_instr_type_deref &&
|
||||
nir_instr_as_deref(nir_src_use_instr(src))->deref_type != nir_deref_type_cast) {
|
||||
nir_deref_instr *cast =
|
||||
nir_deref_instr_create(state->impl->function->shader,
|
||||
nir_deref_type_cast);
|
||||
|
|
@ -128,13 +128,13 @@ repair_ssa_def(nir_def *def, void *void_state)
|
|||
|
||||
nir_def_init(&cast->instr, &cast->def, def->num_components,
|
||||
def->bit_size);
|
||||
nir_instr_insert(nir_before_instr(nir_src_parent_instr(src)),
|
||||
nir_instr_insert(nir_before_instr(nir_src_use_instr(src)),
|
||||
&cast->instr);
|
||||
block_def = &cast->def;
|
||||
}
|
||||
|
||||
if (nir_src_is_if(src))
|
||||
nir_src_rewrite(&nir_src_parent_if(src)->condition, block_def);
|
||||
nir_src_rewrite(&nir_src_use_if(src)->condition, block_def);
|
||||
else
|
||||
nir_src_rewrite(src, block_def);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ nir_schedule_ssa_deps(nir_def *def, void *in_state)
|
|||
|
||||
nir_foreach_use(src, def) {
|
||||
nir_schedule_node *use_n = nir_schedule_get_node(instr_map,
|
||||
nir_src_parent_instr(src));
|
||||
nir_src_use_instr(src));
|
||||
|
||||
add_read_dep(state, def_n, use_n);
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ nir_schedule_regs_freed_src_cb(nir_src *src, void *in_state)
|
|||
struct set *remaining_uses = nir_schedule_scoreboard_get_src(scoreboard, src);
|
||||
|
||||
if (remaining_uses->entries == 1 &&
|
||||
_mesa_set_search(remaining_uses, nir_src_parent_instr(src))) {
|
||||
_mesa_set_search(remaining_uses, nir_src_use_instr(src))) {
|
||||
state->regs_freed += nir_schedule_src_pressure(src);
|
||||
}
|
||||
|
||||
|
|
@ -899,7 +899,7 @@ nir_schedule_mark_src_scheduled(nir_src *src, void *state)
|
|||
struct set *remaining_uses = nir_schedule_scoreboard_get_src(scoreboard, src);
|
||||
|
||||
struct set_entry *entry = _mesa_set_search(remaining_uses,
|
||||
nir_src_parent_instr(src));
|
||||
nir_src_use_instr(src));
|
||||
if (entry) {
|
||||
/* Once we've used an SSA value in one instruction, bump the priority of
|
||||
* the other uses so the SSA value can get fully consumed.
|
||||
|
|
@ -911,12 +911,12 @@ nir_schedule_mark_src_scheduled(nir_src *src, void *state)
|
|||
*/
|
||||
if (!nir_def_is_const(src->ssa)) {
|
||||
nir_foreach_use(other_src, src->ssa) {
|
||||
if (nir_src_parent_instr(other_src) == nir_src_parent_instr(src))
|
||||
if (nir_src_use_instr(other_src) == nir_src_use_instr(src))
|
||||
continue;
|
||||
|
||||
nir_schedule_node *n =
|
||||
nir_schedule_get_node(scoreboard->instr_map,
|
||||
nir_src_parent_instr(other_src));
|
||||
nir_src_use_instr(other_src));
|
||||
|
||||
if (n && !n->partially_evaluated_path) {
|
||||
if (debug) {
|
||||
|
|
@ -933,7 +933,7 @@ nir_schedule_mark_src_scheduled(nir_src *src, void *state)
|
|||
|
||||
nir_schedule_mark_use(scoreboard,
|
||||
(void *)src->ssa,
|
||||
nir_src_parent_instr(src),
|
||||
nir_src_use_instr(src),
|
||||
nir_schedule_src_pressure(src));
|
||||
|
||||
return true;
|
||||
|
|
@ -1191,7 +1191,7 @@ nir_schedule_ssa_def_init_scoreboard(nir_def *def, void *state)
|
|||
_mesa_set_add(def_uses, nir_def_instr(def));
|
||||
|
||||
nir_foreach_use(src, def) {
|
||||
_mesa_set_add(def_uses, nir_src_parent_instr(src));
|
||||
_mesa_set_add(def_uses, nir_src_use_instr(src));
|
||||
}
|
||||
|
||||
/* XXX: Handle if uses */
|
||||
|
|
|
|||
|
|
@ -608,8 +608,8 @@ add_uses_to_worklist(nir_instr *instr,
|
|||
nir_def *def = nir_instr_def(instr);
|
||||
|
||||
nir_foreach_use_safe(use_src, def) {
|
||||
if (nir_algebraic_automaton(nir_src_parent_instr(use_src), states, pass_op_table))
|
||||
nir_instr_worklist_push_tail(worklist, nir_src_parent_instr(use_src));
|
||||
if (nir_algebraic_automaton(nir_src_use_instr(use_src), states, pass_op_table))
|
||||
nir_instr_worklist_push_tail(worklist, nir_src_use_instr(use_src));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ static inline bool
|
|||
is_used_by_non_fsat(const nir_alu_instr *instr)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
|
||||
if (user_instr->type != nir_instr_type_alu)
|
||||
return true;
|
||||
|
|
@ -496,7 +496,7 @@ static inline bool
|
|||
is_used_by_non_ldc_nv(const nir_alu_instr *instr)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
|
||||
if (user_instr->type != nir_instr_type_intrinsic)
|
||||
return true;
|
||||
|
|
@ -514,7 +514,7 @@ static inline bool
|
|||
is_only_used_as_float_impl(const nir_alu_instr *instr, bool nsz, unsigned depth)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
|
||||
if (user_instr->type != nir_instr_type_alu) {
|
||||
if (user_instr->type == nir_instr_type_intrinsic) {
|
||||
|
|
@ -594,7 +594,7 @@ static inline bool
|
|||
is_only_used_by_fadd(const nir_alu_instr *instr)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
@ -622,7 +622,7 @@ static inline bool
|
|||
is_only_used_by_alu_op(const nir_alu_instr *instr, nir_op op)
|
||||
{
|
||||
nir_foreach_use(src, &instr->def) {
|
||||
const nir_instr *const user_instr = nir_src_parent_instr(src);
|
||||
const nir_instr *const user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -1539,7 +1539,7 @@ read_phi(read_ctx *ctx, nir_block *blk, union packed_instr header)
|
|||
* we have to set the parent_instr manually. It doesn't really matter
|
||||
* when we do it, so we might as well do it here.
|
||||
*/
|
||||
nir_src_set_parent_instr(&src->src, &phi->instr);
|
||||
nir_src_set_use_instr(&src->src, &phi->instr);
|
||||
|
||||
/* Stash it in the list of phi sources. We'll walk this list and fix up
|
||||
* sources at the very end of read_function_impl.
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ is_if_use_inside_loop(nir_src *use, nir_loop *loop)
|
|||
nir_cf_node_as_block(nir_cf_node_next(&loop->cf_node));
|
||||
|
||||
nir_block *prev_block =
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_parent_if(use)->cf_node));
|
||||
nir_cf_node_as_block(nir_cf_node_prev(&nir_src_use_if(use)->cf_node));
|
||||
if (prev_block->index <= block_before_loop->index ||
|
||||
prev_block->index >= block_after_loop->index) {
|
||||
return false;
|
||||
|
|
@ -81,8 +81,8 @@ is_use_inside_loop(nir_src *use, nir_loop *loop)
|
|||
nir_block *block_after_loop =
|
||||
nir_cf_node_as_block(nir_cf_node_next(&loop->cf_node));
|
||||
|
||||
if (nir_src_parent_instr(use)->block->index <= block_before_loop->index ||
|
||||
nir_src_parent_instr(use)->block->index >= block_after_loop->index) {
|
||||
if (nir_src_use_instr(use)->block->index <= block_before_loop->index ||
|
||||
nir_src_use_instr(use)->block->index >= block_after_loop->index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -212,8 +212,8 @@ convert_loop_exit_for_ssa(nir_def *def, void *void_state)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (nir_src_parent_instr(use)->type == nir_instr_type_phi &&
|
||||
nir_src_parent_instr(use)->block == state->block_after_loop) {
|
||||
if (nir_src_use_instr(use)->type == nir_instr_type_phi &&
|
||||
nir_src_use_instr(use)->block == state->block_after_loop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -253,13 +253,13 @@ convert_loop_exit_for_ssa(nir_def *def, void *void_state)
|
|||
nir_foreach_use_including_if_safe(use, def) {
|
||||
if (nir_src_is_if(use)) {
|
||||
if (!is_if_use_inside_loop(use, state->loop))
|
||||
nir_src_rewrite(&nir_src_parent_if(use)->condition, dest);
|
||||
nir_src_rewrite(&nir_src_use_if(use)->condition, dest);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nir_src_parent_instr(use)->type == nir_instr_type_phi &&
|
||||
state->block_after_loop == nir_src_parent_instr(use)->block) {
|
||||
if (nir_src_use_instr(use)->type == nir_instr_type_phi &&
|
||||
state->block_after_loop == nir_src_use_instr(use)->block) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ trivialize_loads(nir_function_impl *impl, nir_block *block)
|
|||
nir_intrinsic_instr *reg = nir_reg_get_decl(intr->src[1].ssa);
|
||||
|
||||
nir_foreach_reg_load(load, reg) {
|
||||
nir_instr *parent = nir_src_parent_instr(load);
|
||||
nir_instr *parent = nir_src_use_instr(load);
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(parent);
|
||||
|
||||
BITSET_CLEAR(state.trivial_loads, intr->def.index);
|
||||
|
|
@ -335,7 +335,7 @@ clear_def(nir_def *def, void *state)
|
|||
if (nir_src_is_if(src))
|
||||
continue;
|
||||
|
||||
nir_instr *parent = nir_src_parent_instr(src);
|
||||
nir_instr *parent = nir_src_use_instr(src);
|
||||
if (parent->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ calc_dominance(struct nir_use_dominance_state *state,
|
|||
break;
|
||||
} else {
|
||||
update_imm_dom(state,
|
||||
get_node(state, nir_src_parent_instr(src)),
|
||||
get_node(state, nir_src_use_instr(src)),
|
||||
&new_idom);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ tag_src(nir_src *src, validate_state *state)
|
|||
}
|
||||
}
|
||||
|
||||
/* Due to tagging, it's not safe to use nir_src_parent_instr during the main
|
||||
/* Due to tagging, it's not safe to use nir_src_use_instr during the main
|
||||
* validate loop. This is a tagging-aware version.
|
||||
*/
|
||||
static nir_instr *
|
||||
|
|
@ -176,7 +176,7 @@ static void
|
|||
validate_if_src(nir_src *src, validate_state *state)
|
||||
{
|
||||
validate_src_tag(src, state);
|
||||
validate_assert(state, nir_src_parent_if(src) == state->if_stmt);
|
||||
validate_assert(state, nir_src_use_if(src) == state->if_stmt);
|
||||
validate_assert(state, src->ssa != NULL);
|
||||
validate_assert(state, src->ssa->num_components == 1);
|
||||
}
|
||||
|
|
@ -184,11 +184,11 @@ validate_if_src(nir_src *src, validate_state *state)
|
|||
static void
|
||||
validate_src(nir_src *src, validate_state *state)
|
||||
{
|
||||
/* Validate the tag first, so that nir_src_parent_instr is valid */
|
||||
/* Validate the tag first, so that nir_src_use_instr is valid */
|
||||
validate_src_tag(src, state);
|
||||
|
||||
/* Source assumed to be instruction, use validate_if_src for if */
|
||||
validate_assert(state, nir_src_parent_instr(src) == state->instr);
|
||||
validate_assert(state, nir_src_use_instr(src) == state->instr);
|
||||
|
||||
validate_assert(state, src->ssa != NULL);
|
||||
}
|
||||
|
|
@ -1795,13 +1795,13 @@ validate_src_dominance(nir_src *src, void *_state)
|
|||
{
|
||||
validate_state *state = _state;
|
||||
|
||||
if (nir_def_block(src->ssa) == nir_src_parent_instr(src)->block) {
|
||||
if (nir_def_block(src->ssa) == nir_src_use_instr(src)->block) {
|
||||
validate_assert(state, src->ssa->index < state->impl->ssa_alloc);
|
||||
validate_assert(state, BITSET_TEST(state->ssa_defs_found,
|
||||
src->ssa->index));
|
||||
} else {
|
||||
validate_assert(state, nir_block_dominates(nir_def_block(src->ssa),
|
||||
nir_src_parent_instr(src)->block));
|
||||
nir_src_use_instr(src)->block));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,8 +159,8 @@ TEST_F(nir_cf_test, lcssa_iter_safety_during_deref_remat)
|
|||
|
||||
EXPECT_FALSE(nir_def_is_unused(index));
|
||||
nir_foreach_use_including_if(src, index)
|
||||
EXPECT_TRUE(!nir_src_is_if(src) && nir_src_parent_instr(src)->type == nir_instr_type_phi &&
|
||||
nir_src_parent_instr(src)->block == block_after_loop);
|
||||
EXPECT_TRUE(!nir_src_is_if(src) && nir_src_use_instr(src)->type == nir_instr_type_phi &&
|
||||
nir_src_use_instr(src)->block == block_after_loop);
|
||||
|
||||
nir_validate_shader(b->shader, NULL);
|
||||
nir_validate_ssa_dominance(b->shader, NULL);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ static bool
|
|||
nir_def_is_used_as(nir_def *def, nir_alu_type type)
|
||||
{
|
||||
nir_foreach_use(use, def) {
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ protected:
|
|||
has_non_io_offset_non_vertex_index_use(nir_builder *b, nir_def *def)
|
||||
{
|
||||
nir_foreach_use(src, def) {
|
||||
nir_instr *instr = nir_src_parent_instr(src);
|
||||
nir_instr *instr = nir_src_use_instr(src);
|
||||
|
||||
if (instr->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ lower_64b_reg(nir_builder *b, nir_intrinsic_instr *reg)
|
|||
|
||||
nir_foreach_reg_store_safe (store_reg_src, reg) {
|
||||
nir_intrinsic_instr *store =
|
||||
nir_instr_as_intrinsic(nir_src_parent_instr(store_reg_src));
|
||||
nir_instr_as_intrinsic(nir_src_use_instr(store_reg_src));
|
||||
b->cursor = nir_before_instr(&store->instr);
|
||||
|
||||
nir_def *packed = store->src[0].ssa;
|
||||
|
|
@ -153,7 +153,7 @@ lower_64b_reg(nir_builder *b, nir_intrinsic_instr *reg)
|
|||
|
||||
nir_foreach_reg_load_safe (load_reg_src, reg) {
|
||||
nir_intrinsic_instr *load =
|
||||
nir_instr_as_intrinsic(nir_src_parent_instr(load_reg_src));
|
||||
nir_instr_as_intrinsic(nir_src_use_instr(load_reg_src));
|
||||
b->cursor = nir_before_instr(&load->instr);
|
||||
|
||||
int base = nir_intrinsic_base(load);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ all_uses_float(nir_def *def, bool allow_src2)
|
|||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(use_instr);
|
||||
|
|
@ -66,7 +66,7 @@ all_uses_bit(nir_def *def)
|
|||
if (nir_src_is_if(use))
|
||||
return false;
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use);
|
||||
nir_instr *use_instr = nir_src_use_instr(use);
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
nir_alu_instr *use_alu = nir_instr_as_alu(use_instr);
|
||||
|
|
@ -222,7 +222,7 @@ rewrite_cost(nir_def *def, const void *data)
|
|||
|
||||
bool mov_needed = false;
|
||||
nir_foreach_use (use, def) {
|
||||
nir_instr *parent_instr = nir_src_parent_instr(use);
|
||||
nir_instr *parent_instr = nir_src_use_instr(use);
|
||||
if (parent_instr->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(parent_instr);
|
||||
if (alu->op == nir_op_vec2 ||
|
||||
|
|
|
|||
|
|
@ -2854,7 +2854,7 @@ glsl_sampler_to_pipe(int sampler_dim, bool is_array)
|
|||
static uint32_t
|
||||
get_src_index(nir_src *src)
|
||||
{
|
||||
nir_instr *instr = nir_src_parent_instr(src);
|
||||
nir_instr *instr = nir_src_use_instr(src);
|
||||
switch (instr->type) {
|
||||
case nir_instr_type_alu: {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
|
|
@ -2952,7 +2952,7 @@ get_src(struct lp_build_nir_soa_context *bld, nir_src *src, uint32_t component)
|
|||
return bld->ssa_defs[src->ssa->index * NIR_MAX_VEC_COMPONENTS * 2 + NIR_MAX_VEC_COMPONENTS + component];
|
||||
|
||||
LLVMValueRef result[NIR_MAX_VEC_COMPONENTS] = { NULL };
|
||||
get_instr_src_vec(bld, nir_src_parent_instr(src), get_src_index(src), result);
|
||||
get_instr_src_vec(bld, nir_src_use_instr(src), get_src_index(src), result);
|
||||
return result[component];
|
||||
}
|
||||
|
||||
|
|
@ -3009,7 +3009,7 @@ assign_ssa_dest(struct lp_build_nir_soa_context *bld, const nir_def *ssa,
|
|||
nir_foreach_use_including_if(use, ssa) {
|
||||
bool use_divergent = nir_src_is_if(use);
|
||||
if (!use_divergent)
|
||||
use_divergent = lp_nir_instr_src_divergent(nir_src_parent_instr(use), get_src_index(use));
|
||||
use_divergent = lp_nir_instr_src_divergent(nir_src_use_instr(use), get_src_index(use));
|
||||
used_by_divergent |= use_divergent;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -761,10 +761,10 @@ ntt_try_store_in_tgsi_output_with_use(struct ntt_compile *c,
|
|||
if (nir_src_is_if(src))
|
||||
return false;
|
||||
|
||||
if (nir_src_parent_instr(src)->type != nir_instr_type_intrinsic)
|
||||
if (nir_src_use_instr(src)->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
if (intr->intrinsic != nir_intrinsic_store_output ||
|
||||
!nir_src_is_const(intr->src[1])) {
|
||||
return false;
|
||||
|
|
@ -792,7 +792,7 @@ ntt_try_store_reg_in_tgsi_output(struct ntt_compile *c, struct ureg_dst *dst,
|
|||
/* Look for a single use for try_store_in_tgsi_output */
|
||||
nir_src *use = NULL;
|
||||
nir_foreach_reg_load(src, reg_decl) {
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
nir_foreach_use_including_if(load_use, &load->def) {
|
||||
/* We can only have one use */
|
||||
if (use != NULL)
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ vec_dest_has_swizzle(nir_alu_instr *vec, nir_def *ssa)
|
|||
|
||||
/* don't deal with possible bypassed vec/mov chain */
|
||||
nir_foreach_use(use_src, ssa) {
|
||||
nir_instr *instr = nir_src_parent_instr(use_src);
|
||||
nir_instr *instr = nir_src_use_instr(use_src);
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ lower_alu(struct etna_compile *c, nir_alu_instr *alu)
|
|||
/* check that vecN instruction is only user of this */
|
||||
bool need_mov = false;
|
||||
nir_foreach_use_including_if(use_src, ssa) {
|
||||
if (nir_src_is_if(use_src) || nir_src_parent_instr(use_src) != &alu->instr)
|
||||
if (nir_src_is_if(use_src) || nir_src_use_instr(use_src) != &alu->instr)
|
||||
need_mov = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ real_def(nir_def *def, unsigned *swiz, unsigned *mask)
|
|||
* we can apply the same logic to movs in a some cases too
|
||||
*/
|
||||
nir_foreach_use(use_src, def) {
|
||||
nir_instr *instr = nir_src_parent_instr(use_src);
|
||||
nir_instr *instr = nir_src_use_instr(use_src);
|
||||
|
||||
/* src bypass check: for now only deal with tex src mov case
|
||||
* note: for alu don't bypass mov for multiple uniform sources
|
||||
|
|
@ -240,7 +240,7 @@ real_def(nir_def *def, unsigned *swiz, unsigned *mask)
|
|||
case nir_op_vec4:
|
||||
assert(!nir_def_used_by_if(def));
|
||||
nir_foreach_use(use_src, def)
|
||||
assert(nir_src_parent_instr(use_src) == instr);
|
||||
assert(nir_src_use_instr(use_src) == instr);
|
||||
|
||||
update_swiz_mask(alu, def, swiz, mask);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static void register_node_ssa(gpir_block *block, gpir_node *node, nir_def *ssa)
|
|||
*/
|
||||
bool needs_register = false;
|
||||
nir_foreach_use(use, ssa) {
|
||||
if (nir_src_parent_instr(use)->block != nir_def_block(ssa)) {
|
||||
if (nir_src_use_instr(use)->block != nir_def_block(ssa)) {
|
||||
needs_register = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ static void register_node_ssa(gpir_block *block, gpir_node *node, nir_def *ssa)
|
|||
|
||||
if (!needs_register) {
|
||||
nir_foreach_if_use(use, ssa) {
|
||||
if (nir_cf_node_prev(&nir_src_parent_if(use)->cf_node) !=
|
||||
if (nir_cf_node_prev(&nir_src_use_if(use)->cf_node) !=
|
||||
&nir_def_block(ssa)->cf_node) {
|
||||
needs_register = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ duplicate_def_at_use(nir_builder *b, nir_def *def, bool duplicate_for_ffma)
|
|||
nir_def *dupl;
|
||||
|
||||
if (!nir_src_is_if(use_src) &&
|
||||
last_parent_instr == nir_src_parent_instr(use_src)) {
|
||||
last_parent_instr == nir_src_use_instr(use_src)) {
|
||||
dupl = last_dupl;
|
||||
} else {
|
||||
/* if ssa use, clone for the target block
|
||||
|
|
@ -44,8 +44,8 @@ duplicate_def_at_use(nir_builder *b, nir_def *def, bool duplicate_for_ffma)
|
|||
if (nir_src_is_if(use_src)) {
|
||||
b->cursor = nir_before_def(def);
|
||||
} else {
|
||||
b->cursor = nir_before_instr(nir_src_parent_instr(use_src));
|
||||
last_parent_instr = nir_src_parent_instr(use_src);
|
||||
b->cursor = nir_before_instr(nir_src_use_instr(use_src));
|
||||
last_parent_instr = nir_src_use_instr(use_src);
|
||||
|
||||
if (duplicate_for_ffma &&
|
||||
last_parent_instr->type == nir_instr_type_alu &&
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ replace_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||
|
||||
nir_foreach_use_safe(src, &intrin->def) {
|
||||
struct hash_entry *entry =
|
||||
_mesa_hash_table_search(visited_instrs, nir_src_parent_instr(src));
|
||||
if (entry && (nir_src_parent_instr(src)->type != nir_instr_type_phi)) {
|
||||
_mesa_hash_table_search(visited_instrs, nir_src_use_instr(src));
|
||||
if (entry && (nir_src_use_instr(src)->type != nir_instr_type_phi)) {
|
||||
nir_def *def = entry->data;
|
||||
nir_src_rewrite(src, def);
|
||||
continue;
|
||||
|
|
@ -70,11 +70,11 @@ replace_intrinsic(nir_builder *b, nir_intrinsic_instr *intrin)
|
|||
b->cursor = nir_before_src(src);
|
||||
nir_def *new = clone_intrinsic(b, intrin);
|
||||
nir_src_rewrite(src, new);
|
||||
_mesa_hash_table_insert(visited_instrs, nir_src_parent_instr(src), new);
|
||||
_mesa_hash_table_insert(visited_instrs, nir_src_use_instr(src), new);
|
||||
}
|
||||
nir_foreach_if_use_safe(src, &intrin->def) {
|
||||
b->cursor = nir_before_src(src);
|
||||
nir_src_rewrite(&nir_src_parent_if(src)->condition, clone_intrinsic(b, intrin));
|
||||
nir_src_rewrite(&nir_src_use_if(src)->condition, clone_intrinsic(b, intrin));
|
||||
}
|
||||
|
||||
nir_instr_remove(&intrin->instr);
|
||||
|
|
@ -89,8 +89,8 @@ replace_load_const(nir_builder *b, nir_load_const_instr *load_const)
|
|||
|
||||
nir_foreach_use_safe(src, &load_const->def) {
|
||||
struct hash_entry *entry =
|
||||
_mesa_hash_table_search(visited_instrs, nir_src_parent_instr(src));
|
||||
if (entry && (nir_src_parent_instr(src)->type != nir_instr_type_phi)) {
|
||||
_mesa_hash_table_search(visited_instrs, nir_src_use_instr(src));
|
||||
if (entry && (nir_src_use_instr(src)->type != nir_instr_type_phi)) {
|
||||
nir_def *def = entry->data;
|
||||
nir_src_rewrite(src, def);
|
||||
continue;
|
||||
|
|
@ -100,7 +100,7 @@ replace_load_const(nir_builder *b, nir_load_const_instr *load_const)
|
|||
load_const->def.bit_size,
|
||||
load_const->value);
|
||||
nir_src_rewrite(src, new);
|
||||
_mesa_hash_table_insert(visited_instrs, nir_src_parent_instr(src), new);
|
||||
_mesa_hash_table_insert(visited_instrs, nir_src_use_instr(src), new);
|
||||
}
|
||||
|
||||
nir_instr_remove(&load_const->instr);
|
||||
|
|
|
|||
|
|
@ -306,10 +306,10 @@ ntr_try_store_in_tgsi_output_with_use(struct ntr_compile *c, struct ureg_dst *ds
|
|||
if (nir_src_is_if(src))
|
||||
return false;
|
||||
|
||||
if (nir_src_parent_instr(src)->type != nir_instr_type_intrinsic)
|
||||
if (nir_src_use_instr(src)->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
if (intr->intrinsic != nir_intrinsic_store_output || !nir_src_is_const(intr->src[1])) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ ntr_try_store_reg_in_tgsi_output(struct ntr_compile *c, struct ureg_dst *dst,
|
|||
/* Look for a single use for try_store_in_tgsi_output */
|
||||
nir_src *use = NULL;
|
||||
nir_foreach_reg_load (src, reg_decl) {
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
nir_intrinsic_instr *load = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
nir_foreach_use_including_if (load_use, &load->def) {
|
||||
/* We can only have one use */
|
||||
if (use != NULL)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ r300_is_only_used_as_float(const nir_alu_instr *instr)
|
|||
if (nir_src_is_if(src))
|
||||
return false;
|
||||
|
||||
nir_instr *user_instr = nir_src_parent_instr(src);
|
||||
nir_instr *user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type == nir_instr_type_alu) {
|
||||
nir_alu_instr *alu = nir_instr_as_alu(user_instr);
|
||||
switch (alu->op) {
|
||||
|
|
@ -129,7 +129,7 @@ remove_clip_vertex(nir_builder *b, nir_instr *instr, UNUSED void *_)
|
|||
deref->var->data.mode == nir_var_shader_out &&
|
||||
deref->var->data.location == VARYING_SLOT_CLIP_VERTEX) {
|
||||
nir_foreach_use_safe (src, &deref->def) {
|
||||
nir_instr_remove(nir_src_parent_instr(src));
|
||||
nir_instr_remove(nir_src_use_instr(src));
|
||||
}
|
||||
nir_instr_remove(instr);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ is_only_used_by_intrinsic(const nir_alu_instr *instr, nir_intrinsic_op op)
|
|||
nir_foreach_use (src, &instr->def) {
|
||||
is_used = true;
|
||||
|
||||
nir_instr *user_instr = nir_src_parent_instr(src);
|
||||
nir_instr *user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type != nir_instr_type_intrinsic)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ follow_modifiers(nir_instr *instr)
|
|||
intrin->intrinsic == nir_intrinsic_load_constant ||
|
||||
intrin->intrinsic == nir_intrinsic_load_input) {
|
||||
nir_foreach_use (use, &intrin->def) {
|
||||
if (nir_src_parent_instr(use)->type == nir_instr_type_phi)
|
||||
if (nir_src_use_instr(use)->type == nir_instr_type_phi)
|
||||
return intrin->def.index;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ get_dest_usee_mask(nir_intrinsic_instr *op)
|
|||
|
||||
nir_foreach_use(use_src, &op->def)
|
||||
{
|
||||
auto use_instr = nir_src_parent_instr(use_src);
|
||||
auto use_instr = nir_src_use_instr(use_src);
|
||||
mq.ssa_index = use_src->ssa->index;
|
||||
|
||||
switch (use_instr->type) {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ infer_nir_alu_type_from_uses_ssa(nir_def *ssa);
|
|||
static nir_alu_type
|
||||
infer_nir_alu_type_from_use(nir_src *src)
|
||||
{
|
||||
nir_instr *instr = nir_src_parent_instr(src);
|
||||
nir_instr *instr = nir_src_use_instr(src);
|
||||
nir_alu_type atype = nir_type_invalid;
|
||||
switch (instr->type) {
|
||||
case nir_instr_type_alu: {
|
||||
|
|
@ -5626,7 +5626,7 @@ static void
|
|||
fixup_deref_components(nir_deref_instr *deref)
|
||||
{
|
||||
nir_foreach_use(src, &deref->def) {
|
||||
nir_instr *user_instr = nir_src_parent_instr(src);
|
||||
nir_instr *user_instr = nir_src_use_instr(src);
|
||||
if (user_instr->type != nir_instr_type_deref)
|
||||
continue;
|
||||
nir_deref_instr *user_deref = nir_instr_as_deref(user_instr);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ lvp_lower_node_payload_deref(nir_builder *b, nir_instr *instr, void *data)
|
|||
nir_def_rewrite_uses(&deref->def, &cast->def);
|
||||
} else {
|
||||
nir_foreach_use_safe(use, &deref->def) {
|
||||
b->cursor = nir_before_instr(nir_src_parent_instr(use));
|
||||
b->cursor = nir_before_instr(nir_src_use_instr(use));
|
||||
nir_def *payload = nir_load_var(b, deref->var);
|
||||
nir_deref_instr *cast =
|
||||
nir_build_deref_cast(b, payload, nir_var_mem_global, deref->type, 0);
|
||||
|
|
|
|||
|
|
@ -1029,7 +1029,7 @@ remat_load_const(nir_builder *b, nir_instr *instr, UNUSED void *cb_data)
|
|||
return false;
|
||||
|
||||
nir_foreach_use_safe (src, &nconst->def) {
|
||||
nir_instr *use_instr = nir_src_parent_instr(src);
|
||||
nir_instr *use_instr = nir_src_use_instr(src);
|
||||
b->cursor = nir_before_instr(use_instr);
|
||||
|
||||
nir_def *remat_const = nir_build_imm(b,
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ verify_users(nir_instr_worklist *sources, struct set *verified_phis,
|
|||
return false;
|
||||
|
||||
nir_foreach_use(use, src_def) {
|
||||
nir_instr *user_instr = nir_src_parent_instr(use);
|
||||
nir_instr *user_instr = nir_src_use_instr(use);
|
||||
|
||||
if (user_instr->type == nir_instr_type_phi) {
|
||||
nir_instr_worklist_push_tail(sources, user_instr);
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ intel_nir_cleanup_resource_intel_instr(nir_builder *b,
|
|||
|
||||
bool progress = false;
|
||||
nir_foreach_use_safe(src, &intrin->def) {
|
||||
if (!nir_src_is_if(src) && skip_resource_intel_cleanup(nir_src_parent_instr(src)))
|
||||
if (!nir_src_is_if(src) && skip_resource_intel_cleanup(nir_src_use_instr(src)))
|
||||
continue;
|
||||
|
||||
progress = true;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ are_all_uses_fadd(nir_def *def)
|
|||
if (nir_src_is_if(use_src))
|
||||
return false;
|
||||
|
||||
nir_instr *use_instr = nir_src_parent_instr(use_src);
|
||||
nir_instr *use_instr = nir_src_use_instr(use_src);
|
||||
if (use_instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ clc_lower_input_image_deref(nir_builder *b, struct clc_image_lower_context *cont
|
|||
nir_foreach_use_safe(src, &context->deref->def) {
|
||||
enum image_type type;
|
||||
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intrinsic = nir_instr_as_intrinsic(nir_src_parent_instr(src));
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_intrinsic) {
|
||||
nir_intrinsic_instr *intrinsic = nir_instr_as_intrinsic(nir_src_use_instr(src));
|
||||
nir_alu_type dest_type;
|
||||
|
||||
b->cursor = nir_before_instr(&intrinsic->instr);
|
||||
|
|
@ -247,9 +247,9 @@ clc_lower_input_image_deref(nir_builder *b, struct clc_image_lower_context *cont
|
|||
default:
|
||||
UNREACHABLE("Unsupported image intrinsic");
|
||||
}
|
||||
} else if (nir_src_parent_instr(src)->type == nir_instr_type_tex) {
|
||||
} else if (nir_src_use_instr(src)->type == nir_instr_type_tex) {
|
||||
assert(in_var->data.access & ACCESS_NON_WRITEABLE);
|
||||
nir_tex_instr *tex = nir_instr_as_tex(nir_src_parent_instr(src));
|
||||
nir_tex_instr *tex = nir_instr_as_tex(nir_src_use_instr(src));
|
||||
|
||||
switch (nir_alu_type_get_base_type(tex->dest_type)) {
|
||||
case nir_type_float: type = FLOAT4; break;
|
||||
|
|
|
|||
|
|
@ -2205,13 +2205,13 @@ add_def_to_worklist(nir_def *def, void *state)
|
|||
{
|
||||
nir_foreach_use_including_if(src, def) {
|
||||
if (nir_src_is_if(src)) {
|
||||
nir_if *nif = nir_src_parent_if(src);
|
||||
nir_if *nif = nir_src_use_if(src);
|
||||
nir_foreach_block_in_cf_node(block, &nif->cf_node) {
|
||||
nir_foreach_instr(instr, block)
|
||||
nir_instr_worklist_push_tail(state, instr);
|
||||
}
|
||||
} else
|
||||
nir_instr_worklist_push_tail(state, nir_src_parent_instr(src));
|
||||
nir_instr_worklist_push_tail(state, nir_src_use_instr(src));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2136,7 +2136,7 @@ static bool
|
|||
is_phi_src(nir_def *ssa)
|
||||
{
|
||||
nir_foreach_use(src, ssa)
|
||||
if (nir_src_parent_instr(src)->type == nir_instr_type_phi)
|
||||
if (nir_src_use_instr(src)->type == nir_instr_type_phi)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,8 +355,8 @@ try_remat_ldcx_alu_use(nir_builder *b, nir_alu_instr *alu, uint8_t src_idx,
|
|||
nir_instr_insert(nir_before_instr(&alu->instr), &new_load->instr);
|
||||
|
||||
nir_foreach_use_safe(use, &load->def) {
|
||||
if (nir_src_parent_instr(use)->type == nir_instr_type_alu &&
|
||||
nir_src_parent_instr(use)->block == alu->instr.block)
|
||||
if (nir_src_use_instr(use)->type == nir_instr_type_alu &&
|
||||
nir_src_use_instr(use)->block == alu->instr.block)
|
||||
nir_src_rewrite(use, &new_load->def);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1185,7 +1185,7 @@ bifrost_nir_lower_vs_atomics_impl(nir_builder *b, nir_intrinsic_instr *intr,
|
|||
|
||||
unsigned output_mask = 0;
|
||||
nir_foreach_use(use, &intr->def) {
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
if (parent->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ bool nir_fuse_io_16(nir_shader *shader);
|
|||
static bool
|
||||
nir_src_is_f2fmp(nir_src *use)
|
||||
{
|
||||
nir_instr *parent = nir_src_parent_instr(use);
|
||||
nir_instr *parent = nir_src_use_instr(use);
|
||||
|
||||
if (parent->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue