[Mesa-dev] [PATCH 2/2] i965: Let dump_instructions() work before calculate_cfg().

Ben Widawsky ben at bwidawsk.net
Sat Feb 14 15:57:44 PST 2015


On Fri, Feb 13, 2015 at 10:54:06AM -0800, Matt Turner wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp     | 24 ++++++++++++++++--------
>  src/mesa/drivers/dri/i965/brw_shader.cpp | 17 ++++++++++++-----
>  2 files changed, 28 insertions(+), 13 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 41473fa..cc0be10 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3167,7 +3167,6 @@ fs_visitor::dump_instructions()
>  void
>  fs_visitor::dump_instructions(const char *name)
>  {
> -   calculate_register_pressure();
>     FILE *file = stderr;
>     if (name && geteuid() != 0) {
>        file = fopen(name, "w");
> @@ -3175,14 +3174,23 @@ fs_visitor::dump_instructions(const char *name)
>           file = stderr;
>     }
>  
> -   int ip = 0, max_pressure = 0;
> -   foreach_block_and_inst(block, backend_instruction, inst, cfg) {
> -      max_pressure = MAX2(max_pressure, regs_live_at_ip[ip]);
> -      fprintf(file, "{%3d} %4d: ", regs_live_at_ip[ip], ip);
> -      dump_instruction(inst, file);
> -      ++ip;
> +   if (cfg) {
> +      calculate_register_pressure();
> +      int ip = 0, max_pressure = 0;
> +      foreach_block_and_inst(block, backend_instruction, inst, cfg) {
> +         max_pressure = MAX2(max_pressure, regs_live_at_ip[ip]);
> +         fprintf(file, "{%3d} %4d: ", regs_live_at_ip[ip], ip);
> +         dump_instruction(inst, file);
> +         ip++;
> +      }
> +      fprintf(file, "Maximum %3d registers live at once.\n", max_pressure);
> +   } else {
> +      int ip = 0;
> +      foreach_in_list(backend_instruction, inst, &instructions) {
> +         fprintf(file, "%4d: ", ip++);
> +         dump_instruction(inst, file);
> +      }
>     }
> -   fprintf(file, "Maximum %3d registers live at once.\n", max_pressure);
>  
>     if (file != stderr) {
>        fclose(file);
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
> index ad2e22a..a47772b 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
> @@ -1044,11 +1044,18 @@ backend_visitor::dump_instructions(const char *name)
>           file = stderr;
>     }
>  
> -   int ip = 0;
> -   foreach_block_and_inst(block, backend_instruction, inst, cfg) {
> -      if (!name)
> -         fprintf(stderr, "%d: ", ip++);
> -      dump_instruction(inst, file);
> +   if (cfg) {
> +      int ip = 0;
> +      foreach_block_and_inst(block, backend_instruction, inst, cfg) {
> +         fprintf(file, "%4d: ", ip++);
> +         dump_instruction(inst, file);
> +      }
> +   } else {
> +      int ip = 0;
> +      foreach_in_list(backend_instruction, inst, &instructions) {
> +         fprintf(file, "%4d: ", ip++);
> +         dump_instruction(inst, file);
> +      }
>     }
>  
>     if (file != stderr) {

Both are:
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>


More information about the mesa-dev mailing list