Directly assign initializers to variables in variable declarations
.. instead of first assigning to a temporary and then assigning the temporary to the argument/local. Change-Id: I15a6c2073b78c5cfc829c7edef07c6bf48be7886 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
68bd6fcc8a
commit
898f67ca3b
|
@ -842,9 +842,16 @@ void Codegen::variableDeclaration(VariableDeclaration *ast)
|
|||
Q_ASSERT(expr.code);
|
||||
initializer = *expr;
|
||||
|
||||
int initialized = _block->newTemp();
|
||||
move(_block->TEMP(initialized), initializer);
|
||||
move(identifier(ast->name.toString(), ast->identifierToken.startLine, ast->identifierToken.startColumn), _block->TEMP(initialized));
|
||||
IR::Expr *lhs = identifier(ast->name.toString(), ast->identifierToken.startLine,
|
||||
ast->identifierToken.startColumn);
|
||||
|
||||
if (lhs->asArgLocal()) {
|
||||
move(lhs, initializer);
|
||||
} else {
|
||||
int initialized = _block->newTemp();
|
||||
move(_block->TEMP(initialized), initializer);
|
||||
move(lhs, _block->TEMP(initialized));
|
||||
}
|
||||
}
|
||||
|
||||
void Codegen::variableDeclarationList(VariableDeclarationList *ast)
|
||||
|
|
Loading…
Reference in New Issue