X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fvc4%2Fvc4_opt_cse.c;h=d3ef91083c61322d962d7dac33f182001a420c15;hb=c4b0dd53568fa276079f6b6bf7ba4b857ddd65a5;hp=511e3b94f07c67b25ebf366389d19d1c519f1289;hpb=55d2a1626219ac041ce05477827b592efa1c7b81;p=mesa.git diff --git a/src/gallium/drivers/vc4/vc4_opt_cse.c b/src/gallium/drivers/vc4/vc4_opt_cse.c index 511e3b94f07..d3ef91083c6 100644 --- a/src/gallium/drivers/vc4/vc4_opt_cse.c +++ b/src/gallium/drivers/vc4/vc4_opt_cse.c @@ -62,7 +62,8 @@ inst_key_equals(const void *a, const void *b) } static struct qinst * -vc4_find_cse(struct hash_table *ht, struct qinst *inst, uint32_t sf_count, +vc4_find_cse(struct vc4_compile *c, struct hash_table *ht, + struct qinst *inst, uint32_t sf_count, uint32_t r4_count) { if (inst->dst.file != QFILE_TEMP || @@ -90,11 +91,11 @@ vc4_find_cse(struct hash_table *ht, struct qinst *inst, uint32_t sf_count, fprintf(stderr, "CSE found match:\n"); fprintf(stderr, " Original inst: "); - qir_dump_inst(entry->data); + qir_dump_inst(c, entry->data); fprintf(stderr, "\n"); fprintf(stderr, " Our inst: "); - qir_dump_inst(inst); + qir_dump_inst(c, inst); fprintf(stderr, "\n"); } @@ -109,7 +110,7 @@ vc4_find_cse(struct hash_table *ht, struct qinst *inst, uint32_t sf_count, if (debug) { fprintf(stderr, "Added to CSE HT: "); - qir_dump_inst(inst); + qir_dump_inst(c, inst); fprintf(stderr, "\n"); } @@ -117,14 +118,13 @@ vc4_find_cse(struct hash_table *ht, struct qinst *inst, uint32_t sf_count, } bool -qir_opt_cse(struct qcompile *c) +qir_opt_cse(struct vc4_compile *c) { bool progress = false; struct simple_node *node, *t; struct qinst *last_sf = NULL; uint32_t sf_count = 0, r4_count = 0; - return false; struct hash_table *ht = _mesa_hash_table_create(NULL, inst_key_equals); if (!ht) return false; @@ -144,10 +144,10 @@ qir_opt_cse(struct qcompile *c) if (debug) { fprintf(stderr, "Removing redundant SF: "); - qir_dump_inst(inst); + qir_dump_inst(c, inst); fprintf(stderr, "\n"); } - remove_from_list(&inst->link); + qir_remove_instruction(inst); progress = true; continue; } else { @@ -155,7 +155,7 @@ qir_opt_cse(struct qcompile *c) sf_count++; } } else { - struct qinst *cse = vc4_find_cse(ht, inst, + struct qinst *cse = vc4_find_cse(c, ht, inst, sf_count, r4_count); if (cse) { inst->src[0] = cse->dst; @@ -167,13 +167,13 @@ qir_opt_cse(struct qcompile *c) if (debug) { fprintf(stderr, " Turned into: "); - qir_dump_inst(inst); + qir_dump_inst(c, inst); fprintf(stderr, "\n"); } } } - if (qir_reads_r4(inst)) + if (qir_writes_r4(inst)) r4_count++; }