glsl: remove struct kill_entry in constant propagation
The only value in kill_entry is the writemask, which can be stored in the data pointer of the hash table entry. Suggested by Eric Anholt. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
This commit is contained in:

committed by
Rafael Antognolli

parent
d6e869afe9
commit
13cfd6cc96
@@ -77,20 +77,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class kill_entry
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/* override operator new from exec_node */
|
|
||||||
DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(kill_entry)
|
|
||||||
|
|
||||||
explicit kill_entry(unsigned write_mask)
|
|
||||||
{
|
|
||||||
this->write_mask = write_mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned write_mask;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ir_constant_propagation_visitor : public ir_rvalue_visitor {
|
class ir_constant_propagation_visitor : public ir_rvalue_visitor {
|
||||||
public:
|
public:
|
||||||
ir_constant_propagation_visitor()
|
ir_constant_propagation_visitor()
|
||||||
@@ -126,8 +112,7 @@ public:
|
|||||||
exec_list *acp;
|
exec_list *acp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash table of kill_entry: The masks of variables whose values were
|
* Hash table of killed entries: maps variables to the mask of killed channels.
|
||||||
* killed in this block.
|
|
||||||
*/
|
*/
|
||||||
hash_table *kills;
|
hash_table *kills;
|
||||||
|
|
||||||
@@ -381,10 +366,8 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions)
|
|||||||
this->killed_all = this->killed_all || orig_killed_all;
|
this->killed_all = this->killed_all || orig_killed_all;
|
||||||
|
|
||||||
hash_entry *htk;
|
hash_entry *htk;
|
||||||
hash_table_foreach(new_kills, htk) {
|
hash_table_foreach(new_kills, htk)
|
||||||
kill_entry *k = (kill_entry *) htk->data;
|
kill((ir_variable *) htk->key, (uintptr_t) htk->data);
|
||||||
kill((ir_variable *) htk->key, k->write_mask);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ir_visitor_status
|
ir_visitor_status
|
||||||
@@ -429,8 +412,7 @@ ir_constant_propagation_visitor::visit_enter(ir_loop *ir)
|
|||||||
|
|
||||||
hash_entry *htk;
|
hash_entry *htk;
|
||||||
hash_table_foreach(new_kills, htk) {
|
hash_table_foreach(new_kills, htk) {
|
||||||
kill_entry *k = (kill_entry *) htk->data;
|
kill((ir_variable *) htk->key, (uintptr_t) htk->data);
|
||||||
kill((ir_variable *) htk->key, k->write_mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* already descended into the children. */
|
/* already descended into the children. */
|
||||||
@@ -460,13 +442,12 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
|
|||||||
*/
|
*/
|
||||||
hash_entry *kill_hash_entry = _mesa_hash_table_search(this->kills, var);
|
hash_entry *kill_hash_entry = _mesa_hash_table_search(this->kills, var);
|
||||||
if (kill_hash_entry) {
|
if (kill_hash_entry) {
|
||||||
kill_entry *entry = (kill_entry *) kill_hash_entry->data;
|
uintptr_t new_write_mask = ((uintptr_t) kill_hash_entry->data) | write_mask;
|
||||||
entry->write_mask |= write_mask;
|
kill_hash_entry->data = (void *) new_write_mask;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Not already in the hash table. Make new entry. */
|
/* Not already in the hash table. Make new entry. */
|
||||||
_mesa_hash_table_insert(this->kills, var,
|
_mesa_hash_table_insert(this->kills, var, (void *) uintptr_t(write_mask));
|
||||||
new(this->lin_ctx) kill_entry(write_mask));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user