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

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


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

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 622b7de..cc0317d 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -503,3 +503,17 @@ cfg_t::intersect(bblock_t *b1, bblock_t *b2)
    assert(b1);
    return b1;
 }
+
+void
+cfg_t::dump_cfg()
+{
+   printf("digraph CFG {\n");
+   for (int b = 0; b < num_blocks; b++) {
+      bblock_t *block = this->blocks[b];
+
+      foreach_list_typed_safe (bblock_link, child, link, &block->children) {
+         printf("\t%d -> %d\n", b, child->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 86bdbf3..8cd1d21 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -208,6 +208,7 @@ struct cfg_t {
    static bblock_t *intersect(bblock_t *b1, bblock_t *b2);
 
    void dump(backend_visitor *v);
+   void dump_cfg();
 #endif
    void *mem_ctx;
 
-- 
2.0.4



More information about the mesa-dev mailing list