diff options
author | Jason Ekstrand <[email protected]> | 2014-11-04 11:02:09 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-01-15 07:19:00 -0800 |
commit | 946012f10f93f249444436dc780ae74d477e44a3 (patch) | |
tree | aacbd1abc60650e6d87a2b21f971761a77225802 /src/glsl/nir/nir.c | |
parent | fbc443ad564a46e105e0b1d7a12a6f2b07c56b1d (diff) |
nir: Automatically handle SSA uses when an instruction is inserted
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir.c')
-rw-r--r-- | src/glsl/nir/nir.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 5e5f1aca750..3b74e424bbe 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -1144,12 +1144,9 @@ add_use_cb(nir_src *src, void *state) { nir_instr *instr = (nir_instr *) state; - if (src->is_ssa) - return true; - - nir_register *reg = src->reg.reg; + struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses; - _mesa_set_add(reg->uses, _mesa_hash_pointer(instr), instr); + _mesa_set_add(uses_set, _mesa_hash_pointer(instr), instr); return true; } @@ -1280,16 +1277,13 @@ remove_use_cb(nir_src *src, void *state) { nir_instr *instr = (nir_instr *) state; - if (src->is_ssa) - return true; - - nir_register *reg = src->reg.reg; + struct set *uses_set = src->is_ssa ? src->ssa->uses : src->reg.reg->uses; - struct set_entry *entry = _mesa_set_search(reg->uses, + struct set_entry *entry = _mesa_set_search(uses_set, _mesa_hash_pointer(instr), instr); if (entry) - _mesa_set_remove(reg->uses, entry); + _mesa_set_remove(uses_set, entry); return true; } |