summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-06-28 20:02:51 -0700
committerMatt Turner <[email protected]>2014-07-01 08:55:52 -0700
commit2e90d1fb62a6ef53c15eff76e242c510145178a9 (patch)
tree57ea18f128ff1fa1a4c76a90ad06376d509b6a6b /src/mesa
parentec1b2d6aa075c678f0eb0405be64253450f995a1 (diff)
i965/fs: Pass cfg to calculate_live_intervals().
We've often created the CFG immediately before, so use it when available. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_live_variables.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp4
6 files changed, 15 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 58e71756b16..961c56cdab8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -373,7 +373,7 @@ public:
void assign_constant_locations();
void demote_pull_constants();
void invalidate_live_intervals();
- void calculate_live_intervals();
+ void calculate_live_intervals(const cfg_t *cfg = NULL);
void calculate_register_pressure();
bool opt_algebraic();
bool opt_cse();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 381c5697f10..57278011580 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -317,9 +317,8 @@ fs_visitor::opt_cse()
{
bool progress = false;
- calculate_live_intervals();
-
cfg_t cfg(&instructions);
+ calculate_live_intervals(&cfg);
for (int b = 0; b < cfg.num_blocks; b++) {
bblock_t *block = cfg.blocks[b];
diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
index 7b2d4aa9b72..d41a42c3ac0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
@@ -41,7 +41,7 @@ fs_visitor::dead_code_eliminate()
cfg_t cfg(&instructions);
- calculate_live_intervals();
+ calculate_live_intervals(&cfg);
int num_vars = live_intervals->num_vars;
BITSET_WORD *live = ralloc_array(NULL, BITSET_WORD, BITSET_WORDS(num_vars));
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 0973dc9d83a..585dc3dad3b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -243,7 +243,7 @@ fs_live_variables::var_from_reg(fs_reg *reg)
return var_from_vgrf[reg->reg] + reg->reg_offset;
}
-fs_live_variables::fs_live_variables(fs_visitor *v, cfg_t *cfg)
+fs_live_variables::fs_live_variables(fs_visitor *v, const cfg_t *cfg)
: v(v), cfg(cfg)
{
mem_ctx = ralloc_context(NULL);
@@ -304,7 +304,7 @@ fs_visitor::invalidate_live_intervals()
* information about whole VGRFs.
*/
void
-fs_visitor::calculate_live_intervals()
+fs_visitor::calculate_live_intervals(const cfg_t *cfg)
{
if (this->live_intervals)
return;
@@ -320,8 +320,12 @@ fs_visitor::calculate_live_intervals()
virtual_grf_end[i] = -1;
}
- cfg_t cfg(&instructions);
- this->live_intervals = new(mem_ctx) fs_live_variables(this, &cfg);
+ if (cfg) {
+ this->live_intervals = new(mem_ctx) fs_live_variables(this, cfg);
+ } else {
+ cfg_t cfg(&instructions);
+ this->live_intervals = new(mem_ctx) fs_live_variables(this, &cfg);
+ }
/* Merge the per-component live ranges to whole VGRF live ranges. */
for (int i = 0; i < live_intervals->num_vars; i++) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h
index 5a7dd279b3c..13c3eb49a35 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h
@@ -57,7 +57,7 @@ class fs_live_variables {
public:
DECLARE_RALLOC_CXX_OPERATORS(fs_live_variables)
- fs_live_variables(fs_visitor *v, cfg_t *cfg);
+ fs_live_variables(fs_visitor *v, const cfg_t *cfg);
~fs_live_variables();
bool vars_interfere(int a, int b);
@@ -97,7 +97,7 @@ protected:
void compute_start_end();
fs_visitor *v;
- cfg_t *cfg;
+ const cfg_t *cfg;
void *mem_ctx;
};
diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
index 079eb2eb795..1287adb34c4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp
@@ -93,10 +93,10 @@ fs_visitor::opt_saturate_propagation()
{
bool progress = false;
- calculate_live_intervals();
-
cfg_t cfg(&instructions);
+ calculate_live_intervals(&cfg);
+
for (int b = 0; b < cfg.num_blocks; b++) {
progress = opt_saturate_propagation_local(this, cfg.blocks[b])
|| progress;