Mesa (master): i965: Compute the number of live registers at each IP.
Matt Turner
mattst88 at kemper.freedesktop.org
Tue Jan 21 22:26:43 UTC 2014
Module: Mesa
Branch: master
Commit: 3b74f4b2333704bc7dbe5714e1f2aa4d201669ee
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b74f4b2333704bc7dbe5714e1f2aa4d201669ee
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sun Aug 4 23:27:14 2013 -0700
i965: Compute the number of live registers at each IP.
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 18 ++++++++++++++++++
src/mesa/drivers/dri/i965/brw_fs.h | 3 +++
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 +
3 files changed, 22 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index f8ae434..4766a8a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3229,6 +3229,24 @@ fs_visitor::assign_binding_table_offsets()
assign_common_binding_table_offsets(next_binding_table_offset);
}
+void
+fs_visitor::calculate_register_pressure()
+{
+ calculate_live_intervals();
+
+ int num_instructions = 0;
+ foreach_list(node, &this->instructions) {
+ ++num_instructions;
+ }
+
+ regs_live_at_ip = rzalloc_array(mem_ctx, int, num_instructions);
+
+ for (int reg = 0; reg < virtual_grf_count; reg++) {
+ for (int ip = virtual_grf_start[reg]; ip <= virtual_grf_end[reg]; ip++)
+ regs_live_at_ip[ip] += virtual_grf_sizes[reg];
+ }
+}
+
bool
fs_visitor::run()
{
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 6ed16f6..f064886 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -310,6 +310,7 @@ public:
void setup_pull_constants();
void invalidate_live_intervals();
void calculate_live_intervals();
+ void calculate_register_pressure();
bool opt_algebraic();
bool opt_cse();
bool opt_cse_local(bblock_t *block, exec_list *aeb);
@@ -448,6 +449,8 @@ public:
int *virtual_grf_end;
brw::fs_live_variables *live_intervals;
+ int *regs_live_at_ip;
+
/* This is the map from UNIFORM hw_reg + reg_offset as generated by
* the visitor to the packed uniform number after
* remove_dead_constants() that represents the actual uploaded
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 643ba5f..69ca940 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2934,6 +2934,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
this->virtual_grf_start = NULL;
this->virtual_grf_end = NULL;
this->live_intervals = NULL;
+ this->regs_live_at_ip = NULL;
this->params_remap = NULL;
this->nr_params_remap = 0;
More information about the mesa-commit
mailing list