Mesa (master): i965/fs: Make lower_load_payload etc. appear in INTEL_DEBUG =optimizer.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Jan 16 21:34:33 UTC 2015


Module: Mesa
Branch: master
Commit: faaca237341abc0f784edfb16df50104110365b8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=faaca237341abc0f784edfb16df50104110365b8

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jan 16 01:05:21 2015 -0800

i965/fs: Make lower_load_payload etc. appear in INTEL_DEBUG=optimizer.

In order to support calling lower_load_payload() inside a condition,
this patch makes OPT() a statement expression:

https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html

We recently did the equivalent change in the vec4 backend (commit
9b8bd67768769b685c25e1276e053505aede5f93).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 5d129fe..35639de 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3543,7 +3543,7 @@ fs_visitor::optimize()
    assign_constant_locations();
    demote_pull_constants();
 
-#define OPT(pass, args...) do {                                         \
+#define OPT(pass, args...) ({                                           \
       pass_num++;                                                       \
       bool this_progress = pass(args);                                  \
                                                                         \
@@ -3556,7 +3556,8 @@ fs_visitor::optimize()
       }                                                                 \
                                                                         \
       progress = progress || this_progress;                             \
-   } while (false)
+      this_progress;                                                    \
+   })
 
    if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
       char filename[64];
@@ -3568,10 +3569,11 @@ fs_visitor::optimize()
 
    bool progress;
    int iteration = 0;
+   int pass_num = 0;
    do {
       progress = false;
+      pass_num = 0;
       iteration++;
-      int pass_num = 0;
 
       OPT(remove_duplicate_mrf_writes);
 
@@ -3590,11 +3592,13 @@ fs_visitor::optimize()
       OPT(compact_virtual_grfs);
    } while (progress);
 
-   if (lower_load_payload()) {
+   pass_num = 0;
+
+   if (OPT(lower_load_payload)) {
       split_virtual_grfs();
-      register_coalesce();
-      compute_to_mrf();
-      dead_code_eliminate();
+      OPT(register_coalesce);
+      OPT(compute_to_mrf);
+      OPT(dead_code_eliminate);
    }
 
    lower_uniform_pull_constant_loads();




More information about the mesa-commit mailing list