From 7b9cf797903a5ea70072a28c0486d3e99ee60645 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 6 Mar 2013 08:51:44 -0800 Subject: [PATCH] i965: Make src_reg::equals() take a constant reference, not a pointer. This is more typical C++ style. Signed-off-by: Kenneth Graunke Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_vec4.cpp | 22 +++++++++---------- src/mesa/drivers/dri/i965/brw_vec4.h | 2 +- .../dri/i965/brw_vec4_copy_propagation.cpp | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index fa186b536bf..e816b94e608 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -323,19 +323,19 @@ vec4_visitor::implied_mrf_writes(vec4_instruction *inst) } bool -src_reg::equals(src_reg *r) +src_reg::equals(const src_reg &r) const { - return (file == r->file && - reg == r->reg && - reg_offset == r->reg_offset && - type == r->type && - negate == r->negate && - abs == r->abs && - swizzle == r->swizzle && - !reladdr && !r->reladdr && - 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 && + swizzle == r.swizzle && + !reladdr && !r.reladdr && + memcmp(&fixed_hw_reg, &r.fixed_hw_reg, sizeof(fixed_hw_reg)) == 0 && - imm.u == r->imm.u); + imm.u == r.imm.u); } static bool diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index c2bbd68edf6..a3ba9c77647 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -126,7 +126,7 @@ public: src_reg(int32_t i); src_reg(struct brw_reg reg); - bool equals(src_reg *r); + bool equals(const src_reg &r) const; bool is_zero() const; bool is_one() const; bool is_accumulator() const; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp index 3242c3a0dd0..abafe47a759 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp @@ -82,7 +82,7 @@ try_constant_propagation(vec4_instruction *inst, int arg, src_reg *values[4]) */ src_reg value = *values[0]; for (int i = 1; i < 4; i++) { - if (!value.equals(values[i])) + if (!value.equals(*values[i])) return false; } @@ -289,7 +289,7 @@ vec4_visitor::try_copy_propagation(vec4_instruction *inst, int arg, return false; /* Don't report progress if this is a noop. */ - if (value.equals(&inst->src[arg])) + if (value.equals(inst->src[arg])) return false; value.type = inst->src[arg].type; -- 2.30.2