From 6700d7e423bb2d7c5f0b46740bd92b5e65679eaf Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 14 Aug 2015 10:18:39 -0700 Subject: nir: add nir_{src,dest}_bit_size() helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: use a ternary (Jason) Reviewed-by: Jason Ekstrand Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Iago Toral Quiroga --- src/compiler/nir/nir.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/compiler/nir') 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); -- cgit v1.2.3