From a50915984fe1205a3479cc8a5d07a8b3bde7d6bc Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 29 Oct 2014 13:27:37 -0700 Subject: [PATCH] i965/vec4: Make live_intervals part of the vec4_visitor class. Like in fs_visitor. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_vec4.h | 5 +++-- .../drivers/dri/i965/brw_vec4_live_variables.cpp | 15 +++++++-------- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index abdab993be9..6924775314a 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -87,6 +87,8 @@ namespace brw { class dst_reg; +class vec4_live_variables; + unsigned swizzle_for_size(int size); @@ -301,6 +303,7 @@ public: unsigned int max_grf; int *virtual_grf_start; int *virtual_grf_end; + brw::vec4_live_variables *live_intervals; dst_reg userplane[MAX_CLIP_PLANES]; /** @@ -311,8 +314,6 @@ public: /** Per-virtual-grf indices into an array of size virtual_grf_reg_count */ int *virtual_grf_reg_map; - bool live_intervals_valid; - dst_reg *variable_storage(ir_variable *var); void reladdr_to_temp(ir_instruction *ir, src_reg *reg, int *num_reladdr); 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 80b912a343b..44eed1ca658 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp @@ -195,7 +195,7 @@ vec4_live_variables::~vec4_live_variables() void vec4_visitor::calculate_live_intervals() { - if (this->live_intervals_valid) + if (this->live_intervals) return; int *start = ralloc_array(mem_ctx, int, this->virtual_grf_count * 4); @@ -247,29 +247,28 @@ 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. */ - vec4_live_variables livevars(this, cfg); + this->live_intervals = new(mem_ctx) vec4_live_variables(this, cfg); foreach_block (block, cfg) { - for (int i = 0; i < livevars.num_vars; i++) { - if (BITSET_TEST(livevars.bd[block->num].livein, i)) { + for (int i = 0; i < live_intervals->num_vars; i++) { + if (BITSET_TEST(live_intervals->bd[block->num].livein, i)) { start[i] = MIN2(start[i], block->start_ip); end[i] = MAX2(end[i], block->start_ip); } - if (BITSET_TEST(livevars.bd[block->num].liveout, i)) { + if (BITSET_TEST(live_intervals->bd[block->num].liveout, i)) { start[i] = MIN2(start[i], block->end_ip); end[i] = MAX2(end[i], block->end_ip); } } } - - this->live_intervals_valid = true; } void vec4_visitor::invalidate_live_intervals() { - live_intervals_valid = false; + ralloc_free(live_intervals); + live_intervals = NULL; } bool diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index c1c24ac0b49..417dcb15e29 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -3571,7 +3571,7 @@ vec4_visitor::vec4_visitor(struct brw_context *brw, this->virtual_grf_reg_map = NULL; this->virtual_grf_reg_count = 0; this->virtual_grf_array_size = 0; - this->live_intervals_valid = false; + this->live_intervals = NULL; this->max_grf = brw->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF; -- 2.30.2