nir/cf: Return a cursor from nir_cf_extract as well

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036>
This commit is contained in:
Jason Ekstrand
2022-04-26 08:53:31 -05:00
committed by Marge Bot
parent d65cf403f3
commit 25661ea028
2 changed files with 9 additions and 4 deletions

View File

@@ -678,7 +678,11 @@ cleanup_cf_node(nir_cf_node *node, nir_function_impl *impl)
} }
} }
void /**
* Extracts everything between two cursors. Returns the cursor which is
* equivalent to the old begin/end curosors.
*/
nir_cursor
nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end) nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end)
{ {
nir_block *block_begin, *block_end, *block_before, *block_after; nir_block *block_begin, *block_end, *block_before, *block_after;
@@ -686,7 +690,7 @@ nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end)
if (nir_cursors_equal(begin, end)) { if (nir_cursors_equal(begin, end)) {
exec_list_make_empty(&extracted->list); exec_list_make_empty(&extracted->list);
extracted->impl = NULL; /* we shouldn't need this */ extracted->impl = NULL; /* we shouldn't need this */
return; return begin;
} }
split_block_cursor(begin, &block_before, &block_begin); split_block_cursor(begin, &block_before, &block_begin);
@@ -737,7 +741,7 @@ nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end)
cf_node = next; cf_node = next;
} }
stitch_blocks(block_before, block_after); return stitch_blocks(block_before, block_after);
} }
static void static void

View File

@@ -136,7 +136,8 @@ typedef struct {
nir_function_impl *impl; /* for cleaning up if the list is deleted */ nir_function_impl *impl; /* for cleaning up if the list is deleted */
} nir_cf_list; } nir_cf_list;
void nir_cf_extract(nir_cf_list *extracted, nir_cursor begin, nir_cursor end); nir_cursor nir_cf_extract(nir_cf_list *extracted, nir_cursor begin,
nir_cursor end);
nir_cursor nir_cf_reinsert(nir_cf_list *cf_list, nir_cursor cursor); nir_cursor nir_cf_reinsert(nir_cf_list *cf_list, nir_cursor cursor);