Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Bug 228: Second pass at reducing the number of temporaries created. #221

Merged
merged 1 commit into from
Jun 15, 2016

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 15, 2016

Improves upon #219 by refactoring the checks for COMPOUND_EXPR into a routine that recursively iterates all expressions, splitting the result from the rest of the expression.

There are a few more cases that are caught too, including component references, and when generating constructors for array and struct literals, both when using new() and without.

The compiler also now extracts the temporary object from constructor expressions in build_expr_dtor(), which elides a temporary of the call result being made.

Finally, add_stmt() both now recursively adds COMPOUND_EXPR expressions as separate statements, and checks for side effects in all statements to be written. This removes a lot of noise from common rewrites where ((e1, e2), e3) is generated, but only the first and last expression actually do anything.

Improves upon D-Programming-GDC#219 by refactoring the checks for COMPOUND_EXPR into
a routine that recursively iterates all expressions, splitting the
result from the rest of the expression.

There are a few more cases that are caught too, including component
references, and when generating constructors for array and struct
literals, both when using new() and without.

The compiler also now extracts the temporary object from constructor
expressions in build_expr_dtor(), which elides a temporary of the
call result being made.

Finally, add_stmt() both now recursively adds COMPOUND_EXPR
expressions as separate statements, and checks for side effects in
all statements to be written.  This removes a lot of noise from
common rewrites where ((e1, e2), e3) is generated, but only the
first and last expression actually do anything.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant