aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-07-16 12:14:41 -0700
committerMatt Turner <[email protected]>2014-08-22 10:23:33 -0700
commitb7d50beea43e0dade13f4a30bc2f261eaca8a5b5 (patch)
tree123ede4ac0ea53d38842012d1fc5077fed7d101f /src/mesa/drivers/dri
parente51e20c35ef89409494161010f86750366faef4c (diff)
i965/cfg: Add functions to test if a block is a successor/predecessor.
Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.cpp24
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index d806b83c0db..9cd8b9fcdf3 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -71,6 +71,30 @@ bblock_t::add_successor(void *mem_ctx, bblock_t *successor)
children.push_tail(::link(mem_ctx, successor));
}
+bool
+bblock_t::is_predecessor_of(const bblock_t *block) const
+{
+ foreach_list_typed_safe (bblock_link, parent, link, &block->parents) {
+ if (parent->block == this) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool
+bblock_t::is_successor_of(const bblock_t *block) const
+{
+ foreach_list_typed_safe (bblock_link, child, link, &block->children) {
+ if (child->block == this) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void
bblock_t::dump(backend_visitor *v)
{
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h b/src/mesa/drivers/dri/i965/brw_cfg.h
index 29e31e77efb..a6888704e28 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.h
+++ b/src/mesa/drivers/dri/i965/brw_cfg.h
@@ -58,6 +58,8 @@ struct bblock_t {
bblock_t();
void add_successor(void *mem_ctx, bblock_t *successor);
+ bool is_predecessor_of(const bblock_t *block) const;
+ bool is_successor_of(const bblock_t *block) const;
void dump(backend_visitor *v);
#endif