nir: add a new nir_cf_list_clone_and_reinsert() helper
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 16 Nov 2018 03:57:11 +0000 (14:57 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 10 Dec 2018 02:59:50 +0000 (13:59 +1100)
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_control_flow.h

index 2ea460e5df3d07bdc5874c65d319790211bcee7c..9111b30a2979d6dda61dd7300cb82882f8e31bf7 100644 (file)
@@ -145,6 +145,16 @@ void nir_cf_delete(nir_cf_list *cf_list);
 void nir_cf_list_clone(nir_cf_list *dst, nir_cf_list *src, nir_cf_node *parent,
                        struct hash_table *remap_table);
 
+static inline void
+nir_cf_list_clone_and_reinsert(nir_cf_list *src_list, nir_cf_node *parent,
+                               nir_cursor cursor,
+                               struct hash_table *remap_table)
+{
+   nir_cf_list list;
+   nir_cf_list_clone(&list, src_list, parent, remap_table);
+   nir_cf_reinsert(&list, cursor);
+}
+
 static inline void
 nir_cf_list_extract(nir_cf_list *extracted, struct exec_list *cf_list)
 {