Mesa (master): nir: Add a helper for getting the current block from a cursor
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Tue Mar 29 01:36:07 UTC 2016
Module: Mesa
Branch: master
Commit: 35e2e96b307bcd6dd839a11e2bd98fa22bd4d50a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=35e2e96b307bcd6dd839a11e2bd98fa22bd4d50a
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Fri Mar 25 14:16:47 2016 -0700
nir: Add a helper for getting the current block from a cursor
Reviewed-by: Rob Clark <robdclark at gmail.com>
---
src/compiler/nir/nir.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d5c6a05..c19ae59 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1881,6 +1881,17 @@ typedef struct {
};
} nir_cursor;
+static inline nir_block *
+nir_cursor_current_block(nir_cursor cursor)
+{
+ if (cursor.option == nir_cursor_before_instr ||
+ cursor.option == nir_cursor_after_instr) {
+ return cursor.instr->block;
+ } else {
+ return cursor.block;
+ }
+}
+
bool nir_cursors_equal(nir_cursor a, nir_cursor b);
static inline nir_cursor
More information about the mesa-commit
mailing list