i965/cfg: Add macros to iterate through a block given a starting point.
authorMatt Turner <mattst88@gmail.com>
Tue, 2 Sep 2014 03:01:50 +0000 (20:01 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 24 Sep 2014 16:42:46 +0000 (09:42 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_cfg.h

index 7985a9795aca3ae33a44e0f462105e7d14d05306..3819f1f3401cae6cfe14f9f984a11a7f548dd94a 100644 (file)
@@ -142,4 +142,14 @@ struct cfg_t {
         __inst != __block->start->prev;                        \
         __inst = (__type *)__inst->prev)
 
+#define foreach_inst_in_block_starting_from(__type, __scan_inst, __inst, __block) \
+   for (__type *__scan_inst = (__type *)__inst->next;          \
+        __scan_inst != __block->end->next;                     \
+        __scan_inst = (__type *)__scan_inst->next)
+
+#define foreach_inst_in_block_reverse_starting_from(__type, __scan_inst, __inst, __block) \
+   for (__type *__scan_inst = (__type *)__inst->prev;          \
+        __scan_inst != __block->start->prev;                   \
+        __scan_inst = (__type *)__scan_inst->prev)
+
 #endif /* BRW_CFG_H */