[Mesa-dev] [PATCH 08/20] i965/cfg: Add functions to test if a block is a successor/predecessor.

Pohjolainen, Topi topi.pohjolainen at intel.com
Tue Aug 5 10:21:30 PDT 2014


On Thu, Jul 24, 2014 at 07:54:15PM -0700, Matt Turner wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_cfg.cpp | 24 ++++++++++++++++++++++++
>  src/mesa/drivers/dri/i965/brw_cfg.h   |  2 ++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> index d806b83..9cd8b9f 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> @@ -71,6 +71,30 @@ bblock_t::add_successor(void *mem_ctx, bblock_t *successor)
>     children.push_tail(::link(mem_ctx, successor));
>  }
>  
> +bool
> +bblock_t::is_predecessor_of(const bblock_t *block) const
> +{
> +   foreach_list_typed_safe (bblock_link, parent, link, &block->parents) {

I read patch number three again, and noticed this small formatting change
there as well. I haven't seen us leaving the space before "(" anywhere else.

> +      if (parent->block == this) {
> +         return true;
> +      }

We have one line blocks with and without {}. I just thought I mention in
case you didn't mean to.

> +   }
> +
> +   return false;
> +}
> +
> +bool
> +bblock_t::is_successor_of(const bblock_t *block) const
> +{
> +   foreach_list_typed_safe (bblock_link, child, link, &block->children) {
> +      if (child->block == this) {
> +         return true;
> +      }
> +   }
> +
> +   return false;
> +}
> +
>  void
>  bblock_t::dump(backend_visitor *v)
>  {
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
> index 29e31e7..a688870 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.h
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.h
> @@ -58,6 +58,8 @@ struct bblock_t {
>     bblock_t();
>  
>     void add_successor(void *mem_ctx, bblock_t *successor);
> +   bool is_predecessor_of(const bblock_t *block) const;
> +   bool is_successor_of(const bblock_t *block) const;
>     void dump(backend_visitor *v);
>  #endif
>  
> -- 
> 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