[Mesa-dev] [PATCH 1/5] i965/vec4: Make live_intervals part of the vec4_visitor class.
Matt Turner
mattst88 at gmail.com
Wed Oct 29 14:10:09 PDT 2014
Like in fs_visitor.
---
src/mesa/drivers/dri/i965/brw_vec4.h | 5 +++--
src/mesa/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 750f491..795f4ff 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 80b912a..44eed1c 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 b46879b..a6afc7a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3547,7 +3547,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.0.4
More information about the mesa-dev
mailing list