aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-11-28 11:03:14 -0800
committerMatt Turner <[email protected]>2013-12-04 20:05:41 -0800
commit51194932d3b866e56b0001874c28f862d382dbd3 (patch)
treec06678900f8974e2ca30d6cc3df8d27424cf0c54 /src
parentfa1923ac3afe47b225bcc9c83211ae99366d5948 (diff)
i965/cfg: Add code to dump blocks and cfg.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.cpp34
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index e9d2bb81ee7..cfe43d20139 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -67,6 +67,19 @@ bblock_t::make_list(void *mem_ctx)
return new(mem_ctx) bblock_link(this);
}
+void
+bblock_t::dump(backend_visitor *v)
+{
+ int ip = this->start_ip;
+ for (backend_instruction *inst = (backend_instruction *)this->start;
+ inst != this->end->next;
+ inst = (backend_instruction *) inst->next) {
+ printf("%5d: ", ip);
+ v->dump_instruction(inst);
+ ip++;
+ }
+}
+
cfg_t::cfg_t(backend_visitor *v)
{
create(v->mem_ctx, &v->instructions);
@@ -261,3 +274,24 @@ cfg_t::make_block_array()
}
assert(i == num_blocks);
}
+
+void
+cfg_t::dump(backend_visitor *v)
+{
+ for (int b = 0; b < this->num_blocks; b++) {
+ bblock_t *block = this->blocks[b];
+ printf("START B%d", b);
+ foreach_list(node, &block->parents) {
+ bblock_link *link = (bblock_link *)node;
+ printf(" <-B%d", link->block->block_num);
+ }
+ printf("\n");
+ block->dump(v);
+ printf("END B%d", b);
+ foreach_list(node, &block->children) {
+ bblock_link *link = (bblock_link *)node;
+ printf(" ->B%d", link->block->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 ec5a3a02059..e667d2271b6 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -46,6 +46,7 @@ public:
bblock_t();
void add_successor(void *mem_ctx, bblock_t *successor);
+ void dump(backend_visitor *v);
backend_instruction *start;
backend_instruction *end;
@@ -72,6 +73,8 @@ public:
void set_next_block(bblock_t *block);
void make_block_array();
+ void dump(backend_visitor *v);
+
/** @{
*
* Used while generating the block list.