mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
treewide: Use nir_deref_instr_is_arr()
Via coccinelle and some manual fixups. @@ expression e1; @@ - e1->deref_type == nir_deref_type_array || e1->deref_type == nir_deref_type_ptr_as_array + nir_deref_instr_is_arr(e1) Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38856>
This commit is contained in:
parent
263a82f49b
commit
dc44c0f32b
6 changed files with 6 additions and 12 deletions
|
|
@ -129,8 +129,7 @@ nir_deref_instr_has_indirect(nir_deref_instr *instr)
|
||||||
if (instr->deref_type == nir_deref_type_cast)
|
if (instr->deref_type == nir_deref_type_cast)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((instr->deref_type == nir_deref_type_array ||
|
if (nir_deref_instr_is_arr(instr) &&
|
||||||
instr->deref_type == nir_deref_type_ptr_as_array) &&
|
|
||||||
!nir_src_is_const(instr->arr.index))
|
!nir_src_is_const(instr->arr.index))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,8 +281,7 @@ pin_intrinsic(nir_intrinsic_instr *intrin)
|
||||||
nir_var_mem_push_const)) {
|
nir_var_mem_push_const)) {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
while (deref->deref_type != nir_deref_type_var) {
|
while (deref->deref_type != nir_deref_type_var) {
|
||||||
if ((deref->deref_type == nir_deref_type_array ||
|
if (nir_deref_instr_is_arr(deref) &&
|
||||||
deref->deref_type == nir_deref_type_ptr_as_array) &&
|
|
||||||
!nir_src_is_always_uniform(deref->arr.index)) {
|
!nir_src_is_always_uniform(deref->arr.index)) {
|
||||||
instr->pass_flags = GCM_INSTR_PINNED;
|
instr->pass_flags = GCM_INSTR_PINNED;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -838,8 +838,7 @@ is_indirect_load(nir_instr *instr)
|
||||||
if (!nir_deref_mode_may_be(deref, mem_modes))
|
if (!nir_deref_mode_may_be(deref, mem_modes))
|
||||||
return false;
|
return false;
|
||||||
while (deref) {
|
while (deref) {
|
||||||
if ((deref->deref_type == nir_deref_type_array ||
|
if (nir_deref_instr_is_arr(deref) &&
|
||||||
deref->deref_type == nir_deref_type_ptr_as_array) &&
|
|
||||||
!nir_src_is_const(deref->arr.index)) {
|
!nir_src_is_const(deref->arr.index)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1144,8 +1144,7 @@ print_deref_instr(nir_deref_instr *instr, print_state *state)
|
||||||
instr->cast.align_mul, instr->cast.align_offset);
|
instr->cast.align_mul, instr->cast.align_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instr->deref_type == nir_deref_type_array ||
|
if (nir_deref_instr_is_arr(instr)) {
|
||||||
instr->deref_type == nir_deref_type_ptr_as_array) {
|
|
||||||
if (instr->arr.in_bounds)
|
if (instr->arr.in_bounds)
|
||||||
fprintf(fp, " (in bounds)");
|
fprintf(fp, " (in bounds)");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -915,8 +915,7 @@ write_deref(write_ctx *ctx, const nir_deref_instr *deref)
|
||||||
header.deref_var.object_idx = var_idx;
|
header.deref_var.object_idx = var_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deref->deref_type == nir_deref_type_array ||
|
if (nir_deref_instr_is_arr(deref)) {
|
||||||
deref->deref_type == nir_deref_type_ptr_as_array) {
|
|
||||||
header.deref.packed_src_ssa_16bit = are_object_ids_16bit(ctx);
|
header.deref.packed_src_ssa_16bit = are_object_ids_16bit(ctx);
|
||||||
|
|
||||||
header.deref.in_bounds = deref->arr.in_bounds;
|
header.deref.in_bounds = deref->arr.in_bounds;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,7 @@ resize_deref(nir_builder *b, nir_deref_instr *deref,
|
||||||
|
|
||||||
/* NIR requires array indices have to match the deref bit size */
|
/* NIR requires array indices have to match the deref bit size */
|
||||||
if (deref->def.bit_size != bit_size &&
|
if (deref->def.bit_size != bit_size &&
|
||||||
(deref->deref_type == nir_deref_type_array ||
|
nir_deref_instr_is_arr(deref)) {
|
||||||
deref->deref_type == nir_deref_type_ptr_as_array)) {
|
|
||||||
b->cursor = nir_before_instr(&deref->instr);
|
b->cursor = nir_before_instr(&deref->instr);
|
||||||
nir_def *idx;
|
nir_def *idx;
|
||||||
if (nir_src_is_const(deref->arr.index)) {
|
if (nir_src_is_const(deref->arr.index)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue