nir: add nir_instr_is_first() and nir_instr_is_last() helpers
authorConnor Abbott <connor.w.abbott@intel.com>
Wed, 15 Jul 2015 19:00:47 +0000 (12:00 -0700)
committerConnor Abbott <connor.w.abbott@intel.com>
Fri, 17 Jul 2015 16:47:22 +0000 (09:47 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <connor.w.abbott@intel.com>
src/glsl/nir/nir.h

index e9a506c59712b370a57304070516d0d8cf45e555..0db1fc3076e18d624d52f8dd7d5b6d7dd3e12e80 100644 (file)
@@ -443,6 +443,18 @@ nir_instr_prev(nir_instr *instr)
       return exec_node_data(nir_instr, prev, node);
 }
 
+static inline bool
+nir_instr_is_first(nir_instr *instr)
+{
+   return exec_node_is_head_sentinel(exec_node_get_prev(&instr->node));
+}
+
+static inline bool
+nir_instr_is_last(nir_instr *instr)
+{
+   return exec_node_is_tail_sentinel(exec_node_get_next(&instr->node));
+}
+
 typedef struct {
    /** for debugging only, can be NULL */
    const char* name;