vc4: Put dead writes into the NOP register when generating code.
authorEric Anholt <eric@anholt.net>
Tue, 23 Sep 2014 20:20:29 +0000 (13:20 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 23 Sep 2014 20:51:42 +0000 (13:51 -0700)
They still provide register pressure since I haven't made a special class
for them, but since they're only live for one instruction it probably
doesn't matter.

This improves the readability of QPU assembly.

src/gallium/drivers/vc4/vc4_register_allocate.c

index 639037e60f7b7526fa2ecb9ae5cd6303a33a8b71..72f5271d653b09e94fb3146e56bdc136f5d755e6 100644 (file)
@@ -237,9 +237,16 @@ vc4_register_allocate(struct vc4_context *vc4, struct vc4_compile *c)
         bool ok = ra_allocate(g);
         assert(ok);
 
-        for (uint32_t i = 0; i < c->num_temps; i++)
+        for (uint32_t i = 0; i < c->num_temps; i++) {
                 temp_registers[i] = vc4_regs[ra_get_node_reg(g, i)];
 
+                /* If the value's never used, just write to the NOP register
+                 * for clarity in debug output.
+                 */
+                if (def[i] == use[i])
+                        temp_registers[i] = qpu_ra(QPU_W_NOP);
+        }
+
         ralloc_free(g);
 
         return temp_registers;