[Mesa-dev] [PATCH 2/3] i965/vec4: Pass const references to vec4_instruction().
Matt Turner
mattst88 at gmail.com
Sat Jun 28 16:49:02 PDT 2014
text data bss dec hex filename
4244821 123200 39648 4407669 434175 i965_dri.so
4231165 123200 39648 4394013 430c1d i965_dri.so
Cuts 13k of .text and saves a bunch of useless struct copies.
---
src/mesa/drivers/dri/i965/brw_vec4.h | 8 ++++----
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 366198c..5702d06 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -233,10 +233,10 @@ public:
DECLARE_RALLOC_CXX_OPERATORS(vec4_instruction)
vec4_instruction(vec4_visitor *v, enum opcode opcode,
- dst_reg dst = dst_reg(),
- src_reg src0 = src_reg(),
- src_reg src1 = src_reg(),
- src_reg src2 = src_reg());
+ const dst_reg &dst = dst_reg(),
+ const src_reg &src0 = src_reg(),
+ const src_reg &src1 = src_reg(),
+ const src_reg &src2 = src_reg());
struct brw_reg get_dst(void);
struct brw_reg get_src(const struct brw_vec4_prog_data *prog_data, int i);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 3a360d4..c732c90 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -30,8 +30,9 @@ extern "C" {
namespace brw {
vec4_instruction::vec4_instruction(vec4_visitor *v,
- enum opcode opcode, dst_reg dst,
- src_reg src0, src_reg src1, src_reg src2)
+ enum opcode opcode, const dst_reg &dst,
+ const src_reg &src0, const src_reg &src1,
+ const src_reg &src2)
{
this->opcode = opcode;
this->dst = dst;
--
1.8.3.2
More information about the mesa-dev
mailing list