From: Matt Turner Date: Fri, 11 Jul 2014 23:17:47 +0000 (-0700) Subject: i965/cfg: Embed link in bblock_t for main block list. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d688667c7f8ab69b079b7c85dccc2b70e5863e32;p=mesa.git i965/cfg: Embed link in bblock_t for main block list. 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. Reviewed-by: Topi Pohjolainen --- diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp index 07111f5ac42..4a5c912daf8 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 01fcc1befdc..324df6caf6c 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;