nir: Add src/dest num_components helpers
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Mar 2018 04:44:51 +0000 (21:44 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 31 Mar 2018 00:20:27 +0000 (17:20 -0700)
We already have these for bit_size

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir.h

index 9fff1f4647d5c34897a143d766be061bee49f477..5ba6a1f0687877b428e60ef8f1c9c7dd0845b44d 100644 (file)
@@ -631,12 +631,24 @@ nir_src_bit_size(nir_src src)
    return src.is_ssa ? src.ssa->bit_size : src.reg.reg->bit_size;
 }
 
+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);