From d7e482d32cf0188a1ed49e76f008837be5cfd720 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 29 Oct 2014 16:25:51 -0700 Subject: nir: Add a function to detect if a block is immediately followed by an if Since we don't actually have an "if" instruction, this is a very common pattern when iterating over instructions. This adds a helper function for it to make things a little less painful. Reviewed-by: Connor Abbott --- src/glsl/nir/nir.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/glsl/nir/nir.h') diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index 2ea7542d313..84be1d65f0a 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1277,6 +1277,11 @@ bool nir_foreach_block(nir_function_impl *impl, nir_foreach_block_cb cb, bool nir_foreach_block_reverse(nir_function_impl *impl, nir_foreach_block_cb cb, void *state); +/* If the following CF node is an if, this function returns that if. + * Otherwise, it returns NULL. + */ +nir_if *nir_block_following_if(nir_block *block); + void nir_index_local_regs(nir_function_impl *impl); void nir_index_global_regs(nir_shader *shader); void nir_index_ssa_defs(nir_function_impl *impl); -- cgit v1.2.3