}
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 ||
uint32_t hash = _mesa_hash_data(&key, sizeof(key));
struct hash_entry *entry =
- _mesa_hash_table_search(ht, hash, &key);
+ _mesa_hash_table_search_pre_hashed(ht, hash, &key);
if (entry) {
if (debug) {
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");
}
if (!alloc_key)
return NULL;
memcpy(alloc_key, &key, sizeof(*alloc_key));
- _mesa_hash_table_insert(ht, hash, alloc_key, inst);
+ _mesa_hash_table_insert_with_hash(ht, hash, alloc_key, inst);
if (debug) {
fprintf(stderr, "Added to CSE HT: ");
- qir_dump_inst(inst);
+ qir_dump_inst(c, inst);
fprintf(stderr, "\n");
}
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);
+ struct hash_table *ht = _mesa_hash_table_create(NULL, NULL,
+ inst_key_equals);
if (!ht)
return false;
foreach_s(node, t, &c->instructions) {
struct qinst *inst = (struct qinst *)node;
- if (qir_has_side_effects(inst)) {
+ if (qir_has_side_effects(c, inst)) {
if (inst->op == QOP_TLB_DISCARD_SETUP)
last_sf = NULL;
continue;
if (debug) {
fprintf(stderr,
"Removing redundant SF: ");
- qir_dump_inst(inst);
+ qir_dump_inst(c, inst);
fprintf(stderr, "\n");
}
qir_remove_instruction(inst);
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;
if (debug) {
fprintf(stderr, " Turned into: ");
- qir_dump_inst(inst);
+ qir_dump_inst(c, inst);
fprintf(stderr, "\n");
}
}