From: Jason Ekstrand Date: Mon, 31 Aug 2015 21:48:10 +0000 (-0700) Subject: nir/cursor: Add a helper for getting the current block X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de4f379a7092bb1710e205128447ff447b3868c5;p=mesa.git nir/cursor: Add a helper for getting the current block --- 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) {