mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
rollback binexpr splitting, caused slowdowns
This commit is contained in:
parent
32068a832a
commit
9256f910f0
@ -58,19 +58,19 @@ X = BinExpr X = LeftExpr
|
||||
if(rightBx!=null && (!rightBx.left.isSimple || !rightBx.right.isSimple))
|
||||
return noModifications
|
||||
|
||||
// TODO below attempts to remove stack-based evaluated expressions, but sometimes the resulting code is BIGGER.
|
||||
val dt = assignment.target.inferType(program)
|
||||
if(!dt.isInteger)
|
||||
return noModifications
|
||||
val tempVar = IdentifierReference(getTempVarName(dt), binExpr.right.position)
|
||||
val assignTempVar = Assignment(
|
||||
AssignTarget(tempVar, null, null, binExpr.right.position),
|
||||
binExpr.right, binExpr.right.position
|
||||
)
|
||||
return listOf(
|
||||
IAstModification.InsertBefore(assignment, assignTempVar, assignment.parent as IStatementContainer),
|
||||
IAstModification.ReplaceNode(binExpr.right, tempVar.copy(), binExpr)
|
||||
)
|
||||
// TODO below attempts to remove stack-based evaluated expressions, but often the resulting code is BIGGER, and SLOWER.
|
||||
// val dt = assignment.target.inferType(program)
|
||||
// if(!dt.isInteger)
|
||||
// return noModifications
|
||||
// val tempVar = IdentifierReference(getTempVarName(dt), binExpr.right.position)
|
||||
// val assignTempVar = Assignment(
|
||||
// AssignTarget(tempVar, null, null, binExpr.right.position),
|
||||
// binExpr.right, binExpr.right.position
|
||||
// )
|
||||
// return listOf(
|
||||
// IAstModification.InsertBefore(assignment, assignTempVar, assignment.parent as IStatementContainer),
|
||||
// IAstModification.ReplaceNode(binExpr.right, tempVar.copy(), binExpr)
|
||||
// )
|
||||
}
|
||||
|
||||
if(binExpr.right.isSimple) {
|
||||
|
Loading…
Reference in New Issue
Block a user