nir+drivers: add helpers to get # of src/dest components

Add helpers to get the number of src/dest components for an intrinsic,
and update spots that were open-coding this logic to use the helpers
instead.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Rob Clark
2018-03-28 08:32:10 -04:00
parent 91f9450b32
commit 51888bf07d
6 changed files with 32 additions and 25 deletions

View File

@@ -257,10 +257,7 @@ copy_prop_instr(nir_instr *instr)
nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
for (unsigned i = 0;
i < nir_intrinsic_infos[intrin->intrinsic].num_srcs; i++) {
unsigned num_components =
nir_intrinsic_infos[intrin->intrinsic].src_components[i];
if (!num_components)
num_components = intrin->num_components;
unsigned num_components = nir_intrinsic_src_components(intrin, i);
while (copy_prop_src(&intrin->src[i], instr, NULL, num_components))
progress = true;