summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-11-15 14:35:12 -0800
committerEric Anholt <[email protected]>2016-11-29 08:38:59 -0800
commitf4baf809937c98dabee90ea57b9d7e6135bdb0df (patch)
treee292072ff951813b8cc4729a99761c2f98218bb6 /src/gallium
parenta025983dd9cfcba8a452205efbc5c0be8ff3da74 (diff)
vc4: Restructure VPM write optimization into two passes.
For texturing, there won't be a fixed limit on how many writes there are, so we need to compute uses up front.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/vc4/vc4_opt_coalesce_ff_writes.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_coalesce_ff_writes.c b/src/gallium/drivers/vc4/vc4_opt_coalesce_ff_writes.c
index 4e5b1193d3a..c08c02619f7 100644
--- a/src/gallium/drivers/vc4/vc4_opt_coalesce_ff_writes.c
+++ b/src/gallium/drivers/vc4/vc4_opt_coalesce_ff_writes.c
@@ -42,20 +42,10 @@ qir_opt_coalesce_ff_writes(struct vc4_compile *c)
return false;
bool progress = false;
- struct qinst *vpm_writes[64] = { 0 };
uint32_t use_count[c->num_temps];
- uint32_t vpm_write_count = 0;
memset(&use_count, 0, sizeof(use_count));
qir_for_each_inst_inorder(inst, c) {
- switch (inst->dst.file) {
- case QFILE_VPM:
- vpm_writes[vpm_write_count++] = inst;
- break;
- default:
- break;
- }
-
for (int i = 0; i < qir_get_nsrc(inst); i++) {
if (inst->src[i].file == QFILE_TEMP) {
uint32_t temp = inst->src[i].index;
@@ -64,13 +54,16 @@ qir_opt_coalesce_ff_writes(struct vc4_compile *c)
}
}
- for (int i = 0; i < vpm_write_count; i++) {
- if (!qir_is_raw_mov(vpm_writes[i]) ||
- vpm_writes[i]->src[0].file != QFILE_TEMP) {
+ qir_for_each_inst_inorder(mov_inst, c) {
+ if (!qir_is_raw_mov(mov_inst) || mov_inst->sf)
+ continue;
+ if (mov_inst->src[0].file != QFILE_TEMP)
+ continue;
+
+ if (mov_inst->dst.file != QFILE_VPM)
continue;
- }
- uint32_t temp = vpm_writes[i]->src[0].index;
+ uint32_t temp = mov_inst->src[0].index;
if (use_count[temp] != 1)
continue;
@@ -89,10 +82,9 @@ qir_opt_coalesce_ff_writes(struct vc4_compile *c)
/* Move the generating instruction to the end of the program
* to maintain the order of the VPM writes.
*/
- assert(!vpm_writes[i]->sf);
list_del(&inst->link);
- list_addtail(&inst->link, &vpm_writes[i]->link);
- qir_remove_instruction(c, vpm_writes[i]);
+ list_addtail(&inst->link, &mov_inst->link);
+ qir_remove_instruction(c, mov_inst);
c->defs[inst->dst.index] = NULL;
inst->dst.file = QFILE_VPM;