[Mesa-dev] [RFC 4/9] i965/cfg: Add function to generate a dot file of the dominator tree.

Matt Turner mattst88 at gmail.com
Fri Oct 31 18:27:48 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_cfg.cpp | 10 ++++++++++
 src/mesa/drivers/dri/i965/brw_cfg.h   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index cc0317d..65e2d37 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -517,3 +517,13 @@ cfg_t::dump_cfg()
    }
    printf("}\n");
 }
+
+void
+cfg_t::dump_domtree()
+{
+   printf("digraph CFG {\n");
+   foreach_block(block, this) {
+      printf("\t%d -> %d\n", block->idom->num, block->num);
+   }
+   printf("}\n");
+}
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 8cd1d21..e6403bd 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -209,6 +209,7 @@ struct cfg_t {
 
    void dump(backend_visitor *v);
    void dump_cfg();
+   void dump_domtree();
 #endif
    void *mem_ctx;
 
-- 
2.0.4



More information about the mesa-dev mailing list