// constructor
-variable_entry::variable_entry(ir_variable *var)
+ir_variable_refcount_entry::ir_variable_refcount_entry(ir_variable *var)
{
this->var = var;
assign = NULL;
}
-variable_entry *
+ir_variable_refcount_entry *
ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
{
assert(var);
foreach_iter(exec_list_iterator, iter, this->variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)iter.get();
if (entry->var == var)
return entry;
}
- variable_entry *entry = new(mem_ctx) variable_entry(var);
+ ir_variable_refcount_entry *entry = new(mem_ctx) ir_variable_refcount_entry(var);
assert(entry->referenced_count == 0);
this->variable_list.push_tail(entry);
return entry;
ir_visitor_status
ir_variable_refcount_visitor::visit(ir_variable *ir)
{
- variable_entry *entry = this->get_variable_entry(ir);
+ ir_variable_refcount_entry *entry = this->get_variable_entry(ir);
if (entry)
entry->declaration = true;
ir_variable_refcount_visitor::visit(ir_dereference_variable *ir)
{
ir_variable *const var = ir->variable_referenced();
- variable_entry *entry = this->get_variable_entry(var);
+ ir_variable_refcount_entry *entry = this->get_variable_entry(var);
if (entry)
entry->referenced_count++;
ir_visitor_status
ir_variable_refcount_visitor::visit_leave(ir_assignment *ir)
{
- variable_entry *entry;
+ ir_variable_refcount_entry *entry;
entry = this->get_variable_entry(ir->lhs->variable_referenced());
if (entry) {
entry->assigned_count++;
#include "ir_visitor.h"
#include "glsl_types.h"
-class variable_entry : public exec_node
+class ir_variable_refcount_entry : public exec_node
{
public:
- variable_entry(ir_variable *var);
+ ir_variable_refcount_entry(ir_variable *var);
ir_variable *var; /* The key: the variable's pointer. */
ir_assignment *assign; /* An assignment to the variable, if any */
virtual ir_visitor_status visit_enter(ir_function_signature *);
virtual ir_visitor_status visit_leave(ir_assignment *);
- variable_entry *get_variable_entry(ir_variable *var);
+ ir_variable_refcount_entry *get_variable_entry(ir_variable *var);
- /* List of variable_entry */
+ /* List of ir_variable_refcount_entry */
exec_list variable_list;
void *mem_ctx;
v.run(instructions);
foreach_iter(exec_list_iterator, iter, v.variable_list) {
- variable_entry *entry = (variable_entry *)iter.get();
+ ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)iter.get();
/* Since each assignment is a reference, the refereneced count must be
* greater than or equal to the assignment count. If they are equal,
lhs_var->mode == ir_var_inout)
continue;
- variable_entry *entry = info->refs->get_variable_entry(lhs_var);
+ ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var);
if (!entry->declaration ||
entry->assigned_count != 1 ||