[Mesa-dev] [PATCH 04/13] i965/vec4: kill off the final possible dst_reg ctor

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 5 08:17:52 PST 2015


From: Emil Velikov <emil.velikov at collabora.co.uk>

By providing default values for type and writemask, the compiler will
'create' the constructor for us. The values chosen are the exact same
ones, used in the default ctor - dst_reg(), as such the compiler should
be smart enough to optimise the duplicated (identical) assignment.

Signed-off-by: Emil Velikov <emil.velikov at collabora.co.uk>
---
 src/mesa/drivers/dri/i965/brw_ir_vec4.h | 7 ++++---
 src/mesa/drivers/dri/i965/brw_vec4.cpp  | 8 --------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
index 9b5b10c..8d3efea 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
@@ -103,12 +103,13 @@ public:
    void init();
 
    dst_reg();
-   dst_reg(enum brw_reg_file file, int nr);
    dst_reg(enum brw_reg_file file, int nr, const glsl_type *type,
            unsigned writemask);
-   dst_reg(enum brw_reg_file file, int nr, brw_reg_type type,
-           unsigned writemask);
+   dst_reg(enum brw_reg_file file, int nr,
+           brw_reg_type type = BRW_REGISTER_TYPE_UD,
+           unsigned writemask = WRITEMASK_XYZW);
    dst_reg(struct brw_reg reg);
+
    dst_reg(class vec4_visitor *v, const struct glsl_type *type);
 
    explicit dst_reg(const src_reg &reg);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 6975a19..39d4a68 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -99,14 +99,6 @@ dst_reg::dst_reg()
    init();
 }
 
-dst_reg::dst_reg(enum brw_reg_file file, int nr)
-{
-   init();
-
-   this->file = file;
-   this->nr = nr;
-}
-
 dst_reg::dst_reg(enum brw_reg_file file, int nr, const glsl_type *type,
                  unsigned writemask)
 {
-- 
2.6.2



More information about the mesa-dev mailing list