mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-28 10:50:39 +02:00
glsl2: Track the number of ir_loop_jump instructions that are in a loop
This commit is contained in:
parent
351525d534
commit
3bcfafcf03
3 changed files with 27 additions and 0 deletions
|
|
@ -103,6 +103,7 @@ class loop_analysis : public ir_hierarchical_visitor {
|
|||
public:
|
||||
loop_analysis();
|
||||
|
||||
virtual ir_visitor_status visit(ir_loop_jump *);
|
||||
virtual ir_visitor_status visit(ir_dereference_variable *);
|
||||
|
||||
virtual ir_visitor_status visit_enter(ir_loop *);
|
||||
|
|
@ -131,6 +132,22 @@ loop_analysis::loop_analysis()
|
|||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
loop_analysis::visit(ir_loop_jump *ir)
|
||||
{
|
||||
(void) ir;
|
||||
|
||||
assert(!this->state.is_empty());
|
||||
|
||||
loop_variable_state *const ls =
|
||||
(loop_variable_state *) this->state.get_head();
|
||||
|
||||
ls->num_loop_jumps++;
|
||||
|
||||
return visit_continue;
|
||||
}
|
||||
|
||||
|
||||
ir_visitor_status
|
||||
loop_analysis::visit(ir_dereference_variable *ir)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,8 +104,14 @@ public:
|
|||
*/
|
||||
hash_table *var_hash;
|
||||
|
||||
/**
|
||||
* Number of ir_loop_jump instructions that operate on this loop
|
||||
*/
|
||||
unsigned num_loop_jumps;
|
||||
|
||||
loop_variable_state()
|
||||
{
|
||||
this->num_loop_jumps = 0;
|
||||
this->var_hash = hash_table_ctor(0, hash_table_pointer_hash,
|
||||
hash_table_pointer_compare);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -253,6 +253,10 @@ loop_control_visitor::visit_leave(ir_loop *ir)
|
|||
* satisfied.
|
||||
*/
|
||||
if_stmt->remove();
|
||||
|
||||
assert(ls->num_loop_jumps > 0);
|
||||
ls->num_loop_jumps--;
|
||||
|
||||
this->progress = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue