[Mesa-dev] [PATCH 2/2] glsl: Rename variable_entry2 to variable_entry.

Kenneth Graunke kenneth at whitecape.org
Sat Jan 28 16:58:38 PST 2012


This should be safe now that ir_variable_refcount.h doesn't expose a
type with the same name.  The only other type with the same name is
in brw_fs_vector_splitting.cpp, but both of these should be file-scope,
so I don't expect problems.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-and-tested-by: Matt Turner <mattst88 at gmail.com>
---
 src/glsl/opt_structure_splitting.cpp |   38 +++++++++++++++------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

I'm not entirely confident in this patch.  It shouldn't cause problems on
MSVC because MSVC doesn't build the i965 driver.

diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp
index 2c1f6bb..337d82e 100644
--- a/src/glsl/opt_structure_splitting.cpp
+++ b/src/glsl/opt_structure_splitting.cpp
@@ -40,14 +40,10 @@
 
 static bool debug = false;
 
-// XXX using variable_entry2 here to avoid collision (MSVC multiply-defined
-// function) with the variable_entry class seen in ir_variable_refcount.h
-// Perhaps we can use the one in ir_variable_refcount.h and make this class
-// here go away?
-class variable_entry2 : public exec_node
+class variable_entry : public exec_node
 {
 public:
-   variable_entry2(ir_variable *var)
+   variable_entry(ir_variable *var)
    {
       this->var = var;
       this->whole_structure_access = 0;
@@ -89,7 +85,7 @@ public:
    virtual ir_visitor_status visit_enter(ir_assignment *);
    virtual ir_visitor_status visit_enter(ir_function_signature *);
 
-   variable_entry2 *get_variable_entry2(ir_variable *var);
+   variable_entry *get_variable_entry(ir_variable *var);
 
    /* List of variable_entry */
    exec_list variable_list;
@@ -97,8 +93,8 @@ public:
    void *mem_ctx;
 };
 
-variable_entry2 *
-ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
+variable_entry *
+ir_structure_reference_visitor::get_variable_entry(ir_variable *var)
 {
    assert(var);
 
@@ -106,12 +102,12 @@ ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
       return NULL;
 
    foreach_iter(exec_list_iterator, iter, this->variable_list) {
-      variable_entry2 *entry = (variable_entry2 *)iter.get();
+      variable_entry *entry = (variable_entry *)iter.get();
       if (entry->var == var)
 	 return entry;
    }
 
-   variable_entry2 *entry = new(mem_ctx) variable_entry2(var);
+   variable_entry *entry = new(mem_ctx) variable_entry(var);
    this->variable_list.push_tail(entry);
    return entry;
 }
@@ -120,7 +116,7 @@ ir_structure_reference_visitor::get_variable_entry2(ir_variable *var)
 ir_visitor_status
 ir_structure_reference_visitor::visit(ir_variable *ir)
 {
-   variable_entry2 *entry = this->get_variable_entry2(ir);
+   variable_entry *entry = this->get_variable_entry(ir);
 
    if (entry)
       entry->declaration = true;
@@ -132,7 +128,7 @@ ir_visitor_status
 ir_structure_reference_visitor::visit(ir_dereference_variable *ir)
 {
    ir_variable *const var = ir->variable_referenced();
-   variable_entry2 *entry = this->get_variable_entry2(var);
+   variable_entry *entry = this->get_variable_entry(var);
 
    if (entry)
       entry->whole_structure_access++;
@@ -193,13 +189,13 @@ public:
 
    void split_deref(ir_dereference **deref);
    void handle_rvalue(ir_rvalue **rvalue);
-   variable_entry2 *get_splitting_entry(ir_variable *var);
+   variable_entry *get_splitting_entry(ir_variable *var);
 
    exec_list *variable_list;
    void *mem_ctx;
 };
 
-variable_entry2 *
+variable_entry *
 ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
 {
    assert(var);
@@ -208,7 +204,7 @@ ir_structure_splitting_visitor::get_splitting_entry(ir_variable *var)
       return NULL;
 
    foreach_iter(exec_list_iterator, iter, *this->variable_list) {
-      variable_entry2 *entry = (variable_entry2 *)iter.get();
+      variable_entry *entry = (variable_entry *)iter.get();
       if (entry->var == var) {
 	 return entry;
       }
@@ -228,7 +224,7 @@ ir_structure_splitting_visitor::split_deref(ir_dereference **deref)
    if (!deref_var)
       return;
 
-   variable_entry2 *entry = get_splitting_entry(deref_var->var);
+   variable_entry *entry = get_splitting_entry(deref_var->var);
    if (!entry)
       return;
 
@@ -263,8 +259,8 @@ ir_structure_splitting_visitor::visit_leave(ir_assignment *ir)
 {
    ir_dereference_variable *lhs_deref = ir->lhs->as_dereference_variable();
    ir_dereference_variable *rhs_deref = ir->rhs->as_dereference_variable();
-   variable_entry2 *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL;
-   variable_entry2 *rhs_entry = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL;
+   variable_entry *lhs_entry = lhs_deref ? get_splitting_entry(lhs_deref->var) : NULL;
+   variable_entry *rhs_entry = rhs_deref ? get_splitting_entry(rhs_deref->var) : NULL;
    const glsl_type *type = ir->rhs->type;
 
    if ((lhs_entry || rhs_entry) && !ir->condition) {
@@ -312,7 +308,7 @@ do_structure_splitting(exec_list *instructions)
 
    /* Trim out variables we can't split. */
    foreach_iter(exec_list_iterator, iter, refs.variable_list) {
-      variable_entry2 *entry = (variable_entry2 *)iter.get();
+      variable_entry *entry = (variable_entry *)iter.get();
 
       if (debug) {
 	 printf("structure %s@%p: decl %d, whole_access %d\n",
@@ -334,7 +330,7 @@ do_structure_splitting(exec_list *instructions)
     * components.
     */
    foreach_iter(exec_list_iterator, iter, refs.variable_list) {
-      variable_entry2 *entry = (variable_entry2 *)iter.get();
+      variable_entry *entry = (variable_entry *)iter.get();
       const struct glsl_type *type = entry->var->type;
 
       entry->mem_ctx = ralloc_parent(entry->var);
-- 
1.7.7.6



More information about the mesa-dev mailing list