summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qir.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-06-25 19:49:07 -0700
committerEric Anholt <[email protected]>2016-07-04 16:33:22 -0700
commitac772b24a18bddc490dae171441795dedd85d7b2 (patch)
treebf3e17b02a62a36bb3eba706913e26866f8857d9 /src/gallium/drivers/vc4/vc4_qir.c
parent8a52f03f5deeb36ea4d58d56fbb711a2004d7587 (diff)
vc4: Regularize instruction emit macros
ALU0 didn't have the _dest variant, and ALU2 didn't unset the def the way ALU1 did. This should make the ALU[012] macros much clearer, by moving most of their contents to vc4_qir.c
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qir.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 526e3a179aa..5d5ba1f0e13 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -376,13 +376,37 @@ qir_inst4(enum qop op, struct qreg dst,
return inst;
}
-void
+static void
qir_emit(struct vc4_compile *c, struct qinst *inst)
{
+ list_addtail(&inst->link, &c->instructions);
+}
+
+/* Updates inst to write to a new temporary, emits it, and notes the def. */
+struct qreg
+qir_emit_def(struct vc4_compile *c, struct qinst *inst)
+{
+ assert(inst->dst.file == QFILE_NULL);
+
+ inst->dst = qir_get_temp(c);
+
if (inst->dst.file == QFILE_TEMP)
c->defs[inst->dst.index] = inst;
- qir_emit_nodef(c, inst);
+ qir_emit(c, inst);
+
+ return inst->dst;
+}
+
+struct qinst *
+qir_emit_nondef(struct vc4_compile *c, struct qinst *inst)
+{
+ if (inst->dst.file == QFILE_TEMP)
+ c->defs[inst->dst.index] = NULL;
+
+ qir_emit(c, inst);
+
+ return inst;
}
bool