i965/fs: Switch opt_cse() to the fs_builder constructor from instruction.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
Francisco Jerez 2015-07-27 19:18:51 +03:00
parent 992cda2c8a
commit 5e645e68d6
1 changed files with 8 additions and 8 deletions

View File

@ -180,8 +180,6 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate)
{
int written = inst->regs_written;
int dst_width = inst->exec_size / 8;
const fs_builder ubld = bld.exec_all(inst->force_writemask_all)
.group(inst->exec_size, inst->force_sechalf);
fs_inst *copy;
if (written > dst_width) {
@ -204,11 +202,11 @@ create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate)
}
for (int i = header_size; i < sources; i++) {
payload[i] = src;
src = offset(src, ubld, 1);
src = offset(src, bld, 1);
}
copy = ubld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size);
copy = bld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size);
} else {
copy = ubld.MOV(inst->dst, src);
copy = bld.MOV(inst->dst, src);
copy->src[0].negate = negate;
}
assert(copy->regs_written == written);
@ -258,13 +256,14 @@ fs_visitor::opt_cse_local(bblock_t *block)
*/
bool no_existing_temp = entry->tmp.file == BAD_FILE;
if (no_existing_temp && !entry->generator->dst.is_null()) {
const fs_builder ibld = fs_builder(this, block, entry->generator)
.at(block, entry->generator->next);
int written = entry->generator->regs_written;
entry->tmp = fs_reg(GRF, alloc.allocate(written),
entry->generator->dst.type);
create_copy_instr(bld.at(block, entry->generator->next),
entry->generator, entry->tmp, false);
create_copy_instr(ibld, entry->generator, entry->tmp, false);
entry->generator->dst = entry->tmp;
}
@ -273,8 +272,9 @@ fs_visitor::opt_cse_local(bblock_t *block)
if (!inst->dst.is_null()) {
assert(inst->regs_written == entry->generator->regs_written);
assert(inst->dst.type == entry->tmp.type);
const fs_builder ibld(this, block, inst);
create_copy_instr(bld.at(block, inst), inst, entry->tmp, negate);
create_copy_instr(ibld, inst, entry->tmp, negate);
}
/* Set our iterator so that next time through the loop inst->next