[Mesa-dev] [PATCH 11/13] i965 vs: Make get_assignment_lhs() a method

Paul Berry stereotype441 at gmail.com
Wed Nov 16 11:07:18 PST 2011


Previously, get_assignment_lhs() was a static function.  But it makes
just as much sense to make it a private member functions of
vec4_visitor, because it is one of vec4_visitor's implementation
details, just like the other functions in brw_vec4_visitor.cpp.

This will allow the implementation details of vec4_visitor to be made
private.
---
 src/mesa/drivers/dri/i965/brw_vec4.h           |    1 +
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |   10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 5d2f120..226413b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -556,6 +556,7 @@ public:
    void generate_pull_constant_load(vec4_instruction *inst,
 				    struct brw_reg dst,
 				    struct brw_reg index);
+   dst_reg get_assignment_lhs(ir_dereference *ir);
 };
 
 } /* namespace brw */
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 5025115..cf71ef4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1460,8 +1460,8 @@ vec4_visitor::visit(ir_dereference_record *ir)
  * instead of potentially using a temporary like we might with the
  * ir_dereference handler.
  */
-static dst_reg
-get_assignment_lhs(ir_dereference *ir, vec4_visitor *v)
+dst_reg
+vec4_visitor::get_assignment_lhs(ir_dereference *ir)
 {
    /* The LHS must be a dereference.  If the LHS is a variable indexed array
     * access of a vector, it must be separated into a series conditional moves
@@ -1476,8 +1476,8 @@ get_assignment_lhs(ir_dereference *ir, vec4_visitor *v)
    /* Use the rvalue deref handler for the most part.  We'll ignore
     * swizzles in it and write swizzles using writemask, though.
     */
-   ir->accept(v);
-   return dst_reg(v->result);
+   ir->accept(this);
+   return dst_reg(this->result);
 }
 
 void
@@ -1590,7 +1590,7 @@ vec4_visitor::try_rewrite_rhs_to_dst(ir_assignment *ir,
 void
 vec4_visitor::visit(ir_assignment *ir)
 {
-   dst_reg dst = get_assignment_lhs(ir->lhs, this);
+   dst_reg dst = get_assignment_lhs(ir->lhs);
    uint32_t predicate = BRW_PREDICATE_NONE;
 
    if (!ir->lhs->type->is_scalar() &&
-- 
1.7.6.4



More information about the mesa-dev mailing list