diff options
author | Francisco Jerez <[email protected]> | 2015-06-03 18:20:50 +0300 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2015-06-09 15:18:31 +0300 |
commit | 35e5f118a5116685b30ad3305c1c153f1af37f66 (patch) | |
tree | 6ca6bdeb1a214f1862ab01bc29118b4e178ca401 /src | |
parent | e04b4156a745fc09afa066c892c1913362eae9df (diff) |
i965/fs: Migrate opt_combine_constants to the IR builder.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp index aa62031df73..0af5a915c9f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp @@ -38,6 +38,8 @@ #include "brw_fs_live_variables.h" #include "brw_cfg.h" +using namespace brw; + /* Returns whether an instruction could co-issue if its immediate source were * replaced with a GRF source. */ @@ -270,15 +272,14 @@ fs_visitor::opt_combine_constants() reg.stride = 0; for (int i = 0; i < table.len; i++) { struct imm *imm = &table.imm[i]; - - fs_inst *mov = MOV(reg, fs_reg(imm->val)); - mov->force_writemask_all = true; - if (imm->inst) { - imm->inst->insert_before(imm->block, mov); - } else { - backend_instruction *inst = imm->block->last_non_control_flow_inst(); - inst->insert_after(imm->block, mov); - } + /* Insert it either before the instruction that generated the immediate + * or after the last non-control flow instruction of the common ancestor. + */ + exec_node *n = (imm->inst ? imm->inst : + imm->block->last_non_control_flow_inst()->next); + const fs_builder ibld = bld.at(imm->block, n).exec_all(); + + ibld.MOV(reg, fs_reg(imm->val)); imm->reg = reg.reg; imm->subreg_offset = reg.subreg_offset; |