<div dir="ltr">Only build-tested.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 15, 2017 at 8:43 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/compiler/nir/nir_builder.h | 41 ++++++++++++++++++++++++++++++<wbr>+++++++++++<br>
1 file changed, 41 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir_<wbr>builder.h b/src/compiler/nir/nir_<wbr>builder.h<br>
index 194d327..cdfc15b 100644<br>
--- a/src/compiler/nir/nir_<wbr>builder.h<br>
+++ b/src/compiler/nir/nir_<wbr>builder.h<br>
@@ -81,6 +81,47 @@ nir_builder_cf_insert(nir_<wbr>builder *build, nir_cf_node *cf)<br>
nir_cf_node_insert(build-><wbr>cursor, cf);<br>
}<br>
<br>
+static inline void<br>
+nir_push_if(nir_builder *build, nir_ssa_def *condition)<br>
+{<br>
+ nir_if *nif = nir_if_create(build->shader);<br>
+ nif->condition = nir_src_for_ssa(condition);<br>
+ nir_builder_cf_insert(build, &nif->cf_node);<br>
+ build->cursor = nir_before_cf_list(&nif->then_<wbr>list);<br>
+}<br>
+<br>
+static inline void<br>
+nir_push_else(nir_builder *build)<br>
+{<br>
+ nir_block *block = nir_cursor_current_block(<wbr>build->cursor);<br>
+ nir_if *nif = nir_cf_node_as_if(block->cf_<wbr>node.parent);<br>
+ build->cursor = nir_before_cf_list(&nif->else_<wbr>list);<br>
+}<br>
+<br>
+static inline void<br>
+nir_pop_if(nir_builder *build)<br>
+{<br>
+ nir_block *block = nir_cursor_current_block(<wbr>build->cursor);<br>
+ nir_if *nif = nir_cf_node_as_if(block->cf_<wbr>node.parent);<br>
+ build->cursor = nir_after_cf_node(&nif->cf_<wbr>node);<br>
+}<br>
+<br>
+static inline void<br>
+nir_push_loop(nir_builder *build)<br>
+{<br>
+ nir_loop *loop = nir_loop_create(build->shader)<wbr>;<br>
+ nir_builder_cf_insert(build, &loop->cf_node);<br>
+ build->cursor = nir_before_cf_list(&loop-><wbr>body);<br>
+}<br>
+<br>
+static inline void<br>
+nir_pop_loop(nir_builder *build)<br>
+{<br>
+ nir_block *block = nir_cursor_current_block(<wbr>build->cursor);<br>
+ nir_loop *loop = nir_cf_node_as_loop(block->cf_<wbr>node.parent);<br>
+ build->cursor = nir_after_cf_node(&loop->cf_<wbr>node);<br>
+}<br>
+<br>
static inline nir_ssa_def *<br>
nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size)<br>
{<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div>