nir: Add a helper for getting the current block from a cursor

Reviewed-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Jason Ekstrand 2016-03-25 14:16:47 -07:00
parent be98c47528
commit 35e2e96b30
1 changed files with 11 additions and 0 deletions

View File

@ -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