i965/fs: Use a const reference in fs_reg::equals instead of a pointer.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 10 May 2012 23:10:14 +0000 (16:10 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 14 May 2012 22:12:46 +0000 (15:12 -0700)
This lets you omit some ampersands and is more idiomatic C++.  Using
const also marks the function as not altering either register (which
was obvious, but nice to enforce).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index fd67318f55019166c292c231722c370edfa63561..bcdedf07e6614ab75bf873cddc146e28b85bc6e6 100644 (file)
@@ -1618,7 +1618,7 @@ fs_visitor::get_instruction_generating_reg(fs_inst *start,
        end->predicated ||
        end->force_uncompressed ||
        end->force_sechalf ||
-       !reg.equals(&end->dst)) {
+       !reg.equals(end->dst)) {
       return NULL;
    } else {
       return end;
index 6b45c4ece961374c17333f3f08fc6f968c635386..d4473a230731afaf31d0f9303abf3401dc43b10b 100644 (file)
@@ -126,18 +126,18 @@ public:
    fs_reg(enum register_file file, int reg, uint32_t type);
    fs_reg(class fs_visitor *v, const struct glsl_type *type);
 
-   bool equals(fs_reg *r)
+   bool equals(const fs_reg &r) const
    {
-      return (file == r->file &&
-             reg == r->reg &&
-             reg_offset == r->reg_offset &&
-             type == r->type &&
-             negate == r->negate &&
-             abs == r->abs &&
-             memcmp(&fixed_hw_reg, &r->fixed_hw_reg,
+      return (file == r.file &&
+             reg == r.reg &&
+             reg_offset == r.reg_offset &&
+             type == r.type &&
+             negate == r.negate &&
+             abs == r.abs &&
+             memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
                     sizeof(fixed_hw_reg)) == 0 &&
-             smear == r->smear &&
-             imm.u == r->imm.u);
+             smear == r.smear &&
+             imm.u == r.imm.u);
    }
 
    /** Register file: ARF, GRF, MRF, IMM. */
@@ -291,10 +291,10 @@ public:
    bool equals(fs_inst *inst)
    {
       return (opcode == inst->opcode &&
-             dst.equals(&inst->dst) &&
-             src[0].equals(&inst->src[0]) &&
-             src[1].equals(&inst->src[1]) &&
-             src[2].equals(&inst->src[2]) &&
+             dst.equals(inst->dst) &&
+             src[0].equals(inst->src[0]) &&
+             src[1].equals(inst->src[1]) &&
+             src[2].equals(inst->src[2]) &&
              saturate == inst->saturate &&
              predicated == inst->predicated &&
              conditional_mod == inst->conditional_mod &&
index 20d4c53a858ffd09f72928d71339b1727fcf2efc..bb0c8bdb2f1d0b1dc70cc837f5019a59007a7051 100644 (file)
@@ -569,7 +569,7 @@ fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r,
         l.type = brw_type_for_base_type(type);
         r.type = brw_type_for_base_type(type);
 
-        if (predicated || !l.equals(&r)) {
+        if (predicated || !l.equals(r)) {
            fs_inst *inst = emit(BRW_OPCODE_MOV, l, r);
            inst->predicated = predicated;
         }