From fb5dcb81cc121e4355b7eef014474a5c42a2f6db Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 19 May 2016 14:43:23 -0700 Subject: [PATCH] i965: Pass nir_src/nir_dest by reference. Cuts 6K of .text. text data bss dec hex filename 5772372 264648 29320 6066340 5c90a4 lib/i965_dri.so before 5766074 264648 29320 6060042 5c780a lib/i965_dri.so after Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_fs.h | 6 +++--- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 6 +++--- src/mesa/drivers/dri/i965/brw_vec4.h | 12 ++++++------ src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 236858c..f705217 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -256,9 +256,9 @@ public: nir_tex_instr *instr); void nir_emit_jump(const brw::fs_builder &bld, nir_jump_instr *instr); - fs_reg get_nir_src(nir_src src); - fs_reg get_nir_src_imm(nir_src src); - fs_reg get_nir_dest(nir_dest dest); + fs_reg get_nir_src(const nir_src &src); + fs_reg get_nir_src_imm(const nir_src &src); + fs_reg get_nir_dest(const nir_dest &dest); fs_reg get_nir_image_deref(const nir_deref_var *deref); fs_reg get_indirect_offset(nir_intrinsic_instr *instr); void emit_percomp(const brw::fs_builder &bld, const fs_inst &inst, diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 203ebd2..0bf0e09 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -1451,7 +1451,7 @@ fs_visitor::nir_emit_undef(const fs_builder &bld, nir_ssa_undef_instr *instr) } fs_reg -fs_visitor::get_nir_src(nir_src src) +fs_visitor::get_nir_src(const nir_src &src) { fs_reg reg; if (src.is_ssa) { @@ -1474,14 +1474,14 @@ fs_visitor::get_nir_src(nir_src src) * Return an IMM for constants; otherwise call get_nir_src() as normal. */ fs_reg -fs_visitor::get_nir_src_imm(nir_src src) +fs_visitor::get_nir_src_imm(const nir_src &src) { nir_const_value *val = nir_src_as_const_value(src); return val ? fs_reg(brw_imm_d(val->i32[0])) : get_nir_src(src); } fs_reg -fs_visitor::get_nir_dest(nir_dest dest) +fs_visitor::get_nir_dest(const nir_dest &dest) { if (dest.is_ssa) { const brw_reg_type reg_type = diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index bc54eaf..76dea04 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -326,14 +326,14 @@ public: virtual void nir_emit_undef(nir_ssa_undef_instr *instr); virtual void nir_emit_ssbo_atomic(int op, nir_intrinsic_instr *instr); - dst_reg get_nir_dest(nir_dest dest, enum brw_reg_type type); - dst_reg get_nir_dest(nir_dest dest, nir_alu_type type); - dst_reg get_nir_dest(nir_dest dest); - src_reg get_nir_src(nir_src src, enum brw_reg_type type, + dst_reg get_nir_dest(const nir_dest &dest, enum brw_reg_type type); + dst_reg get_nir_dest(const nir_dest &dest, nir_alu_type type); + dst_reg get_nir_dest(const nir_dest &dest); + src_reg get_nir_src(const nir_src &src, enum brw_reg_type type, unsigned num_components = 4); - src_reg get_nir_src(nir_src src, nir_alu_type type, + src_reg get_nir_src(const nir_src &src, nir_alu_type type, unsigned num_components = 4); - src_reg get_nir_src(nir_src src, + src_reg get_nir_src(const nir_src &src, unsigned num_components = 4); src_reg get_indirect_offset(nir_intrinsic_instr *instr); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index 29f52fa..f3b4528 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -267,7 +267,7 @@ dst_reg_for_nir_reg(vec4_visitor *v, nir_register *nir_reg, } dst_reg -vec4_visitor::get_nir_dest(nir_dest dest) +vec4_visitor::get_nir_dest(const nir_dest &dest) { if (dest.is_ssa) { dst_reg dst = dst_reg(VGRF, alloc.allocate(1)); @@ -280,19 +280,19 @@ vec4_visitor::get_nir_dest(nir_dest dest) } dst_reg -vec4_visitor::get_nir_dest(nir_dest dest, enum brw_reg_type type) +vec4_visitor::get_nir_dest(const nir_dest &dest, enum brw_reg_type type) { return retype(get_nir_dest(dest), type); } dst_reg -vec4_visitor::get_nir_dest(nir_dest dest, nir_alu_type type) +vec4_visitor::get_nir_dest(const nir_dest &dest, nir_alu_type type) { return get_nir_dest(dest, brw_type_for_nir_type(type)); } src_reg -vec4_visitor::get_nir_src(nir_src src, enum brw_reg_type type, +vec4_visitor::get_nir_src(const nir_src &src, enum brw_reg_type type, unsigned num_components) { dst_reg reg; @@ -314,14 +314,14 @@ vec4_visitor::get_nir_src(nir_src src, enum brw_reg_type type, } src_reg -vec4_visitor::get_nir_src(nir_src src, nir_alu_type type, +vec4_visitor::get_nir_src(const nir_src &src, nir_alu_type type, unsigned num_components) { return get_nir_src(src, brw_type_for_nir_type(type), num_components); } src_reg -vec4_visitor::get_nir_src(nir_src src, unsigned num_components) +vec4_visitor::get_nir_src(const nir_src &src, unsigned num_components) { /* if type is not specified, default to signed int */ return get_nir_src(src, nir_type_int, num_components); -- 2.7.4