From 391eaa59bd2b71078a28ff34dd3d4eed470653ee Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 4 Aug 2013 23:34:01 -0700 Subject: [PATCH] i965/fs: Show register pressure in dump_instructions() output. Dumping the number of live registers at each IP allows us to see register pressure and identify any local maxima. This should aid in debugging passes designed to reduce register pressure, as well as optimizations that suddenly trigger spilling. Reviewed-by: Matt Turner Reviewed-by: Jordan Justen --- src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++++++++ src/mesa/drivers/dri/i965/brw_fs.h | 1 + src/mesa/drivers/dri/i965/brw_shader.h | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4766a8a1197..181a9393b8c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2941,6 +2941,20 @@ fs_visitor::lower_uniform_pull_constant_loads() } } +void +fs_visitor::dump_instructions() +{ + calculate_register_pressure(); + + int ip = 0; + foreach_list(node, &this->instructions) { + backend_instruction *inst = (backend_instruction *)node; + printf("{%3d} %4d: ", regs_live_at_ip[ip], ip); + dump_instruction(inst); + ++ip; + } +} + void fs_visitor::dump_instruction(backend_instruction *be_inst) { diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index f064886cead..f493784012b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -432,6 +432,7 @@ public: void setup_builtin_uniform_values(ir_variable *ir); int implied_mrf_writes(fs_inst *inst); + virtual void dump_instructions(); void dump_instruction(backend_instruction *inst); void visit_atomic_counter_intrinsic(ir_call *ir); diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h index ff5af932e08..936a2070dc0 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.h +++ b/src/mesa/drivers/dri/i965/brw_shader.h @@ -86,7 +86,7 @@ public: exec_list instructions; virtual void dump_instruction(backend_instruction *inst) = 0; - void dump_instructions(); + virtual void dump_instructions(); void assign_common_binding_table_offsets(uint32_t next_binding_table_offset); -- 2.30.2