Commit bc3e66a8 authored by Jason Ekstrand's avatar Jason Ekstrand
Browse files

nir: Delete nir_register::uses and nir_register::if_uses



We do piles of book-keeping work to keep track of them but never used
them for anything.
Acked-by: Karol Herbst's avatarKarol Herbst <kherbst@redhat.com>
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
parent 0957bd8c
Pipeline #29238 passed with stages
in 13 minutes and 43 seconds
......@@ -74,9 +74,7 @@ reg_create(void *mem_ctx, struct exec_list *list)
{
nir_register *reg = ralloc(mem_ctx, nir_register);
list_inithead(&reg->uses);
list_inithead(&reg->defs);
list_inithead(&reg->if_uses);
reg->num_components = 0;
reg->bit_size = 32;
......@@ -769,8 +767,8 @@ add_use_cb(nir_src *src, void *state)
nir_instr *instr = state;
src->parent_instr = instr;
list_addtail(&src->use_link,
src->is_ssa ? &src->ssa->uses : &src->reg.reg->uses);
if (src->is_ssa)
list_addtail(&src->use_link, &src->ssa->uses);
return true;
}
......@@ -1358,15 +1356,11 @@ src_add_all_uses(nir_src *src, nir_instr *parent_instr, nir_if *parent_if)
src->parent_instr = parent_instr;
if (src->is_ssa)
list_addtail(&src->use_link, &src->ssa->uses);
else
list_addtail(&src->use_link, &src->reg.reg->uses);
} else {
assert(parent_if);
src->parent_if = parent_if;
if (src->is_ssa)
list_addtail(&src->use_link, &src->ssa->if_uses);
else
list_addtail(&src->use_link, &src->reg.reg->if_uses);
}
}
}
......
......@@ -453,14 +453,8 @@ typedef struct nir_register {
/** only for debug purposes, can be NULL */
const char *name;
/** set of nir_srcs where this register is used (read from) */
struct list_head uses;
/** set of nir_dests where this register is defined (written to) */
struct list_head defs;
/** set of nir_ifs where this register is used as a condition */
struct list_head if_uses;
} nir_register;
#define nir_foreach_register(reg, reg_list) \
......
......@@ -208,9 +208,7 @@ clone_register(clone_state *state, const nir_register *reg)
nreg->name = ralloc_strdup(nreg, reg->name);
/* reconstructing uses/defs/if_uses handled by nir_instr_insert() */
list_inithead(&nreg->uses);
list_inithead(&nreg->defs);
list_inithead(&nreg->if_uses);
return nreg;
}
......@@ -600,9 +598,6 @@ fixup_phi_srcs(clone_state *state)
if (src->src.is_ssa) {
src->src.ssa = remap_local(state, src->src.ssa);
list_addtail(&src->src.use_link, &src->src.ssa->uses);
} else {
src->src.reg.reg = remap_reg(state, src->src.reg.reg);
list_addtail(&src->src.use_link, &src->src.reg.reg->uses);
}
}
assert(list_empty(&state->phi_srcs));
......
......@@ -527,9 +527,6 @@ update_if_uses(nir_cf_node *node)
if (if_stmt->condition.is_ssa) {
list_addtail(&if_stmt->condition.use_link,
&if_stmt->condition.ssa->if_uses);
} else {
list_addtail(&if_stmt->condition.use_link,
&if_stmt->condition.reg.reg->if_uses);
}
}
......
......@@ -268,8 +268,6 @@ nir_lower_regs_to_ssa_impl(nir_function_impl *impl)
nir_foreach_register_safe(reg, &impl->registers) {
if (state.values[reg->index]) {
assert(list_empty(&reg->uses));
assert(list_empty(&reg->if_uses));
assert(list_empty(&reg->defs));
exec_node_remove(&reg->node);
}
......
......@@ -255,9 +255,7 @@ read_register(read_ctx *ctx)
reg->name = NULL;
}
list_inithead(&reg->uses);
list_inithead(&reg->defs);
list_inithead(&reg->if_uses);
return reg;
}
......
......@@ -144,13 +144,6 @@ validate_reg_src(nir_src *src, validate_state *state,
reg_validate_state *reg_state = (reg_validate_state *) entry->data;
if (state->instr) {
_mesa_set_add(reg_state->uses, src);
} else {
validate_assert(state, state->if_stmt);
_mesa_set_add(reg_state->if_uses, src);
}
validate_assert(state, reg_state->where_defined == state->impl &&
"using a register declared in a different function");
......@@ -935,13 +928,9 @@ prevalidate_reg_decl(nir_register *reg, validate_state *state)
validate_assert(state, !BITSET_TEST(state->regs_found, reg->index));
BITSET_SET(state->regs_found, reg->index);
list_validate(&reg->uses);
list_validate(&reg->defs);
list_validate(&reg->if_uses);
reg_validate_state *reg_state = ralloc(state->regs, reg_validate_state);
reg_state->uses = _mesa_pointer_set_create(reg_state);
reg_state->if_uses = _mesa_pointer_set_create(reg_state);
reg_state->defs = _mesa_pointer_set_create(reg_state);
reg_state->where_defined = state->impl;
......@@ -957,34 +946,6 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state)
assume(entry);
reg_validate_state *reg_state = (reg_validate_state *) entry->data;
nir_foreach_use(src, reg) {
struct set_entry *entry = _mesa_set_search(reg_state->uses, src);
validate_assert(state, entry);
_mesa_set_remove(reg_state->uses, entry);
}
if (reg_state->uses->entries != 0) {
printf("extra entries in register uses:\n");
set_foreach(reg_state->uses, entry)
printf("%p\n", entry->key);
abort();
}
nir_foreach_if_use(src, reg) {
struct set_entry *entry = _mesa_set_search(reg_state->if_uses, src);
validate_assert(state, entry);
_mesa_set_remove(reg_state->if_uses, entry);
}
if (reg_state->if_uses->entries != 0) {
printf("extra entries in register if_uses:\n");
set_foreach(reg_state->if_uses, entry)
printf("%p\n", entry->key);
abort();
}
nir_foreach_def(src, reg) {
struct set_entry *entry = _mesa_set_search(reg_state->defs, src);
validate_assert(state, entry);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment