nir/builder: Add a build_deref_array_imm helper
Unlike most of the cases in which we do this by hand, the new helper properly handles non-32-bit pointers. Reviewed-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:

committed by
Jason Ekstrand

parent
fcf2a0122e
commit
1664de5924
@@ -843,6 +843,17 @@ nir_build_deref_array(nir_builder *build, nir_deref_instr *parent,
|
||||
return deref;
|
||||
}
|
||||
|
||||
static inline nir_deref_instr *
|
||||
nir_build_deref_array_imm(nir_builder *build, nir_deref_instr *parent,
|
||||
int64_t index)
|
||||
{
|
||||
assert(parent->dest.is_ssa);
|
||||
nir_ssa_def *idx_ssa = nir_imm_intN_t(build, index,
|
||||
parent->dest.ssa.bit_size);
|
||||
|
||||
return nir_build_deref_array(build, parent, idx_ssa);
|
||||
}
|
||||
|
||||
static inline nir_deref_instr *
|
||||
nir_build_deref_ptr_as_array(nir_builder *build, nir_deref_instr *parent,
|
||||
nir_ssa_def *index)
|
||||
|
Reference in New Issue
Block a user