From: Jason Ekstrand Date: Fri, 25 Mar 2016 21:16:47 +0000 (-0700) Subject: nir: Add a helper for getting the current block from a cursor X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=35e2e96b307bcd6dd839a11e2bd98fa22bd4d50a;p=mesa.git nir: Add a helper for getting the current block from a cursor Reviewed-by: Rob Clark --- 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