diff options
author | Francisco Jerez <[email protected]> | 2015-06-04 16:13:35 +0300 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2015-06-09 15:18:32 +0300 |
commit | 74c2458ecf492f2dd344b4f6114b13a376f90657 (patch) | |
tree | 89d28aca88cc75474a9ea881be5345b88054085a /src/mesa | |
parent | e7069fbc701de68b65a876e1b4bfde4f111dd084 (diff) |
i965/fs: Migrate opt_cse to the IR builder.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index 822a6a3a2f8..70f0217b93d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -32,6 +32,8 @@ * 13.1 (p378). */ +using namespace brw; + namespace { struct aeb_entry : public exec_node { /** The instruction that generates the expression value. */ @@ -173,11 +175,13 @@ instructions_match(fs_inst *a, fs_inst *b, bool *negate) operands_match(a, b, negate); } -static fs_inst * -create_copy_instr(fs_visitor *v, fs_inst *inst, fs_reg src, bool negate) +static void +create_copy_instr(const fs_builder &bld, fs_inst *inst, fs_reg src, bool negate) { int written = inst->regs_written; int dst_width = inst->dst.width / 8; + const fs_builder ubld = bld.group(inst->exec_size, inst->force_sechalf) + .exec_all(inst->force_writemask_all); fs_inst *copy; if (written > dst_width) { @@ -193,7 +197,7 @@ create_copy_instr(fs_visitor *v, fs_inst *inst, fs_reg src, bool negate) } assert(src.file == GRF); - payload = ralloc_array(v->mem_ctx, fs_reg, sources); + payload = ralloc_array(bld.shader->mem_ctx, fs_reg, sources); for (int i = 0; i < header_size; i++) { payload[i] = src; payload[i].width = 8; @@ -203,16 +207,12 @@ create_copy_instr(fs_visitor *v, fs_inst *inst, fs_reg src, bool negate) payload[i] = src; src = offset(src, 1); } - copy = v->LOAD_PAYLOAD(inst->dst, payload, sources, header_size); + copy = ubld.LOAD_PAYLOAD(inst->dst, payload, sources, header_size); } else { - copy = v->MOV(inst->dst, src); + copy = ubld.MOV(inst->dst, src); copy->src[0].negate = negate; } - copy->force_writemask_all = inst->force_writemask_all; - copy->force_sechalf = inst->force_sechalf; assert(copy->regs_written == written); - - return copy; } bool @@ -266,9 +266,8 @@ fs_visitor::opt_cse_local(bblock_t *block) entry->generator->dst.type, entry->generator->dst.width); - fs_inst *copy = create_copy_instr(this, entry->generator, - entry->tmp, false); - entry->generator->insert_after(block, copy); + create_copy_instr(bld.at(block, entry->generator->next), + entry->generator, entry->tmp, false); entry->generator->dst = entry->tmp; } @@ -279,9 +278,7 @@ fs_visitor::opt_cse_local(bblock_t *block) assert(inst->dst.width == entry->generator->dst.width); assert(inst->dst.type == entry->tmp.type); - fs_inst *copy = create_copy_instr(this, inst, - entry->tmp, negate); - inst->insert_before(block, copy); + create_copy_instr(bld.at(block, inst), inst, entry->tmp, negate); } /* Set our iterator so that next time through the loop inst->next |