summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-03-25 14:16:47 -0700
committerJason Ekstrand <[email protected]>2016-03-28 18:32:48 -0700
commit35e2e96b307bcd6dd839a11e2bd98fa22bd4d50a (patch)
treec85c7ee6a53c18f33a30b99b45684e28fac0f49a /src/compiler
parentbe98c475284823abdd9a6102c1c65ed548d9afd2 (diff)
nir: Add a helper for getting the current block from a cursor
Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index d5c6a056164..c19ae5948bd 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