i965: Make bblock_t::next and friends return NULL at sentinels.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 30 Mar 2016 19:00:02 +0000 (12:00 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 4 Apr 2016 21:34:16 +0000 (14:34 -0700)
The bblock_t::prev/prev_const/next/next_const API returns bblock_t
pointers, rather than exec_nodes.  So it's a bit surprising.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_cfg.h
src/mesa/drivers/dri/i965/brw_shader.cpp

index 405020b77e57f22d3e4756b90bef9bcddae2c00d..5b770aa7af121c6f08308c13aa169d9b21d9cd22 100644 (file)
@@ -121,24 +121,36 @@ bblock_end_const(const struct bblock_t *block)
 static inline struct bblock_t *
 bblock_next(struct bblock_t *block)
 {
+   if (exec_node_is_tail_sentinel(block->link.next))
+      return NULL;
+
    return (struct bblock_t *)block->link.next;
 }
 
 static inline const struct bblock_t *
 bblock_next_const(const struct bblock_t *block)
 {
+   if (exec_node_is_tail_sentinel(block->link.next))
+      return NULL;
+
    return (const struct bblock_t *)block->link.next;
 }
 
 static inline struct bblock_t *
 bblock_prev(struct bblock_t *block)
 {
+   if (exec_node_is_head_sentinel(block->link.prev))
+      return NULL;
+
    return (struct bblock_t *)block->link.prev;
 }
 
 static inline const struct bblock_t *
 bblock_prev_const(const struct bblock_t *block)
 {
+   if (exec_node_is_head_sentinel(block->link.prev))
+      return NULL;
+
    return (const struct bblock_t *)block->link.prev;
 }
 
index 736deb443ddf36f26ed9dcced559b9da3f9b1457..376cb2582320da6eb4ea152459f68af76e957e70 100644 (file)
@@ -938,7 +938,7 @@ static void
 adjust_later_block_ips(bblock_t *start_block, int ip_adjustment)
 {
    for (bblock_t *block_iter = start_block->next();
-        !block_iter->link.is_tail_sentinel();
+        block_iter;
         block_iter = block_iter->next()) {
       block_iter->start_ip += ip_adjustment;
       block_iter->end_ip += ip_adjustment;