Mesa (master): i965/vec4: Track liveness of the flag register.
Matt Turner
mattst88 at kemper.freedesktop.org
Tue Dec 2 00:44:39 UTC 2014
Module: Mesa
Branch: master
Commit: 7a5cc789def94af7e5c364cce7b0884eee2bcc6b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a5cc789def94af7e5c364cce7b0884eee2bcc6b
Author: Matt Turner <mattst88 at gmail.com>
Date: Sun Nov 2 21:16:44 2014 -0800
i965/vec4: Track liveness of the flag register.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
.../drivers/dri/i965/brw_vec4_live_variables.cpp | 28 ++++++++++++++++++++
.../drivers/dri/i965/brw_vec4_live_variables.h | 5 ++++
2 files changed, 33 insertions(+)
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 4c8a2ef..9835069 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
@@ -85,6 +85,11 @@ vec4_live_variables::setup_def_use()
}
}
}
+ if (inst->reads_flag()) {
+ if (!BITSET_TEST(bd->flag_def, 0)) {
+ BITSET_SET(bd->flag_use, 0);
+ }
+ }
/* Check for unconditional writes to whole registers. These
* are the things that screen off preceding definitions of a
@@ -101,6 +106,11 @@ vec4_live_variables::setup_def_use()
}
}
}
+ if (inst->writes_flag()) {
+ if (!BITSET_TEST(bd->flag_use, 0)) {
+ BITSET_SET(bd->flag_def, 0);
+ }
+ }
ip++;
}
@@ -134,6 +144,13 @@ vec4_live_variables::compute_live_variables()
cont = true;
}
}
+ BITSET_WORD new_livein = (bd->flag_use[0] |
+ (bd->flag_liveout[0] &
+ ~bd->flag_def[0]));
+ if (new_livein & ~bd->flag_livein[0]) {
+ bd->flag_livein[0] |= new_livein;
+ cont = true;
+ }
/* Update liveout */
foreach_list_typed(bblock_link, child_link, link, &block->children) {
@@ -147,6 +164,12 @@ vec4_live_variables::compute_live_variables()
cont = true;
}
}
+ BITSET_WORD new_liveout = (child_bd->flag_livein[0] &
+ ~bd->flag_liveout[0]);
+ if (new_liveout) {
+ bd->flag_liveout[0] |= new_liveout;
+ cont = true;
+ }
}
}
}
@@ -166,6 +189,11 @@ vec4_live_variables::vec4_live_variables(vec4_visitor *v, cfg_t *cfg)
block_data[i].use = rzalloc_array(mem_ctx, BITSET_WORD, bitset_words);
block_data[i].livein = rzalloc_array(mem_ctx, BITSET_WORD, bitset_words);
block_data[i].liveout = rzalloc_array(mem_ctx, BITSET_WORD, bitset_words);
+
+ block_data[i].flag_def[0] = 0;
+ block_data[i].flag_use[0] = 0;
+ block_data[i].flag_livein[0] = 0;
+ block_data[i].flag_liveout[0] = 0;
}
setup_def_use();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h
index 6f736be..5e68383 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.h
@@ -49,6 +49,11 @@ struct block_data {
/** Which defs reach the exit point of the block. */
BITSET_WORD *liveout;
+
+ BITSET_WORD flag_def[1];
+ BITSET_WORD flag_use[1];
+ BITSET_WORD flag_livein[1];
+ BITSET_WORD flag_liveout[1];
};
class vec4_live_variables {
More information about the mesa-commit
mailing list