diff options
author | Jason Ekstrand <[email protected]> | 2015-01-21 11:10:11 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-21 12:21:10 -0800 |
commit | 7da60eca4f9e8b8e38b709e728ea94b07be1b0e4 (patch) | |
tree | a4ab4585411a2ff831959b4b0472793c21bbd15b /src/glsl/nir | |
parent | 3c3e60e050ea0850fcfeb5c4c2aa4f954d54d665 (diff) |
nir: Add src and dest constructors
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r-- | src/glsl/nir/nir.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 5ebfc5a1bbc..7b5794d7470 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -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); |