[Mesa-dev] [PATCH 01/20] i965/cfg: Embed link in bblock_t for main block list.
Matt Turner
mattst88 at gmail.com
Thu Jul 24 19:54:08 PDT 2014
The next patch adds a foreach_block (block, cfg) macro, which works
better if it provides a direct bblock_t pointer, rather than a
bblock_link pointer that you have to use to find the actual block.
---
src/mesa/drivers/dri/i965/brw_cfg.cpp | 10 +++++-----
src/mesa/drivers/dri/i965/brw_cfg.h | 2 ++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 07111f5..4a5c912 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -67,8 +67,8 @@ bblock_t::bblock_t() :
void
bblock_t::add_successor(void *mem_ctx, bblock_t *successor)
{
- successor->parents.push_tail(link(mem_ctx, this));
- children.push_tail(link(mem_ctx, successor));
+ successor->parents.push_tail(::link(mem_ctx, this));
+ children.push_tail(::link(mem_ctx, successor));
}
void
@@ -285,7 +285,7 @@ cfg_t::set_next_block(bblock_t **cur, bblock_t *block, int ip)
block->start_ip = ip;
block->block_num = num_blocks++;
- block_list.push_tail(link(mem_ctx, block));
+ block_list.push_tail(&block->link);
*cur = block;
}
@@ -295,8 +295,8 @@ cfg_t::make_block_array()
blocks = ralloc_array(mem_ctx, bblock_t *, num_blocks);
int i = 0;
- foreach_list_typed(bblock_link, link, link, &block_list) {
- blocks[i++] = link->block;
+ foreach_list_typed(bblock_t, block, link, &block_list) {
+ blocks[i++] = block;
}
assert(i == num_blocks);
}
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 01fcc1b..324df6c 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -61,6 +61,8 @@ struct bblock_t {
void dump(backend_visitor *v);
#endif
+ struct exec_node link;
+
struct backend_instruction *start;
struct backend_instruction *end;
--
1.8.5.5
More information about the mesa-dev
mailing list