summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-02-26 16:07:52 -0800
committerMatt Turner <[email protected]>2015-02-17 20:44:09 -0800
commitb06eef05d040ffcfe5a203387b1c4b5b0b32848a (patch)
tree7f26c7003244b8dbac1095ac5e8a3d6d870764bb
parent0e3dbc0248340bebd1a3012f18db5383ec90b077 (diff)
i965/cfg: Add function to generate a dot file of the CFG.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.cpp14
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index b8e5e2edba3..e094a88f0b5 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -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");
+}
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 215f2487e41..4d4eb2dad66 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -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;