diff options
author | Kenneth Graunke <[email protected]> | 2019-04-08 11:22:20 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-04-28 22:36:08 -0700 |
commit | 2b44b27dbe994a39d511211dcce1bb8367b0d066 (patch) | |
tree | c3985cbcfebd76e04c17d2d22cd9c8eefc274ff6 /src/compiler/nir/nir.h | |
parent | 08dc93c67c7d599a09cf353d50a3f0cf72f76135 (diff) |
nir: Add a new nir_cf_list_is_empty_block() helper.
Helper and name suggested by Eric Anholt.
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir.h')
-rw-r--r-- | src/compiler/nir/nir.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 0ba90caad38..3fc01b798e4 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2127,6 +2127,21 @@ nir_loop_last_block(nir_loop *loop) return nir_cf_node_as_block(exec_node_data(nir_cf_node, tail, node)); } +/** + * Return true if this list of cf_nodes contains a single empty block. + */ +static inline bool +nir_cf_list_is_empty_block(struct exec_list *cf_list) +{ + if (exec_list_is_singular(cf_list)) { + struct exec_node *head = exec_list_get_head(cf_list); + nir_block *block = + nir_cf_node_as_block(exec_node_data(nir_cf_node, head, node)); + return exec_list_is_empty(&block->instr_list); + } + return false; +} + typedef struct { uint8_t num_components; uint8_t bit_size; |