diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2018-07-06 17:21:34 -0700 |
---|---|---|
committer | Rafael Antognolli <[email protected]> | 2018-07-12 14:03:51 -0700 |
commit | d6e869afe90df1d6fa02b1dcb1a367c48fca001a (patch) | |
tree | f623850bb82c6492f8a16df31174267eec5b560c /src/compiler/glsl | |
parent | 094225d69d25239a36daebb0021235cce65afa59 (diff) |
glsl: slim the kill_entry struct used in const propagation
Since 4654439fdd7 "glsl: Use hash tables for
opt_constant_propagation() kill sets." uses a hash_table for storing
kill_entries, so the structs can be simplified.
Remove the exec_node from kill_entry since it is not used in an
exec_list anymore.
Remove the 'var' from kill_entry since it is now redundant with the
key of the hash table.
Suggested by Eric Anholt.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Thomas Helland <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/opt_constant_propagation.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp index 05dc71efb72..f91498b45cd 100644 --- a/src/compiler/glsl/opt_constant_propagation.cpp +++ b/src/compiler/glsl/opt_constant_propagation.cpp @@ -77,20 +77,17 @@ public: }; -class kill_entry : public exec_node +class kill_entry { public: /* override operator new from exec_node */ DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(kill_entry) - kill_entry(ir_variable *var, unsigned write_mask) + explicit kill_entry(unsigned write_mask) { - assert(var); - this->var = var; this->write_mask = write_mask; } - ir_variable *var; unsigned write_mask; }; @@ -386,7 +383,7 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions) hash_entry *htk; hash_table_foreach(new_kills, htk) { kill_entry *k = (kill_entry *) htk->data; - kill(k->var, k->write_mask); + kill((ir_variable *) htk->key, k->write_mask); } } @@ -433,7 +430,7 @@ ir_constant_propagation_visitor::visit_enter(ir_loop *ir) hash_entry *htk; hash_table_foreach(new_kills, htk) { kill_entry *k = (kill_entry *) htk->data; - kill(k->var, k->write_mask); + kill((ir_variable *) htk->key, k->write_mask); } /* already descended into the children. */ @@ -469,7 +466,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask) } /* Not already in the hash table. Make new entry. */ _mesa_hash_table_insert(this->kills, var, - new(this->lin_ctx) kill_entry(var, write_mask)); + new(this->lin_ctx) kill_entry(write_mask)); } /** |