aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/opt_constant_propagation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/glsl/opt_constant_propagation.cpp')
-rw-r--r--mesalib/src/glsl/opt_constant_propagation.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/mesalib/src/glsl/opt_constant_propagation.cpp b/mesalib/src/glsl/opt_constant_propagation.cpp
index 18f5da689..c334e1276 100644
--- a/mesalib/src/glsl/opt_constant_propagation.cpp
+++ b/mesalib/src/glsl/opt_constant_propagation.cpp
@@ -172,8 +172,7 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
channel = i;
}
- foreach_list(n, this->acp) {
- acp_entry *entry = (acp_entry *) n;
+ foreach_in_list(acp_entry, entry, this->acp) {
if (entry->var == deref->var && entry->write_mask & (1 << channel)) {
found = entry;
break;
@@ -317,8 +316,7 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions)
this->killed_all = false;
/* Populate the initial acp with a constant of the original */
- foreach_list(n, orig_acp) {
- acp_entry *a = (acp_entry *) n;
+ foreach_in_list(acp_entry, a, orig_acp) {
this->acp->push_tail(new(this->mem_ctx) acp_entry(a));
}
@@ -333,8 +331,7 @@ ir_constant_propagation_visitor::handle_if_block(exec_list *instructions)
this->acp = orig_acp;
this->killed_all = this->killed_all || orig_killed_all;
- foreach_list(n, new_kills) {
- kill_entry *k = (kill_entry *) n;
+ foreach_in_list(kill_entry, k, new_kills) {
kill(k->var, k->write_mask);
}
}
@@ -378,8 +375,7 @@ ir_constant_propagation_visitor::visit_enter(ir_loop *ir)
this->acp = orig_acp;
this->killed_all = this->killed_all || orig_killed_all;
- foreach_list(n, new_kills) {
- kill_entry *k = (kill_entry *) n;
+ foreach_in_list(kill_entry, k, new_kills) {
kill(k->var, k->write_mask);
}
@@ -397,9 +393,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
return;
/* Remove any entries currently in the ACP for this kill. */
- foreach_list_safe(n, this->acp) {
- acp_entry *entry = (acp_entry *) n;
-
+ foreach_in_list_safe(acp_entry, entry, this->acp) {
if (entry->var == var) {
entry->write_mask &= ~write_mask;
if (entry->write_mask == 0)
@@ -410,9 +404,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
/* Add this writemask of the variable to the list of killed
* variables in this block.
*/
- foreach_list(n, this->kills) {
- kill_entry *entry = (kill_entry *) n;
-
+ foreach_in_list(kill_entry, entry, this->kills) {
if (entry->var == var) {
entry->write_mask |= write_mask;
return;