nir: Introduce nir_metadata_instr_index for nir_index_instr() being current.

This will be useful to remove the live_index field from nir_ssa_def.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3395>
This commit is contained in:
Eric Anholt 2020-09-29 15:33:39 -07:00
parent b05c107d74
commit b6cb184e86
3 changed files with 17 additions and 0 deletions

View file

@ -935,6 +935,9 @@ nir_instr_insert(nir_cursor cursor, nir_instr *instr)
if (instr->type == nir_instr_type_jump)
nir_handle_add_jump(instr->block);
nir_function_impl *impl = nir_cf_node_get_function(&instr->block->cf_node);
impl->valid_metadata &= ~nir_metadata_instr_index;
}
static bool

View file

@ -2869,6 +2869,18 @@ typedef enum {
*/
nir_metadata_loop_analysis = 0x10,
/** Indicates that nir_instr::index values are valid.
*
* The start instruction has index 0 and they increase through a natural
* walk of instructions in blocks in the CFG. The indices my have holes
* after passes such as DCE.
*
* A pass can preserve this metadata type if it never adds or moves any
* instructions (most passes shouldn't preserve this metadata type), but
* can preserve it if it only removes instructions.
*/
nir_metadata_instr_index = 0x20,
/** All metadata
*
* This includes all nir_metadata flags except not_properly_reset. Passes

View file

@ -37,6 +37,8 @@ nir_metadata_require(nir_function_impl *impl, nir_metadata required, ...)
if (NEEDS_UPDATE(nir_metadata_block_index))
nir_index_blocks(impl);
if (NEEDS_UPDATE(nir_metadata_instr_index))
nir_index_instrs(impl);
if (NEEDS_UPDATE(nir_metadata_dominance))
nir_calc_dominance_impl(impl);
if (NEEDS_UPDATE(nir_metadata_live_ssa_defs))