[Mesa-dev] [PATCH 01/20] i965/cfg: Embed link in bblock_t for main block list.

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Aug 4 06:09:18 PDT 2014


On Thu, Jul 24, 2014 at 07:54:08PM -0700, Matt Turner wrote:
> 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(-)

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

> 
> 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
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list