nir: add nir_after_phis() cursor helper
authorConnor Abbott <cwabbott0@gmail.com>
Fri, 2 Sep 2016 23:06:52 +0000 (19:06 -0400)
committerConnor Abbott <cwabbott0@gmail.com>
Sat, 3 Sep 2016 04:37:48 +0000 (00:37 -0400)
And re-implement nir_after_cf_node_and_phis() using it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir.h

index d0dfb0d04b3d2b196c81c04528f5ad05c8296005..6852551cc45cf8768fba2fd8601046517b0d4165 100644 (file)
@@ -1758,6 +1758,9 @@ typedef struct nir_shader_compiler_options {
     * information must be inferred from the list of input nir_variables.
     */
    bool use_interpolated_input_intrinsics;
+
+   bool lower_b2dx;
+   bool lower_b2i;
 } nir_shader_compiler_options;
 
 typedef struct nir_shader_info {
@@ -2107,6 +2110,16 @@ nir_after_cf_node(nir_cf_node *node)
    return nir_before_block(nir_cf_node_as_block(nir_cf_node_next(node)));
 }
 
+static inline nir_cursor
+nir_after_phis(nir_block *block)
+{
+   nir_foreach_instr(instr, block) {
+      if (instr->type != nir_instr_type_phi)
+         return nir_before_instr(instr);
+   }
+   return nir_after_block(block);
+}
+
 static inline nir_cursor
 nir_after_cf_node_and_phis(nir_cf_node *node)
 {
@@ -2116,11 +2129,7 @@ nir_after_cf_node_and_phis(nir_cf_node *node)
    nir_block *block = nir_cf_node_as_block(nir_cf_node_next(node));
    assert(block->cf_node.type == nir_cf_node_block);
 
-   nir_foreach_instr(instr, block) {
-      if (instr->type != nir_instr_type_phi)
-         return nir_before_instr(instr);
-   }
-   return nir_after_block(block);
+   return nir_after_phis(block);
 }
 
 static inline nir_cursor