From e9822f77a9cc024f528d30382fd5ad21c73a173b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 5 Mar 2014 17:05:54 -0800 Subject: glsl: Skip making a temporary for assignments when we don't need one. While we wish our optimization passes could identify all the cases where we can coalesce our variables, we miss out on a lot of opportunities. total instructions in shared programs: 1673849 -> 1673166 (-0.04%) instructions in affected programs: 299521 -> 298838 (-0.23%) GAINED: 7 LOST: 0 Note that many programs are "hurt". The notable ones are where we produce unrolling in cases we didn't before (presumably just because of the lower instruction count). But there are also some cases where pushing things right into the variables prevents copy propagation and tree grafting, since we don't split our variable usage webs apart. Reviewed-by: Kenneth Graunke --- src/glsl/ast.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/glsl/ast.h') diff --git a/src/glsl/ast.h b/src/glsl/ast.h index ae70b003cfe..6b136f51879 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -217,6 +217,13 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + + ir_rvalue *do_hir(exec_list *instructions, + struct _mesa_glsl_parse_state *state, + bool needs_rvalue); + virtual void print(void) const; enum ast_operators oper; @@ -287,6 +294,9 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); + private: /** * Is this function call actually a constructor? @@ -359,6 +369,9 @@ public: virtual ir_rvalue *hir(exec_list *instructions, struct _mesa_glsl_parse_state *state); + + virtual void hir_no_rvalue(exec_list *instructions, + struct _mesa_glsl_parse_state *state); }; /** -- cgit v1.2.3