/* bitset of registers we have currently found; used to check uniqueness */
BITSET_WORD *regs_found;
- /* map of local variable -> function implementation where it is defined */
+ /* map of variable -> function implementation where it is defined or NULL
+ * if it is a global variable
+ */
struct hash_table *var_defs;
/* map of instruction/var/etc to failed assert string */
static void
validate_var_use(nir_variable *var, validate_state *state)
{
- if (var->data.mode == nir_var_local) {
- struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
-
- validate_assert(state, entry);
+ struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
+ validate_assert(state, entry);
+ if (var->data.mode == nir_var_local)
validate_assert(state, (nir_function_impl *) entry->data == state->impl);
- }
}
static void
* support)
*/
- if (!is_global) {
- _mesa_hash_table_insert(state->var_defs, var, state->impl);
- }
+ _mesa_hash_table_insert(state->var_defs, var,
+ is_global ? NULL : state->impl);
state->var = NULL;
}