nir/builder: Add a helper for getting the most recently added instruction
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 10 Dec 2016 20:00:12 +0000 (12:00 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 7 Jan 2017 00:44:28 +0000 (16:44 -0800)
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/compiler/nir/nir_builder.h

index 1da30ab8fc1333cd958d21d891d35fbb2e1b36e2..194d32709f1de77ff23b81b9c74947f6e6cacdbe 100644 (file)
@@ -68,6 +68,13 @@ nir_builder_instr_insert(nir_builder *build, nir_instr *instr)
    build->cursor = nir_after_instr(instr);
 }
 
+static inline nir_instr *
+nir_builder_last_instr(nir_builder *build)
+{
+   assert(build->cursor.option == nir_cursor_after_instr);
+   return build->cursor.instr;
+}
+
 static inline void
 nir_builder_cf_insert(nir_builder *build, nir_cf_node *cf)
 {