[Mesa-dev] [PATCH 08/20] i965: Remove now unneeded calls to calculate_cfg().
Matt Turner
mattst88 at gmail.com
Tue Sep 2 21:34:19 PDT 2014
Now that nothing invalidates the CFG, we can calculate_cfg() immediately
after emit_fb_writes()/emit_thread_end() and never again.
---
src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp | 2 --
src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++------------
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 2 --
src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp | 1 -
.../drivers/dri/i965/brw_fs_peephole_predicated_break.cpp | 2 --
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 2 --
src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 2 --
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 1 -
src/mesa/drivers/dri/i965/brw_vec4.cpp | 10 ++--------
src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp | 1 -
src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 2 --
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ----
12 files changed, 4 insertions(+), 39 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
index 9d5ba58..485ab91 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -40,8 +40,6 @@ dead_control_flow_eliminate(backend_visitor *v)
{
bool progress = false;
- v->calculate_cfg();
-
foreach_block_safe (block, v->cfg) {
bblock_t *if_block = NULL, *else_block = NULL, *endif_block = block;
bool found = false;
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4f5ff94..8f79321 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1923,8 +1923,6 @@ fs_visitor::assign_constant_locations()
void
fs_visitor::demote_pull_constants()
{
- calculate_cfg();
-
foreach_block_and_inst (block, fs_inst, inst, cfg) {
for (int i = 0; i < inst->sources; i++) {
if (inst->src[i].file != UNIFORM)
@@ -2415,8 +2413,6 @@ fs_visitor::remove_duplicate_mrf_writes()
memset(last_mrf_move, 0, sizeof(last_mrf_move));
- calculate_cfg();
-
foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
if (inst->is_control_flow()) {
memset(last_mrf_move, 0, sizeof(last_mrf_move));
@@ -2671,8 +2667,6 @@ fs_visitor::insert_gen4_send_dependency_workarounds()
* have a .reg_offset of 0.
*/
- calculate_cfg();
-
foreach_block_and_inst(block, fs_inst, inst, cfg) {
if (inst->mlen != 0 && inst->dst.file == GRF) {
insert_gen4_pre_send_dependency_workarounds(block, inst);
@@ -2704,8 +2698,6 @@ fs_visitor::insert_gen4_send_dependency_workarounds()
void
fs_visitor::lower_uniform_pull_constant_loads()
{
- calculate_cfg();
-
foreach_block_and_inst (block, fs_inst, inst, cfg) {
if (inst->opcode != FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD)
continue;
@@ -2758,8 +2750,6 @@ fs_visitor::lower_load_payload()
{
bool progress = false;
- calculate_cfg();
-
foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
fs_reg dst = inst->dst;
@@ -3223,6 +3213,8 @@ fs_visitor::run()
emit_fb_writes();
+ calculate_cfg();
+
split_virtual_grfs();
move_uniform_array_access_to_pull_constants();
@@ -3367,8 +3359,6 @@ fs_visitor::run()
*/
assert(sanity_param_count == fp->Base.Parameters->NumParameters);
- calculate_cfg();
-
return !failed;
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 806135b..da208dc 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -608,8 +608,6 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block,
bool
fs_visitor::opt_copy_propagate()
{
- calculate_cfg();
-
bool progress = false;
void *copy_prop_ctx = ralloc_context(NULL);
exec_list *out_acp[cfg->num_blocks];
diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
index 577f4db..79070c1 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -319,7 +319,6 @@ fs_visitor::calculate_live_intervals()
virtual_grf_end[i] = -1;
}
- calculate_cfg();
this->live_intervals = new(mem_ctx) fs_live_variables(this, cfg);
/* Merge the per-component live ranges to whole VGRF live ranges. */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
index a1bc14d..c669fbe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
@@ -45,8 +45,6 @@ fs_visitor::opt_peephole_predicated_break()
{
bool progress = false;
- calculate_cfg();
-
foreach_block (block, cfg) {
/* BREAK and CONTINUE instructions, by definition, can only be found at
* the ends of basic blocks.
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 6ee30ed..02014ef 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -669,8 +669,6 @@ fs_visitor::spill_reg(int spill_reg)
last_scratch += size * reg_size;
- calculate_cfg();
-
/* Generate spill/unspill instructions for the objects being
* spilled. Right now, we spill or unspill the whole thing to a
* virtual grf of the same size. For most instructions, though, we
diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
index 0bc734e..2437a2f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
@@ -127,8 +127,6 @@ fs_visitor::opt_peephole_sel()
{
bool progress = false;
- calculate_cfg();
-
foreach_block (block, cfg) {
/* IF instructions, by definition, can only be found at the ends of
* basic blocks.
diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index e1806b9..0f7d894 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -413,7 +413,6 @@ public:
this->remaining_grf_uses = NULL;
this->grf_active = NULL;
}
- v->calculate_cfg();
}
~instruction_scheduler()
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index e91ef82..1d4f692 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -697,8 +697,6 @@ vec4_visitor::opt_algebraic()
{
bool progress = false;
- calculate_cfg();
-
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
switch (inst->opcode) {
case BRW_OPCODE_ADD:
@@ -804,8 +802,6 @@ vec4_visitor::move_push_constants_to_pull_constants()
}
}
- calculate_cfg();
-
/* Now actually rewrite usage of the things we've moved to pull
* constants.
*/
@@ -856,8 +852,6 @@ vec4_visitor::opt_set_dependency_control()
vec4_instruction *last_mrf_write[BRW_MAX_GRF];
uint8_t mrf_channels_written[BRW_MAX_GRF];
- calculate_cfg();
-
assert(prog_data->total_grf ||
!"Must be called after register allocation");
@@ -1734,6 +1728,8 @@ vec4_visitor::run()
emit_thread_end();
+ calculate_cfg();
+
/* Before any optimization, push array accesses out to scratch
* space where we need them to be. This pass may allocate new
* virtual GRFs, so we want to do it early. It also makes sure
@@ -1833,8 +1829,6 @@ vec4_visitor::run()
*/
assert(sanity_param_count == prog->Parameters->NumParameters);
- calculate_cfg();
-
return !failed;
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
index 2686174..5b7acf4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
@@ -247,7 +247,6 @@ vec4_visitor::calculate_live_intervals()
* The control flow-aware analysis was done at a channel level, while at
* this point we're distilling it down to vgrfs.
*/
- calculate_cfg();
vec4_live_variables livevars(this, cfg);
foreach_block (block, cfg) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index 8faa724..270d6dc 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -327,8 +327,6 @@ vec4_visitor::spill_reg(int spill_reg_nr)
assert(virtual_grf_sizes[spill_reg_nr] == 1);
unsigned int spill_offset = c->last_scratch++;
- calculate_cfg();
-
/* Generate spill/unspill instructions for the objects being spilled. */
foreach_block_and_inst(block, vec4_instruction, inst, cfg) {
for (unsigned int i = 0; i < 3; i++) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 86280ba..411f67a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3277,8 +3277,6 @@ vec4_visitor::move_grf_array_access_to_scratch()
scratch_loc[i] = -1;
}
- calculate_cfg();
-
/* First, calculate the set of virtual GRFs that need to be punted
* to scratch due to having any array access on them, and where in
* scratch.
@@ -3385,8 +3383,6 @@ vec4_visitor::move_uniform_array_access_to_pull_constants()
pull_constant_loc[i] = -1;
}
- calculate_cfg();
-
/* Walk through and find array access of uniforms. Put a copy of that
* uniform in the pull constant buffer.
*
--
1.8.5.5
More information about the mesa-dev
mailing list