[Mesa-dev] [PATCH 08/47] nir/nir: fixup for new foreach_block()
Connor Abbott
cwabbott0 at gmail.com
Wed Apr 13 04:34:47 UTC 2016
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/compiler/nir/nir.c | 42 ++++++++++++++----------------------------
1 file changed, 14 insertions(+), 28 deletions(-)
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index ea8aa88..95d644a 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1640,13 +1640,6 @@ nir_block_get_following_loop(nir_block *block)
return nir_cf_node_as_loop(next_node);
}
-static bool
-index_block(nir_block *block, void *state)
-{
- unsigned *index = state;
- block->index = (*index)++;
- return true;
-}
void
nir_index_blocks(nir_function_impl *impl)
@@ -1656,7 +1649,9 @@ nir_index_blocks(nir_function_impl *impl)
if (impl->valid_metadata & nir_metadata_block_index)
return;
- nir_foreach_block(impl, index_block, &index);
+ nir_foreach_block(impl, block) {
+ block->index = index++;
+ }
impl->num_blocks = index;
}
@@ -1670,15 +1665,6 @@ index_ssa_def_cb(nir_ssa_def *def, void *state)
return true;
}
-static bool
-index_ssa_block(nir_block *block, void *state)
-{
- nir_foreach_instr(block, instr)
- nir_foreach_ssa_def(instr, index_ssa_def_cb, state);
-
- return true;
-}
-
/**
* The indices are applied top-to-bottom which has the very nice property
* that, if A dominates B, then A->index <= B->index.
@@ -1687,18 +1673,13 @@ void
nir_index_ssa_defs(nir_function_impl *impl)
{
unsigned index = 0;
- nir_foreach_block(impl, index_ssa_block, &index);
- impl->ssa_alloc = index;
-}
-static bool
-index_instrs_block(nir_block *block, void *state)
-{
- unsigned *index = state;
- nir_foreach_instr(block, instr)
- instr->index = (*index)++;
+ nir_foreach_block(impl, block) {
+ nir_foreach_instr(block, instr)
+ nir_foreach_ssa_def(instr, index_ssa_def_cb, &index);
+ }
- return true;
+ impl->ssa_alloc = index;
}
/**
@@ -1709,7 +1690,12 @@ unsigned
nir_index_instrs(nir_function_impl *impl)
{
unsigned index = 0;
- nir_foreach_block(impl, index_instrs_block, &index);
+
+ nir_foreach_block(impl, block) {
+ nir_foreach_instr(block, instr)
+ instr->index = index++;
+ }
+
return index;
}
--
2.5.0
More information about the mesa-dev
mailing list