summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir.c
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2014-07-18 16:13:11 -0700
committerJason Ekstrand <[email protected]>2015-01-15 07:18:58 -0800
commitb559ee709b26e013dda49332c55b3e25cd185bcd (patch)
tree4f54ceb62b0248dceb812c11f8a528599eeb3332 /src/glsl/nir/nir.c
parentcff1deff72294b810e4f03b72c7a871aacef8477 (diff)
nir: calculate dominance information
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r--src/glsl/nir/nir.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index be293fb029c..c3b0ee4e120 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -248,6 +248,7 @@ nir_function_impl_create(nir_function_overload *overload)
impl->reg_alloc = 0;
impl->ssa_alloc = 0;
impl->block_index_dirty = true;
+ impl->dominance_dirty = true;
/* create start & end blocks */
nir_block *start_block = nir_block_create(mem_ctx);
@@ -274,6 +275,8 @@ nir_block_create(void *mem_ctx)
block->successors[0] = block->successors[1] = NULL;
block->predecessors = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
+ block->imm_dom = NULL;
+ block->dom_frontier = _mesa_set_create(mem_ctx, _mesa_key_pointer_equal);
exec_list_make_empty(&block->instr_list);
@@ -817,6 +820,9 @@ handle_jump(nir_block *block)
unlink_block_successors(block);
+ nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node);
+ impl->dominance_dirty = true;
+
if (jump_instr->type == nir_jump_break ||
jump_instr->type == nir_jump_continue) {
nir_loop *loop = nearest_loop(&block->cf_node);
@@ -841,7 +847,6 @@ handle_jump(nir_block *block)
}
} else {
assert(jump_instr->type == nir_jump_return);
- nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node);
link_blocks(block, impl->end_block, NULL);
}
}
@@ -912,6 +917,9 @@ handle_remove_jump(nir_block *block, nir_jump_type type)
block_add_pred(next_block, last_block);
}
}
+
+ nir_function_impl *impl = nir_cf_node_get_function(&block->cf_node);
+ impl->dominance_dirty = true;
}
/**
@@ -1019,6 +1027,7 @@ nir_cf_node_insert_after(nir_cf_node *node, nir_cf_node *after)
nir_function_impl *impl = nir_cf_node_get_function(node);
impl->block_index_dirty = true;
+ impl->dominance_dirty = true;
}
void
@@ -1061,6 +1070,7 @@ nir_cf_node_insert_before(nir_cf_node *node, nir_cf_node *before)
nir_function_impl *impl = nir_cf_node_get_function(node);
impl->block_index_dirty = true;
+ impl->dominance_dirty = true;
}
void