rollback binexpr splitting, caused slowdowns

This commit is contained in:
Irmen de Jong
2021-11-28 18:50:05 +01:00
parent 32068a832a
commit 9256f910f0

View File

@@ -58,19 +58,19 @@ X = BinExpr X = LeftExpr
if(rightBx!=null && (!rightBx.left.isSimple || !rightBx.right.isSimple)) if(rightBx!=null && (!rightBx.left.isSimple || !rightBx.right.isSimple))
return noModifications return noModifications
// TODO below attempts to remove stack-based evaluated expressions, but sometimes the resulting code is BIGGER. // TODO below attempts to remove stack-based evaluated expressions, but often the resulting code is BIGGER, and SLOWER.
val dt = assignment.target.inferType(program) // val dt = assignment.target.inferType(program)
if(!dt.isInteger) // if(!dt.isInteger)
return noModifications // return noModifications
val tempVar = IdentifierReference(getTempVarName(dt), binExpr.right.position) // val tempVar = IdentifierReference(getTempVarName(dt), binExpr.right.position)
val assignTempVar = Assignment( // val assignTempVar = Assignment(
AssignTarget(tempVar, null, null, binExpr.right.position), // AssignTarget(tempVar, null, null, binExpr.right.position),
binExpr.right, binExpr.right.position // binExpr.right, binExpr.right.position
) // )
return listOf( // return listOf(
IAstModification.InsertBefore(assignment, assignTempVar, assignment.parent as IStatementContainer), // IAstModification.InsertBefore(assignment, assignTempVar, assignment.parent as IStatementContainer),
IAstModification.ReplaceNode(binExpr.right, tempVar.copy(), binExpr) // IAstModification.ReplaceNode(binExpr.right, tempVar.copy(), binExpr)
) // )
} }
if(binExpr.right.isSimple) { if(binExpr.right.isSimple) {