diff options
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 5b871812d46..0ba19cbb25d 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -700,6 +700,22 @@ nir_src_num_components(nir_src src) return src.is_ssa ? src.ssa->num_components : src.reg.reg->num_components; } +static inline bool +nir_src_is_const(nir_src src) +{ + return src.is_ssa && + src.ssa->parent_instr->type == nir_instr_type_load_const; +} + +int64_t nir_src_as_int(nir_src src); +uint64_t nir_src_as_uint(nir_src src); +bool nir_src_as_bool(nir_src src); +double nir_src_as_float(nir_src src); +int64_t nir_src_comp_as_int(nir_src src, unsigned component); +uint64_t nir_src_comp_as_uint(nir_src src, unsigned component); +bool nir_src_comp_as_bool(nir_src src, unsigned component); +double nir_src_comp_as_float(nir_src src, unsigned component); + static inline unsigned nir_dest_bit_size(nir_dest dest) { |