From: Eric Anholt Date: Wed, 16 Jul 2014 16:09:05 +0000 (-0700) Subject: vc4: Add more useful debug for the undefined-source case X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32948ca768fec6debdcdafa58bce2b65c328250d;p=mesa.git vc4: Add more useful debug for the undefined-source case We could get undefined sources in real programs from the wild, so we'll need to turn off this debug eventually. But for now, using undefined sources is typically me just mistyping something. --- diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c index da47539af0f..6b047023e56 100644 --- a/src/gallium/drivers/vc4/vc4_qpu_emit.c +++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c @@ -266,11 +266,18 @@ vc4_generate_code(struct qcompile *c) src[i] = qpu_rn(0); break; case QFILE_TEMP: - assert(reg_allocated[index] != -1); - src[i] = allocate_to_qpu_reg[reg_allocated[index]]; - reg_uses_remaining[index]--; - if (reg_uses_remaining[index] == 0) - reg_in_use[reg_allocated[index]] = false; + if (reg_allocated[index] == -1) { + fprintf(stderr, "undefined reg use: "); + qir_dump_inst(qinst); + fprintf(stderr, "\n"); + + src[i] = qpu_rn(0); + } else { + src[i] = allocate_to_qpu_reg[reg_allocated[index]]; + reg_uses_remaining[index]--; + if (reg_uses_remaining[index] == 0) + reg_in_use[reg_allocated[index]] = false; + } break; case QFILE_UNIF: src[i] = qpu_unif();