Derefence components of constants smarter

During generation of calls to constructors, derefernce constants by creating
new constants instead of creating dereferences.
This commit is contained in:
Ian Romanick 2010-06-04 16:20:35 -07:00
parent 989cfc432e
commit c9cb1032be
1 changed files with 7 additions and 0 deletions

View File

@ -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()) {