From: Connor Abbott Date: Fri, 14 Aug 2015 17:18:39 +0000 (-0700) Subject: nir: add nir_{src,dest}_bit_size() helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6700d7e423bb2d7c5f0b46740bd92b5e65679eaf;p=mesa.git nir: add nir_{src,dest}_bit_size() helpers v2: use a ternary (Jason) Reviewed-by: Jason Ekstrand Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Iago Toral Quiroga --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 8f411793d9d..6413f438ee3 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -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);