Mesa (master): nir/builder: Add a helper for getting the most recently added instruction

Jason Ekstrand jekstrand at kemper.freedesktop.org
Sat Jan 7 00:44:49 UTC 2017


Module: Mesa
Branch: master
Commit: 830dca74fe888cc6cc2d27f99a6c2488d69fc1c0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=830dca74fe888cc6cc2d27f99a6c2488d69fc1c0

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sat Dec 10 12:00:12 2016 -0800

nir/builder: Add a helper for getting the most recently added instruction

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

---

 src/compiler/nir/nir_builder.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 1da30ab..194d327 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -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)
 {




More information about the mesa-commit mailing list