diff options
author | Matt Turner <[email protected]> | 2014-04-18 11:56:46 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-06-17 09:38:05 -0700 |
commit | 138905d728fd1f4b38ff6a7137a5bbcac1d0875a (patch) | |
tree | 7a453e3884650600219670c8ee10c0bc2f89c64c | |
parent | b996216384679e9bce5a62e417198da704c09c19 (diff) |
i965/fs: Lower LOAD_PAYLOAD and clean up.
Clean up with with register_coalesce()/dead_code_eliminate().
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 38 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index fa00c11cfb4..62868d11245 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2580,6 +2580,39 @@ fs_visitor::lower_uniform_pull_constant_loads() } } +bool +fs_visitor::lower_load_payload() +{ + bool progress = false; + + foreach_list_safe(node, &instructions) { + fs_inst *inst = (fs_inst *)node; + + if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) { + fs_reg dst = inst->dst; + + /* src[0] represents the (optional) message header. */ + if (inst->src[0].file != BAD_FILE) { + inst->insert_before(MOV(dst, inst->src[0])); + } + dst.reg_offset++; + + for (int i = 1; i < inst->sources; i++) { + inst->insert_before(MOV(dst, inst->src[i])); + dst.reg_offset++; + } + + inst->remove(); + progress = true; + } + } + + if (progress) + invalidate_live_intervals(); + + return progress; +} + void fs_visitor::dump_instructions() { @@ -3078,6 +3111,11 @@ fs_visitor::run() OPT(compute_to_mrf); } while (progress); + if (lower_load_payload()) { + register_coalesce(); + dead_code_eliminate(); + } + lower_uniform_pull_constant_loads(); assign_curb_setup(); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 4ce5fa319e1..885c186bb39 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -391,6 +391,7 @@ public: void fail(const char *msg, ...); void no16(const char *msg, ...); void lower_uniform_pull_constant_loads(); + bool lower_load_payload(); void push_force_uncompressed(); void pop_force_uncompressed(); |