Mesa (master): nvir/gm107: iterate over all defs in SchedDataCalculatorGM107::findFirstUse

Karol Herbst karolherbst at kemper.freedesktop.org
Mon Feb 26 13:42:25 UTC 2018


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

Author: Karol Herbst <kherbst at redhat.com>
Date:   Tue Dec  5 10:32:25 2017 +0100

nvir/gm107: iterate over all defs in SchedDataCalculatorGM107::findFirstUse

In the sched data calculator we have to track first use of defs by iterating
over all defs of an instruction, not just the first one.

v2: fix minGRP and maxGRP values

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Signed-off-by: Karol Herbst <kherbst at redhat.com>

---

 .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 34 ++++++++++++----------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
index b1e9f941fe..96bd276884 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
@@ -3956,31 +3956,33 @@ Instruction *
 SchedDataCalculatorGM107::findFirstUse(const Instruction *bari) const
 {
    Instruction *insn, *next;
-   int minGPR, maxGPR;
 
    if (!bari->defExists(0))
       return NULL;
 
-   minGPR = bari->def(0).rep()->reg.data.id;
-   maxGPR = minGPR + bari->def(0).rep()->reg.size / 4 - 1;
-
    for (insn = bari->next; insn != NULL; insn = next) {
       next = insn->next;
 
       for (int s = 0; insn->srcExists(s); ++s) {
          const Value *src = insn->src(s).rep();
-         if (bari->def(0).getFile() == FILE_GPR) {
-            if (insn->src(s).getFile() != FILE_GPR ||
-                src->reg.data.id + src->reg.size / 4 - 1 < minGPR ||
-                src->reg.data.id > maxGPR)
-               continue;
-            return insn;
-         } else
-         if (bari->def(0).getFile() == FILE_PREDICATE) {
-            if (insn->src(s).getFile() != FILE_PREDICATE ||
-                src->reg.data.id != minGPR)
-               continue;
-            return insn;
+         for (int d = 0; bari->defExists(d); ++d) {
+            const ValueDef &def = bari->def(d);
+            int minGPR = def.rep()->reg.data.id;
+            int maxGPR = minGPR + def.rep()->reg.size / 4 - 1;
+
+            if (def.getFile() == FILE_GPR) {
+               if (insn->src(s).getFile() != FILE_GPR ||
+                   src->reg.data.id + src->reg.size / 4 - 1 < minGPR ||
+                   src->reg.data.id > maxGPR)
+                  continue;
+               return insn;
+            } else
+            if (def.getFile() == FILE_PREDICATE) {
+               if (insn->src(s).getFile() != FILE_PREDICATE ||
+                   src->reg.data.id != minGPR)
+                  continue;
+               return insn;
+            }
          }
       }
    }




More information about the mesa-commit mailing list