nir: Add src and dest constructors
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 21 Jan 2015 19:10:11 +0000 (11:10 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 21 Jan 2015 20:21:10 +0000 (12:21 -0800)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir.h

index 5ebfc5a1bbc25b9df63a27efe0796fc17471403d..7b5794d7470482863379f70507998c3aef3912f7 100644 (file)
@@ -482,6 +482,43 @@ typedef struct {
    bool is_ssa;
 } nir_dest;
 
+static inline nir_src
+nir_src_for_ssa(nir_ssa_def *def)
+{
+   nir_src src;
+
+   src.is_ssa = true;
+   src.ssa = def;
+
+   return src;
+}
+
+static inline nir_src
+nir_src_for_reg(nir_register *reg)
+{
+   nir_src src;
+
+   src.is_ssa = false;
+   src.reg.reg = reg;
+   src.reg.indirect = NULL;
+   src.reg.base_offset = 0;
+
+   return src;
+}
+
+static inline nir_dest
+nir_dest_for_reg(nir_register *reg)
+{
+   nir_dest dest;
+
+   dest.is_ssa = false;
+   dest.reg.reg = reg;
+   dest.reg.indirect = NULL;
+   dest.reg.base_offset = 0;
+
+   return dest;
+}
+
 nir_src nir_src_copy(nir_src src, void *mem_ctx);
 nir_dest nir_dest_copy(nir_dest dest, void *mem_ctx);