diff options
author | Jason Ekstrand <[email protected]> | 2018-03-14 21:44:51 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-03-30 17:20:27 -0700 |
commit | 956f17395bfcf7f8ce9dd5ac9fd14a13e86f3a8f (patch) | |
tree | 8f25edb4a57f7eb81651e250f8cdd985463b0142 /src/compiler/nir | |
parent | bebf758c4925d828b3df5e0f4168abc56e71859d (diff) |
nir: Add src/dest num_components helpers
We already have these for bit_size
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir')
-rw-r--r-- | src/compiler/nir/nir.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 9fff1f4647d..5ba6a1f0687 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -632,11 +632,23 @@ nir_src_bit_size(nir_src src) } static inline unsigned +nir_src_num_components(nir_src src) +{ + return src.is_ssa ? src.ssa->num_components : src.reg.reg->num_components; +} + +static inline unsigned nir_dest_bit_size(nir_dest dest) { return dest.is_ssa ? dest.ssa.bit_size : dest.reg.reg->bit_size; } +static inline unsigned +nir_dest_num_components(nir_dest dest) +{ + return dest.is_ssa ? dest.ssa.num_components : dest.reg.reg->num_components; +} + void nir_src_copy(nir_src *dest, const nir_src *src, void *instr_or_if); void nir_dest_copy(nir_dest *dest, const nir_dest *src, nir_instr *instr); |