nir: add nir_{src,dest}_bit_size() helpers
authorConnor Abbott <connor.w.abbott@intel.com>
Fri, 14 Aug 2015 17:18:39 +0000 (10:18 -0700)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Thu, 17 Mar 2016 10:16:33 +0000 (11:16 +0100)
v2: use a ternary (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/compiler/nir/nir.h

index 8f411793d9d4d3c1f1e7fc65ae6cfa004c432f99..6413f438ee31b3f98ab267b21efa36a074333edd 100644 (file)
@@ -564,6 +564,18 @@ nir_dest_for_reg(nir_register *reg)
    return dest;
 }
 
+static inline unsigned
+nir_src_bit_size(nir_src src)
+{
+   return src.is_ssa ? src.ssa->bit_size : src.reg.reg->bit_size;
+}
+
+static inline unsigned
+nir_dest_bit_size(nir_dest dest)
+{
+   return dest.is_ssa ? dest.ssa.bit_size : dest.reg.reg->bit_size;
+}
+
 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);