Mesa (master): vc4: Move follow_movs() to common QIR code.

Eric Anholt anholt at kemper.freedesktop.org
Thu Dec 18 03:36:48 UTC 2014


Module: Mesa
Branch: master
Commit: ff266483fb61fd69775daf5c931ca7a56a26f4ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff266483fb61fd69775daf5c931ca7a56a26f4ac

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Dec 10 15:37:07 2014 -0800

vc4: Move follow_movs() to common QIR code.

I want this from other passes.

---

 src/gallium/drivers/vc4/vc4_opt_algebraic.c |   13 ++-----------
 src/gallium/drivers/vc4/vc4_qir.c           |    9 +++++++++
 src/gallium/drivers/vc4/vc4_qir.h           |    1 +
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_opt_algebraic.c b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
index ec526fb..4376c7b 100644
--- a/src/gallium/drivers/vc4/vc4_opt_algebraic.c
+++ b/src/gallium/drivers/vc4/vc4_opt_algebraic.c
@@ -59,19 +59,10 @@ dump_to(struct vc4_compile *c, struct qinst *inst)
         fprintf(stderr, "\n");
 }
 
-static struct qreg
-follow_movs(struct qinst **defs, struct qreg reg)
-{
-        while (reg.file == QFILE_TEMP && defs[reg.index]->op == QOP_MOV)
-                reg = defs[reg.index]->src[0];
-
-        return reg;
-}
-
 static bool
 is_zero(struct vc4_compile *c, struct qinst **defs, struct qreg reg)
 {
-        reg = follow_movs(defs, reg);
+        reg = qir_follow_movs(defs, reg);
 
         return (reg.file == QFILE_UNIF &&
                 c->uniform_contents[reg.index] == QUNIFORM_CONSTANT &&
@@ -81,7 +72,7 @@ is_zero(struct vc4_compile *c, struct qinst **defs, struct qreg reg)
 static bool
 is_1f(struct vc4_compile *c, struct qinst **defs, struct qreg reg)
 {
-        reg = follow_movs(defs, reg);
+        reg = qir_follow_movs(defs, reg);
 
         return (reg.file == QFILE_UNIF &&
                 c->uniform_contents[reg.index] == QUNIFORM_CONSTANT &&
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 49b7901..d7251ab 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -327,6 +327,15 @@ qir_remove_instruction(struct qinst *qinst)
         free(qinst);
 }
 
+struct qreg
+qir_follow_movs(struct qinst **defs, struct qreg reg)
+{
+        while (reg.file == QFILE_TEMP && defs[reg.index]->op == QOP_MOV)
+                reg = defs[reg.index]->src[0];
+
+        return reg;
+}
+
 void
 qir_compile_destroy(struct vc4_compile *c)
 {
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index 46f4c12..40c0d3d 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -371,6 +371,7 @@ bool qir_has_side_effects(struct vc4_compile *c, struct qinst *inst);
 bool qir_depends_on_flags(struct qinst *inst);
 bool qir_writes_r4(struct qinst *inst);
 bool qir_reads_r4(struct qinst *inst);
+struct qreg qir_follow_movs(struct qinst **defs, struct qreg reg);
 
 void qir_dump(struct vc4_compile *c);
 void qir_dump_inst(struct vc4_compile *c, struct qinst *inst);




More information about the mesa-commit mailing list