From: Ian Romanick Date: Fri, 4 Jun 2010 23:20:35 +0000 (-0700) Subject: Derefence components of constants smarter X-Git-Tag: 062012170305~10660^2~625^2~160 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9cb1032be454ff5fdb802a629565cfaeb2e5d5a;p=profile%2Fivi%2Fmesa.git Derefence components of constants smarter During generation of calls to constructors, derefernce constants by creating new constants instead of creating dereferences. --- diff --git a/ast_function.cpp b/ast_function.cpp index 06498b0..fc53d7a 100644 --- a/ast_function.cpp +++ b/ast_function.cpp @@ -188,6 +188,13 @@ dereference_component(ir_rvalue *src, unsigned component) { assert(component < src->type->components()); + /* If the source is a constant, just create a new constant instead of a + * dereference of the existing constant. + */ + ir_constant *constant = src->as_constant(); + if (constant) + return new ir_constant(constant, component); + if (src->type->is_scalar()) { return src; } else if (src->type->is_vector()) {