In case we don't have a nir_src.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3978>
return ((ctx->func->impl->reg_alloc + ctx->temp_alloc++) << 1) | IS_REG;
}
+static inline unsigned
+nir_ssa_index(nir_ssa_def *ssa)
+{
+ return (ssa->index << 1) | 0;
+}
+
static inline unsigned
nir_src_index(compiler_context *ctx, nir_src *src)
{
if (src->is_ssa)
- return (src->ssa->index << 1) | 0;
+ return nir_ssa_index(src->ssa);
else {
assert(!src->reg.indirect);
return (src->reg.reg->index << 1) | IS_REG;