Mesa (master): i965/cfg: Add a foreach_inst_in_block_safe macro.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Aug 19 02:06:31 UTC 2014


Module: Mesa
Branch: master
Commit: 26624b85e70cc4fdf77d7a4be15c154644db5894
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=26624b85e70cc4fdf77d7a4be15c154644db5894

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Jul 10 17:30:40 2014 -0700

i965/cfg: Add a foreach_inst_in_block_safe macro.

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

---

 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;    \
+        __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;                        \




More information about the mesa-commit mailing list