---
src/mesa/drivers/dri/i965/brw_cfg.h| 53 ++
.../drivers/dri/i965/brw_dead_control_flow.cpp | 16 +++
.../dri/i965/brw_fs_peephole_predicated_break.cpp | 12 ++---
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 4 +-
src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 4 +-
src/mesa/drivers/dri/i965/brw_shader.cpp | 4 +-
6 files changed, 73 insertions(+), 20 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h
b/src/mesa/drivers/dri/i965/brw_cfg.h
index 3511914..41c8c2a 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -66,6 +66,11 @@ struct bblock_t {
const backend_instruction *start() const;
backend_instruction *end();
const backend_instruction *end() const;
+
+ bblock_t *next();
+ const bblock_t *next() const;
+ bblock_t *prev();
+ const bblock_t *prev() const;
#endif
struct exec_node link;
@@ -112,6 +117,30 @@ bblock_end_const(const struct bblock_t *block)
return (const struct backend_instruction
*)exec_list_get_tail_const(block-instructions);
}
+static inline struct bblock_t *
+bblock_next(struct bblock_t *block)
+{
+ return (struct bblock_t *)block-link.next;
+}
+
+static inline const struct bblock_t *
+bblock_next_const(const struct bblock_t *block)
+{
+ return (const struct bblock_t *)block-link.next;
+}
+
+static inline struct bblock_t *
+bblock_prev(struct bblock_t *block)
+{
+ return (struct bblock_t *)block-link.prev;
+}
+
+static inline const struct bblock_t *
+bblock_prev_const(const struct bblock_t *block)
+{
+ return (const struct bblock_t *)block-link.prev;
+}
+
#ifdef __cplusplus
inline backend_instruction *
bblock_t::start()
@@ -136,6 +165,30 @@ bblock_t::end() const
{
return bblock_end_const(this);
}
+
+inline bblock_t *
+bblock_t::next()
+{
+ return bblock_next(this);
+}
+
+inline const bblock_t *
+bblock_t::next() const
+{
+ return bblock_next_const(this);
+}
+
+inline bblock_t *
+bblock_t::prev()
+{
+ return bblock_prev(this);
+}
+
+inline const bblock_t *
+bblock_t::prev() const
+{
+ return bblock_prev_const(this);
+}
#endif
struct cfg_t {
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
index 557c3ad..8a7f42a 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -52,20 +52,20 @@ dead_control_flow_eliminate(backend_visitor *v)
continue;
backend_instruction *if_inst = NULL, *else_inst = NULL;
- backend_instruction *prev_inst = ((bblock_t
*)endif_block-link.prev)-end();
+ backend_instruction *prev_inst = endif_block-next()-end();
if (prev_inst-opcode == BRW_OPCODE_ELSE) {
else_inst = prev_inst;
- else_block = (bblock_t *)endif_block-link.prev;
+ else_block = endif_block-prev();
found = true;
if (else_block-start_ip == else_block-end_ip)
-prev_inst = ((bblock_t *)else_block-link.prev)-end();
+prev_inst = else_block-prev()-end();
}
if (prev_inst-opcode == BRW_OPCODE_IF) {
if_inst = prev_inst;
- if_block = else_block != NULL ? (bblock_t *)else_block-link.prev
- : (bblock_t *)endif_block-link.prev;
+ if_block = else_block != NULL ? else_block-prev()
+ : endif_block-prev();
found = true;
} else {
/* Don't remove the ENDIF if we didn't find a dead IF. */
@@ -77,7 +77,7 @@ dead_control_flow_eliminate(backend_visitor *v)
if (if_inst) {
if (if_block-start_ip == if_block-end_ip) {
- earlier_block = (bblock_t *)if_block-link.prev;
+ earlier_block = if_block-prev();
} else {
earlier_block = if_block;
}
@@ -91,7 +91,7 @@ dead_control_flow_eliminate(backend_visitor *v)
if (endif_inst) {
if (endif_block-start_ip == endif_block-end_ip) {
- later_block = (bblock_t *)endif_block-link.next;
+ later_block = endif_block-next();
} else {
later_block = endif_block;
}
@@ -114,7 +114,7 @@ dead_control_flow_eliminate(backend_visitor *v)
* __next block pointer was pointing to.
*/
if (endif_block != later_block) {
- __next = (bblock_t *)earlier_block-link.next;
+ __next = earlier_block-next();
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
index 802b8de..31b287a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
@@ -57,17 +57,17 @@