[Mesa-dev] [PATCH 05/20] i965/cfg: Add a foreach_inst_in_block_safe macro.

Pohjolainen, Topi topi.pohjolainen at intel.com
Tue Aug 5 11:14:55 PDT 2014


On Thu, Jul 24, 2014 at 07:54:12PM -0700, Matt Turner wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_cfg.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
> index a5d2df5..913a1ed 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.h
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.h
> @@ -120,6 +120,14 @@ struct cfg_t {
>          __inst != __block->end->next;                          \
>          __inst = (__type *)__inst->next)
>  
> +#define foreach_inst_in_block_safe(__type, __inst, __block)    \
> +   for (__type *__inst = (__type *)__block->start,             \
> +               *__next = (__type *)__inst->next,               \
> +               *__end = (__type *)__block->end->next->next;    \

Patches 4 and 7 make sense but the double ->next->next here is not obvious
to me.

> +        __next != __end;                                       \
> +        __inst = __next,                                       \
> +        __next = (__type *)__next->next)
> +
>  #define foreach_inst_in_block_reverse(__type, __inst, __block) \
>     for (__type *__inst = (__type *)__block->end;               \
>          __inst != __block->start->prev;                        \
> -- 
> 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