}
static bool
-vc4_nir_lower_blend_block(nir_block *block, void *state)
+vc4_nir_lower_blend_block(nir_block *block, struct vc4_compile *c)
{
- struct vc4_compile *c = state;
-
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_intrinsic)
continue;
{
nir_foreach_function(function, s) {
if (function->impl) {
- nir_foreach_block_call(function->impl,
- vc4_nir_lower_blend_block, c);
+ nir_foreach_block(block, function->impl) {
+ vc4_nir_lower_blend_block(block, c);
+ }
nir_metadata_preserve(function->impl,
nir_metadata_block_index |
}
static bool
-vc4_nir_lower_io_block(nir_block *block, void *arg)
+vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl)
{
- struct vc4_compile *c = arg;
- nir_function_impl *impl =
- nir_cf_node_get_function(&block->cf_node);
-
nir_builder b;
nir_builder_init(&b, impl);
- nir_foreach_instr_safe(instr, block)
- vc4_nir_lower_io_instr(c, &b, instr);
-
- return true;
-}
-
-static bool
-vc4_nir_lower_io_impl(struct vc4_compile *c, nir_function_impl *impl)
-{
- nir_foreach_block_call(impl, vc4_nir_lower_io_block, c);
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr_safe(instr, block)
+ vc4_nir_lower_io_instr(c, &b, instr);
+ }
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);
}
static bool
-vc4_nir_lower_txf_ms_block(nir_block *block, void *arg)
+vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl)
{
- struct vc4_compile *c = arg;
- nir_function_impl *impl =
- nir_cf_node_get_function(&block->cf_node);
-
nir_builder b;
nir_builder_init(&b, impl);
- nir_foreach_instr_safe(instr, block) {
- if (instr->type == nir_instr_type_tex) {
- vc4_nir_lower_txf_ms_instr(c, &b,
- nir_instr_as_tex(instr));
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr_safe(instr, block) {
+ if (instr->type == nir_instr_type_tex) {
+ vc4_nir_lower_txf_ms_instr(c, &b,
+ nir_instr_as_tex(instr));
+ }
}
}
- return true;
-}
-
-static bool
-vc4_nir_lower_txf_ms_impl(struct vc4_compile *c, nir_function_impl *impl)
-{
- nir_foreach_block_call(impl, vc4_nir_lower_txf_ms_block, c);
-
nir_metadata_preserve(impl,
nir_metadata_block_index |
nir_metadata_dominance);
.lower_negate = true,
};
-static bool
-count_nir_instrs_in_block(nir_block *block, void *state)
-{
- int *count = (int *) state;
- nir_foreach_instr(instr, block) {
- *count = *count + 1;
- }
- return true;
-}
-
static int
count_nir_instrs(nir_shader *nir)
{
nir_foreach_function(function, nir) {
if (!function->impl)
continue;
- nir_foreach_block_call(function->impl, count_nir_instrs_in_block, &count);
+ nir_foreach_block(block, function->impl) {
+ nir_foreach_instr(instr, block)
+ count++;
+ }
}
return count;
}