i965/cfg: Add function to generate a dot file of the CFG.
authorMatt Turner <mattst88@gmail.com>
Thu, 27 Feb 2014 00:07:52 +0000 (16:07 -0800)
committerMatt Turner <mattst88@gmail.com>
Wed, 18 Feb 2015 04:44:09 +0000 (20:44 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_cfg.cpp
src/mesa/drivers/dri/i965/brw_cfg.h

index b8e5e2edba3681b421f00422f435c5e121f9ad88..e094a88f0b5af973d43e54a45ace0363fd0e3fb7 100644 (file)
@@ -495,3 +495,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");
+}
index 215f2487e41d167e2b90428df329955afd1fb723..4d4eb2dad66eaca88ca3f1426d5d701e4bcf8a19 100644 (file)
@@ -274,6 +274,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;