summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Abbott <connor.w.abbott@intel.com>2015-08-14 10:18:39 -0700
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>2016-03-17 11:16:33 +0100
commit6700d7e423bb2d7c5f0b46740bd92b5e65679eaf (patch)
treefd78bf82762c68eb5c9ad16a2ca99476713eeb46
parente172dbe5d2e9a4effd92823cd8ebc342e0928a36 (diff)
nir: add nir_{src,dest}_bit_size() helpers
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>
-rw-r--r--src/compiler/nir/nir.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 8f411793d9..6413f438ee 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);