From e58992aedd9693f0356f3691d510a5e976473a0c Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sat, 28 Jun 2014 23:11:22 -0700 Subject: [PATCH] i965/fs: Pass const references to emit functions. Cuts 10k of .text and saves a bunch of useless struct copies. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 13 +++++++------ src/mesa/drivers/dri/i965/brw_fs.h | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index db3d35783fb..d1ded33a6b0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -734,32 +734,33 @@ fs_visitor::emit(enum opcode opcode) } fs_inst * -fs_visitor::emit(enum opcode opcode, fs_reg dst) +fs_visitor::emit(enum opcode opcode, const fs_reg &dst) { return emit(new(mem_ctx) fs_inst(opcode, dst)); } fs_inst * -fs_visitor::emit(enum opcode opcode, fs_reg dst, fs_reg src0) +fs_visitor::emit(enum opcode opcode, const fs_reg &dst, const fs_reg &src0) { return emit(new(mem_ctx) fs_inst(opcode, dst, src0)); } fs_inst * -fs_visitor::emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1) +fs_visitor::emit(enum opcode opcode, const fs_reg &dst, const fs_reg &src0, + const fs_reg &src1) { return emit(new(mem_ctx) fs_inst(opcode, dst, src0, src1)); } fs_inst * -fs_visitor::emit(enum opcode opcode, fs_reg dst, - fs_reg src0, fs_reg src1, fs_reg src2) +fs_visitor::emit(enum opcode opcode, const fs_reg &dst, const fs_reg &src0, + const fs_reg &src1, const fs_reg &src2) { return emit(new(mem_ctx) fs_inst(opcode, dst, src0, src1, src2)); } fs_inst * -fs_visitor::emit(enum opcode opcode, fs_reg dst, +fs_visitor::emit(enum opcode opcode, const fs_reg &dst, fs_reg src[], int sources) { return emit(new(mem_ctx) fs_inst(opcode, dst, src, sources)); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 906a1ddc660..3d0da23acf1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -290,12 +290,13 @@ public: void emit(exec_list list); fs_inst *emit(enum opcode opcode); - fs_inst *emit(enum opcode opcode, fs_reg dst); - fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0); - fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1); - fs_inst *emit(enum opcode opcode, fs_reg dst, - fs_reg src0, fs_reg src1, fs_reg src2); - fs_inst *emit(enum opcode opcode, fs_reg dst, + fs_inst *emit(enum opcode opcode, const fs_reg &dst); + fs_inst *emit(enum opcode opcode, const fs_reg &dst, const fs_reg &src0); + fs_inst *emit(enum opcode opcode, const fs_reg &dst, const fs_reg &src0, + const fs_reg &src1); + fs_inst *emit(enum opcode opcode, const fs_reg &dst, + const fs_reg &src0, const fs_reg &src1, const fs_reg &src2); + fs_inst *emit(enum opcode opcode, const fs_reg &dst, fs_reg src[], int sources); fs_inst *MOV(const fs_reg &dst, const fs_reg &src); -- 2.30.2