From de4f379a7092bb1710e205128447ff447b3868c5 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 31 Aug 2015 14:48:10 -0700 Subject: [PATCH] nir/cursor: Add a helper for getting the current block --- src/glsl/nir/nir.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index ac80af37bae..2ad739523ba 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1580,6 +1580,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; + } +} + static inline nir_cursor nir_before_block(nir_block *block) { -- 2.30.2